-
Notifications
You must be signed in to change notification settings - Fork 98
Fix loop body value creation #2777
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
Conversation
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2777 +/- ##
==========================================
- Coverage 70.45% 70.45% -0.01%
==========================================
Files 228 228
Lines 27260 27257 -3
Branches 2760 2760
==========================================
- Hits 19206 19203 -3
Misses 7102 7102
Partials 952 952 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a critical issue in loop statement translation where ir.Value objects were being duplicated, leading to invalid IR graphs. The fix ensures that ir.Value objects are created properly using make_value() and reused rather than duplicated.
Changes:
- Replace bare
ir.Value()construction withmake_value()calls to ensure proper metadata and type information - Use
generate_unique_name()for condition variables to avoid name collisions - Reuse existing
ir.Valueobjects in loop subgraph parameters and outputs instead of creating duplicates
|
|
[Claude] Looking at the error, the issue is that cond_while.name is cond_11 but the actual variable in scope is cond. Let me trace through the code to find the bug. The Problem But later at converter.py:1354-1361, the code tries to look up cond_while.name in the current scope: The problem is that cond_while.name is "cond_11" (a uniquified name), but the Python variable bound in scope is still "cond" (the original test.id). The Fix And update the lookup code: Summary The original code (before your file) had cond_while = ir.Value(name=test.id) which preserved the original name. Your updated version uses make_value(self.generate_unique_name(test.id), ...) which generates a new unique name, breaking the lookup. |
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Create and use ir.Value in loop subgraph inputs and bodies to avoid unintentional duplication of ir.Values (which led to invalid IR graphs).