ttnn.point_to_point

ttnn.point_to_point() ttnn.Tensor

Point-to-point send and receive operation. Send a tensor shard from one device to another over the fabric. If sender_coord == receiver_coord (same device), it performs a local on-device copy of the shard into output_tensor (no fabric); if output_tensor aliases input_tensor this is a no-op.

Args:

input_tensor (ttnn.Tensor): the input tensor. sender_coord (ttnn.MeshCoordinate): Coordinate of device containing input_tensor (shard). receiver_coord (ttnn.MeshCoordinate): Coordinate of device receiving input_tensor (shard).

Keyword Args:

topology (ttnn.Topology): Fabric topology. output_tensor (ttnn.Tensor,optional): Optional output tensor. intermediate_tensor (ttnn.Tensor,optional): Optional intermediate tensor.

Returns:

ttnn.Tensor – the output tensor, with transferred shard on receiving device.

Supported dtypes and layouts:

Dtypes

Layouts

BFLOAT16, BFLOAT8_B, FLOAT32

TILE, ROW_MAJOR

point_to_point does not restrict the input dtype (BFLOAT16 uses a power-of-two fabric packet size). The output layout must match the input layout, and the page size must be 16-byte aligned. The output has the same tensor spec as the input, with the sender’s shard delivered to the receiver device. If sender_coord == receiver_coord the transfer degenerates to a local on-device copy (no fabric).

Memory Support:
  • Interleaved: DRAM and L1

  • Sharded: not supported

Example

torch_input = torch.randn([1, 1, 32, 256], dtype=torch.bfloat16)
tt_input = ttnn.from_torch(
    torch_input,
    dtype=ttnn.bfloat16,
    layout=ttnn.TILE_LAYOUT,
    device=mesh_device,
    mesh_mapper=ttnn.ShardTensorToMesh(mesh_device, dim=0),
)

# Send the shard on the sender coordinate to the receiver coordinate (same row/column).
sender_coord = ttnn.MeshCoordinate(0, 0)
receiver_coord = ttnn.MeshCoordinate(0, 1)
output = ttnn.point_to_point(tt_input, sender_coord, receiver_coord, topology=ttnn.Topology.Linear)
logger.info(output.shape)  # same spec as the input