victory-shader: decode f16 inline float constants in v_add_f16 wave reductions #16

Merged
Androtim merged 1 commit from upstream-pr/16 into main 2026-11-28 13:16:12 +00:00
Androtim commented 2026-11-28 05:31:28 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T05:31:28Z.


## Summary
Ports upstream VIctory commit f3578e3 (#2493) into crates/victory-shader/src/emit/wave.rs:

  • Decodes GFX10 inline f16 float constants (codes 240..=248: 0.5, -0.5, 1.0, -1.0, 2.0, -2.0, 4.0, -4.0, 1/(2*pi)) when simulating operands of v_add_f16 in whole-wave reduction detection instead of decoding their f32 bit patterns whose low 15 bits are zero (which previously misclassified non-zero f16 inline constants as an additive zero identity).
  • Adds unit test wave::tests::v_add_f16_inline_float_constants_are_not_zero_identity (using MiniVI's Shape::Active(Op::AddH, ...)).

Rig Specs Tested On

  • CPU: 13th Gen Intel(R) Core(TM) i7-13700F
  • GPU & VRAM: NVIDIA GeForce RTX 4060 Ti (Driver 32.0.16.2124, 8 GiB VRAM)
  • System RAM: 32 GiB
  • OS & GPU Driver: Microsoft Windows 11 Home (Build 26300)

Run Settings & Profile

  • Build & Commit SHA: Unit/compiler test suite @ ed78e8f (and verified via windows-latest CI)
  • Console Profile & Internal Resolution / Scale: N/A (shader compiler fix; no runtime GPU capture needed)
  • Ray Tracing / Upscaling / Frame Generation: N/A
  • Scene / Area & Session Length: N/A (synthetic GFX10 ISA wave32 reduction test suite)

Measurements & Verification

  • Automated Checks:
    • cargo +1.98.1-x86_64-pc-windows-gnu xtask policy (294 files ok)
    • cargo +1.98.1-x86_64-pc-windows-gnu test -p xtask (6 passed)
    • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings (0 warnings)
    • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics -- -D warnings (0 warnings)
    • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader emit::wave -- --test-threads=1 (22 passed; 0 failed, including v_add_f16_inline_float_constants_are_not_zero_identity; full victory-shader run hit 3 pre-existing Windows 11 Build 26300 local dxil.dll validation mismatches in rect::tests & barycentric_tests out of 290 tests, verified on windows-latest CI)
<!-- greyfinch-sync:Androtim/MiniVI:issue:5537079750 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/16). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T05:31:28Z. --- ## Summary Ports upstream `VIctory` commit `f3578e3` (#2493) into `crates/victory-shader/src/emit/wave.rs`: - Decodes GFX10 inline f16 float constants (codes `240..=248`: `0.5`, `-0.5`, `1.0`, `-1.0`, `2.0`, `-2.0`, `4.0`, `-4.0`, `1/(2*pi)`) when simulating operands of `v_add_f16` in whole-wave reduction detection instead of decoding their f32 bit patterns whose low 15 bits are zero (which previously misclassified non-zero f16 inline constants as an additive zero identity). - Adds unit test `wave::tests::v_add_f16_inline_float_constants_are_not_zero_identity` (using MiniVI's `Shape::Active(Op::AddH, ...)`). ## Rig Specs Tested On - **CPU:** 13th Gen Intel(R) Core(TM) i7-13700F - **GPU & VRAM:** NVIDIA GeForce RTX 4060 Ti (Driver 32.0.16.2124, 8 GiB VRAM) - **System RAM:** 32 GiB - **OS & GPU Driver:** Microsoft Windows 11 Home (Build 26300) ## Run Settings & Profile - **Build & Commit SHA:** Unit/compiler test suite @ `ed78e8f` (and verified via `windows-latest` CI) - **Console Profile & Internal Resolution / Scale:** N/A (shader compiler fix; no runtime GPU capture needed) - **Ray Tracing / Upscaling / Frame Generation:** N/A - **Scene / Area & Session Length:** N/A (synthetic GFX10 ISA wave32 reduction test suite) ## Measurements & Verification - **Automated Checks:** - [x] `cargo +1.98.1-x86_64-pc-windows-gnu xtask policy` (`294 files ok`) - [x] `cargo +1.98.1-x86_64-pc-windows-gnu test -p xtask` (`6 passed`) - [x] `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings` (0 warnings) - [x] `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics -- -D warnings` (0 warnings) - [x] `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader emit::wave -- --test-threads=1` (`22 passed; 0 failed`, including `v_add_f16_inline_float_constants_are_not_zero_identity`; full `victory-shader` run hit 3 pre-existing Windows 11 Build 26300 local `dxil.dll` validation mismatches in `rect::tests` & `barycentric_tests` out of 290 tests, verified on `windows-latest` CI)
Androtim commented 2026-11-28 06:03:02 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T06:03:02Z.


Automated triage for the maintainers (not an approval).

Verdict: merge-candidate · CI (check): passing

Triage Review

  • Scope & Correctness: Clean, targeted port of upstream VIctory commit f3578e3 in crates/victory-shader/src/emit/wave.rs. In simulate(), Operand::Const(c @ 240..=248) is now decoded to the GFX10 IEEE-754 f16 bit patterns (0x3800, 0xB800, 0x3C00, 0xBC00, 0x4000, 0xC000, 0x4400, 0xC400, 0x3118 for ±0.5, ±1.0, ±2.0, ±4.0, 1/(2*pi)) when name == "v_add_f16", preventing their f32 encodings (whose low 16 bits are 0x0000 for 240..=247) from being misclassified as the Op::AddH zero identity.
  • Coverage & Edge Cases:
    • v_add_f16 is the only 16-bit float reduction op modelled in Op/simulate().
    • Operand::Const(128) (0) still falls through to crate::resource::inline(128) (0), preserving valid +0.0 identity detection.
    • Indexing usize::from(c - 240) is bounded by c @ 240..=248 against the 9-element array.
    • The new unit test v_add_f16_inline_float_constants_are_not_zero_identity exhaustively verifies 128 yields Some(Shape::Active(Op::AddH, v0_in, saved, 0)) while 240..=248 all yield None.
  • CI & GPU Testing: CI is passing. Because this is a self-contained, conservative compiler-analysis fix with deterministic ISA unit coverage and no driver/hardware-specific codegen changes, a local real-GPU smoke test is not required.

Automated triage review — not formal maintainer approval.


Generated with Antigravity CLI (agy).

<!-- greyfinch-sync:Androtim/MiniVI:comment:7235047253 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/16#issuecomment-7235047253). Originally posted by [Androtim](https://github.com/Androtim) on 2026-11-28T06:03:02Z. --- <!-- minivi-triage v1 head=ed78e8f47ede2386164e54a808cfbe0fde0d2b19 verdict=merge-candidate ci=passing at=2026-11-28T06:03:29Z --> Automated triage for the maintainers (not an approval). **Verdict:** `merge-candidate` · **CI (`check`):** `passing` ### Triage Review - **Scope & Correctness**: Clean, targeted port of upstream `VIctory` commit `f3578e3` in `crates/victory-shader/src/emit/wave.rs`. In `simulate()`, `Operand::Const(c @ 240..=248)` is now decoded to the GFX10 IEEE-754 `f16` bit patterns (`0x3800`, `0xB800`, `0x3C00`, `0xBC00`, `0x4000`, `0xC000`, `0x4400`, `0xC400`, `0x3118` for `±0.5`, `±1.0`, `±2.0`, `±4.0`, `1/(2*pi)`) when `name == "v_add_f16"`, preventing their `f32` encodings (whose low 16 bits are `0x0000` for `240..=247`) from being misclassified as the `Op::AddH` zero identity. - **Coverage & Edge Cases**: - `v_add_f16` is the only 16-bit float reduction op modelled in `Op`/`simulate()`. - `Operand::Const(128)` (`0`) still falls through to `crate::resource::inline(128)` (`0`), preserving valid `+0.0` identity detection. - Indexing `usize::from(c - 240)` is bounded by `c @ 240..=248` against the 9-element array. - The new unit test `v_add_f16_inline_float_constants_are_not_zero_identity` exhaustively verifies `128` yields `Some(Shape::Active(Op::AddH, v0_in, saved, 0))` while `240..=248` all yield `None`. - **CI & GPU Testing**: CI is passing. Because this is a self-contained, conservative compiler-analysis fix with deterministic ISA unit coverage and no driver/hardware-specific codegen changes, a local real-GPU smoke test is not required. *Automated triage review — not formal maintainer approval.* --- _Generated with Antigravity CLI (`agy`)._
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
Androtim/MiniVI!16
No description provided.