triton.experimental.gluon.language.amd.cdna5.tdm.update_tensor_descriptor

triton.experimental.gluon.language.amd.cdna5.tdm.update_tensor_descriptor(desc: tensor_descriptor, add_offsets: List[constexpr | tensor] = None, set_bounds: List[constexpr | tensor] = None, pred=None, clamp_bounds: bool = False, _semantic=None) tensor_descriptor

Update selected fields of a TDM descriptor; return a new descriptor SSA value.

Each parameter is independently optional; only the fields the caller names are written. Everything else is inherited from the input descriptor.

NOTE: Unlike the standard tensor-descriptor mental model, add_offsets here moves the tile position only. It does NOT update the descriptor’s bounds. If the loop crosses an OOB boundary, you must also pass set_bounds explicitly, or pass clamp_bounds=True to derive the OOB extent from add_offsets.

Parameters:
  • desc (tensor_descriptor) – the input descriptor.

  • add_offsets (List[int], optional) – per-dim deltas in element units that move the tile position. Does not touch the bounds.

  • set_bounds (List[int], optional) – per-dim absolute rewrite of the descriptor’s bounds. Use to install OOB extent at a peel epilogue.

  • pred (int, optional) – set the descriptor’s predicate.

  • clamp_bounds (bool, optional) – if True, also shrink the descriptor’s bounds by add_offsets (tensor_dim[i] = max(0, tensor_dim[i] - add_offsets[i])) to derive the advanced tile’s OOB extent. Requires add_offsets; mutually exclusive with set_bounds.

Returns:

a new descriptor SSA value with the requested fields rewritten.

Return type:

tensor_descriptor

Raises:

ValueError – if no parameter is provided (no-op updates are forbidden).

Example

# K-loop interior: bump tile position only
d = tdm.update_tensor_descriptor(d, add_offsets=[0, BLOCK_K])

# Prologue: position at first tile + set the predicate
d = tdm.update_tensor_descriptor(d, add_offsets=[pid_m * BLOCK_M, 0],
                                 pred=do_load)

# Peel epilogue: install real OOB extent for the partial last tile
d = tdm.update_tensor_descriptor(d, set_bounds=[M - pid_m * BLOCK_M, K - k_main])