asc.experimental.asctile.sub_block_num

asc.experimental.asctile.sub_block_num() → PlainValue

Returns the number of vector or cube sub-cores on the AI core.

This function returns the count of sub-cores available on the current AI core. For example, on Ascend950PR_9599 chip there are 2 vector sub-cores and 1 cube sub-core, so this function returns 2 when called from vector code and 1 when called from cube code.

Returns:

The number of sub-cores on the AI core

Return type:

PlainValue

Examples

Use with block_idx to compute starting iteration in a loop:

idx = asctile.cast(asctile.block_idx(), asctile.int32)
num = asctile.cast(asctile.sub_block_num(), asctile.int32)
start = idx / num
for i in asctile.range(start, total, step=asctile.block_num()):
    ...