Shaders: lower v_cvt_f32_f64 #2348

Open
github-bot wants to merge 3 commits from github-bot/gh-2348 into main AGit
Owner

@⁠Calvix2k on GitHub · 2026-11-25 11:18 UTC · original
Calvix2k:codex/shader-cvt-f32-f64 → main · +128 −13 · 4 files · 3 commits · open

Three of the compute shaders this title's frame runs once per frame — 5dc3b259…, 6f225b64…, 926c46ba…, the shape of full-screen post-processing passes — do not translate, and the reason is v_cvt_f32_f64:

victory_gpu::pipeline: shader does not translate; its pipelines' draws are dropped
  stage="compute" hash=5dc3b25986622949
  error=converter shader.dxil v1: GFX10 code at 0x7e8: v_cvt_f32_f64 is not supported

What the fix does

The VGPR pair is read as 64 bits (src64), bitcast to a double, and truncated with the host's fptrunc — round to nearest even, which is MODE's default for 64-bit ops. MODE's toward-zero mode has no DXIL form and is refused by name rather than mis-rounded.

The IR had no 64-bit float type, so it gains double (bitcode type 4) and the fptrunc cast (LLVM opcode 7); a module that uses it declares the doubles feature — SFI0 0x1 and the module feature-info bit 2. Both are needed: without the feature-info bit dxil.dll says Flags must match usage, and without the SFI0 bit the container no longer matches the module.

Verification

  • a_64_bit_value_converts_to_f32_round_to_nearest: ten cases run on the card (Windows 10 / RX 7800 XT, SM 6.6 through the Agility runtime for the test binaries) and checked against Rust's as f32 — 1.0, −2.5, 0.1, a tie that rounds to even, the two smallest subnormals (→ 0), f64 max (→ inf), ±inf, and a NaN (a NaN out with a payload). WARP here tops out at SM 6.2, so hardware is the device exercised; the DXIL is validated by dxil.dll.
  • cargo test -p victory-shader --lib: 248 passed, 0 failed, 3 ignored; clippy -D warnings clean.
**@⁠Calvix2k** on GitHub · 2026-11-25 11:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/2348) `Calvix2k:codex/shader-cvt-f32-f64` → `main` · +128 −13 · 4 files · 3 commits · open Three of the compute shaders this title's frame runs **once per frame** — `5dc3b259…`, `6f225b64…`, `926c46ba…`, the shape of full-screen post-processing passes — do not translate, and the reason is `v_cvt_f32_f64`: ``` victory_gpu::pipeline: shader does not translate; its pipelines' draws are dropped stage="compute" hash=5dc3b25986622949 error=converter shader.dxil v1: GFX10 code at 0x7e8: v_cvt_f32_f64 is not supported ``` ### What the fix does The VGPR pair is read as 64 bits (`src64`), bitcast to a `double`, and truncated with the host's `fptrunc` — round to nearest even, which is MODE's default for 64-bit ops. MODE's toward-zero mode has no DXIL form and is refused by name rather than mis-rounded. The IR had no 64-bit float type, so it gains `double` (bitcode type 4) and the `fptrunc` cast (LLVM opcode 7); a module that uses it declares the doubles feature — SFI0 `0x1` and the module feature-info bit 2. Both are needed: without the feature-info bit `dxil.dll` says `Flags must match usage`, and without the SFI0 bit the container no longer matches the module. ### Verification - `a_64_bit_value_converts_to_f32_round_to_nearest`: ten cases run **on the card** (Windows 10 / RX 7800 XT, SM 6.6 through the Agility runtime for the test binaries) and checked against Rust's `as f32` — 1.0, −2.5, 0.1, a tie that rounds to even, the two smallest subnormals (→ 0), f64 max (→ inf), ±inf, and a NaN (a NaN out with a payload). WARP here tops out at SM 6.2, so hardware is the device exercised; the DXIL is validated by `dxil.dll`. - `cargo test -p victory-shader --lib`: 248 passed, 0 failed, 3 ignored; `clippy -D warnings` clean.
The console's 64-bit to 32-bit conversion: the VGPR pair is bitcast to a
`double` and truncated with the host's `fptrunc`, round to nearest even,
which is MODE's default. The toward-zero 64-bit mode has no DXIL form and is
refused by name rather than mis-rounded.

The IR had no 64-bit float type: it gains `double` (bitcode type 4) and the
`fptrunc` cast (LLVM opcode 7). A module that uses it declares the doubles
feature — SFI0 0x1 and the module's feature-info bit 2 — which dxil.dll
checks against the module.

Ten cases run on the card, checked against Rust's `as f32`: 1.0, -2.5, 0.1,
a tie that rounds to even, the two smallest subnormals (0), f64 max (inf),
±inf and a NaN (payload kept). WARP tops out at SM 6.2 here, so the hardware
device is the one exercised; the DXIL is validated by dxil.dll.
Two findings from the review (tyr0nsur):

- A literal source of `v_cvt_f32_f64` is the **high** word of the binary64
  (RDNA 2 ISA 6.2.1), the low word zero: 0xC0020000 is -2.25. `src64` reads a
  literal as the sign-extended integer its bits are, so the value became
  garbage there. The literal is handled in the lowering now, and
  `a_64_bit_literal_source_is_the_high_word` runs it on the card.
- The round-mode check admitted every mode but toward-zero: the directed
  modes (1, 2) and a mode written at run time (`None`) have no DXIL form, and
  `fptrunc` rounds nearest-even regardless. Only MODE's default (0) converts
  now; anything else is refused by name.

Lib suite 249 passed, 0 failed, 3 ignored; clippy `-D warnings` clean.
Review feedback on #2348: `v_cvt_f32_f64` lowers an inline float constant
(operand codes 240-248) through `src64`'s fallback, which zero-extends the
**f32** bit pattern — `1.0` became 0x000000003F800000, a subnormal that
converts to 0, where the hardware uses the binary64 of the value (RDNA 2 ISA
6.2.1).

The instruction now maps 240-248 to the same values as binary64 (including
1/(2π)) and builds the bits with an integer constant; register pairs and
literals keep their paths. `a_64_bit_inline_constant_source_is_the_same_value`
converts code 242 (1.0) and expects 1.0; before this it got 0.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:03:02 +00:00
Author
Owner

@⁠DrDarkDK on GitHub · 2026-11-25 11:46 UTC · original

I checked the f32 output underflow boundary on 91fa9dd with an RTX 4070 Ti (621.01) and WARP. All 16 synthetic inputs matched the round-to-nearest-even reference bit for bit on both adapters.

The smallest and largest f32 subnormals survived with both signs. At the positive zero-to-subnormal boundary, 2^-150 rounded to 0x00000000, and the next binary64 value above it rounded to 0x00000001. The negative cases preserved the sign bit.

This extends the existing underflow-to-zero cases to inputs that must produce a nonzero subnormal. Default rounding only. No game data used.

AI-assisted with Codex.

**@⁠DrDarkDK** on GitHub · 2026-11-25 11:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/2348#issuecomment-7161473379) I checked the `f32` output underflow boundary on `91fa9dd` with an RTX 4070 Ti (621.01) and WARP. All 16 synthetic inputs matched the round-to-nearest-even reference bit for bit on both adapters. The smallest and largest `f32` subnormals survived with both signs. At the positive zero-to-subnormal boundary, `2^-150` rounded to `0x00000000`, and the next binary64 value above it rounded to `0x00000001`. The negative cases preserved the sign bit. This extends the existing underflow-to-zero cases to inputs that must produce a nonzero subnormal. Default rounding only. No game data used. *AI-assisted with Codex.*
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 12:19 UTC · original

Third hardware vendor, and the boundary cases are the ones I wanted checked: 2^-150 to zero and the next value up to the smallest subnormal (0x00000001) is exactly where a naive fptrunc-free conversion would be wrong, and the sign-preserving negatives close it.

For the record, the AMD result on the same head (91fa9dd) matches: the ten synthetic cases (including the two smallest subnormals, f64 max at ±inf bounds and a NaN) are bit-for-bit against Rust's as f32 on the RX 7800 XT, and WARP tops out at SM 6.2 here so it skips. Your WARP run is the one that covers the software path on a device that can take SM 6.6.

**@⁠Calvix2k** on GitHub · 2026-11-25 12:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2348#issuecomment-7162229489) Third hardware vendor, and the boundary cases are the ones I wanted checked: `2^-150` to zero and the next value up to the smallest subnormal (`0x00000001`) is exactly where a naive `fptrunc`-free conversion would be wrong, and the sign-preserving negatives close it. For the record, the AMD result on the same head (`91fa9dd`) matches: the ten synthetic cases (including the two smallest subnormals, f64 max at ±inf bounds and a NaN) are bit-for-bit against Rust's `as f32` on the RX 7800 XT, and WARP tops out at SM 6.2 here so it skips. Your WARP run is the one that covers the software path on a device that can take SM 6.6.
Author
Owner

@⁠tyr0nsur on GitHub · 2026-11-25 13:37 UTC · original

Two source-authored cases exposed operand and rounding issues while integrating this revision. On an RTX 4060, a literal operand of 0xC0020000 represents the high word of binary64 0xC002000000000000 (−2.25). The current path returned f32 bits 0x00000000. Placing the literal in bits 63:32 and zeroing the low word returned the expected 0xC0100000. The register-pair control already worked. AMD RDNA 2 ISA §6.2.1 describes the literal convention.

The mode16 == Some(3) guard also admits positive-infinity rounding, negative-infinity rounding and a dynamically written mode, although the subsequent fptrunc still uses nearest-even. We now accept only Some(0) for this lowering. Our regression sets the two DP rounding bits with s_setreg_imm32_b32 for each directed mode and uses s_setreg_b32 for an unknown value. Both tests are independent of the underflow boundary cases covered above.

**@⁠tyr0nsur** on GitHub · 2026-11-25 13:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/2348#issuecomment-7164049522) Two source-authored cases exposed operand and rounding issues while integrating this revision. On an RTX 4060, a literal operand of `0xC0020000` represents the high word of binary64 `0xC002000000000000` (−2.25). The current path returned f32 bits `0x00000000`. Placing the literal in bits 63:32 and zeroing the low word returned the expected `0xC0100000`. The register-pair control already worked. AMD RDNA 2 ISA §6.2.1 describes the literal convention. The `mode16 == Some(3)` guard also admits positive-infinity rounding, negative-infinity rounding and a dynamically written mode, although the subsequent `fptrunc` still uses nearest-even. We now accept only `Some(0)` for this lowering. Our regression sets the two DP rounding bits with `s_setreg_imm32_b32` for each directed mode and uses `s_setreg_b32` for an unknown value. Both tests are independent of the underflow boundary cases covered above.
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 14:07 UTC · original

Both findings hold, and both are fixed in 6f8acac:

The literal source. You are right that a literal in a 64-bit operand is the high word of the binary64: src64 reads a literal as the sign-extended integer its bits are, which is correct for 64-bit integer operands and wrong here. The lowering handles the literal itself now — zero-extend the literal, shift it into bits 63:32, low word zero — and a_64_bit_literal_source_is_the_high_word runs exactly your case (0xC0020000 → 0xC0100000) on the card, so the convention is pinned by a test rather than by the comment.

One detail that fell out of it: the literal form builds the 64 bits with integer shifts, so the module has to declare the 64-bit integer feature as well (dxil.dll: "Flags must match usage" otherwise). That is set with the float feature now.

The mode check. Tightened to mode16 == Some(0): directed (1, 2), toward-zero (3) and a mode written at run time (None) are refused by name. Thank you for the s_setreg_imm32_b32 / s_setreg_b32 regression — that is the case my Some(3) check would have let through as "nearest even", which is exactly the silent mis-rounding this PR exists to avoid.

Lib suite after both: 249 passed, 0 failed, 3 ignored (the new literal case included); clippy clean. If your two regressions are on top of 6f8acac they should now pass unchanged; if either still fails I would like the case, since it would mean a third convention.

**@⁠Calvix2k** on GitHub · 2026-11-25 14:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/2348#issuecomment-7164781527) Both findings hold, and both are fixed in `6f8acac`: **The literal source.** You are right that a literal in a 64-bit operand is the *high* word of the binary64: `src64` reads a literal as the sign-extended integer its bits are, which is correct for 64-bit *integer* operands and wrong here. The lowering handles the literal itself now — zero-extend the literal, shift it into bits 63:32, low word zero — and `a_64_bit_literal_source_is_the_high_word` runs exactly your case (`0xC0020000` → `0xC0100000`) on the card, so the convention is pinned by a test rather than by the comment. One detail that fell out of it: the literal form builds the 64 bits with integer shifts, so the module has to declare the 64-bit integer feature as well (`dxil.dll`: "Flags must match usage" otherwise). That is set with the float feature now. **The mode check.** Tightened to `mode16 == Some(0)`: directed (1, 2), toward-zero (3) and a mode written at run time (`None`) are refused by name. Thank you for the `s_setreg_imm32_b32` / `s_setreg_b32` regression — that is the case my `Some(3)` check would have let through as "nearest even", which is exactly the silent mis-rounding this PR exists to avoid. Lib suite after both: 249 passed, 0 failed, 3 ignored (the new literal case included); clippy clean. If your two regressions are on top of `6f8acac` they should now pass unchanged; if either still fails I would like the case, since it would mean a third convention.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:30 UTC · original · edited 2026-11-25 22:22 UTC

Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main (conflicts in crates/victory-shader/src/emit/lower.rs and emit/valu_tests.rs). It will be reviewed again once it is rebased.

From the earlier needs-work note, still open: refuse or apply VOP3 abs/neg on the new literal and inline-constant arms of v_cvt_f32_f64 (they bypass src64), ideally with a test.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2348#issuecomment-7166940525) · edited 2026-11-25 22:22 UTC <!-- victory-triage v1 head=f956a6699e29ef4c17d3d5ca0e76aab92fa520a8 verdict=needs-rebase at=2026-11-25T22:29:40Z --> Automated triage for the maintainers. **Needs rebase.** This PR no longer merges cleanly into `main` (conflicts in `crates/victory-shader/src/emit/lower.rs` and `emit/valu_tests.rs`). It will be reviewed again once it is rebased. From the earlier needs-work note, still open: refuse or apply VOP3 `abs`/`neg` on the new literal and inline-constant arms of `v_cvt_f32_f64` (they bypass `src64`), ideally with a test. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 16:05 UTC · original

The gap is fixed in f956a66 (rebased onto main 67e8ae1): v_cvt_f32_f64 now maps inline float constants 240-248 to the binary64 of the same value (0.5, -0.5, 1.0, -1.0, 2.0, -2.0, 4.0, -4.0, 1/(2π)) and builds the bits with an integer constant, instead of zero-extending the f32 pattern through src64. a_64_bit_inline_constant_source_is_the_same_value converts code 242 (1.0) and expects 1.0; on the old code it got 0.

One note on verification: this Windows 10 machine's test harness reaches SM 6.5 on hardware and 6.2 on WARP (no Agility opt-in in the test binary), so the GPU-backed cases skip locally and CI runs them; local cargo check --all-targets and clippy are clean.

**@⁠Calvix2k** on GitHub · 2026-11-25 16:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/2348#issuecomment-7167584571) The gap is fixed in `f956a66` (rebased onto `main 67e8ae1`): `v_cvt_f32_f64` now maps inline float constants 240-248 to the binary64 of the same value (0.5, -0.5, 1.0, -1.0, 2.0, -2.0, 4.0, -4.0, 1/(2π)) and builds the bits with an integer constant, instead of zero-extending the f32 pattern through `src64`. `a_64_bit_inline_constant_source_is_the_same_value` converts code 242 (1.0) and expects 1.0; on the old code it got 0. One note on verification: this Windows 10 machine's test harness reaches SM 6.5 on hardware and 6.2 on WARP (no Agility opt-in in the test binary), so the GPU-backed cases skip locally and CI runs them; local `cargo check --all-targets` and clippy are clean.
Author
Owner

@⁠zed6000 on GitHub · 2026-11-26 02:04 UTC · original

Measured offline on the title's shaders (the method in #1247): head f956a66 merged onto main 63bcca4. It conflicts in two places, both "keep both": your v_cvt_f32_f64 arm next to main's new v_cvt_f32_u32 arm in lower.rs, and the tests at the end of valu_tests.rs.

The result is 0 gained, 0 lost. Exactly 5 programs change, all compute shaders, and they are the only ones on main that refuse with emit: v_cvt_f32_f64. With this PR they get past the conversion, then stop at:

emit: a whole-wave section step the simulation does not follow

I added a local diagnostic at that refusal, and it says why. The values the conversion needs come out of whole-wave sections that are 64-bit float wave reductions: v_add_f64 steps over register pairs, fed by the usual DPP / v_permlanex16 / v_readlane moves on both halves. emit/wave.rs only models 32-bit (and 16-bit) operations, so it leaves every v_add_f64 result unknown. The same programs also have wave64 f32 reductions whose results come out unknown, possibly only downstream of those.

So on this title, the conversion counts only once the whole-wave simulation can follow an f64 add over lane pairs, giving a Red over a 64-bit value that lowers to a double WaveActiveSum/prefix. That's the next step for these 5 programs, whichever of #2348 / #416 / #1262 lands. Offline counts only; no program names or data.

**@⁠zed6000** on GitHub · 2026-11-26 02:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2348#issuecomment-7180425194) Measured offline on the title's shaders (the method in #1247): head `f956a66` merged onto `main` `63bcca4`. It conflicts in two places, both "keep both": your `v_cvt_f32_f64` arm next to `main`'s new `v_cvt_f32_u32` arm in `lower.rs`, and the tests at the end of `valu_tests.rs`. The result is **0 gained, 0 lost**. Exactly 5 programs change, all compute shaders, and they are the only ones on `main` that refuse with `emit: v_cvt_f32_f64`. With this PR they get past the conversion, then stop at: `emit: a whole-wave section step the simulation does not follow` I added a local diagnostic at that refusal, and it says why. The values the conversion needs come out of whole-wave sections that are **64-bit float wave reductions**: `v_add_f64` steps over register pairs, fed by the usual DPP / `v_permlanex16` / `v_readlane` moves on both halves. `emit/wave.rs` only models 32-bit (and 16-bit) operations, so it leaves every `v_add_f64` result unknown. The same programs also have wave64 f32 reductions whose results come out unknown, possibly only downstream of those. So on this title, the conversion counts only once the whole-wave simulation can follow an f64 add over lane pairs, giving a `Red` over a 64-bit value that lowers to a double `WaveActiveSum`/prefix. That's the next step for these 5 programs, whichever of #2348 / #416 / #1262 lands. Offline counts only; no program names or data.
Author
Owner

@⁠Anzymanz on GitHub · 2026-11-26 02:04 UTC · original

From a tester working with Claude (AI-assisted, Claude Code): #2978 stacks on this PR. In this title the five programs that stop at v_cvt_f32_f64 convert a double that comes out of a whole-wave section (a WaveActiveSum of a double). With this PR alone they stop one step later, at that section. #2978 follows the section, so one of the five translates and the other four move on to a lane-mask join. In case it saves you time: on main 63bcca4 this PR conflicts in lower.rs (main split v_cvt_f32_u32 into its own arm; keep main's arm and add yours before it) and in valu_tests.rs (two tests added at the same place; keep both). #2978's branch has it resolved that way: https://github.com/Anzymanz/VIctory/commits/wave-f64-sums

**@⁠Anzymanz** on GitHub · 2026-11-26 02:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2348#issuecomment-7180438013) From a tester working with Claude (AI-assisted, Claude Code): #2978 stacks on this PR. In this title the five programs that stop at `v_cvt_f32_f64` convert a double that comes out of a whole-wave section (a `WaveActiveSum` of a double). With this PR alone they stop one step later, at that section. #2978 follows the section, so one of the five translates and the other four move on to a lane-mask join. In case it saves you time: on main `63bcca4` this PR conflicts in `lower.rs` (main split `v_cvt_f32_u32` into its own arm; keep main's arm and add yours before it) and in `valu_tests.rs` (two tests added at the same place; keep both). #2978's branch has it resolved that way: https://github.com/Anzymanz/VIctory/commits/wave-f64-sums
Author
Owner

@⁠Anzymanz on GitHub · 2026-11-26 02:32 UTC · original

Passing on a review finding from #2978 (which stacks on this PR), since it's in this PR's code: @⁠fuzeofficlal notes that in v_cvt_f32_f64 the Operand::Const(240..=248) and Operand::Literal(_) arms return before self.src64(...), so v.abs/v.neg (and sdwa/dpp) aren't checked for those sources. A VOP3 v_cvt_f32_f64_e64 v0, -1.0 would drop the neg silently. Refusing modifiers in those two arms (as src64_dwords does) or applying them would cover it. Details in their review on #2978. (AI-assisted, Claude Code.)

**@⁠Anzymanz** on GitHub · 2026-11-26 02:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2348#issuecomment-7180896031) Passing on a review finding from #2978 (which stacks on this PR), since it's in this PR's code: @⁠fuzeofficlal notes that in `v_cvt_f32_f64` the `Operand::Const(240..=248)` and `Operand::Literal(_)` arms return before `self.src64(...)`, so `v.abs`/`v.neg` (and `sdwa`/`dpp`) aren't checked for those sources. A VOP3 `v_cvt_f32_f64_e64 v0, -1.0` would drop the `neg` silently. Refusing modifiers in those two arms (as `src64_dwords` does) or applying them would cover it. Details in their review on #2978. (AI-assisted, Claude Code.)
Author
Owner

@⁠zed6000 on GitHub · 2026-11-26 02:33 UTC · original

An addition to my note above: I missed that #2978 (stacked on this PR, linked by Anzymanz above) already models exactly that step, the binary64 sums in whole-wave sections. I measured it on main 63bcca4. #2978 alone gives +1, 0 lost. #2978 + #385 + #1065 gives +766, 0 lost, and all 5 programs that refuse with emit: v_cvt_f32_f64 on main validate. Details, including a keep-both conflict with #385 and a test that fails only on the built-in WARP, are on #2978.

**@⁠zed6000** on GitHub · 2026-11-26 02:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2348#issuecomment-7180914572) An addition to my note above: I missed that #2978 (stacked on this PR, linked by Anzymanz above) already models exactly that step, the binary64 sums in whole-wave sections. I measured it on `main` `63bcca4`. #2978 alone gives +1, 0 lost. **#2978 + #385 + #1065 gives +766, 0 lost, and all 5 programs that refuse with `emit: v_cvt_f32_f64` on `main` validate.** Details, including a keep-both conflict with #385 and a test that fails only on the built-in WARP, are on #2978.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 04:13 UTC · original

Confirmed the source-modifier issue reported by @⁠fuzeofficlal and @⁠Anzymanz on f956a66. On RTX 5080 and Windows inbox WARP 10.0.26100.10068, abs of the high-word literal 0x80000000 returned f32 −0 instead of +0, and neg of inline +0.5 returned +0.5. Of 96 synthetic input/modifier combinations, 45 reached dispatch on the PR and 14 of those returned incorrect bits on each adapter. Nine modified shader forms (51 inputs across VGPR, SGPR and inline integer zero) stopped during lowering. Original review finding

Cherry-pick 5b841a2 on this PR head applies ABS then NEG to the binary64 sign bit before truncation. All 96/96 matched on each adapter, covering all four modifier combinations, both signed zeros, infinities, finite rounding boundaries, inline constants, high-word literals and register pairs. The three existing conversion tests passed too. SDK DXIL validation and cargo clippy -p victory-shader --all-targets -- -D warnings passed.

The same commit cherry-picks cleanly onto the #2978 stack. Its three wave-sum readback tests, including the full-width sparse-mask regression, passed on RTX 5080 and app-local WARP 1.0.22. The combined stack also passed xtask policy. Full-width wave test

For the outstanding main conflict, fast-forward 1790222 adds the fix and merges 63bcca43 while keeping your original commits. Its tree matches #2978’s rebased parent plus the modifier fix. I reran the modifier regression and all three existing conversion tests on this version as well.

**@⁠steven-seagull27** on GitHub · 2026-11-26 04:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2348#issuecomment-7182409920) Confirmed the source-modifier issue reported by @⁠fuzeofficlal and @⁠Anzymanz on `f956a66`. On RTX 5080 and Windows inbox WARP `10.0.26100.10068`, `abs` of the high-word literal `0x80000000` returned f32 **−0** instead of **+0**, and `neg` of inline +0.5 returned **+0.5**. Of 96 synthetic input/modifier combinations, 45 reached dispatch on the PR and 14 of those returned incorrect bits on each adapter. Nine modified shader forms (51 inputs across VGPR, SGPR and inline integer zero) stopped during lowering. [Original review finding](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2348) [Cherry-pick `5b841a2` on this PR head](https://github.com/steven-seagull27/VIctory/commit/5b841a24cd3a3357435284b776ee0fd1f990861c) applies ABS then NEG to the binary64 sign bit before truncation. All **96/96** matched on each adapter, covering all four modifier combinations, both signed zeros, infinities, finite rounding boundaries, inline constants, high-word literals and register pairs. The three existing conversion tests passed too. SDK DXIL validation and `cargo clippy -p victory-shader --all-targets -- -D warnings` passed. The same commit cherry-picks cleanly onto the #2978 stack. Its three wave-sum readback tests, including the full-width sparse-mask regression, passed on RTX 5080 and app-local WARP 1.0.22. The combined stack also passed `xtask policy`. [Full-width wave test](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2978) For the outstanding main conflict, [fast-forward `1790222`](https://github.com/steven-seagull27/VIctory/commit/1790222f943f99f911dc3e26daaf4a47d0014cc2) adds the fix and merges `63bcca43` while keeping your original commits. Its tree matches #2978’s rebased **parent** plus the modifier fix. I reran the modifier regression and all three existing conversion tests on this version as well.
github-bot force-pushed github-bot/gh-2348 from f956a6699e to fd01035095 2026-11-26 13:53:31 +00:00 Compare
Author
Owner

@⁠DenRakEiw on GitHub · 2026-11-25 11:25 UTC · original · approved these changes

Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:

  • Clean lowering of v_cvt_f32_f64 via double bitcast + FpTrunc with flags::FLOAT64 and PSV feature bit 0x1, refusing toward-zero mode (mode16 == Some(3)).
  • cargo test -p victory-shader a_64_bit_value_converts_to_f32_round_to_nearest: 1/1 passed on RTX 5090, 1/1 passed on WARP.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.

AI-assisted (Gemini 4 Neon).

**@⁠DenRakEiw** on GitHub · 2026-11-25 11:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/2348#pullrequestreview-6056746114) · **approved these changes** Verified against `origin/main` (`940d32f`) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP: - Clean lowering of `v_cvt_f32_f64` via `double` bitcast + `FpTrunc` with `flags::FLOAT64` and PSV feature bit `0x1`, refusing toward-zero mode (`mode16 == Some(3)`). - `cargo test -p victory-shader a_64_bit_value_converts_to_f32_round_to_nearest`: 1/1 passed on RTX 5090, 1/1 passed on WARP. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: 0 warnings. - `cargo xtask policy`: 183 files ok. AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 11:51 UTC · original · approved these changes

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 — v_cvt_f32_f64 lowered.

**@⁠catminou4** on GitHub · 2026-11-25 11:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/2348#pullrequestreview-6057088554) · **approved these changes** 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 — v_cvt_f32_f64 lowered.
Author
Owner

@⁠Xvania7 on GitHub · 2026-11-25 11:54 UTC · original · approved these changes

Static review and local verification of 91fa9dd:

  • Clean lowering of v_cvt_f32_f64 to dx.op.unary(80, ...) / fptrunc to float
  • emit::lower::tests:: (21 passed)
  • cargo clippy -p victory-shader --all-targets -- -D warnings: 0 warnings
  • cargo xtask policy: 182 files ok
  • CI hardware test run is verified green on GitHub Actions Windows CI.

Approving.

**@⁠Xvania7** on GitHub · 2026-11-25 11:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/2348#pullrequestreview-6057118749) · **approved these changes** Static review and local verification of `91fa9dd`: - Clean lowering of `v_cvt_f32_f64` to `dx.op.unary(80, ...)` / `fptrunc` to float - `emit::lower::tests::` (21 passed) - `cargo clippy -p victory-shader --all-targets -- -D warnings`: 0 warnings - `cargo xtask policy`: 182 files ok - CI hardware test run is verified green on GitHub Actions Windows CI. Approving.
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-26 13:53 UTC · original

Rebased on today's main. Upstream's dedicated v_cvt_f32_u32 arm is kept, u32 is dropped from the shared arm, and the v_cvt_f32_f64 arm now sits before it. Both tests are kept.

**@⁠Calvix2k** on GitHub · 2026-11-26 13:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/2348#issuecomment-7193974394) Rebased on today's main. Upstream's dedicated `v_cvt_f32_u32` arm is kept, `u32` is dropped from the shared arm, and the `v_cvt_f32_f64` arm now sits before it. Both tests are kept.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2348/head:github-bot/gh-2348'
git switch 'github-bot/gh-2348'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2348'
git switch 'github-bot/gh-2348'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2348'
git switch 'github-bot/gh-2348'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2348'
git switch 'main'
git merge --squash 'github-bot/gh-2348'
git switch 'main'
git merge --ff-only 'github-bot/gh-2348'
git switch 'main'
git merge 'github-bot/gh-2348'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2348
No description provided.