fix(opt): visit input operand of AtomicOp::CompareAndSwap#1331
Draft
kimjune01 wants to merge 1 commit into
Draft
fix(opt): visit input operand of AtomicOp::CompareAndSwap#1331kimjune01 wants to merge 1 commit into
kimjune01 wants to merge 1 commit into
Conversation
The optimizer's visit_atomic handler for CompareAndSwap visited op.cmp twice and never visited op.input. This meant the atomic pointer variable was not tracked as read, so the optimizer could break the binding chain between the Index op (which registers the atomic scope) and the CAS op (which looks it up), causing "Atomic should have a scope registered" panics in cubecl-spirv. Also fixes the duplicate visit of op.cmp (copy-paste bug). Fixes tracel-ai#1318
kimjune01
marked this pull request as draft
May 17, 2026 20:09
Author
|
Human here. Unfortunate news: I just moved this into drafts because I just realized that I can't repro the issue locally anymore. I quit my job this past week and no longer have access to a linux or windows machine like I used to. I'm on a macbook pro now. I wish I could've taken it to completion by actually running the tests. Thanks for understanding |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1318.
visit_atomicforCompareAndSwapvisitedop.cmptwice and never visitedop.input. The atomic pointer variable therefore wasn't tracked as read, and the optimizer could break the binding chain between theIndexop (which registers the atomic scope) and theCASop (which looks it up). The downstream effect was theAtomic should have a scope registeredpanic incubecl-spirv.This change visits
op.inputand removes the duplicate visit ofop.cmp(a copy-paste bug).Testing
cargo xtask validatepasses.Hypothesis graph
Investigation notes and the repo-level hypothesis graph that informed this fix: https://github.com/kimjune01/sweep/blob/master/repo-hypotheses/tracel-ai-cubecl.md