tenstorrent / tt-metal

:metal: TT-NN operator library, and TT-Metalium low level kernel programming model.
https://docs.tenstorrent.com/ttnn/latest/index.html
Apache License 2.0
492 stars 82 forks source link

Unsupported cases for `aten.amin/amax` conversion #12936

Open jerrysky3 opened 2 months ago

jerrysky3 commented 2 months ago

When trying to convert aten.amin/amax to ttnn.min/max, we ran into the issues below with tt-metal and currently don't support them:

jerrysky3 commented 1 month ago

We also found ttnn.max(input_tensor) always return 0 even if all values < 0

bbradelTT commented 17 hours ago

@jerrysky3 could you please provide one or more concrete examples of calling ttnn.max for the last case ("When the output shape is (x, ttnn.TILE_SIZE * y) where x % ttnn.TILE_SIZE != 0")?

Do you mean something like


def test_max3(device): 
    x = -torch.ones((3, 1, 3, 64), dtype=torch.float32)
    x_tt = ttnn.from_torch(x, dtype=ttnn.bfloat16, layout=ttnn.TILE_LAYOUT, device=device)
    keepdim = False # True
    y_tt = ttnn.max(x_tt, dim=0, keepdim=keepdim)
    y = ttnn.to_torch(y_tt)
    z = torch.max(x, dim=0, keepdim=keepdim).values
    print(f'x {x}\ny_tt {y_tt}\nz {z}')
    assert_with_pcc(z, y)