Shaders: lower ds_min_f32 / ds_max_f32 (and _rtn) with RDNA2's NaN rules #628

Open
mercuryVM wants to merge 7 commits from upstream-pr/628 into main
mercuryVM commented 2026-11-24 05:54:45 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T05:54:45Z.


What

ds_min_f32, ds_max_f32, ds_min_rtn_f32 and ds_max_rtn_f32 were refused (an LDS operation), so any compute or mesh program that used one failed to translate. DXIL has no float atomics on groupshared memory, so each now lowers to a compare-exchange loop. The loop reads the dword, computes what RDNA2 would write, and retries cmpxchg until no other lane changed the dword in between.

What RDNA2 writes follows @Lyrnc's measurement on gfx1036, all pairs of 17 values in four modes, reported in a comment below:

  • An sNaN, data first, then memory, is written back quieted.
  • Otherwise a NaN loses to a number, whichever side it is on. Two quiet NaNs give the data.
  • Numbers compare as floats with -0 below +0. The order is computed on integers: the bits of negative floats get their magnitude reversed.
  • The _rtn forms return the dword's value from before.

The first commit used a pair of integer atomics (signed max plus unsigned min). The numbers come out the same, but that cannot express NaNs already in memory. The second commit replaces it with the loop after the measurement.

Known gap, marked shortcut: in the code: f32 denormals compare as kept. With the console's MODE flushing them, they would order as ±0 first, and the translator does not model MODE.

Helpers Lower::lds_float_min_max (the loop) and Lower::lds_float_pick (the choice) are in crates/victory-shader/src/emit/lower.rs. In valu_tests.rs, the test builder now takes a thread count and an LDS size (build_cs; build_valu_cs calls it unchanged), and run_cases_on picks the devices.

Effect on the title: none

Measured by @Parakeet-Wheat on the retail 1.0.2.1 shaders, in a comment below: the title contains 0 ds_{min,max}{,_rtn}_f32; its LDS minimum and maximum are all integer (ds_max_u32, ds_min_u32, ds_max_i32). victory translate --list --validate gives the same outcome on main and on this PR: 21,736 validated, 4,003 failed, 162 rejected. So this PR only completes the instruction set. It doesn't unblock anything in the game, and it can wait behind work that does.

Overlap

I searched open and closed PRs: #164 adds the integer LDS atomics with cmpst. No PR handles the float forms; #163 lists them as refused.

Tested

Windows 11, NVIDIA RTX 5070, AMD CPU. No game data.

  • ds_min_max_f32_order_floats_and_return_the_old_value: a one-thread program, for every pair from 19 values (±0, ±1, ±2.5, ±1e-30, ±denormal, ±inf, ±MAX, plus quiet and signalling NaNs of both signs) in memory and as data, for both ops. It checks the dword afterwards (read back with ds_read_b32) and the old value returned by _rtn, against a reference that follows the measured model. Hardware only: a one-wave program with LDS declares WaveSize(32) (existing behaviour), and WARP's pipeline creation refuses it.
  • ds_min_max_f32_are_atomic_across_waves: 64 threads each apply (thread - 32) as a float to one dword after a barrier. Checks max from -inf (31), max from 100 (100), min from +inf (-32) and min from -0 (-32). Runs on hardware and WARP.
  • Mutation check: dropping the "a NaN in memory loses to a number" rule fails the first test on hardware (ds_max_f32 on NaN [0x7fc00000] with 0 gave 0x7fc00000, want 0).
  • cargo test --workspace: all passed (victory-shader 71 passed). rustfmt --edition 2024 --check on both files: clean. cargo clippy -p victory-shader --all-targets: no warnings. cargo xtask policy: 151 files ok.

Not tested

  • The title was not run, and I have no shader package, so I can't say how many of the title's programs use these instructions. None of the 12 programs embedded in the executable does.
  • No console hardware. The NaN rules come from @Lyrnc's RDNA2 desktop measurement (gfx1036), not the console's silicon. Only the f32 denormals-kept mode is modelled.
  • No 64-lane (AMD) host GPU.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6575617288 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/628). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T05:54:45Z. --- ## What `ds_min_f32`, `ds_max_f32`, `ds_min_rtn_f32` and `ds_max_rtn_f32` were refused (`an LDS operation`), so any compute or mesh program that used one failed to translate. DXIL has no float atomics on groupshared memory, so each now lowers to a **compare-exchange loop**. The loop reads the dword, computes what RDNA2 would write, and retries `cmpxchg` until no other lane changed the dword in between. What RDNA2 writes follows @Lyrnc's measurement on gfx1036, all pairs of 17 values in four modes, reported in a comment below: - An sNaN, data first, then memory, is written back quieted. - Otherwise a NaN loses to a number, whichever side it is on. Two quiet NaNs give the data. - Numbers compare as floats with -0 below +0. The order is computed on integers: the bits of negative floats get their magnitude reversed. - The `_rtn` forms return the dword's value from before. The first commit used a pair of integer atomics (signed max plus unsigned min). The numbers come out the same, but that cannot express NaNs already in memory. The second commit replaces it with the loop after the measurement. Known gap, marked `shortcut:` in the code: f32 denormals compare as kept. With the console's MODE flushing them, they would order as ±0 first, and the translator does not model MODE. Helpers `Lower::lds_float_min_max` (the loop) and `Lower::lds_float_pick` (the choice) are in `crates/victory-shader/src/emit/lower.rs`. In `valu_tests.rs`, the test builder now takes a thread count and an LDS size (`build_cs`; `build_valu_cs` calls it unchanged), and `run_cases_on` picks the devices. ## Effect on the title: none Measured by @Parakeet-Wheat on the retail 1.0.2.1 shaders, in a comment below: the title contains 0 `ds_{min,max}{,_rtn}_f32`; its LDS minimum and maximum are all integer (`ds_max_u32`, `ds_min_u32`, `ds_max_i32`). `victory translate --list --validate` gives the same outcome on `main` and on this PR: 21,736 validated, 4,003 failed, 162 rejected. So this PR only completes the instruction set. It doesn't unblock anything in the game, and it can wait behind work that does. ## Overlap I searched open and closed PRs: #164 adds the integer LDS atomics with `cmpst`. No PR handles the float forms; #163 lists them as refused. ## Tested Windows 11, NVIDIA RTX 5070, AMD CPU. No game data. - `ds_min_max_f32_order_floats_and_return_the_old_value`: a one-thread program, for every pair from 19 values (±0, ±1, ±2.5, ±1e-30, ±denormal, ±inf, ±MAX, plus quiet and signalling NaNs of both signs) in memory and as data, for both ops. It checks the dword afterwards (read back with `ds_read_b32`) and the old value returned by `_rtn`, against a reference that follows the measured model. Hardware only: a one-wave program with LDS declares `WaveSize(32)` (existing behaviour), and WARP's pipeline creation refuses it. - `ds_min_max_f32_are_atomic_across_waves`: 64 threads each apply `(thread - 32)` as a float to one dword after a barrier. Checks max from -inf (31), max from 100 (100), min from +inf (-32) and min from -0 (-32). Runs on hardware and WARP. - Mutation check: dropping the "a NaN in memory loses to a number" rule fails the first test on hardware (`ds_max_f32 on NaN [0x7fc00000] with 0 gave 0x7fc00000, want 0`). - `cargo test --workspace`: all passed (victory-shader 71 passed). `rustfmt --edition 2024 --check` on both files: clean. `cargo clippy -p victory-shader --all-targets`: no warnings. `cargo xtask policy`: 151 files ok. ## Not tested - The title was not run, and I have no shader package, so I can't say how many of the title's programs use these instructions. None of the 12 programs embedded in the executable does. - No console hardware. The NaN rules come from @Lyrnc's RDNA2 desktop measurement (gfx1036), not the console's silicon. Only the f32 denormals-kept mode is modelled. - No 64-lane (AMD) host GPU. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
LAKSHYA-cmd-tech commented 2026-11-24 06:54:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T05:58:03Z.

Review: APPROVED


Tested on Windows 11 with Rust 1.98.1 (x86_64-pc-windows-msvc).

  • cargo test -p victory-shader: all 71 tests passed (0 failed). Both new hardware and cross-wave atomic tests (ds_min_max_f32_order_floats_and_return_the_old_value and ds_min_max_f32_are_atomic_across_waves) succeeded cleanly.
  • cargo xtask policy: 151 files ok.
  • Verified integer atomic bit-representation transformation logic for float LDS min/max in emit/lower.rs.
<!-- greyfinch-sync:Marvisak/VIctory:review:6034400128 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/628#pullrequestreview-6034400128). Originally posted by [LAKSHYA-cmd-tech](https://github.com/LAKSHYA-cmd-tech) on 2026-11-24T05:58:03Z. **Review:** APPROVED --- Tested on Windows 11 with Rust 1.98.1 (x86_64-pc-windows-msvc). - cargo test -p victory-shader: all 71 tests passed (0 failed). Both new hardware and cross-wave atomic tests (ds_min_max_f32_order_floats_and_return_the_old_value and ds_min_max_f32_are_atomic_across_waves) succeeded cleanly. - cargo xtask policy: 151 files ok. - Verified integer atomic bit-representation transformation logic for float LDS min/max in emit/lower.rs.
Lyrnc commented 2026-11-24 06:56:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Lyrnc on 2026-11-24T06:06:52Z.


RDNA2 hardware measurement of ds_min_f32 / ds_max_f32: the ordering of numbers, ±0 included, matches this PR. The NaN rules differ, and the hardware's rule is simpler than the gap marked shortcut: here.

Setup. AMD Radeon iGPU of a Ryzen 7 9800X3D, gfx1036 (RDNA2), AMD driver 32.0.21042.62, Windows 11 Pro 26200. In a HIP kernel (assembled by the AMD driver's amd_comgr), each lane writes a "memory" value to its own LDS dword, runs ds_{min,max}{,_rtn}_f32 with a "data" value, and reads the dword back. All 289 pairs of 17 values: ±0, ±1, ±2.5, ±smallest denormal, ±inf, ±max, ±qNaN, and three sNaNs. Each pair ran under IEEE mode on/off × f32 denormals flushed/kept. RDNA2 desktop silicon, not the console's. No game data.

This model fits 289/289 in all four modes, for min and max, with and without _rtn:

  1. Denormals follow the f32 denormal mode (flushed to ±0 first when the mode flushes). IEEE mode makes no difference.
  2. An sNaN, data first, then memory, is written back quieted: data 0x7f800001 gives 0x7fc00001.
  3. Otherwise a NaN loses to a number, whichever side it is on: data 0 with memory 0x7fc00000 writes 0, and NaN data leaves a number unchanged. With both quiet NaNs the data is kept.
  4. ±0: min gives -0 if either is -0, max gives +0 unless both are -0.
  5. Everything else is the plain float compare.
  6. _rtn returns the memory value from before, on every row.

Against this PR, with f32 denormals kept, every row without a NaN matches (182/289), including -0 < +0. The 107 others:

Case Hardware This PR
a quiet NaN already in the dword, number as data the number is written (min(0, qNaN) = 0) integer compare of the bits (the shortcut:)
sNaN data quieted sNaN written (0x7fc00001) dword unchanged
data number, sNaN in the dword quieted sNaN of the dword stays integer compare

With f32 denormals flushed there are 28 more: data 0 with memory 0x80000001 gives 0x80000000 on the hardware (the denormal flushed to -0, then -0 < +0), where the integer order keeps 0x80000001. So the integer ordering is right for numbers in the denormals-kept mode. The NaN handling could follow rules 2-3, which is two more selects rather than a float compare.

AI use: Claude Code (Claude Opus 5.5) wrote the probes, ran them on the GPU above and drafted this comment; the numbers come from the hardware run.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7123597917 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/628#issuecomment-7123597917). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-11-24T06:06:52Z. --- RDNA2 hardware measurement of `ds_min_f32` / `ds_max_f32`: the ordering of numbers, ±0 included, matches this PR. The NaN rules differ, and the hardware's rule is simpler than the gap marked `shortcut:` here. **Setup.** AMD Radeon iGPU of a Ryzen 7 9800X3D, **gfx1036 (RDNA2)**, AMD driver 32.0.21042.62, Windows 11 Pro 26200. In a HIP kernel (assembled by the AMD driver's amd_comgr), each lane writes a "memory" value to its own LDS dword, runs `ds_{min,max}{,_rtn}_f32` with a "data" value, and reads the dword back. All 289 pairs of 17 values: ±0, ±1, ±2.5, ±smallest denormal, ±inf, ±max, ±qNaN, and three sNaNs. Each pair ran under IEEE mode on/off × f32 denormals flushed/kept. RDNA2 desktop silicon, not the console's. No game data. This model fits **289/289 in all four modes**, for min and max, with and without `_rtn`: 1. Denormals follow the f32 denormal mode (flushed to ±0 first when the mode flushes). IEEE mode makes no difference. 2. An sNaN, data first, then memory, is written back quieted: data `0x7f800001` gives `0x7fc00001`. 3. Otherwise a NaN loses to a number, whichever side it is on: data `0` with memory `0x7fc00000` writes `0`, and NaN data leaves a number unchanged. With both quiet NaNs the data is kept. 4. ±0: min gives -0 if either is -0, max gives +0 unless both are -0. 5. Everything else is the plain float compare. 6. `_rtn` returns the memory value from before, on every row. Against this PR, with f32 denormals kept, every row without a NaN matches (182/289), including -0 < +0. The 107 others: | Case | Hardware | This PR | |---|---|---| | a quiet NaN already in the dword, number as data | the number is written (min(0, qNaN) = 0) | integer compare of the bits (the `shortcut:`) | | sNaN data | quieted sNaN written (`0x7fc00001`) | dword unchanged | | data number, sNaN in the dword | quieted sNaN of the dword stays | integer compare | With f32 denormals flushed there are 28 more: data `0` with memory `0x80000001` gives `0x80000000` on the hardware (the denormal flushed to -0, then -0 < +0), where the integer order keeps `0x80000001`. So the integer ordering is right for numbers in the denormals-kept mode. The NaN handling could follow rules 2-3, which is two more selects rather than a float compare. AI use: Claude Code (Claude Opus 5.5) wrote the probes, ran them on the GPU above and drafted this comment; the numbers come from the hardware run.
mercuryVM commented 2026-11-24 06:56:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T06:30:10Z.


@Lyrnc thank you, that measurement settles it. I followed your model in 5d07613: the integer-atomic pair is replaced by a compare-exchange loop around rules 2-5, since no single integer atomic can let a NaN already in the dword lose to a number. Both quiet NaNs give the data, as you reported. The test now has quiet and signalling NaNs of both signs, in memory and as data (361 pairs per op, dword afterwards and _rtn value). It passes on an RTX 5070, and dropping the 'NaN in memory loses' rule makes it fail. Rule 1 (denormals following the f32 mode) is left as a marked shortcut: the translator does not model MODE, so this matches the denormals-kept mode only.

@LAKSHYA-cmd-tech thanks for testing. The lowering changed after your approval (now a CAS loop), so it may be worth another look.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7123999599 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/628#issuecomment-7123999599). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T06:30:10Z. --- @Lyrnc thank you, that measurement settles it. I followed your model in 5d07613: the integer-atomic pair is replaced by a compare-exchange loop around rules 2-5, since no single integer atomic can let a NaN already in the dword lose to a number. Both quiet NaNs give the data, as you reported. The test now has quiet and signalling NaNs of both signs, in memory and as data (361 pairs per op, dword afterwards and `_rtn` value). It passes on an RTX 5070, and dropping the 'NaN in memory loses' rule makes it fail. Rule 1 (denormals following the f32 mode) is left as a marked shortcut: the translator does not model MODE, so this matches the denormals-kept mode only. @LAKSHYA-cmd-tech thanks for testing. The lowering changed after your approval (now a CAS loop), so it may be worth another look. AI-assisted (Claude Code).
Lyrnc commented 2026-11-24 08:02:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Lyrnc on 2026-11-24T07:33:43Z.


Tested 5d07613 merged onto main d2a4bae (clean) on both GPUs here: pass.

  • ds_min_max_f32_* tests, RTX 5080 (driver 610.88): 2 passed.
  • Same tests on the Radeon iGPU (gfx1036, driver 32.0.21042.62), through #94's VICTORY_ADAPTER=amd (local merge only): 2 passed. This is the hardware the model came from, now running the translated DXIL.
  • lds_min_max_ref is the rule set that fitted 289/289 on the hardware with f32 denormals kept: sNaN data first, then memory, quieted; a NaN loses to a number; two quiet NaNs keep the data; -0 < +0.

AI use: Claude Code (Claude Opus 5.5) ran the tests and drafted this comment.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7125124914 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/628#issuecomment-7125124914). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-11-24T07:33:43Z. --- Tested `5d07613` merged onto `main` `d2a4bae` (clean) on both GPUs here: **pass**. - `ds_min_max_f32_*` tests, RTX 5080 (driver 610.88): 2 passed. - Same tests on the Radeon iGPU (gfx1036, driver 32.0.21042.62), through #94's `VICTORY_ADAPTER=amd` (local merge only): 2 passed. This is the hardware the model came from, now running the translated DXIL. - `lds_min_max_ref` is the rule set that fitted 289/289 on the hardware with f32 denormals kept: sNaN data first, then memory, quieted; a NaN loses to a number; two quiet NaNs keep the data; -0 < +0. AI use: Claude Code (Claude Opus 5.5) ran the tests and drafted this comment.
slint6614-dev commented 2026-11-24 08:02:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by slint6614-dev on 2026-11-24T07:35:09Z.


AMD hardware check, Windows 11, Adrenalin driver: RX 9070 (RDNA4) and the Ryzen 9600X iGPU (RDNA2, gfx1036), each picked as the D3D12 device for cargo test -p victory-shader --release (local adapter-selection patch, not part of this PR).

  • Whole victory-shader suite: 71 passed, 0 failed on both GPUs; both new ds_min_max_f32_* tests pass on the hardware device.
  • Negative control: with lower.rs reverted to main both new tests fail (the opcodes are refused before reaching the GPU), as expected.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7125150437 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/628#issuecomment-7125150437). Originally posted by [slint6614-dev](https://github.com/slint6614-dev) on 2026-11-24T07:35:09Z. --- AMD hardware check, Windows 11, Adrenalin driver: RX 9070 (RDNA4) and the Ryzen 9600X iGPU (RDNA2, gfx1036), each picked as the D3D12 device for `cargo test -p victory-shader --release` (local adapter-selection patch, not part of this PR). - Whole `victory-shader` suite: 71 passed, 0 failed on both GPUs; both new `ds_min_max_f32_*` tests pass on the hardware device. - Negative control: with `lower.rs` reverted to main both new tests fail (the opcodes are refused before reaching the GPU), as expected.
mercuryVM commented 2026-11-24 09:06:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T08:48:41Z.


Merged current main (58fed37) in a5ae95f. Only the end of valu_tests.rs conflicted; run_cases_on keeps #433's one-at-a-time lock. victory-shader: 91 passed on the RTX 5070. @Lyrnc @slint6614-dev thank you for the runs on RDNA2, RDNA4 and the RTX 5080.

Note for testing: cargo test -p victory-shader does not compile on current main (#719, a call to lowers without its new rsrc2 argument; @LAKSHYA-cmd-tech has a fix branch). I ran the suite with that one-line fix applied locally, not committed here.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7126592249 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/628#issuecomment-7126592249). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T08:48:41Z. --- Merged current `main` (`58fed37`) in a5ae95f. Only the end of `valu_tests.rs` conflicted; `run_cases_on` keeps #433's one-at-a-time lock. `victory-shader`: 91 passed on the RTX 5070. @Lyrnc @slint6614-dev thank you for the runs on RDNA2, RDNA4 and the RTX 5080. Note for testing: `cargo test -p victory-shader` does not compile on current `main` (#719, a call to `lowers` without its new `rsrc2` argument; @LAKSHYA-cmd-tech has a fix branch). I ran the suite with that one-line fix applied locally, not committed here. AI-assisted (Claude Code).
catminou4 commented 2026-11-24 10:03:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T09:37:29Z.

Review: APPROVED


Merges cleanly with main; macOS arm64, rustc 1.98.1, cargo test -p victory-shader --locked with the PR merged into main 8e79c80 → 70 passed / 0 failed / 1 ignored (1 ignored = Windows GPU execution suite).

The lowering is a CAS loop around lds_float_pick, and I checked the pick against the hardware reference in the new tests: sNaN quieted with data first, a NaN losing to a number, two quiet NaNs giving the data, and the sign-flip key ordering -0 below +0 — all match lds_min_max_ref. _rtn is handled by the existing replace("_rtn", "") at the atomic matcher, and the tests cover both the old-value-return and read-back forms, plus cross-wave atomicity on WARP and hardware.

Three notes, none blocking:

  1. The host-execution tests in valu_tests.rs are Windows-gated, so on macOS this PR is compile-checked only; the gfx1036 measurements in the description are the real evidence — CI on Windows will exercise them.
  2. lower.rs now has the // ---- instructions ---- comment twice in a row (hunk at ~2251) — drop one.
  3. The denormal shortcut is documented in the comment; fine as long as MODE stays unmodelled.
<!-- greyfinch-sync:Marvisak/VIctory:review:6036817341 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/628#pullrequestreview-6036817341). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T09:37:29Z. **Review:** APPROVED --- Merges cleanly with main; macOS arm64, rustc 1.98.1, `cargo test -p victory-shader --locked` with the PR merged into main `8e79c80` → **70 passed / 0 failed / 1 ignored** (1 ignored = Windows GPU execution suite). The lowering is a CAS loop around `lds_float_pick`, and I checked the pick against the hardware reference in the new tests: sNaN quieted with data first, a NaN losing to a number, two quiet NaNs giving the data, and the sign-flip key ordering -0 below +0 — all match `lds_min_max_ref`. `_rtn` is handled by the existing `replace("_rtn", "")` at the atomic matcher, and the tests cover both the old-value-return and read-back forms, plus cross-wave atomicity on WARP and hardware. Three notes, none blocking: 1. The host-execution tests in `valu_tests.rs` are Windows-gated, so on macOS this PR is compile-checked only; the gfx1036 measurements in the description are the real evidence — CI on Windows will exercise them. 2. `lower.rs` now has the `// ---- instructions ----` comment twice in a row (hunk at ~2251) — drop one. 3. The denormal shortcut is documented in the comment; fine as long as MODE stays unmodelled.
mercuryVM commented 2026-11-24 11:04:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T10:20:12Z.


@catminou4 thanks for the review. Note 2 is fixed in b108d2f (one // ---- instructions ---- left). I merged current main (ffe310e) on top in 717e732; it merged without conflicts. On that head, the CI's own commands pass locally: both cargo clippy ... -D warnings runs, cargo test --workspace --locked, and victory-shader 122 passed on the RTX 5070 and WARP.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7128636775 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/628#issuecomment-7128636775). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T10:20:12Z. --- @catminou4 thanks for the review. Note 2 is fixed in b108d2f (one `// ---- instructions ----` left). I merged current `main` (`ffe310e`) on top in 717e732; it merged without conflicts. On that head, the CI's own commands pass locally: both `cargo clippy ... -D warnings` runs, `cargo test --workspace --locked`, and `victory-shader` 122 passed on the RTX 5070 and WARP. AI-assisted (Claude Code).
mercuryVM commented 2026-11-24 12:04:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T11:06:59Z.


@Parakeet-Wheat the same question as on #596, if you have time: how many ds_{min,max}{,_rtn}_f32 the retail shaders contain, and whether translate --list --validate changes any outcome with this PR. Counts only, nothing from the shaders.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7129676018 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/628#issuecomment-7129676018). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T11:06:59Z. --- @Parakeet-Wheat the same question as on #596, if you have time: how many `ds_{min,max}{,_rtn}_f32` the retail shaders contain, and whether `translate --list --validate` changes any outcome with this PR. Counts only, nothing from the shaders. AI-assisted (Claude Code).
Parakeet-Wheat commented 2026-11-24 12:04:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Parakeet-Wheat on 2026-11-24T11:31:26Z.


@mercuryVM here are the counts for 717e732 (which already contains main ffe310e):

  • Setup: Windows 11 26300, NVIDIA GeForce RTX 3070 (8 GB, driver 610.88), Ryzen 5 5600X, Rust 1.98.1 (x86_64-pc-windows-msvc), dxil.dll 1.8.2502, title 1.0.2.1.
  • victory shader-info --disasm over shaders.rpf and the executable: 0 ds_{min,max}{,_rtn}_f32. The title's LDS min/max are all integer: ds_max_u32 147, ds_min_u32 78, ds_max_i32 2. Its 4 "an LDS operation" refusals on main are other instructions.
  • victory translate <exe> shaders.rpf --list --validate, main vs this PR: no program changes outcome (21,736 validated, 4,003 failed, 162 rejected on both).
  • cargo test -p victory-shader --locked: 122 passed, 0 failed, 1 ignored. Both ds_min_max_f32_* tests pass, but each ran for over 60 s on this GPU (100 s for the whole suite, against about 45 s without them).

Offline translation and validation only; no shader contents or extracted data included. AI-assisted (Claude Code); run on my machine.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7130206724 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/628#issuecomment-7130206724). Originally posted by [Parakeet-Wheat](https://github.com/Parakeet-Wheat) on 2026-11-24T11:31:26Z. --- @mercuryVM here are the counts for `717e732` (which already contains `main` `ffe310e`): - **Setup:** Windows 11 26300, NVIDIA GeForce RTX 3070 (8 GB, driver `610.88`), Ryzen 5 5600X, Rust 1.98.1 (`x86_64-pc-windows-msvc`), `dxil.dll` 1.8.2502, title 1.0.2.1. - `victory shader-info --disasm` over `shaders.rpf` and the executable: **0 `ds_{min,max}{,_rtn}_f32`**. The title's LDS min/max are all integer: `ds_max_u32` 147, `ds_min_u32` 78, `ds_max_i32` 2. Its 4 "an LDS operation" refusals on `main` are other instructions. - `victory translate <exe> shaders.rpf --list --validate`, `main` vs this PR: **no program changes outcome** (21,736 validated, 4,003 failed, 162 rejected on both). - `cargo test -p victory-shader --locked`: **122 passed, 0 failed, 1 ignored**. Both `ds_min_max_f32_*` tests pass, but each ran for over 60 s on this GPU (100 s for the whole suite, against about 45 s without them). *Offline translation and validation only; no shader contents or extracted data included. AI-assisted (Claude Code); run on my machine.*
mercuryVM commented 2026-11-24 12:04:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T11:53:46Z.


@Parakeet-Wheat thank you. Zero in the title, all LDS min/max integer: noted at the top of the description. I'll also cut the semantics test's run time (one dispatch per case makes it take over 60 s on your 3070) if this PR stays open.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7130689807 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/628#issuecomment-7130689807). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T11:53:46Z. --- @Parakeet-Wheat thank you. Zero in the title, all LDS min/max integer: noted at the top of the description. I'll also cut the semantics test's run time (one dispatch per case makes it take over 60 s on your 3070) if this PR stays open. AI-assisted (Claude Code).
bvtterbroot commented 2026-11-24 18:06:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by bvtterbroot on 2026-11-24T17:54:37Z.


AMD check at 717e732 (base ffe310e), on an RDNA3 and an RDNA2 GPU:

  • Windows 11, Rust 1.98.1. Radeon RX 7900 XTX (RDNA3, driver 32.0.32029.2010) and the Ryzen 7 7800X3D's iGPU (RDNA2, gfx1036, driver 32.0.21045.29003). I picked each as the hardware device of run_cases with a local adapter-selection patch that is not part of this PR. WARP runs in each pass as well.
  • cargo test -p victory-shader -p victory-gpu --locked: 172 passed, 0 failed, 2 ignored, on both GPUs. That includes its 2 new tests (ds_min_max_f32_are_atomic_across_waves, ds_min_max_f32_order_floats_and_return_the_old_value).

Synthetic tests only, no game files. Tested with AI assistance (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7139880733 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/628#issuecomment-7139880733). Originally posted by [bvtterbroot](https://github.com/bvtterbroot) on 2026-11-24T17:54:37Z. --- AMD check at `717e732` (base `ffe310e`), on an RDNA3 and an RDNA2 GPU: - Windows 11, Rust 1.98.1. Radeon RX 7900 XTX (RDNA3, driver 32.0.32029.2010) and the Ryzen 7 7800X3D's iGPU (RDNA2, gfx1036, driver 32.0.21045.29003). I picked each as the hardware device of `run_cases` with a local adapter-selection patch that is not part of this PR. WARP runs in each pass as well. - `cargo test -p victory-shader -p victory-gpu --locked`: **172 passed, 0 failed**, 2 ignored, on both GPUs. That includes its 2 new tests (`ds_min_max_f32_are_atomic_across_waves`, `ds_min_max_f32_order_floats_and_return_the_old_value`). Synthetic tests only, no game files. _Tested with AI assistance (Claude Code)._
Marvisak commented 2026-11-25 01:07:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:31:18Z.


Automated triage for the maintainers.

Needs rebase. This PR does not merge cleanly into current main (ac2525d). Conflicting files: crates/victory-shader/src/emit/valu_tests.rs.

The content has not been reviewed yet; it will be once the branch is rebased onto main.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148593130 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/628#issuecomment-7148593130). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:31:18Z. --- <!-- victory-triage v1 head=717e732f68c5aaea2c855ed253a6c35b48bd953c verdict=needs-rebase at=2026-11-25T00:13:20Z --> Automated triage for the maintainers. **Needs rebase.** This PR does not merge cleanly into current `main` (ac2525d). Conflicting files: `crates/victory-shader/src/emit/valu_tests.rs`. The content has not been reviewed yet; it will be once the branch is rebased onto `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
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/628:upstream-pr/628'
git switch 'upstream-pr/628'

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