tenstorrent / pytorch2.0_ttnn

⭐️ TTNN Compiler for PyTorch 2.0 ⭐️ It enables running PyTorch2.0 models on Tenstorrent hardware
https://tenstorrent.github.io/tt-metal/latest/ttnn/
25 stars 6 forks source link

aten.view's err value too large on integer type #420

Open swimdi opened 4 hours ago

swimdi commented 4 hours ago

In microsoft/beit-base-patch16-224, there has this pattern

view_13 = torch.ops.aten.view.default(arg223_1, [-1])
index = torch.ops.aten.index.Tensor(arg1_1, [view_13])

where arg1_1.shape = [732, 12] and arg223_1 will to be a list of index

tensor([[731, 729, 729,  ..., 729, 729, 729],
        [730, 364, 363,  ...,   2,   1,   0],
        [730, 365, 364,  ...,   3,   2,   1],
        ...,
        [730, 726, 725,  ..., 364, 363, 362],
        [730, 727, 726,  ..., 365, 364, 363],
        [730, 728, 727,  ..., 366, 365, 364]])

arg223_1 dtype is int64, and value 731 is contained in it, and

One of the suggestion of this issue is NOT lowering torch.ops.aten.view.default to ttnn.reshape if dtype is int64(then beit cannot end-to-end compiled), but I want to get some feedback from TT side

You can reproduce this error by pytest tests/pattern/test_beit_pattern.py

ayerofieiev-tt commented 4 hours ago

Got it. Checking with the team. If we truly can’t support int64 in reshape, I agree, we should avoid.