Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [Bug] view_to_reshape metadata mismatch #3221

Open
sean-xiang-applovin opened this issue Oct 7, 2024 · 1 comment
Open

🐛 [Bug] view_to_reshape metadata mismatch #3221

sean-xiang-applovin opened this issue Oct 7, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@sean-xiang-applovin
Copy link

sean-xiang-applovin commented Oct 7, 2024

Bug Description

When replacing the view nodes with reshape nodes, the metadata of the original view nodes, are assigned to the reshape nodes in the wrong order.

For example, assume we have 2 view nodes, view_1, view_2. So we will have a list, [metadata1, metadata2], from this code

I haven't dive deep yet, but after torch.fx.subgraph_rewriter.replace_pattern(gm, orig, replacement), in the new graph, the view nodes are replaced with reshape nodes, however, the order of reshape nodes can be reshape_default_2, reshape_default_1. In this case, when we set the metadata back by set_metadata(gm, replacement_op, metadata), the metadata can mismatch

To Reproduce

I am sorry, I cannot share the graph of the model, I will try my best to have e toy model to reproduce the error.

Steps to reproduce the behavior:

Expected behavior

Environment

Build information about Torch-TensorRT can be found by turning on debug messages

  • Torch-TensorRT Version (e.g. 1.0.0): 2.4.0
  • PyTorch Version (e.g. 1.0): 2.4.1
  • CPU Architecture: x86_64
  • OS (e.g., Linux): linux
  • How you installed PyTorch (conda, pip, libtorch, source): pip
  • Build command you used (if compiling from source):
  • Are you using local sources or building from archives: no
  • Python version: 3.11.9
  • CUDA version:12.6
  • GPU models and configuration: NVIDIA L4
  • Any other relevant information:

Additional context

@sean-xiang-applovin sean-xiang-applovin added the bug Something isn't working label Oct 7, 2024
@sean-xiang-applovin
Copy link
Author

I check the source code, seems we have converter support for torch.ops.aten.view, so probably the best way to solve this is to delete the view_to_reshape pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants