#13953: Incorrectly handled bfloat16 -0.0 in ttnn.signbit #18346
+104
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ticket
Link to Github Issue
Problem description
-0.0
Incorrectly handled as0.0
inttnn.signbit
. bfloat16 data format should preserve-0.0
values through the unpacker, math, packer pipeline. However,-0.0
in bfloat16 format gets passed into the kernel as0.0
andsignbit
reads this as a positive value.The detailed reasoning is as follows. When unpacking to the Dest register, bfloat16 values are first packed into Src registers and then moved to Dest. When moving these values from Src,
-0.0
is interpreted as0.0
and src zero flags are set. This leads to-0.0
values not being moved, but instead, zeroes being written into relevant locations in Dest.What's changed
Disabled src zero flags for eltwise unary/sfpu operations.
-0.0
values are now moved to Dest instead of written with zeroes.Checklist