Preserve negative zero in CPU Where - #32539
Open
Sylvester Kaczmarek (sylvesterkaczmarek) wants to merge 3 commits into
Open
Preserve negative zero in CPU Where#32539Sylvester Kaczmarek (sylvesterkaczmarek) wants to merge 3 commits into
Sylvester Kaczmarek (sylvesterkaczmarek) wants to merge 3 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Sylvester Kaczmarek (sylvesterkaczmarek)
September 10, 2026 09:28
View session
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The custom verifier must also confirm outputs are zero, and the merge documentation should match the new logic.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Preserves floating-point negative zero in CPU Where selection.
Changes:
- Adds signed-zero-aware merge detection.
- Adds float/double CPU regression tests.
File summaries
| File | Description |
|---|---|
where_op.cc |
Preserves selected -0.0. |
where_op_test.cc |
Tests X and broadcast Y paths. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes #32191.
The CPU
Whereimplementation uses zero-filled selection tensors and treatsvalue != 0as the marker that an element was selected. A selected-0.0compares equal to the+0.0sentinel, so its sign bit is lost.Preserve selected floating-point negative zero while keeping integer and string behavior unchanged. The algorithm comment now describes the signed-zero-aware selection rule.
Testing
WhereOpTest.*cases passed.Validation used a combined worktree on current main with the pending QuickGelu, DivMul, and Gelu fixes. This does not claim validation of the full upstream CI matrix.