Skip to content

fix: Fix unbacked sym int not found issue #3617

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

Merged
merged 5 commits into from
Jun 26, 2025
Merged

fix: Fix unbacked sym int not found issue #3617

merged 5 commits into from
Jun 26, 2025

Conversation

peri044
Copy link
Collaborator

@peri044 peri044 commented Jun 25, 2025

Description

Fixes #3588

Type of change

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

Checklist:

  • My code follows the style guidelines of this project (You can use the linters)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas and hacks
  • I have made corresponding changes to the documentation
  • I have added tests to verify my fix or my feature
  • New and existing unit tests pass locally with my changes
  • 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: api [Python] Issues re: Python API component: runtime component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Jun 25, 2025
@peri044 peri044 requested review from narendasan and zewenli98 June 25, 2025 20:57
Copy link
Collaborator

@zewenli98 zewenli98 left a comment

Choose a reason for hiding this comment

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

LGTM. just a quick question: add_var_to_val(k, v) would fail but set_unbacked_var_to_val(k, v) would work if k already exists right? The tests worked well in the previous. Any changes caused the issue?

@peri044
Copy link
Collaborator Author

peri044 commented Jun 25, 2025

LGTM. just a quick question: add_var_to_val(k, v) would fail but set_unbacked_var_to_val(k, v) would work if k already exists right? The tests worked well in the previous. Any changes caused the issue?

Yes, the tests failed with recent versions of Pytorch which went undetected. add_var_to_val wasn't adding the unbacked symint to var_to_val anymore throughout the torch.export tracing and it resulted in KeyError: u0. The recommended way by Meta to add unbacked symints is through set_unbacked_var_to_val and this ensures unbacked symints are available via node.shape_env.unbacked_var_to_val attribute.

@peri044 peri044 merged commit b0d5787 into main Jun 26, 2025
41 of 85 checks passed
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: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths component: runtime component: tests Issues re: Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 [Bug] Reexport test failures
4 participants