Shaders: lower binary64 class comparisons from their raw words #2311

Closed
andrewpozdnakov7-jpg wants to merge 1 commit from upstream-pr/2313 into main
andrewpozdnakov7-jpg commented 2026-11-25 10:25:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T10:25:42Z.


The decoder knows v_cmp_class_f64 and v_cmpx_class_f64, but the lowering rejects both. Classify the two binary64 words with the existing class-mask path. The low word counts toward the mantissa, so it distinguishes a subnormal from zero and a signaling NaN from infinity. ABS and NEG act on the high word's sign bit.

The regression covers all ten RDNA 2 classes, VGPR and SGPR pairs, literal and inline sources, sign modifiers, and execution masking through v_cmpx. The emitted VGPR and SGPR comparison shaders leave the SFI0 INT64 feature bit clear.

  • 940d32f rejects both synthetic shaders as unsupported.
  • On 5e5727c, DXC 1.9.2609 validates both shaders and app-local Agility 1.620.2 / WARP 1.0.22 reads back the expected result in all 50 dispatch cases. All 30 VALU tests pass in that configuration.
  • Strict shader Clippy and staged asset policy pass.

AMD RDNA 2 ISA guide · Coordination claim

AI-assisted with Codex. Synthetic shaders only.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6602345008 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2313). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-25T10:25:42Z. --- The decoder knows `v_cmp_class_f64` and `v_cmpx_class_f64`, but the lowering rejects both. Classify the two binary64 words with the existing class-mask path. The low word counts toward the mantissa, so it distinguishes a subnormal from zero and a signaling NaN from infinity. ABS and NEG act on the high word's sign bit. The regression covers all ten RDNA 2 classes, VGPR and SGPR pairs, literal and inline sources, sign modifiers, and execution masking through `v_cmpx`. The emitted VGPR and SGPR comparison shaders leave the SFI0 INT64 feature bit clear. - `940d32f` rejects both synthetic shaders as unsupported. - On `5e5727c`, DXC 1.9.2609 validates both shaders and app-local Agility 1.620.2 / WARP 1.0.22 reads back the expected result in all 50 dispatch cases. All 30 VALU tests pass in that configuration. - Strict shader Clippy and staged asset policy pass. [AMD RDNA 2 ISA guide](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf) · [Coordination claim](https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7159539736) AI-assisted with Codex. Synthetic shaders only.
upstream-sync closed this pull request 2026-11-25 11:04:48 +00:00
catminou4 commented 2026-11-25 11:04:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T10:53:57Z.

Review: APPROVED


Tested locally: merged into main 940d32f69b, cargo test -p victory-shader --locked on macOS arm64 — 144 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — binary64 class comparisons lowered from their raw bits.

<!-- greyfinch-sync:Marvisak/VIctory:review:6056241366 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2313#pullrequestreview-6056241366). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T10:53:57Z. **Review:** APPROVED --- Tested locally: merged into main 940d32f69b, `cargo test -p victory-shader --locked` on macOS arm64 — 144 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — binary64 class comparisons lowered from their raw bits.
DesertGamer commented 2026-11-25 11:05:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DesertGamer on 2026-11-25T10:25:59Z.


Not a request to change how this issue works, just a note for people who want a running build to try pull requests together, and for authors whose PRs may already be in it.

VIctory V2 is an integration fork: it merges community pull requests, keeps each author in the history, and runs cargo test --workspace plus one run of the title before each push. On our machine it reaches the first cutscene. It is not playable yet and it is not the official project or endorsed by its author. Three tests are red, listed in the issues there.

What would help us:

  • a test report from your GPU: one comment per machine in hardware reports (there is a form);
  • three small tasks labelled help wanted (one, two, three), two of them look like stale tests.

If you want your PR exercised together with others in a running build, tell us its number.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7159687419 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2313#issuecomment-7159687419). Originally posted by [DesertGamer](https://github.com/DesertGamer) on 2026-11-25T10:25:59Z. --- Not a request to change how this issue works, just a note for people who want a running build to try pull requests together, and for authors whose PRs may already be in it. [VIctory V2](https://github.com/DesertGamer/VIctory-V2) is an integration fork: it merges community pull requests, keeps each author in the history, and runs `cargo test --workspace` plus one run of the title before each push. On our machine it reaches the first cutscene. It is not playable yet and it is not the official project or endorsed by its author. Three tests are red, listed in the issues there. What would help us: - a test report from your GPU: one comment per machine in [hardware reports](https://github.com/DesertGamer/VIctory-V2/issues/4) (there is a form); - three small tasks labelled `help wanted` ([one](https://github.com/DesertGamer/VIctory-V2/issues/16), [two](https://github.com/DesertGamer/VIctory-V2/issues/17), [three](https://github.com/DesertGamer/VIctory-V2/issues/18)), two of them look like stale tests. If you want your PR exercised together with others in a running build, tell us its number.
andrewpozdnakov7-jpg commented 2026-11-25 11:05:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T10:37:54Z.


I checked this with the f64 arithmetic and conversions in #1262 at 70fa9b7. Git reported one conflict between test insertions in valu_tests.rs. The lowering merged cleanly, and both sets of tests are present in 7db76c2, with the original commits and authors intact. All 40 VALU tests passed with DXIL validation and app-local WARP, including both class cases and the comparisons and conversions from #1262. Shader Clippy passed. The integration branch is available if either PR lands first and the other needs the test conflict resolved.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7159959317 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2313#issuecomment-7159959317). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-25T10:37:54Z. --- I checked this with the f64 arithmetic and conversions in #1262 at `70fa9b7`. Git reported one conflict between test insertions in `valu_tests.rs`. The lowering merged cleanly, and both sets of tests are present in [`7db76c2`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/7db76c2caf381527ae67b5ac1fe9f345b946c56f), with the original commits and authors intact. All 40 VALU tests passed with DXIL validation and app-local WARP, including both class cases and the comparisons and conversions from #1262. Shader Clippy passed. The integration branch is available if either PR lands first and the other needs the test conflict resolved.
andrewpozdnakov7-jpg commented 2026-11-25 11:05:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T11:01:01Z.


I missed the earlier #1469 when I opened this. It already implements both binary64 class comparisons. I rebased its production and test commits with the original Git author intact and verified both forms on WARP. The separate EXEC-mask test from this PR is available on that rebase. Closing this duplicate in favor of #1469. Rebase and test results

<!-- greyfinch-sync:Marvisak/VIctory:comment:7160474221 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2313#issuecomment-7160474221). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-25T11:01:01Z. --- I missed the earlier #1469 when I opened this. It already implements both binary64 class comparisons. I rebased its production and test commits with the original Git author intact and verified both forms on WARP. The separate EXEC-mask test from this PR is available on that rebase. Closing this duplicate in favor of #1469. [Rebase and test results](https://github.com/Marvisak/VIctory/pull/1469#issuecomment-7160461128)

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!2311
No description provided.