Fix issue 3525: correct handling of array indexing with sequence#3585
Merged
Conversation
umar456
reviewed
Aug 15, 2024
| int i = | ||
| p.strds[0] * trimIndex(s0 ? gx + p.offs[0] : ptr0[gx], in.dims[0]); | ||
| p.strds[0] * | ||
| trimIndex(s0 ? gx * p.steps[0] + p.offs[0] : ptr0[gx], in.dims[0]); |
Member
There was a problem hiding this comment.
Do you need to update the condition on 42? looks like you would read out of bounds here.
Contributor
Author
There was a problem hiding this comment.
The condition is still correct because gx gy gz gw refer to indices in the output array, and the given check makes sure they are always inside the output array dimensions. The changes affect the indexing of the input array being sampled and the function trimIndex makes sure it's inside the input array dimensions.
Contributor
There was a problem hiding this comment.
Ran tests with compute sanitizer. No issues found.
5 tasks
christophe-murphy
approved these changes
Feb 11, 2025
christophe-murphy
left a comment
Contributor
There was a problem hiding this comment.
Looks good, tests are passing.
3 tasks
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 issue where array indexing with a sequence whose step is not 1 is handled as a sequence with step 1.
Description
af::seqin array indexingFixes: #3525
Changes to Users
Checklist