fix: Prevent OOB access from sentinel indices in atomic_rmw (closes #1335)#1353
Open
botbikamordehai2-sketch wants to merge 1 commit into
Open
Conversation
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.
What
The bug occurs when using max-int sentinel indices in atomic_rmw operations. The current implementation passes the raw index to the hardware, which tries to perform an indirect memory access even for sentinel lanes before applying fill/drop semantics. This results in NRT_EXEC_OOB errors.
Fix
Added a sentinel mask that identifies lanes with indices equal to np.iinfo(np.int32).max. The safe_indices tensor replaces sentinel indices with 0 to avoid OOB memory accesses. The atomic_rmw now uses a predicate to skip sentinel lanes entirely, ensuring they never touch memory. This matches the expected fill/drop semantics where sentinel lanes should be ignored.
Closes #1335