Shaders: v_cvt_rpi_i32_f32 rounds the exact sum; v_cvt_flr/rpi_i32_f32 saturate a NaN by its sign #605

Closed
github-bot wants to merge 2 commits from gh-pr/605/head into gh-pr/605/base
Owner

@⁠upipibi on GitHub · 2026-11-24 05:27 UTC · original
upipibi:fix/cvt-flr-rpi → main · +127 −8 · 2 files · 2 commits · closed without merging

Branch victory-fix/cvt-flr-rpi, two commits on main d2a4bae. The second (NaN) can be dropped without the first.

What

crates/victory-shader/src/emit/lower.rs, the v_cvt_*_i32_f32 arm:

  1. v_cvt_rpi_i32_f32 rounding (commit 1). The lowering added 0.5 as an f32, then floored. The f32 sum rounds to even before the floor, so:

    • 0x3EFFFFFF (0.5 - 2^-25) gave 1, where the nearest integer is 0;
    • 0x4B000001 (2^23 + 1) gave 0x00800002, and every odd integer from 2^23 to 2^24 gave the even one above it.

    It now floors first and adds 1 when x - floor(x) >= 0.5. That difference is exact in f32, so no rounding is left.

  2. NaN (commit 2). v_cvt_flr_i32_f32 and v_cvt_rpi_i32_f32 gave 0 for a NaN (the host's fptosi). They now give 0x7FFFFFFF for a positive and 0x80000000 for a negative NaN, tested on the operand's bits. v_cvt_i32_f32 and v_cvt_u32_f32 are unchanged (NaN gives 0).

Measured on RDNA2 since: @⁠Lyrnc ran both opcodes on an RDNA2 GPU (gfx1036, AMD driver 32.0.21042.62), 43 inputs under all four FLOAT_MODE settings (comment). Rounding: floor of the exact x + 0.5 matches 43/43; the f32-sum model misses exactly the six rows commit 1 targets. NaN: rpi and flr give 0x7fffffff / 0x80000000 by the NaN's sign, quiet or signalling, 43/43; v_cvt_i32_f32 keeps NaN → 0. Only flr of a negative denormal depends on the mode, which is why that case is not in the tests.

Why

Rounding. RDNA2 ISA (30-November-2020), 12.8 "VOP1 Instructions", opcode 12, p. 138:

V_CVT_RPI_I32_F32 Convert from a single-precision float to a signed integer, round to nearest integer. 0.5ULP accuracy, denormals are supported. D.i = (int)floor(S0.f + 0.5).

"Round to nearest integer" of 0.49999997 is 0 and of 8388609 is 8388609; a float sum that rounds first is off by one there.

Against this reading: LLVM's selection pattern (llvm/lib/Target/AMDGPU/AMDGPUInstructions.td, cvt_rpi_i32_f32 = fp_to_sint (ffloor_nnan (fadd $src, fpimm_half))) is written with an f32 add, i.e. it treats the instruction as the rounded sum. I took the ISA's "nearest integer, 0.5ULP" as deciding. No AMD hardware was measured.

NaN. Three sources; none states the values as numbers:

  • RDNA2 ISA, same page: "NaN is converted to 0" is written for V_CVT_U32_F32 (opcode 7) and V_CVT_I32_F32 (opcode 8) only. Opcodes 12 and 13 have no such sentence.
  • AMD GCN3 ISA reference rev 1.1, pp. 12-92 (V_CVT_FLR_I32_F32) and 12-95 (V_CVT_RPI_I32_F32), the same two opcodes: "Float magnitudes too great to be represented by an integer float (unbiased exponent > 30) saturate to max_int or -max_int." On p. 12-93 V_CVT_I32_F32 has the same sentence plus a special-case table with "NaN & -NaN & 0 & -0 -> 0"; FLR and RPI have no such table. A NaN's unbiased exponent is 128.
  • LLVM commit 08ad328ae2 (2015-01-31): "R600/SI: Only select cvt_flr/cvt_rpi with no NaNs. These have different behavior from cvt_i32_f32 on NaN." Still so today (ffloor_nnan in the pattern above).

So "not 0" is stated (LLVM). "By sign, to the largest or smallest integer" is my reading of the GCN3 sentence, and -max_int is taken as 0x80000000. If documented-only behaviour is preferred, drop commit 2.

Where the expected values come from

Test Values from
v_cvt_rpi_i32_f32_rounds_to_nearest the ISA's formula evaluated exactly, by hand (not from the code)
v_cvt_flr_i32_f32_rounds_down the ISA's formula, by hand
v_cvt_flr_and_rpi_i32_f32_saturate_nan_by_sign the GCN3 text and the LLVM note above; since confirmed on RDNA2 hardware (see the note above)

Denormal inputs: the translator does not model the float MODE register (lower.rs: "the float MODE register is not modelled"), so this change does not depend on whether a denormal is flushed. The tests use only denormal cases whose result is the same either way (rpi of a denormal is 0).

Tests

Synthetic 1-thread compute programs from hand-written instruction words in valu_tests.rs (the existing harness: each module goes through dxil.dll validation, here the Windows SDK's, before it runs on the GPU and on WARP).

cargo test -p victory-shader -- --test-threads=1:

  • main d2a4bae: 69 passed.
  • with the tests, before the fix: 69 passed, 3 failed:
    • hardware: v_cvt_rpi_i32_f32(0x3effffff = 4.9999997e-1) = 0x00000001, want 0x00000000
    • hardware: v_cvt_rpi_i32_f32(0x7fc00000 = NaN) = 0x00000000, want 0x7fffffff
    • the flr test failed in that run only on a negative-denormal case that I removed afterwards (it assumed denormals are kept). With its present cases it is a regression guard that should pass on main; I did not re-run it there.
  • after: 72 passed, 0 failed.

cargo xtask policy: ok (151 files). cargo build -p victory and cargo build -p victory --profile diag --features diagnostics: both build; cargo clippy -p victory-shader --tests adds no warnings.

GPU: NVIDIA RTX 3070, driver 616.56, Windows 11; and WARP. These runs show what the translated DXIL computes on a host, not what an AMD GPU does.

Not in r4tedx's integration/testers tree (ca8067d), and no open PR touches these two opcodes (all 354 open PR diffs searched).

No game files were used. AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠upipibi** on GitHub · 2026-11-24 05:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/605) `upipibi:fix/cvt-flr-rpi` → `main` · +127 −8 · 2 files · 2 commits · closed without merging Branch `victory-fix/cvt-flr-rpi`, two commits on `main` `d2a4bae`. The second (NaN) can be dropped without the first. ## What `crates/victory-shader/src/emit/lower.rs`, the `v_cvt_*_i32_f32` arm: 1. **`v_cvt_rpi_i32_f32` rounding (commit 1).** The lowering added 0.5 as an f32, then floored. The f32 sum rounds to even before the floor, so: - `0x3EFFFFFF` (0.5 - 2^-25) gave 1, where the nearest integer is 0; - `0x4B000001` (2^23 + 1) gave `0x00800002`, and every odd integer from 2^23 to 2^24 gave the even one above it. It now floors first and adds 1 when `x - floor(x) >= 0.5`. That difference is exact in f32, so no rounding is left. 2. **NaN (commit 2).** `v_cvt_flr_i32_f32` and `v_cvt_rpi_i32_f32` gave 0 for a NaN (the host's `fptosi`). They now give `0x7FFFFFFF` for a positive and `0x80000000` for a negative NaN, tested on the operand's bits. `v_cvt_i32_f32` and `v_cvt_u32_f32` are unchanged (NaN gives 0). **Measured on RDNA2 since:** @⁠Lyrnc ran both opcodes on an RDNA2 GPU (gfx1036, AMD driver 32.0.21042.62), 43 inputs under all four FLOAT_MODE settings ([comment](https://git.gtahub.st/github/Marvisak--VIctory/pulls/605)). Rounding: floor of the exact `x + 0.5` matches 43/43; the f32-sum model misses exactly the six rows commit 1 targets. NaN: `rpi` and `flr` give `0x7fffffff` / `0x80000000` by the NaN's sign, quiet or signalling, 43/43; `v_cvt_i32_f32` keeps NaN → 0. Only `flr` of a negative denormal depends on the mode, which is why that case is not in the tests. ## Why **Rounding.** RDNA2 ISA (30-November-2020), 12.8 "VOP1 Instructions", opcode 12, p. 138: > V_CVT_RPI_I32_F32 Convert from a single-precision float to a signed integer, round to nearest integer. 0.5ULP accuracy, denormals are supported. D.i = (int)floor(S0.f + 0.5). "Round to nearest integer" of 0.49999997 is 0 and of 8388609 is 8388609; a float sum that rounds first is off by one there. Against this reading: LLVM's selection pattern (`llvm/lib/Target/AMDGPU/AMDGPUInstructions.td`, `cvt_rpi_i32_f32` = `fp_to_sint (ffloor_nnan (fadd $src, fpimm_half))`) is written with an f32 add, i.e. it treats the instruction as the rounded sum. I took the ISA's "nearest integer, 0.5ULP" as deciding. No AMD hardware was measured. **NaN.** Three sources; none states the values as numbers: - RDNA2 ISA, same page: "NaN is converted to 0" is written for `V_CVT_U32_F32` (opcode 7) and `V_CVT_I32_F32` (opcode 8) only. Opcodes 12 and 13 have no such sentence. - AMD GCN3 ISA reference rev 1.1, pp. 12-92 (`V_CVT_FLR_I32_F32`) and 12-95 (`V_CVT_RPI_I32_F32`), the same two opcodes: "Float magnitudes too great to be represented by an integer float (unbiased exponent > 30) saturate to max_int or -max_int." On p. 12-93 `V_CVT_I32_F32` has the same sentence plus a special-case table with "NaN & -NaN & 0 & -0 -> 0"; FLR and RPI have no such table. A NaN's unbiased exponent is 128. - LLVM commit `08ad328ae2` (2015-01-31): "R600/SI: Only select cvt_flr/cvt_rpi with no NaNs. These have different behavior from cvt_i32_f32 on NaN." Still so today (`ffloor_nnan` in the pattern above). So "not 0" is stated (LLVM). "By sign, to the largest or smallest integer" is my reading of the GCN3 sentence, and `-max_int` is taken as `0x80000000`. If documented-only behaviour is preferred, drop commit 2. ## Where the expected values come from | Test | Values from | |---|---| | `v_cvt_rpi_i32_f32_rounds_to_nearest` | the ISA's formula evaluated exactly, by hand (not from the code) | | `v_cvt_flr_i32_f32_rounds_down` | the ISA's formula, by hand | | `v_cvt_flr_and_rpi_i32_f32_saturate_nan_by_sign` | the GCN3 text and the LLVM note above; since confirmed on RDNA2 hardware (see the note above) | Denormal inputs: the translator does not model the float MODE register (`lower.rs`: "the float MODE register is not modelled"), so this change does not depend on whether a denormal is flushed. The tests use only denormal cases whose result is the same either way (rpi of a denormal is 0). ## Tests Synthetic 1-thread compute programs from hand-written instruction words in `valu_tests.rs` (the existing harness: each module goes through `dxil.dll` validation, here the Windows SDK's, before it runs on the GPU and on WARP). `cargo test -p victory-shader -- --test-threads=1`: - `main` `d2a4bae`: 69 passed. - with the tests, before the fix: 69 passed, 3 failed: - `hardware: v_cvt_rpi_i32_f32(0x3effffff = 4.9999997e-1) = 0x00000001, want 0x00000000` - `hardware: v_cvt_rpi_i32_f32(0x7fc00000 = NaN) = 0x00000000, want 0x7fffffff` - the flr test failed in that run only on a negative-denormal case that I removed afterwards (it assumed denormals are kept). With its present cases it is a regression guard that should pass on `main`; I did not re-run it there. - after: 72 passed, 0 failed. `cargo xtask policy`: ok (151 files). `cargo build -p victory` and `cargo build -p victory --profile diag --features diagnostics`: both build; `cargo clippy -p victory-shader --tests` adds no warnings. GPU: NVIDIA RTX 3070, driver 616.56, Windows 11; and WARP. These runs show what the translated DXIL computes on a host, not what an AMD GPU does. Not in r4tedx's `integration/testers` tree (`ca8067d`), and no open PR touches these two opcodes (all 354 open PR diffs searched). No game files were used. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The ISA gives v_cvt_rpi_i32_f32 as "round to nearest integer, 0.5ULP
accuracy", D.i = (int)floor(S0.f + 0.5). The lowering added 0.5 as a
float, which rounds the sum to even before the floor: 0.5 - 2^-25 gave
1, and odd integers from 2^23 up gave the next even one.

It now floors first and goes one up when x - floor(x), which is exact,
is at least a half. Two synthetic GPU tests: the rpi one fails before
(0x3effffff gives 1), the flr one passes before and after.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Only v_cvt_i32_f32 and v_cvt_u32_f32 are documented to convert a NaN to
0. AMD's GCN3 reference gives these two no such special case, only
"Float magnitudes too great to be represented by an integer float
(unbiased exponent > 30) saturate to max_int or -max_int", and LLVM
selects them only without NaNs because they "have different behavior
from cvt_i32_f32 on NaN" (llvm 08ad328ae2). The host's conversion gave
0.

Not measured on AMD hardware: the values follow from the documents.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:09:46 +00:00
github-bot closed this pull request 2026-11-26 04:09:46 +00:00
Author
Owner

@⁠Lyrnc on GitHub · 2026-11-24 05:49 UTC · original · edited 2026-11-24 05:52 UTC

RDNA2 hardware measurement of both commits (the description notes that no AMD hardware was measured): both match the hardware.

Setup. AMD Radeon iGPU of a Ryzen 7 9800X3D, gfx1036 (RDNA2), AMD driver 32.0.21042.62, Windows 11 Pro 26200. Hand-written v_cvt_rpi_i32_f32, v_cvt_flr_i32_f32, and for reference v_cvt_i32_f32 / v_cvt_u32_f32, in a HIP kernel (assembled by the AMD driver's amd_comgr), 43 inputs, each run under four FLOAT_MODE settings: f32 denormals flushed or kept, times IEEE mode off or on. RDNA2 desktop silicon, not the console's. No game data.

Input Value rpi flr i32
0x3effffff 0.49999997 0x00000000 0x00000000 0x00000000
0x3f000000 0.5 0x00000001 0x00000000 0x00000000
0xbf000000 -0.5 0x00000000 0xffffffff 0x00000000
0xbf000001 -0.50000006 0xffffffff 0xffffffff 0x00000000
0x4b000001 8388609 0x00800001 0x00800001 0x00800001
0x4b000003 8388611 0x00800003 0x00800003 0x00800003
0x4b7fffff 16777215 0x00ffffff 0x00ffffff 0x00ffffff
0xcb000001 -8388609 0xff7fffff 0xff7fffff 0xff7fffff
0x4f000000 2^31 0x7fffffff 0x7fffffff 0x7fffffff
0xcf000000 -2^31 0x80000000 0x80000000 0x80000000
0x7f800000 +inf 0x7fffffff 0x7fffffff 0x7fffffff
0xff800000 -inf 0x80000000 0x80000000 0x80000000
0x7fc00000 +NaN 0x7fffffff 0x7fffffff 0x00000000
0xffc00000 -NaN 0x80000000 0x80000000 0x00000000
0x7f800001 +sNaN 0x7fffffff 0x7fffffff 0x00000000
0xffffffff -NaN 0x80000000 0x80000000 0x00000000

Model fit over all 43 inputs, in every mode:

  • Rounding (commit 1). rpi = floor of the exact x + 0.5: 43/43. The f32-sum model (main's lowering, and LLVM's fadd pattern): 37/43, wrong on exactly the six rows the commit targets (0x3effffff, ±(2^23 + 1), 2^23 + 3, ±(2^24 - 1)).
  • NaN (commit 2). rpi and flr give 0x7fffffff for a positive NaN and 0x80000000 for a negative one, quiet or signalling: 43/43 for both. "NaN gives 0" fails the six NaN rows. v_cvt_i32_f32 gives 0 for every NaN, as main assumes. So -max_int is indeed 0x80000000.

The only rows that change with the mode are the negative denormals (0x80000001, 0x807fffff) through flr: 0x00000000 with f32 denormals flushed, 0xffffffff with them kept. That is the case you dropped from the flr test because it assumed denormals are kept; the hardware confirms it depends on MODE, so dropping it was right.

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.

**@⁠Lyrnc** on GitHub · 2026-11-24 05:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/605#issuecomment-7123302580) · edited 2026-11-24 05:52 UTC RDNA2 hardware measurement of both commits (the description notes that no AMD hardware was measured): **both match the hardware.** **Setup.** AMD Radeon iGPU of a Ryzen 7 9800X3D, **gfx1036 (RDNA2)**, AMD driver 32.0.21042.62, Windows 11 Pro 26200. Hand-written `v_cvt_rpi_i32_f32`, `v_cvt_flr_i32_f32`, and for reference `v_cvt_i32_f32` / `v_cvt_u32_f32`, in a HIP kernel (assembled by the AMD driver's amd_comgr), 43 inputs, each run under four FLOAT_MODE settings: f32 denormals flushed or kept, times IEEE mode off or on. RDNA2 desktop silicon, not the console's. No game data. | Input | Value | `rpi` | `flr` | `i32` | |---|---|---|---|---| | `0x3effffff` | 0.49999997 | `0x00000000` | `0x00000000` | `0x00000000` | | `0x3f000000` | 0.5 | `0x00000001` | `0x00000000` | `0x00000000` | | `0xbf000000` | -0.5 | `0x00000000` | `0xffffffff` | `0x00000000` | | `0xbf000001` | -0.50000006 | `0xffffffff` | `0xffffffff` | `0x00000000` | | `0x4b000001` | 8388609 | `0x00800001` | `0x00800001` | `0x00800001` | | `0x4b000003` | 8388611 | `0x00800003` | `0x00800003` | `0x00800003` | | `0x4b7fffff` | 16777215 | `0x00ffffff` | `0x00ffffff` | `0x00ffffff` | | `0xcb000001` | -8388609 | `0xff7fffff` | `0xff7fffff` | `0xff7fffff` | | `0x4f000000` | 2^31 | `0x7fffffff` | `0x7fffffff` | `0x7fffffff` | | `0xcf000000` | -2^31 | `0x80000000` | `0x80000000` | `0x80000000` | | `0x7f800000` | +inf | `0x7fffffff` | `0x7fffffff` | `0x7fffffff` | | `0xff800000` | -inf | `0x80000000` | `0x80000000` | `0x80000000` | | `0x7fc00000` | +NaN | `0x7fffffff` | `0x7fffffff` | `0x00000000` | | `0xffc00000` | -NaN | `0x80000000` | `0x80000000` | `0x00000000` | | `0x7f800001` | +sNaN | `0x7fffffff` | `0x7fffffff` | `0x00000000` | | `0xffffffff` | -NaN | `0x80000000` | `0x80000000` | `0x00000000` | Model fit over all 43 inputs, in every mode: - **Rounding (commit 1).** `rpi` = floor of the exact `x + 0.5`: 43/43. The f32-sum model (`main`'s lowering, and LLVM's `fadd` pattern): 37/43, wrong on exactly the six rows the commit targets (`0x3effffff`, `±(2^23 + 1)`, `2^23 + 3`, `±(2^24 - 1)`). - **NaN (commit 2).** `rpi` and `flr` give `0x7fffffff` for a positive NaN and `0x80000000` for a negative one, quiet or signalling: 43/43 for both. "NaN gives 0" fails the six NaN rows. `v_cvt_i32_f32` gives 0 for every NaN, as `main` assumes. So `-max_int` is indeed `0x80000000`. The only rows that change with the mode are the negative denormals (`0x80000001`, `0x807fffff`) through `flr`: `0x00000000` with f32 denormals flushed, `0xffffffff` with them kept. That is the case you dropped from the flr test because it assumed denormals are kept; the hardware confirms it depends on MODE, so dropping it was right. 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.
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 05:54 UTC · original

Thanks @⁠Lyrnc, that settles both commits. I added your measurement to the description, and the test values now have hardware behind them, not just the documents. The negative-denormal flr case stays out of the tests, since it depends on the mode as you showed.

**@⁠upipibi** on GitHub · 2026-11-24 05:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/605#issuecomment-7123391572) Thanks @⁠Lyrnc, that settles both commits. I added your measurement to the description, and the test values now have hardware behind them, not just the documents. The negative-denormal `flr` case stays out of the tests, since it depends on the mode as you showed.
Author
Owner

@⁠Lyrnc on GitHub · 2026-11-24 06:59 UTC · original

Follow-up from a differential check of the translator against the gfx1036 hardware (121 VALU opcodes as raw VOP3 words, 220 inputs, translator on the Radeon iGPU as host): v_cvt_rpi_i32_f32 and v_cvt_flr_i32_f32 differ from the hardware in 6 of 220 cases each on main, all of them NaN inputs (0 where the hardware gives 0x7fffffff / 0x80000000). With this PR both are 0 of 220, and no other opcode changes.

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

**@⁠Lyrnc** on GitHub · 2026-11-24 06:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/605#issuecomment-7124499714) Follow-up from a differential check of the translator against the gfx1036 hardware (121 VALU opcodes as raw VOP3 words, 220 inputs, translator on the Radeon iGPU as host): `v_cvt_rpi_i32_f32` and `v_cvt_flr_i32_f32` differ from the hardware in 6 of 220 cases each on `main`, all of them NaN inputs (`0` where the hardware gives `0x7fffffff` / `0x80000000`). **With this PR both are 0 of 220**, and no other opcode changes. AI use: Claude Code (Claude Opus 5.5) ran the check and drafted this comment.
Author
Owner

@⁠slint6614-dev on GitHub · 2026-11-24 10:16 UTC · original

AMD hardware check, Windows 11, Adrenalin driver: RX 9070 (RDNA4) and Ryzen 9600X iGPU (RDNA2, gfx1036), each picked as the hardware device of run_cases (local adapter-selection patch, not part of this PR); cargo test -p victory-shader --release valu_tests at the PR head. Negative control: the PR's non-test files reverted to its merge base, its new tests kept.

  • With this PR, all three new tests pass on both AMD GPUs.
  • Negative control: v_cvt_rpi_i32_f32_rounds_to_nearest and v_cvt_flr_and_rpi_i32_f32_saturate_nan_by_sign fail on both GPUs without the fix, so the tests do catch the change on AMD hardware.
  • v_cvt_flr_i32_f32_rounds_down also passes without the fix (main already floors correctly), so it guards against regressions but does not exercise this change.
**@⁠slint6614-dev** on GitHub · 2026-11-24 10:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/605#issuecomment-7128561780) AMD hardware check, Windows 11, Adrenalin driver: RX 9070 (RDNA4) and Ryzen 9600X iGPU (RDNA2, gfx1036), each picked as the hardware device of `run_cases` (local adapter-selection patch, not part of this PR); `cargo test -p victory-shader --release valu_tests` at the PR head. Negative control: the PR's non-test files reverted to its merge base, its new tests kept. - With this PR, all three new tests pass on both AMD GPUs. - Negative control: `v_cvt_rpi_i32_f32_rounds_to_nearest` and `v_cvt_flr_and_rpi_i32_f32_saturate_nan_by_sign` fail on both GPUs without the fix, so the tests do catch the change on AMD hardware. - `v_cvt_flr_i32_f32_rounds_down` also passes without the fix (main already floors correctly), so it guards against regressions but does not exercise this change.
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 10:45 UTC · original · edited 2026-11-24 13:07 UTC

Rebased onto main ffe310e (conflicts only in appended tests in valu_tests.rs; the change itself is unchanged) and pushed: new head e7f5738. cargo test -p victory-shader -- --test-threads=1 gives 123 passed, 0 failed, 1 ignored on an RTX 3070 (driver 616.56), and cargo build -p victory plus the diag build are clean. Thanks @⁠slint6614-dev for the AMD runs with the negative control.

AI-assisted (Claude Code).

**@⁠upipibi** on GitHub · 2026-11-24 10:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/605#issuecomment-7129194014) · edited 2026-11-24 13:07 UTC Rebased onto `main` `ffe310e` (conflicts only in appended tests in `valu_tests.rs`; the change itself is unchanged) and pushed: new head `e7f5738`. `cargo test -p victory-shader -- --test-threads=1` gives 123 passed, 0 failed, 1 ignored on an RTX 3070 (driver 616.56), and `cargo build -p victory` plus the diag build are clean. Thanks @⁠slint6614-dev for the AMD runs with the negative control. AI-assisted (Claude Code).
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 23:32 UTC · original

Closing as superseded: main now has both parts of this, from 77053a0 ("accuracy fixes for discards, f16 rounding, denormals, med3 and signed zeros"). v_cvt_rpi_i32_f32 adds the half exactly (floor of x + 0.5 via x − floor(x)), and v_cvt_flr/rpi_i32_f32 saturate a NaN by its sign. Thanks to Lyrnc and slint6614-dev for the earlier runs here.

**@⁠upipibi** on GitHub · 2026-11-24 23:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/605#issuecomment-7147521242) Closing as superseded: `main` now has both parts of this, from 77053a0 ("accuracy fixes for discards, f16 rounding, denormals, med3 and signed zeros"). `v_cvt_rpi_i32_f32` adds the half exactly (floor of x + 0.5 via x − floor(x)), and `v_cvt_flr/rpi_i32_f32` saturate a NaN by its sign. Thanks to Lyrnc and slint6614-dev for the earlier runs here.

Pull request closed

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!605
No description provided.