Skip to content

🐛 [Bug] view_to_reshape metadata mismatch #3221

Closed
@sean-xiang-applovin

Description

@sean-xiang-applovin

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions