Shader tests: keep the FSPX dot4 test off folded constants #1790

Open
Calvix2k wants to merge 1 commit from upstream-pr/1791 into main
Calvix2k commented 2026-11-24 22:39:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-24T22:39:53Z.


Fixes #1782.

Summary

On RDNA1 the driver's compiler folds a dot4 constant multiplicand with zero-extended bytes, so the FSPX test's literal operands with bytes ≥ 0x80 produced the unsigned dot product on an RX 5700 even though the DXIL asks for the signed opcode.

  • The FSPX test now uses constant operands whose bytes are all below 0x80, where signed and unsigned folding agree.
  • A new dot4_signed_bytes_with_runtime_operands test feeds the original signed values through build_valu_cs's root constants (run-time operands, not literals), so negative-byte signed coverage remains.

No lowering change: the DXIL was already correct.

Validation

  • Both tests pass on a Radeon RX 7800 XT (RDNA3) via the Agility SDK runtime; WARP skipped at SM 6.2.
  • clippy --all-targets --all-features -D warnings and cargo xtask policy (174 files) pass.
  • RDNA1 hardware is not available here; the issue's reproduction on an RX 5700 is the reference for the folded case.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6592841632 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1791). Originally posted by [Calvix2k](https://github.com/Calvix2k) on 2026-11-24T22:39:53Z. --- Fixes #1782. ## Summary On RDNA1 the driver's compiler folds a `dot4` constant multiplicand with zero-extended bytes, so the FSPX test's literal operands with bytes ≥ 0x80 produced the unsigned dot product on an RX 5700 even though the DXIL asks for the signed opcode. - The FSPX test now uses constant operands whose bytes are all below 0x80, where signed and unsigned folding agree. - A new `dot4_signed_bytes_with_runtime_operands` test feeds the original signed values through `build_valu_cs`'s root constants (run-time operands, not literals), so negative-byte signed coverage remains. No lowering change: the DXIL was already correct. ## Validation - Both tests pass on a Radeon RX 7800 XT (RDNA3) via the Agility SDK runtime; WARP skipped at SM 6.2. - clippy `--all-targets --all-features -D warnings` and `cargo xtask policy` (174 files) pass. - RDNA1 hardware is not available here; the issue's reproduction on an RX 5700 is the reference for the folded case.
catminou4 commented 2026-11-24 23:05:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T23:04:17Z.

Review: APPROVED


Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae), cargo test -p victory-shader --locked → 118 passed, 0 failed. GPU execution tests (valu_tests/host) are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests.

FSPX dot4 test kept off folded constants + dot4_signed_bytes_with_runtime_operands: same anti-folding theme as #1790 — complements it.

<!-- greyfinch-sync:Marvisak/VIctory:review:6048810181 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1791#pullrequestreview-6048810181). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T23:04:17Z. **Review:** APPROVED --- Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae), cargo test -p victory-shader --locked → 118 passed, 0 failed. GPU execution tests (valu_tests/host) are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests. FSPX dot4 test kept off folded constants + dot4_signed_bytes_with_runtime_operands: same anti-folding theme as #1790 — complements it.
upipibi commented 2026-11-24 23:05:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-24T22:40:27Z.


Overlap for the reviewers: #1790 (opened a minute earlier) fixes #1782 in the same test, fspx_programs_run_with_the_hardwares_dot_products in valu_tests.rs, the other way round. It loads a, b and the accumulator through v_add_nc_u32 … v4 from a buffer, so every case, the signed high-byte ones included, reaches the driver at run time. This PR keeps literals but limits them to bytes below 0x80, and adds a separate run-time test for the signed values. Both edit the same function, so only one can merge as is. From reading the two diffs' descriptions and file lists; nothing built.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7146510090 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1791#issuecomment-7146510090). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-24T22:40:27Z. --- Overlap for the reviewers: #1790 (opened a minute earlier) fixes #1782 in the same test, `fspx_programs_run_with_the_hardwares_dot_products` in `valu_tests.rs`, the other way round. It loads `a`, `b` and the accumulator through `v_add_nc_u32 … v4` from a buffer, so every case, the signed high-byte ones included, reaches the driver at run time. This PR keeps literals but limits them to bytes below 0x80, and adds a separate run-time test for the signed values. Both edit the same function, so only one can merge as is. From reading the two diffs' descriptions and file lists; nothing built. AI-assisted (Claude Code).
Marvisak commented 2026-11-25 07:03:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T06:22:36Z.


Automated triage for the maintainers.

Proposed close: duplicate of #1790. The head is the same as at the earlier note. Both PRs fix #1782 in fspx_programs_run_with_the_hardwares_dot_products (crates/victory-shader/src/emit/valu_tests.rs). #1790 makes the FSPX test's operands run-time values, so the FSPX path keeps its negative-byte coverage. This PR moves the literals below 0x80 and checks negative bytes only in a separate non-FSPX test. #1790 is still open and merges cleanly. This PR also still adds a stray second blank line after the use block.

On your reply: thanks for the RX 7800 XT run. It shows the tests pass on RDNA3, but it doesn't change the overlap with #1790, and RDNA3 is not the RDNA1 case from #1782. If the maintainer prefers this approach, removing the label keeps it open.

CI: check passing.

The PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7154726632 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1791#issuecomment-7154726632). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T06:22:36Z. --- <!-- victory-triage v1 head=8ec8be9d40eb3bc0db2cc92998b755b13c442e95 verdict=proposed-close at=2026-11-25T11:21:15Z --> Automated triage for the maintainers. **Proposed close: duplicate of #1790.** The head is the same as at the earlier note. Both PRs fix #1782 in `fspx_programs_run_with_the_hardwares_dot_products` (`crates/victory-shader/src/emit/valu_tests.rs`). #1790 makes the FSPX test's operands run-time values, so the FSPX path keeps its negative-byte coverage. This PR moves the literals below 0x80 and checks negative bytes only in a separate non-FSPX test. #1790 is still open and merges cleanly. This PR also still adds a stray second blank line after the `use` block. On your reply: thanks for the RX 7800 XT run. It shows the tests pass on RDNA3, but it doesn't change the overlap with #1790, and RDNA3 is not the RDNA1 case from #1782. If the maintainer prefers this approach, removing the label keeps it open. CI: `check` passing. The PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label. --- _Generated by [Claude Code](https://claude.ai/code)_
Calvix2k commented 2026-11-25 11:05:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-25T10:16:02Z.


Hardware run on an RX 7800 XT (RDNA3), Windows 10 19045, SM 6.6 via the Agility runtime for the test binaries (#486): victory-shader lib suite 248 passed, 0 failed, 3 ignored, including the FSPX dot4 test this PR changes. The runtime-fed operands are exercised on the card here.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7159460327 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1791#issuecomment-7159460327). Originally posted by [Calvix2k](https://github.com/Calvix2k) on 2026-11-25T10:16:02Z. --- Hardware run on an **RX 7800 XT (RDNA3), Windows 10 19045**, SM 6.6 via the Agility runtime for the test binaries (#486): `victory-shader` lib suite **248 passed, 0 failed, 3 ignored**, including the FSPX dot4 test this PR changes. The runtime-fed operands are exercised on the card here.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1791:upstream-pr/1791'
git switch 'upstream-pr/1791'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1791'
git switch 'upstream-pr/1791'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1791'
git switch 'upstream-pr/1791'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1791'
git switch 'main'
git merge --squash 'upstream-pr/1791'
git switch 'main'
git merge --ff-only 'upstream-pr/1791'
git switch 'main'
git merge 'upstream-pr/1791'
git push origin 'main'
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!1790
No description provided.