Skip to content

🐛 [Bug] "Cannot convert symbols to int" when compiling graph that outputs tensor with dynamic shape #3269

@dgcnz

Description

@dgcnz

Bug Description

When doing parse_graph_io on a graph that outputs a tensor with dynamic shapes, extract_var_range_info(node.meta["val"]) fails because tensor.shape[0] in opt_val = int(tensor.shape[0].node.shape_env.get(expr) is an unbacked SymInt without an actual value attached.

This sort of makes sense, so I'm not sure if it's a bug or a non-feature.

Anyway, (I think) another possible source to get a value for that unbacked symint is to use tensor.shape[0].node.shape_env.dim_constraints._static_results which returns {"L['x'].size()[0] == 10"}.

To Reproduce

MRE and logs in this gist.

Expected behavior

Not sure.

Environment

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

  • Torch-TensorRT Version (e.g. 1.0.0): 2.6.0.dev20241030+cu124
  • PyTorch Version (e.g. 1.0): 2.6.0.dev20241028+cu124
  • 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: -
  • Python version: 3.10.0
  • CUDA version: 12.4
  • GPU models and configuration: 4060 TI
  • Any other relevant information: -

Metadata

Metadata

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