Skip to content

Fix noncontiguous AOT inputs - #4509

Open
jloftin-nv wants to merge 2 commits into
pytorch:mainfrom
jloftin-nv:dev-jloftin-non-contigious
Open

Fix noncontiguous AOT inputs#4509
jloftin-nv wants to merge 2 commits into
pytorch:mainfrom
jloftin-nv:dev-jloftin-non-contigious

Conversation

@jloftin-nv

Copy link
Copy Markdown
Contributor

Description

Input.from_tensor rejects non-contiguous / non-channels-last tensors unless disable_memory_format_check=True. The torch.compile backend sets that flag; every dynamo.compile AOT path does not, so the same inputs succeed on one entry point and fail on the other.

Pass disable_memory_format_check=True through the AOT prepare_inputs sites to match the backend behavior.

Type of change

Please delete options that are not relevant and/or add your own.

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • [X ] My code follows the style guidelines of this project (You can use the linters)
  • [X ] I have performed a self-review of my own code
  • [X ] I have commented my code, particularly in hard-to-understand areas and hacks
  • [ X] I have made corresponding changes to the documentation
  • [ X] I have added tests to verify my fix or my feature
  • [ X] New and existing unit tests pass locally with my changes
  • [ X] I have added the relevant labels to my PR in so that relevant reviewers are notified

@github-actions github-actions Bot added component: tests Issues re: Tests component: core Issues re: The core compiler component: api [Python] Issues re: Python API component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Aug 18, 2026
@meta-cla meta-cla Bot added the cla signed label Aug 18, 2026
@github-actions
github-actions Bot requested a review from lanluo-nvidia August 18, 2026 21:51
@lanluo-nvidia lanluo-nvidia added this to the v2.14.0 milestone Aug 20, 2026

@lanluo-nvidia lanluo-nvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • P1 — The top-level Dynamo AOT entry points still reject non-contiguous tensors before reaching these updated functions. py/torch_tensorrt/_compile.py:340,
    py/torch_tensorrt/_compile.py:438, and py/torch_tensorrt/_compile.py:564 call prepare_inputs(...) without disable_memory_format_check=True. Thus
    torch_tensorrt.compile(..., ir="dynamo"), top-level cross-compilation, and convert_method_to_trt_engine still raise ValueError for the same transposed
    inputs, so the change only fixes direct torch_tensorrt.dynamo.* APIs. The test covers only the direct compile path.

@jloftin-nv
jloftin-nv force-pushed the dev-jloftin-non-contigious branch from 327f655 to 8aa3cbc Compare August 21, 2026 17:14
@jloftin-nv

Copy link
Copy Markdown
Contributor Author
  • P1 — The top-level Dynamo AOT entry points still reject non-contiguous tensors before reaching these updated functions. py/torch_tensorrt/_compile.py:340,
    py/torch_tensorrt/_compile.py:438, and py/torch_tensorrt/_compile.py:564 call prepare_inputs(...) without disable_memory_format_check=True. Thus
    torch_tensorrt.compile(..., ir="dynamo"), top-level cross-compilation, and convert_method_to_trt_engine still raise ValueError for the same transposed
    inputs, so the change only fixes direct torch_tensorrt.dynamo.* APIs. The test covers only the direct compile path.

Fixed the other pathways

@lanluo-nvidia lanluo-nvidia modified the milestones: v2.14.0, v2.15.0 Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed component: api [Python] Issues re: Python API component: core Issues re: The core compiler component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths component: tests Issues re: Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants