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/
16 stars 5 forks source link

Model OpenPose. #132

Closed cthsieh closed 2 weeks ago

cthsieh commented 2 weeks ago

Ticket

Link to Github Issue

Problem description

The current OpenPose test does not work because the model in use is not supported by the PyTorch Dynamo compiler flow.

I suspect the issue is due to the model's use of dynamic shapes, which the current PyTorch Dynamo compilation flow does not support well. My assumption is based on the error message during compilation.

E       torch._dynamo.exc.BackendCompilerFailed: backend='ttnn_backend' raised:
E       RuntimeError: aten::clone() Expected a value of type 'Tensor' for argument 'self' but instead found type 'SymInt'.
E       Position: 0
E       Value: s1
E       Declaration: aten::clone(Tensor self, *, MemoryFormat? memory_format=None) -> Tensor
E       Cast error details: Unable to cast s1 to Tensor
E
E       While executing %clone_default_1 : [num_users=1] = call_function[target=torch.ops.aten.clone.default](args = (%l_s_1_,\
), kwargs = {})
E       Original traceback:
E       None
E
E
E       You can suppress this exception and fall back to eager by setting:
E           import torch._dynamo
E           torch._dynamo.config.suppress_errors = True

The error indicates that an aten operator received data of type SymInt instead of the expected Tensor. PyTorch indeed provides a type called SymInt (symbolic integer), introduced as part of its symbolic shapes feature. This feature supports symbolic shape inference in tensor operations, which is especially useful when working with dynamic shapes, enabling more flexible and efficient model design. However, the use of SymInt seems to conflict with the expectations of the Dynamo compiler, as the error occurs within Dynamo itself.

SymInt Reference: pytorch source code

What's changed

We have retained the current test implementation for future study and added another test using a different model that does not have issues with dynamic shapes.

ayerofieiev-tt commented 2 weeks ago

@cthsieh can you help to craft a "Known Issues" page and list the two known issues?

cthsieh commented 6 days ago

@cthsieh can you help to craft a "Known Issues" page and list the two known issues?

  • SymInt
  • Pipeline

Sure, I will.