tt-metal: Tilize/untilize compute kernels are buggy
Describe the bug The following tilize/untilize compute kernels seem to be buggy for uint32 data type:
- tilize_block in tt_metal/include/compute_kernel_api/tilize.h
- untilize_block in tt_metal/include/compute_kernel_api/untilize.h
To Reproduce The following tests use the kernels above and fail with assertion error:
@pytest.mark.parametrize("shape", [[32, 288]])
def test_untilize_with_unpadding_uint32(shape, device):
torch.manual_seed(2005)
input_a = torch.randint(1, 64, shape, dtype=torch.int32)
input_tensor = ttnn.from_torch(input_a, device=device, layout=ttnn.TILE_LAYOUT, dtype=ttnn.uint32)
output_tensor = ttnn.untilize_with_unpadding(input_tensor, [3,279])
output_tensor = ttnn.to_torch(output_tensor)
assert_with_pcc(input_a[:4, :280], output_tensor)
@pytest.mark.parametrize("shape", [[32, 512]])
def test_untilize_uint32(shape, device):
torch.manual_seed(2005)
input_a = torch.randint(1, 64, shape, dtype=torch.int32)
input_tensor = ttnn.from_torch(input_a, device=device, layout=ttnn.TILE_LAYOUT, dtype=ttnn.uint32)
output_tensor = ttnn.untilize(input_tensor)
output_tensor = ttnn.to_torch(output_tensor)
assert_with_pcc(input_a, output_tensor)
@pytest.mark.parametrize("shape", [[15, 15]])
def test_tilize_with_val_padding_uint32(shape, device):
torch.manual_seed(2005)
input_a = torch.randint(0, 64, shape, dtype=torch.int32)
input_tensor = ttnn.from_torch(input_a, device=device, layout=ttnn.ROW_MAJOR_LAYOUT, dtype=ttnn.uint32)
output_tensor = ttnn.tilize_with_val_padding(input_tensor, [32,32], 70)
output_tensor = ttnn.to_torch(output_tensor)
assert_with_pcc(input_a, output_tensor)
@pytest.mark.parametrize("shape", [[32, 32]])
def test_tilize_uint32(shape, device):
torch.manual_seed(2005)
input_a = torch.randint(0, 64, shape, dtype=torch.int32)
input_tensor = ttnn.from_torch(input_a, device=device, layout=ttnn.ROW_MAJOR_LAYOUT, dtype=ttnn.uint32)
output_tensor = ttnn.tilize(input_tensor)
output_tensor = ttnn.to_torch(output_tensor)
assert_with_pcc(input_a, output_tensor)
Additional context Note: You need to add DataType::UINT32 to this line to test uint32 type in tilize https://github.com/tenstorrent/tt-metal/blob/af79262b0b3f9103fa5f4335c6426fbdfd016f0d/ttnn/cpp/ttnn/operations/data_movement/tilize/device/tilize_op.cpp#L25
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 34 (27 by maintainers)
Commits related to this issue
- #16860: Added API int32/uint32 tilize support for BH — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Updated submodule ref, works for 512x512 inputs — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Updated submodule ref — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Added API support for int32/uint32 tilize on WH_B0 — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Added API int32/uint32 tilize support for BH — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Updated submodule ref, works for 512x512 inputs — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Updated submodule ref — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Updated submodule ref, works for 512x512 inputs — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Removed is_32bit_integer flag (unpack to dest resolved in LLK) on WHB0 — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Removed is_32bit_integer flag (unpack to dest resolved in LLK) on BH — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Added API support for int32/uint32 tilize on WH_B0 — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Added API int32/uint32 tilize support for BH — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Removed is_32bit_integer flag (unpack to dest resolved in LLK) on WHB0 — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Removed is_32bit_integer flag (unpack to dest resolved in LLK) on BH — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Added API support for int32/uint32 tilize on WH_B0 — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Added API int32/uint32 tilize support for BH — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Removed is_32bit_integer flag (unpack to dest resolved in LLK) on WHB0 — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Removed is_32bit_integer flag (unpack to dest resolved in LLK) on BH — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Updated submodule ref — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
- #16860: Updated submodule ref — committed to tenstorrent/tt-metal by pmilenkovicTT 2 years ago
Hey, pack untilize is working on the op level, and I will add a PR for that soon. We can close the issue, thank you!
Please keep in mind, this already affects a 3rdparty partner
@ncvetkovicTT confirmed it’s not blocking llama but it is linked to an old p1. I’ll leave it as a p1. Could you prioritize this higher relative to other p1s since it’s quite old.
@ncvetkovicTT I don’t think this is the case anymore because @nardoTT was able to get uint16 working without this fix. We can bring this down from a p0.