asc2.block_idx

asc2.block_idx() PlainValue

Returns the current block (NPU core) index.

In the PyAsc2 programming model, kernels are executed across multiple NPU blocks (cores). This function returns the index of the current block, which can be used to determine which portion of the data to process.

Returns:

The current block index (0-based)

Return type:

PlainValue

Examples

Get the current block index to compute the data offset:

idx = asc2.block_idx()
offset = idx * TILE_SIZE
tile = asc2.copy_in(x_gm, [offset], [TILE_SIZE])