-
Notifications
You must be signed in to change notification settings - Fork 997
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
bfloat16: faster conversion and assignment from integer types #801
bfloat16: faster conversion and assignment from integer types #801
Conversation
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.
LGTM
And thanks for the test!
Added a converting constructor and an assignment operator template from any integer type to `bfloat16_t`. Allows significantly faster conversion and assignment from an integer than when using `bfloat16_t(float)` or `operator=(float)`, by avoiding an `fpclassify(f)` call, and skipping the cases for denormal floats and NaNs.
6c7d534
to
51638e7
Compare
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.
Thanks for the PR, Niels!
I will run the internal CI to make sure nothing is broken and will merge it soon.
Merged! Thanks a lot for the contribution, Niels! |
@emfomenk Hi Evarist! Do you think there is still a chance that the two little commits that we did to src/common/bfloat16.hpp in July, 073e346 (this pull request) and d68271b (pull request #780) will be included with oneDNN v2.0? Apparently they did not make it into v2.0-beta09/src/common/bfloat16.hpp |
Hi @N-Dekker, Thanks for checking the status! The Is it fine for you to wait till beta10 (that will be released in a ~month)? |
@emfomenk Thanks, Evarist! Sure, it's perfectly fine to me to have them in v2.0-beta10! |
Added a converting constructor and an assignment operator template from
any integer type to
bfloat16_t
. Allows significantly faster conversionand assignment from integer than when using
bfloat16_t(float)
oroperator=(float)
, by avoiding anfpclassify(f)
call, and skippingthe cases for denormal floats and NaNs.