-
Notifications
You must be signed in to change notification settings - Fork 75.3k
bfloat16 does not flush denormals (subnormal floats) to zero #36514
Copy link
Copy link
Closed
Labels
comp:coreissues related to core part of tensorflowissues related to core part of tensorflowstat:awaiting responseStatus - Awaiting response from authorStatus - Awaiting response from authortype:bugBugBug
Description
BFloat16: The secret to high performance on Cloud TPUs, Shibo Wang, Pankaj Kanwar (@pkanwar23 right?) , August 23, 2019, says:
bfloat16 handles denormals differently from FP32: it flushes them to zero
I assume this implies that for a denormal 32-bit floating point, denorm, the expression float{bfloat16{denorm}} should be equal to zero.
The current implementation of tensorflow::bfloat16 (master branch, revision bc28d49) appears to behave differently. As can be observed by the following test:
for (float denorm = std::numeric_limits<float>::denorm_min();
denorm < std::numeric_limits<float>::min();
denorm = std::nextafterf(denorm, 1.0f))
ASSERT_EQ(float{ tensorflow::bfloat16{denorm} }, 0.0f);
This assertion fails on the current implementation, from tensorflow/core/lib/bfloat16
Is that indeed a bug in tensorflow::bfloat16?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
comp:coreissues related to core part of tensorflowissues related to core part of tensorflowstat:awaiting responseStatus - Awaiting response from authorStatus - Awaiting response from authortype:bugBugBug