Skip to content

[exir] Materialize alloc shapes in ToOutVarPass#19806

Merged
oscarandersson8218 merged 3 commits into
pytorch:mainfrom
oscarandersson8218:ToOutVarPass_alloc_shapes_fix
May 28, 2026
Merged

[exir] Materialize alloc shapes in ToOutVarPass#19806
oscarandersson8218 merged 3 commits into
pytorch:mainfrom
oscarandersson8218:ToOutVarPass_alloc_shapes_fix

Conversation

@oscarandersson8218
Copy link
Copy Markdown
Collaborator

@oscarandersson8218 oscarandersson8218 commented May 27, 2026

Fix a dynamic-shape lowering bug in exir.

ConstraintBasedSymShapeEvalPass concretizes TensorSpec metadata, but ToOutVarPass was still building memory.alloc nodes from symbolic FakeTensor/tensor_meta shapes. That let symbolic dims leak into the generated ExecuTorch GraphModule and caused runtime failures when the lowered module was executed in Python.

Build memory.alloc specs from concrete upper-bounded integer shapes instead. If an alloc shape is still not concretely bounded, raise a clear error.

Add an EXIR regression test that exports a dynamic-shape model, runs ConstraintBasedSymShapeEvalPass + ToOutVarPass, and verifies that memory.alloc shapes are concrete integers.

cc @digantdesai @freddan80 @per @zingo @mansnils @Sebastian-Larsson @robell @rascani

Fix a dynamic-shape lowering bug in exir.

ConstraintBasedSymShapeEvalPass concretizes TensorSpec metadata, but
ToOutVarPass was still building memory.alloc nodes from symbolic
FakeTensor/tensor_meta shapes. That let symbolic dims leak into the
generated ExecuTorch GraphModule and caused runtime failures when the
lowered module was executed in Python.

Build memory.alloc specs from concrete upper-bounded integer shapes
instead. If an alloc shape is still not concretely bounded, raise a
clear error.

Add an EXIR regression test that exports a dynamic-shape model, runs
ConstraintBasedSymShapeEvalPass + ToOutVarPass, and verifies that
memory.alloc shapes are concrete integers.

Signed-off-by: Oscar Andersson <oscar.andersson@arm.com>
Change-Id: If9a7b4b9aad93c1d594f9f9178d33d7df944c5e6
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented May 27, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19806

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ You can merge normally! (3 Unrelated Failures)

As of commit 2309f03 with merge base 7fd21f2 (image):

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 27, 2026
@oscarandersson8218 oscarandersson8218 added help wanted Extra attention is needed partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: exir Changes to any dialects and passes on these dialects, such as memory planning ciflow/trunk labels May 27, 2026
Copy link
Copy Markdown
Contributor

@digantdesai digantdesai left a comment

Choose a reason for hiding this comment

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

Thanks!

@zingo zingo removed the help wanted Extra attention is needed label May 27, 2026
oscarandersson8218 and others added 2 commits May 28, 2026 07:10
Remove nonzero test case from xfails in test_torch_functions.py.

Signed-off-by: Oscar Andersson <oscar.andersson@arm.com>
Change-Id: I5768429c6e289e114c55a1f77822cc03a619b8ab
@github-actions github-actions Bot added the module: arm Issues related to arm backend label May 28, 2026
@oscarandersson8218 oscarandersson8218 merged commit 94f9719 into pytorch:main May 28, 2026
460 of 465 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: arm Issues related to arm backend partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: exir Changes to any dialects and passes on these dialects, such as memory planning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants