Skip to content

Commit

Permalink
Fix I2S aligment issue on BH
Browse files Browse the repository at this point in the history
Running conv2d sweeps on BH exposed ~150 pcc issues.
TT_METAL_WATCHER exposed unaligned noc transaction in
ttnn/cpp/ttnn/operations/data_movement/sharded/device/kernels/dataflow/reader_unary_stick_layout_sharded_blocks_interleaved_start_id.cpp in these test cases.
block_width_bytes wasn't aligned to 16B in these cases.
For some reason BH codepath was setting unaligned size in this case.
  • Loading branch information
pjosipovic authored and pavlejosipovic committed Feb 16, 2025
1 parent 44d31eb commit df3e71a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions tests/ttnn/unit_tests/test_to_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,26 @@ def test_untilize_w4(shape, input_layout, output_layout, device):
output_tensor = ttnn.to_torch(output_tensor)

assert_with_pcc(input_a[:, :, :1, :10912], output_tensor)


def test_interleaved_to_sharded_block_shareded_unaligned_width(device):
torch_input_shape = [1, 1, 196, 92]
torch_input = torch.randn(torch_input_shape, dtype=torch.bfloat16).bfloat16()

sharded_memory_config = ttnn.create_sharded_memory_config(
[32, 32],
core_grid=ttnn.CoreGrid(
x=7,
y=3,
),
strategy=ttnn.ShardStrategy.BLOCK,
orientation=ttnn.ShardOrientation.COL_MAJOR,
use_height_and_width_as_shard_shape=True,
)
ttnn_input = ttnn.from_torch(torch_input, device=device, layout=ttnn.ROW_MAJOR_LAYOUT)
ttnn_output = ttnn.to_memory_config(ttnn_input, sharded_memory_config)

output_torch = ttnn.to_torch(ttnn_output)

passing, pcc_msg = check_with_pcc_without_tensor_printout(torch_input, output_torch)
assert passing, pcc_msg
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ operation::ProgramWithCallbacks interleaved_to_sharded_multi_core(
num_units_per_row,
shard_height,
shard_width,
(is_blackhole) ? shard_width : padded_offset_bytes,
padded_offset_bytes,
static_cast<uint32_t>(aligned),
aligned_width_offset,
aligned_shard_width,
Expand Down

0 comments on commit df3e71a

Please sign in to comment.