Shaders: 16-bit compares read the low halves whatever op_sel says, as RDNA2 does #926

Open
BastienRodz wants to merge 3 commits from upstream-pr/926 into main
BastienRodz commented 2026-11-24 14:17:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T14:17:13Z.


What's wrong

On RDNA2 the VOP3 op_sel bits are ignored by the 16-bit compares (v_cmp_* and v_cmpx_* on f16, u16, i16): both sources come from the low 16 bits. #833 measured it on gfx1036 (146 rows, every source kind, wave32 and wave64), with v_add_nc_u16 as the control that does honour the bits. half_src honours op_sel for every 16-bit operation:

let mut high = v.opsel >> k & 1 != 0;

So v_cmp_lt_f16_e64 vcc, v0, v1 op_sel:[1,0] with v0 = 0x4000_3C00 and v1 = 0x3C00_3E00 compares high(v0) 2.0 < low(v1) 1.5 and gives false, where the hardware compares 1.0 < 1.5 and gives true.

What the fix does

half_src, which half_fsrc also goes through, ignores op_sel when the instruction is a v_cmp* other than v_cmp_class* (whose behaviour was not measured, so it stays as it was). The SDWA select below it, which does pick the half on hardware, is unchanged, and so is every non-compare 16-bit operation.

How it behaves after the fix

16-bit compares read the low halves whatever op_sel says, as RDNA2 does. Nothing changes for Grand Theft Auto VI: #833 counted 166 VOP3 16-bit compares in its shaders, none with op_sel set.

Tests

cmp16_ignores_op_sel_as_rdna2_does (valu_tests.rs, run on the host GPU and WARP):

  • v_cmp_lt_f16, v_cmp_lt_u16 and v_cmp_lt_i16, each with op_sel 0b01, 0b10 and 0b11, on values where the high and low halves give opposite answers;
  • v_cmpx_lt_f16_e64 writing EXEC;
  • a control: v_add_nc_u16 with op_sel:[1,0] still adds the high half.

cmp16_sdwa_preserves_word_selects (by @MichaelSmithAI, BastienRodz/VIctory#5): v_cmp_lt_{f16,i16,u16}_sdwa still honour the SDWA word selects, low/low and either high word.

On GitHub's windows-latest, Rust 1.98.1, with the upstream CI's commands (clippy -D warnings with and without --all-features, cargo test --workspace --locked -- --test-threads=1):

cargo xtask policy: ok. Synthetic programs only; no game data.

Not tested: v_cmp_class_* with op_sel (left as it was); a title that sets op_sel on a 16-bit compare.

AI-assisted: implemented with Gemini 4 Neon, reviewed and run with Claude Code.

Fixes #833.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:5473877046 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/926). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T14:17:13Z. --- ## What's wrong On RDNA2 the VOP3 `op_sel` bits are ignored by the 16-bit compares (`v_cmp_*` and `v_cmpx_*` on `f16`, `u16`, `i16`): both sources come from the low 16 bits. #833 measured it on gfx1036 (146 rows, every source kind, wave32 and wave64), with `v_add_nc_u16` as the control that does honour the bits. `half_src` honours `op_sel` for every 16-bit operation: ```rust let mut high = v.opsel >> k & 1 != 0; ``` So `v_cmp_lt_f16_e64 vcc, v0, v1 op_sel:[1,0]` with v0 = `0x4000_3C00` and v1 = `0x3C00_3E00` compares high(v0) 2.0 < low(v1) 1.5 and gives false, where the hardware compares 1.0 < 1.5 and gives true. ## What the fix does `half_src`, which `half_fsrc` also goes through, ignores `op_sel` when the instruction is a `v_cmp*` other than `v_cmp_class*` (whose behaviour was not measured, so it stays as it was). The SDWA select below it, which does pick the half on hardware, is unchanged, and so is every non-compare 16-bit operation. ## How it behaves after the fix 16-bit compares read the low halves whatever `op_sel` says, as RDNA2 does. Nothing changes for Grand Theft Auto VI: #833 counted 166 VOP3 16-bit compares in its shaders, none with `op_sel` set. ## Tests `cmp16_ignores_op_sel_as_rdna2_does` (`valu_tests.rs`, run on the host GPU and WARP): - `v_cmp_lt_f16`, `v_cmp_lt_u16` and `v_cmp_lt_i16`, each with `op_sel` `0b01`, `0b10` and `0b11`, on values where the high and low halves give opposite answers; - `v_cmpx_lt_f16_e64` writing EXEC; - a control: `v_add_nc_u16` with `op_sel:[1,0]` still adds the high half. `cmp16_sdwa_preserves_word_selects` (by @MichaelSmithAI, BastienRodz/VIctory#5): `v_cmp_lt_{f16,i16,u16}_sdwa` still honour the SDWA word selects, low/low and either high word. On GitHub's `windows-latest`, Rust 1.98.1, with the upstream CI's commands (clippy `-D warnings` with and without `--all-features`, `cargo test --workspace --locked -- --test-threads=1`): - **This change:** everything passes; `victory-shader` 121 passed, 0 failed (https://github.com/BastienRodz/VIctory/actions/runs/45389398916). - **With the SDWA test added (head `e477c4b`'s parent):** everything passes; `victory-shader` 122 passed, 0 failed (https://github.com/BastienRodz/VIctory/actions/runs/45414030202). - **The new test alone on `main`:** it fails at the first case, `hardware: v_cmp_lt_f16 opsel=0b1 (0x40003c00, 0x3c003e00) = 0, want 1` (https://github.com/BastienRodz/VIctory/actions/runs/45389413162). `cargo xtask policy`: ok. Synthetic programs only; no game data. **Not tested:** `v_cmp_class_*` with `op_sel` (left as it was); a title that sets `op_sel` on a 16-bit compare. AI-assisted: implemented with Gemini 4 Neon, reviewed and run with Claude Code. Fixes #833. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DenRakEiw commented 2026-11-24 14:21:21 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T14:21:21Z.

Review: APPROVED


Tested head a8aa1d1 (fast-forward on main ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC) with NVIDIA GeForce RTX 5090 (Blackwell) and WARP:

  • cargo test -p victory-shader valu_tests: 14 passed, 0 failed (including cmp16_ignores_op_sel_as_rdna2_does on both RTX 5090 and WARP)
  • cargo clippy -p victory-shader --all-targets: 0 warnings
  • cargo xtask policy: ok

Clean, focused fix matching RDNA2 16-bit compare op_sel semantics. Approving.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6040909863 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/926#pullrequestreview-6040909863). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-24T14:21:21Z. **Review:** APPROVED --- Tested head `a8aa1d1` (fast-forward on `main` `ffe310e`) on Windows 11 x64 (Rust 1.98.1 MSVC) with **NVIDIA GeForce RTX 5090** (Blackwell) and **WARP**: - `cargo test -p victory-shader valu_tests`: **14 passed, 0 failed** (including `cmp16_ignores_op_sel_as_rdna2_does` on both RTX 5090 and WARP) - `cargo clippy -p victory-shader --all-targets`: **0 warnings** - `cargo xtask policy`: ok Clean, focused fix matching RDNA2 16-bit compare `op_sel` semantics. Approving. AI-assisted (Gemini 4 Neon).
mercuryVM commented 2026-11-24 14:32:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T14:32:02Z.

Review: APPROVED


Tested e477c4b on Windows 11, RTX 5070, MSVC: cargo test -p victory-shader -- --test-threads=1 122 passed, including cmp16_ignores_op_sel_as_rdna2_does on the GPU backend, and cargo clippy -p victory-shader --all-targets is clean.

  • Ignoring op_sel only for v_cmp* (and v_cmpx*), not v_cmp_class, follows exactly what #833 measured, and the v_add_nc_u16 control keeps honouring it. The test's cases are built so that reading either high half flips the result, so a regression back to honouring op_sel fails it.
  • v_cmp_class is left as before ("not measured"). Worth a follow-up row in #833's harness so the exception is measured rather than assumed.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6041123397 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/926#pullrequestreview-6041123397). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T14:32:02Z. **Review:** APPROVED --- Tested e477c4b on Windows 11, RTX 5070, MSVC: `cargo test -p victory-shader -- --test-threads=1` 122 passed, including `cmp16_ignores_op_sel_as_rdna2_does` on the GPU backend, and `cargo clippy -p victory-shader --all-targets` is clean. - Ignoring `op_sel` only for `v_cmp*` (and `v_cmpx*`), not `v_cmp_class`, follows exactly what #833 measured, and the `v_add_nc_u16` control keeps honouring it. The test's cases are built so that reading either high half flips the result, so a regression back to honouring `op_sel` fails it. - `v_cmp_class` is left as before ("not measured"). Worth a follow-up row in #833's harness so the exception is measured rather than assumed. AI-assisted (Claude Code).
pickles976 commented 2026-11-24 15:03:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pickles976 on 2026-11-24T14:22:10Z.


Same divergence confirmed on the sibling runtime (ivall/xcl) — our VOPC emitter selects the compared half with m.opsel for all 16-bit types (vopc's half closure: m.opsel >> i & 1, f16/u16/i16 alike; v_cmp_class too, which you deliberately left alone). Console-exact is your measured behavior (Series = gfx103x), so ours is the wrong side; it is dormant for this title by your own corpus number — 166 16-bit VOPC compares, none with op_sel set — which is exactly why we never tripped it. Filing it over here with your #833 measurement as the reference so nobody has to re-derive the quirk; thanks for the v_add_nc_u16 control, that is what makes the 146-row result airtight.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7134261430 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/926#issuecomment-7134261430). Originally posted by [pickles976](https://github.com/pickles976) on 2026-11-24T14:22:10Z. --- Same divergence confirmed on the sibling runtime (ivall/xcl) — our VOPC emitter selects the compared half with `m.opsel` for **all** 16-bit types (`vopc`'s `half` closure: `m.opsel >> i & 1`, f16/u16/i16 alike; `v_cmp_class` too, which you deliberately left alone). Console-exact is your measured behavior (Series = gfx103x), so ours is the wrong side; it is **dormant for this title** by your own corpus number — 166 16-bit VOPC compares, none with `op_sel` set — which is exactly why we never tripped it. Filing it over here with your #833 measurement as the reference so nobody has to re-derive the quirk; thanks for the `v_add_nc_u16` control, that is what makes the 146-row result airtight.
MichaelSmithAI commented 2026-11-24 15:04:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by MichaelSmithAI on 2026-11-24T14:23:24Z.


Independent RTX 4090 Wine/vkd3d-proton 3.2 result: the authored VOP3/EXEC test passed on a8aa1d1. A separate nine-case readback confirmed that SDWA compares still honor source-word selection for f16, i16 and u16 on both ffe310e and a8aa1d1. Low/low compared true while choosing either high word compared false. The test-only follow-up adds that neighboring behavior to the regression suite. The class-compare run checks existing translator behavior only. RDNA2 class-compare op_sel remains unmeasured.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7134294224 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/926#issuecomment-7134294224). Originally posted by [MichaelSmithAI](https://github.com/MichaelSmithAI) on 2026-11-24T14:23:24Z. --- Independent RTX 4090 Wine/vkd3d-proton 3.2 result: the authored VOP3/EXEC test passed on a8aa1d1. A separate nine-case readback confirmed that SDWA compares still honor source-word selection for f16, i16 and u16 on both ffe310e and a8aa1d1. Low/low compared true while choosing either high word compared false. The [test-only follow-up](https://github.com/BastienRodz/VIctory/pull/5) adds that neighboring behavior to the regression suite. The class-compare run checks existing translator behavior only. RDNA2 class-compare op_sel remains unmeasured.
shortselow-byte commented 2026-11-24 15:04:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by shortselow-byte on 2026-11-24T14:27:10Z.


Tested at head a8aa1d1 on an AMD host, to add a third backend to the NVIDIA + WARP run above: Windows 11, Rust 1.98.1 MSVC, AMD Radeon RX 6900 XT (RDNA2, driver 32.0.21045.16010).

  • cargo test --locked -p victory-shader cmp16_ignores_op_sel: passed on the AMD device and WARP (neither skipped).
  • cargo test --locked -p victory-shader valu_tests: 14 passed, 0 failed.
  • cargo clippy --workspace --all-targets --locked -- -D warnings, and with --all-features: clean.
  • With the half_src change reverted, the new test fails on the AMD device as it should: hardware: v_cmp_lt_f16 opsel=0b1 (0x40003c00, 0x3c003e00) = 0, want 1.

This checks our translation on AMD's driver, not the console's raw op_sel behaviour, which rests on #833's measurement.

Nit: half_src's doc comment still says op_sel picks the high half; it could mention that 16-bit compares (other than v_cmp_class) ignore it.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7134398025 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/926#issuecomment-7134398025). Originally posted by [shortselow-byte](https://github.com/shortselow-byte) on 2026-11-24T14:27:10Z. --- Tested at head `a8aa1d1` on an AMD host, to add a third backend to the NVIDIA + WARP run above: Windows 11, Rust 1.98.1 MSVC, **AMD Radeon RX 6900 XT** (RDNA2, driver 32.0.21045.16010). - `cargo test --locked -p victory-shader cmp16_ignores_op_sel`: passed on the AMD device and WARP (neither skipped). - `cargo test --locked -p victory-shader valu_tests`: 14 passed, 0 failed. - `cargo clippy --workspace --all-targets --locked -- -D warnings`, and with `--all-features`: clean. - With the `half_src` change reverted, the new test fails on the AMD device as it should: `hardware: v_cmp_lt_f16 opsel=0b1 (0x40003c00, 0x3c003e00) = 0, want 1`. This checks our translation on AMD's driver, not the console's raw `op_sel` behaviour, which rests on #833's measurement. Nit: `half_src`'s doc comment still says op_sel picks the high half; it could mention that 16-bit compares (other than `v_cmp_class`) ignore it.
BastienRodz commented 2026-11-24 15:04:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T14:28:44Z.


Thanks all. Pulled in @MichaelSmithAI's SDWA test (f459735, windows-latest: victory-shader 122 passed, https://github.com/BastienRodz/VIctory/actions/runs/45414030202) and fixed the half_src doc comment @shortselow-byte pointed out (e477c4b, comment only).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7134440419 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/926#issuecomment-7134440419). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T14:28:44Z. --- Thanks all. Pulled in @MichaelSmithAI's SDWA test (`f459735`, windows-latest: `victory-shader` 122 passed, https://github.com/BastienRodz/VIctory/actions/runs/45414030202) and fixed the `half_src` doc comment @shortselow-byte pointed out (`e477c4b`, comment only).
Zipettte commented 2026-11-24 16:05:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T15:41:00Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at e477c4b: cargo test -p victory-shader passes, 122 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7136436638 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/926#issuecomment-7136436638). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T15:41:00Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at e477c4b: `cargo test -p victory-shader` passes, 122 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
BastienRodz commented 2026-11-24 22:02:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T21:50:07Z.


Rebased onto main 70564ae; the only conflicts were test blocks added on both sides at the end of the file. On windows-latest the run is red, but only on emit::synthetic_tests::gathers_at_a_level_match_the_hardware and permutes_read_the_lane_named_and_zero_from_lanes_left_out. main alone fails those two the same way, in its own CI (https://github.com/Marvisak/VIctory/actions/runs/45492970391) and on our fork (https://github.com/BastienRodz/VIctory/actions/runs/45494314536): the runner's adapter is a software one. This PR's own tests pass there. A fix for those two tests is on its way as a separate PR.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7145450649 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/926#issuecomment-7145450649). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T21:50:07Z. --- Rebased onto `main` `70564ae`; the only conflicts were test blocks added on both sides at the end of the file. On `windows-latest` the run is red, but only on `emit::synthetic_tests::gathers_at_a_level_match_the_hardware` and `permutes_read_the_lane_named_and_zero_from_lanes_left_out`. `main` alone fails those two the same way, in its own CI (https://github.com/Marvisak/VIctory/actions/runs/45492970391) and on our fork (https://github.com/BastienRodz/VIctory/actions/runs/45494314536): the runner's adapter is a software one. This PR's own tests pass there. A fix for those two tests is on its way as a separate PR.
BastienRodz commented 2026-11-24 22:02:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T21:59:19Z.


The fix for those two main tests is #1752 (windows-latest green with it).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7145652617 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/926#issuecomment-7145652617). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T21:59:19Z. --- The fix for those two `main` tests is #1752 (`windows-latest` green with it).
BastienRodz commented 2026-11-25 01:08:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-25T00:56:43Z.


Still red on the same two victory-shader tests: main's own CI after 42363ab fails them too. The runner's Basic Render Driver doesn't set the software flag that commit checks. #1919 adds its vendor/device ids, and windows-latest is green with it. This PR's crate passes.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149049592 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/926#issuecomment-7149049592). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-25T00:56:43Z. --- Still red on the same two `victory-shader` tests: `main`'s own CI after `42363ab` fails them too. The runner's Basic Render Driver doesn't set the software flag that commit checks. #1919 adds its vendor/device ids, and `windows-latest` is green with it. This PR's crate passes.
Marvisak commented 2026-11-25 03:03:33 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T02:32:43Z.


Automated triage for the maintainers.

Merge candidate (a recommendation to look, not an approval). The new push only rewords the doc comment on half_src (crates/victory-shader/src/emit/lower.rs) to say that 16-bit compares other than v_cmp_class ignore op_sel; the code is unchanged from the earlier review. half_src clears op_sel for v_cmp*/v_cmpx* except the class compares, while the SDWA word select below it still picks the half, which matches the gfx1036 measurement in #833 (with v_add_nc_u16 as the control). The tests in valu_tests.rs take their expected values from that hardware behaviour and include the SDWA and v_add_nc_u16 controls.

The branch merges cleanly. CI: check passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7150860084 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/926#issuecomment-7150860084). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T02:32:43Z. --- <!-- victory-triage v1 head=d69cac127e53150c27dc86966a7557d3d2d7b3aa verdict=merge-candidate at=2026-11-26T01:23:23Z --> Automated triage for the maintainers. **Merge candidate** (a recommendation to look, not an approval). The new push only rewords the doc comment on `half_src` (`crates/victory-shader/src/emit/lower.rs`) to say that 16-bit compares other than `v_cmp_class` ignore op_sel; the code is unchanged from the earlier review. `half_src` clears op_sel for `v_cmp*`/`v_cmpx*` except the class compares, while the SDWA word select below it still picks the half, which matches the gfx1036 measurement in #833 (with `v_add_nc_u16` as the control). The tests in `valu_tests.rs` take their expected values from that hardware behaviour and include the SDWA and `v_add_nc_u16` controls. The branch merges cleanly. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
catminou4 commented 2026-11-25 04:04:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T04:04:20Z.

Review: APPROVED


Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, cargo test -p victory-shader --locked.

144 passed / 0 failed / 2 ignored. 16-bit compares read the low halves whatever op_sel says — hardware-accurate compare semantics; oldest PR in the backlog (opened early), still mergeable.

<!-- greyfinch-sync:Marvisak/VIctory:review:6051697894 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/926#pullrequestreview-6051697894). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T04:04:20Z. **Review:** APPROVED --- Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, `cargo test -p victory-shader --locked`. 144 passed / 0 failed / 2 ignored. 16-bit compares read the low halves whatever op_sel says — hardware-accurate compare semantics; oldest PR in the backlog (opened early), still mergeable.
fuzeofficlal commented 2026-11-26 02:07:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T01:27:07Z.


Code review and RTX 5090 + WARP + DXIL verification at head d69cac127e53 merged cleanly onto main (63bcca43c6a0; emit/lower.rs = 520,843 B, 3,445 B under the 512 KiB cap):

  • Code review (crates/victory-shader/src/emit/lower.rs:6806-6822):
    • let compare = name.starts_with("v_cmp") && !name.contains("class"); let mut high = !compare && v.opsel >> k & 1 != 0; covers all 16-bit v_cmp_* and v_cmpx_* (f16/u16/i16) comparisons while explicitly exempting v_cmp_class_f16, preserving v.opsel for 16-bit ALU/conversion ops, and keeping v.sdwa WORD_0/WORD_1 selection intact afterwards.
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, dxil.dll 10.0.26100.0, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy (default + --all-features): 0 warnings
    • cmp16 emit::tests emit::lower::tests: 52/52 passed on both RTX 5090 and WARP (including cmp16_ignores_op_sel_as_rdna2_does and cmp16_sdwa_preserves_word_selects).

LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179785490 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/926#issuecomment-7179785490). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T01:27:07Z. --- Code review and RTX 5090 + WARP + DXIL verification at head `d69cac127e53` merged cleanly onto `main` (`63bcca43c6a0`; `emit/lower.rs` = `520,843` B, `3,445` B under the 512 KiB cap): - **Code review (`crates/victory-shader/src/emit/lower.rs:6806-6822`)**: - `let compare = name.starts_with("v_cmp") && !name.contains("class"); let mut high = !compare && v.opsel >> k & 1 != 0;` covers all 16-bit `v_cmp_*` and `v_cmpx_*` (`f16`/`u16`/`i16`) comparisons while explicitly exempting `v_cmp_class_f16`, preserving `v.opsel` for 16-bit ALU/conversion ops, and keeping `v.sdwa` `WORD_0`/`WORD_1` selection intact afterwards. - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `dxil.dll` 10.0.26100.0, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy` (default + `--all-features`): 0 warnings - `cmp16 emit::tests emit::lower::tests`: **52/52 passed** on both RTX 5090 and WARP (including `cmp16_ignores_op_sel_as_rdna2_does` and `cmp16_sdwa_preserves_word_selects`). LGTM.
andrewpozdnakov7-jpg commented 2026-11-27 12:25:01 +00:00 (Migrated from github.com)

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


I combined exact #926 d69cac1 and #3364 55d58e0 on main 63bcca4. The integration branch is e002024. It preserves both PR heads and keeps both sets of tests. The conflict is resolved in half_opsel: ordinary 16-bit compares and the VOP3 encodings of the VOP1/VOP2 operations ignore op_sel, with the existing SDWA selector still applied afterward.

With the same fixtures on main, the compare test and the VOP1/VOP2 test fail. The full VALU group is 36 passed / 2 failed on main and 38 / 0 on the integration, on WARP 1.0.22 with DXIL validation. The SDWA word-select control passes on both, and the VOP3-only arithmetic controls pass on the integration. Strict all-features/all-targets shader Clippy and the asset policy passed.

The branch is available for retesting or for resolving the overlap when either PR lands. If folding the resolution into a commit, please retain Git attribution or use Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

AI-assisted with Codex. Synthetic WARP testing only.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7218217528 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/926#issuecomment-7218217528). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-27T12:25:01Z. --- I combined exact #926 `d69cac1` and #3364 `55d58e0` on main `63bcca4`. The [integration branch](https://github.com/andrewpozdnakov7-jpg/VIctory/tree/review/cmp16-opsel-composition) is `e002024`. It preserves both PR heads and keeps both sets of tests. The conflict is resolved in `half_opsel`: ordinary 16-bit compares and the VOP3 encodings of the VOP1/VOP2 operations ignore `op_sel`, with the existing SDWA selector still applied afterward. With the same fixtures on main, the compare test and the VOP1/VOP2 test fail. The full VALU group is 36 passed / 2 failed on main and 38 / 0 on the integration, on WARP 1.0.22 with DXIL validation. The SDWA word-select control passes on both, and the VOP3-only arithmetic controls pass on the integration. Strict all-features/all-targets shader Clippy and the asset policy passed. The branch is available for retesting or for resolving the overlap when either PR lands. If folding the resolution into a commit, please retain Git attribution or use `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`. AI-assisted with Codex. Synthetic WARP testing only.
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/926:upstream-pr/926'
git switch 'upstream-pr/926'

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