Skip to content
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

[DAPHNE-#687] OneHot bound check #695

Merged
merged 1 commit into from
Apr 27, 2024

Conversation

AlexRTer
Copy link
Collaborator

This PR fixes #687 by adding a simple bound check for the cArg value used for the OneHot encoding. Previous asserts have been replaced with runtime errors and are tested in OneHotTest.cpp. The loop setting all values within an encoded segment to zero is now also a single memset instruction.

Onehot now also accepts 0 as an argument for info, which signals to omit the corresponding column instead of encoding or copying it to res. Currently, if all values in info are 0 a runtime error is thrown. This could be changed to return an empty res instead.

@corepointer
Copy link
Collaborator

LGTM - thx for fixing this.

I'd merge this later today if no further discussion comes up.

This commit fixes the bounds checks of the onehot kernel, adds a zero mode, replaces the assertions, adds test cases and documentation.

Closes daphne-eu#695
@corepointer corepointer force-pushed the OneHot-bounds-check branch from 3c88a6c to 81b1142 Compare April 27, 2024 01:20
@corepointer corepointer merged commit 81b1142 into daphne-eu:main Apr 27, 2024
2 checks passed
@AlexRTer AlexRTer deleted the OneHot-bounds-check branch June 25, 2024 14:33
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.

OneHot kernel does not check bounds
2 participants