Skip to content

Fix narrow bounds checking in generic gathers - #2

Closed
lpetersen-pixel wants to merge 1 commit into
intel:mainfrom
lpetersen-pixel:generic-gather-fix
Closed

lpetersen-pixel wants to merge 1 commit into
intel:mainfrom
lpetersen-pixel:generic-gather-fix

Conversation

@lpetersen-pixel

Copy link
Copy Markdown

I noticed that generic gather did not work for certain values;
for a 128-element source, 1...128', an int8_tindex of 127 should return 128, but currently returns 0 as we callpartial_gather_from` which clamps the upper bound to the index types maximum and tests index < bound.

solution: simply retain the full range size and compare safely; I would assume this adds a branch, but havent checked.

@danieltowner

Copy link
Copy Markdown
Contributor

@lpetersen-pixel Thanks for your repot and fix. Coincidentally I found something very similar recently and have a patch sitting on my machine waiting to be applied. I'll merge/compare with yours when I get back from cppcon.

@lpetersen-pixel

Copy link
Copy Markdown
Author

@lpetersen-pixel Thanks for your repot and fix. Coincidentally I found something very similar recently and have a patch sitting on my machine waiting to be applied. I'll merge/compare with yours when I get back from cppcon.

no worries, thanks for the great talk :)

@danieltowner

Copy link
Copy Markdown
Contributor

@lpetersen-pixel I took your basic fix and created a more comprehensive PR which also added verification and support for AVX-512 (#36). Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants