ttnn.get_optimal_worker_cores_for_sharded_tensor

ttnn.get_optimal_worker_cores_for_sharded_tensor = <nanobind.nb_func object>

ttnn._ttnn.tensor.Tensor, noc: ttnn._ttnn.types.NOC = NOC.RISCV_0_default) -> list[ttnn._ttnn.tensor.CoreCoord]

Returns the optimal worker cores on which to launch programs and kernels for a sharded tensor. These are the worker cores that will allow the program to maximize its use of shard data locality and reduce NoC traffic.

For L1-sharded tensors, returns the cores that hold shards in shard-orientation order. For DRAM-sharded tensors, returns the optimal Tensix worker core for each DRAM bank (in shard-orientation order) that holds shards.

Parameters:
  • tensor – A sharded device tensor (legacy 2D or ND sharded).

  • noc – Which NOC to use for optimal DRAM to worker core mapping (relevant only for DRAM-sharded tensors, default NOC_0).

Returns:

List of worker CoreCoords in shard-orientation order.

Example

>>> cores = ttnn.get_optimal_worker_cores_for_sharded_tensor(sharded_tensor)
>>> # cores will have a list of CoreCoords in shard-orientation order. These are the optimal worker cores on which programs/kernels can be launched for the sharded tensor.
Type:

get_optimal_worker_cores_for_sharded_tensor(tensor