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

#13953: Incorrectly handled bfloat16 -0.0 in ttnn.signbit #18346

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

atatuzunerTT
Copy link
Contributor

@atatuzunerTT atatuzunerTT commented Feb 26, 2025

Ticket

Link to Github Issue

Problem description

-0.0 Incorrectly handled as 0.0 in ttnn.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 as 0.0 and signbit 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 as 0.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

@atatuzunerTT atatuzunerTT changed the title #13953: Incorrectly handled -0.0 in bfloat16 #13953: Incorrectly handled bfloat16 -0.0 in ttnn.signbit Feb 26, 2025
@atatuzunerTT atatuzunerTT force-pushed the atuzuner/signbit_neg_zero branch 3 times, most recently from b9be403 to a7c822c Compare February 27, 2025 14:50
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.

1 participant