bgawrych commented on code in PR #21002:
URL: https://github.com/apache/incubator-mxnet/pull/21002#discussion_r919124466
##########
3rdparty/mshadow/mshadow/base.h:
##########
@@ -769,6 +769,10 @@ namespace isnan_typed {
MSHADOW_XINLINE bool IsNan(volatile mshadow::half::half_t val) {
return (val.half_ & (~MSHADOW_HALF_SIGN_BIT)) > MSHADOW_HALF_EXPONENT_BITS;
}
+ template <>
+ MSHADOW_XINLINE bool IsNan(volatile mshadow::bfloat::bf16_t val) {
+ return (val.bf16_ & (~MSHADOW_BF16_SIGN_BIT)) > MSHADOW_BF16_EXPONENT_BITS;
Review Comment:
checking if float is NaN -
https://stackoverflow.com/questions/26052640/why-does-gcc-implement-isnan-more-efficiently-for-c-cmath-than-c-math-h
I'm not sure if converting bfloat to float won't introduce additional
overhead which can reduce benefit from calling float's isnan
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]