Skip to content

5-Dimension concat on TILE_LAYOUT inputs #16217

Open
@LPanosTT

Description

The following test fails:

def test_5d_concat(device):

    torch_input_tensors = [torch.rand(1, 32, 56, 56, 1, dtype=torch.bfloat16) for _ in range(3)]
    torch_result = torch.cat(torch_input_tensors, dim=-1)

    ttnn_input_tensors = [ttnn.from_torch(x, layout=ttnn.TILE_LAYOUT, device=device) for x in torch_input_tensors]
    ttnn_result = ttnn.concat(ttnn_input_tensors, dim=-1) # throws here
    ttnn_result = ttnn.to_torch(ttnn_result)
    assert_with_pcc(torch_result, ttnn_result, 0.9999)

With error: Tensor rank is greater than 4

Performing the test with a ROW_MAJOR_LAYOUT inputs instead, and then attempting to convert the result to TILE _LAYOUT fails on the subsequent ttnn.to_layout call. Test:

def test_5d_concat(device):

    torch_input_tensors = [torch.rand(1, 32, 56, 56, 1, dtype=torch.bfloat16) for _ in range(3)]
    torch_result = torch.cat(torch_input_tensors, dim=-1)

    ttnn_input_tensors = [ttnn.from_torch(x, layout=ttnn.ROW_MAJOR_LAYOUT, device=device) for x in torch_input_tensors]
    ttnn_result = ttnn.concat(ttnn_input_tensors, dim=-1)
    ttnn_result = ttnn.to_layout(ttnn_result, ttnn.TILE_LAYOUT) # throws here
    ttnn_result = ttnn.to_torch(ttnn_result)
    assert_with_pcc(torch_result, ttnn_result, 0.9999)

With error:

E       RuntimeError: TT_FATAL @ /localdev/lpanos/tt-metal/ttnn/cpp/ttnn/operations/data_movement/reshape_view/reshape.cpp:383: false
E       info:
E       Attempting to reshape between two shapes with different volumes

If we are to perform eltwise operations after the concatenation, its result must be in TILE_LAYOUT.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions