-
Notifications
You must be signed in to change notification settings - Fork 552
Fix issue 3525: correct handling of array indexing with sequence #3585
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
| 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]); |
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.
Do you need to update the condition on 42? looks like you would read out of bounds here.
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.
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.
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.
Ran tests with compute sanitizer. No issues found.
christophe-murphy
left a comment
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.
Looks good, tests are passing.
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