Shaders: round v_exp_f16 once at its double-rounding midpoint #3609

Open
Moon0755 wants to merge 1 commit from upstream-pr/3609 into main
Moon0755 commented 2026-11-27 20:51:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Moon0755 on 2026-11-27T20:51:02Z.


On RDNA2 (full 65,536-input sweep on RX 6700 XT / gfx1031 and matching counts on gfx1036 in Leonida docs/design.md), v_exp_f16 is correctly rounded on every non-NaN input. Lowering through f32 Exp and narrowing back to f16 double-rounds on one finite input: 0x11c5 (0.0007042884826660156), where exact 2^x \approx 1.0004882947531497 is strictly above the 0x3c00/0x3c01 midpoint (1.00048828125), while the nearest f32 (0x3f801000) lands on that exact midpoint and ties-to-even down to 0x3c00 instead of 0x3c01.

Changes

  • crates/victory-shader/src/emit/lower.rs (Lower::valu v_exp_f16, 521,301 bytes / +738 vs main, 2,987 bytes below the 524,288 limit):
    • After reading a = self.half_fsrc(inst, 0)? (post-abs/neg) and emitting unary(21, a), select widened 0x3f802000 (f16 0x3c01) when a == 0x3a38a000 (f16 0x11c5), before output modifiers and f16 narrowing.
  • crates/victory-shader/src/emit/valu_tests.rs:
    • Added v_exp_f16_rounds_the_exact_result_once testing 0x0000 -> 0x3c00, 0xbc00 -> 0x3800, and 0x11c5 -> 0x3c01.

Verification

  • Fork CI control (test only on main): https://github.com/Moon0755/VIctory/actions/runs/46063683100 (failure — 302 passed, 1 failed solely on v_exp_f16_rounds_the_exact_result_once: left=15360 (0x3c00), right=15361 (0x3c01))
  • Fork CI fix (devin/ci-exp-f16-rounding): https://github.com/Moon0755/VIctory/actions/runs/46063917357 (success — 303 passed / 0 failed, Clippy + diagnostics Clippy clean, asset policy: 191 files ok)
  • Local verification (3e6a6f5): v_exp_f16_rounds_the_exact_result_once (1/1, hardware + WARP), both Clippy configs, and cargo xtask policy (191 files ok) clean.
  • Not tested: gfx1013 native hardware measurement, non-midpoint host Exp ULP accuracy, NaN/denormal/MODE interactions (#3365), dxil.dll 1.7, game files. Synthetic tests only (AI-assisted).

— Devin & Neon

<!-- greyfinch-sync:Marvisak/VIctory:issue:5532932861 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3609). Originally posted by [Moon0755](https://github.com/Moon0755) on 2026-11-27T20:51:02Z. --- On RDNA2 (full 65,536-input sweep on RX 6700 XT / `gfx1031` and matching counts on `gfx1036` in Leonida `docs/design.md`), `v_exp_f16` is correctly rounded on every non-NaN input. Lowering through f32 `Exp` and narrowing back to f16 double-rounds on one finite input: `0x11c5` (`0.0007042884826660156`), where exact $2^x \approx 1.0004882947531497$ is strictly above the `0x3c00`/`0x3c01` midpoint (`1.00048828125`), while the nearest f32 (`0x3f801000`) lands on that exact midpoint and ties-to-even down to `0x3c00` instead of `0x3c01`. ### Changes - **`crates/victory-shader/src/emit/lower.rs`** (`Lower::valu` `v_exp_f16`, `521,301` bytes / `+738` vs `main`, `2,987` bytes below the `524,288` limit): - After reading `a = self.half_fsrc(inst, 0)?` (post-`abs`/`neg`) and emitting `unary(21, a)`, select widened `0x3f802000` (f16 `0x3c01`) when `a == 0x3a38a000` (f16 `0x11c5`), before output modifiers and f16 narrowing. - **`crates/victory-shader/src/emit/valu_tests.rs`**: - Added `v_exp_f16_rounds_the_exact_result_once` testing `0x0000 -> 0x3c00`, `0xbc00 -> 0x3800`, and `0x11c5 -> 0x3c01`. ### Verification - **Fork CI control** (test only on `main`): https://github.com/Moon0755/VIctory/actions/runs/46063683100 (`failure` — 302 passed, 1 failed solely on `v_exp_f16_rounds_the_exact_result_once`: `left=15360` (`0x3c00`), `right=15361` (`0x3c01`)) - **Fork CI fix** (`devin/ci-exp-f16-rounding`): https://github.com/Moon0755/VIctory/actions/runs/46063917357 (`success` — 303 passed / 0 failed, Clippy + diagnostics Clippy clean, `asset policy: 191 files ok`) - **Local verification** (`3e6a6f5`): `v_exp_f16_rounds_the_exact_result_once` (`1/1`, hardware + WARP), both Clippy configs, and `cargo xtask policy` (`191 files ok`) clean. - **Not tested**: `gfx1013` native hardware measurement, non-midpoint host `Exp` ULP accuracy, NaN/denormal/MODE interactions (`#3365`), `dxil.dll` 1.7, game files. Synthetic tests only (AI-assisted). — Devin & Neon
andrewpozdnakov7-jpg commented 2026-11-27 21:14:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T21:14:46Z.


I found a round-to-zero regression at the same midpoint on 3e6a6f5. With FP16 MODE set to toward zero, the translated shader returns 0x3c01 for v_exp_f16(0x11c5). Main returns 0x3c00 in that mode. In nearest-even mode, the PR correctly gives 0x3c01 where main gives 0x3c00.

The follow-up selects the f32 immediately above the midpoint (0x3f801001), still below the upper half. The existing narrow16 can then return 0x3c01 in nearest-even mode and 0x3c00 in round-to-zero mode. Follow-up 25ce885

All 32 readbacks passed across the two harness paths, both forced to app-local WARP 1.0.22. The fixture checks plain, abs, neg and clamp forms, with a zero-input control. A separate lowering check confirmed that the three output scales remain unsupported. All 37 VALU tests, strict shader Clippy and the asset policy passed.

Could you confirm the midpoint with explicit FP16 MODE 0 and 3 on the RX 6700 XT used for the native sweep? This report covers VIctory's translated DXIL on WARP. Please retain the Git author when taking the follow-up, or use Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding it into the PR commit. AI-assisted with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7228268603 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3609#issuecomment-7228268603). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-27T21:14:46Z. --- I found a round-to-zero regression at the same midpoint on `3e6a6f5`. With FP16 MODE set to toward zero, the translated shader returns `0x3c01` for `v_exp_f16(0x11c5)`. Main returns `0x3c00` in that mode. In nearest-even mode, the PR correctly gives `0x3c01` where main gives `0x3c00`. The follow-up selects the f32 immediately above the midpoint (`0x3f801001`), still below the upper half. The existing `narrow16` can then return `0x3c01` in nearest-even mode and `0x3c00` in round-to-zero mode. [Follow-up `25ce885`](https://github.com/andrewpozdnakov7-jpg/VIctory/tree/review/exp-f16-midpoint-rtz) All 32 readbacks passed across the two harness paths, both forced to app-local WARP 1.0.22. The fixture checks plain, abs, neg and clamp forms, with a zero-input control. A separate lowering check confirmed that the three output scales remain unsupported. All 37 VALU tests, strict shader Clippy and the asset policy passed. Could you confirm the midpoint with explicit FP16 MODE 0 and 3 on the RX 6700 XT used for the native sweep? This report covers VIctory's translated DXIL on WARP. Please retain the Git author when taking the follow-up, or use `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding it into the PR commit. AI-assisted with Codex.
oni-swr commented 2026-11-27 21:15:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-27T21:15:22Z.


Verification of #3609: PASS, with a file-size caveat.

Environment: native Windows 11, WARP only (no hardware GPU; VICTORY_WARP=1, VICTORY_D3D12_WARP=1, dxil.dll). AI-assisted (Claude).

  • Head 3e6a6f50 is unchanged. It merges onto main 63bcca43 with no conflicts.
  • cargo test -p victory-shader --lib:
    • base: 298 passed, 4 failed, 3 ignored.
    • head: 299 passed, 4 failed, 3 ignored.
    • The same 4 emit::synthetic_tests fail on both, so they are not caused by this PR. Three say "no pipeline for a wave of 32", which WARP cannot run. gathers_at_a_level_match_the_hardware fails on a lane mismatch.
    • The one extra pass is the new test.
  • Control: I applied only the new test to base. It fails there with v_exp_f16(0x11c5) = 0x3c00, want 0x3c01. It passes on head.
  • cargo clippy -p victory-shader --all-targets -- -D warnings on head: clean.
  • Exhaustive sweep: I ran all 65,536 f16 inputs through the shader on WARP, on base and on head. A temporary test did this, and I did not commit it.
    • Base and head differ at exactly one input, 0x11c5 (0x3c00 -> 0x3c01).
    • I compared head against a correctly rounded 2^x table computed with mpmath at 300-bit precision, for every non-NaN input. There are 0 mismatches.
    • The same mpmath analysis finds 0x11c5 is the only input where rounding the exact result via f32 differs from rounding it once.
    • So the fix is a hard-coded special case that covers the whole defect and leaves every other input unchanged.
    • It costs one compare and one select. The comment in the diff reads slightly oddly ("round the exact result up, not the f32 midpoint tie down"), but the code is correct.
  • Size caveat: lower.rs is 521,301 bytes alone, which is fine. It adds 738 bytes.
    • Merged on main with #3597, #3602, #3587 and #3600, the file is 524,409 bytes. That is 121 bytes over the 524,288 limit, so it would need a small offset.
    • Merged with #3608 on main alone, it is 524,676 bytes, 388 over.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7228278099 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3609#issuecomment-7228278099). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-27T21:15:22Z. --- **Verification of #3609: PASS, with a file-size caveat.** Environment: native Windows 11, WARP only (no hardware GPU; `VICTORY_WARP=1`, `VICTORY_D3D12_WARP=1`, dxil.dll). AI-assisted (Claude). - Head 3e6a6f50 is unchanged. It merges onto main 63bcca43 with no conflicts. - `cargo test -p victory-shader --lib`: - base: 298 passed, 4 failed, 3 ignored. - head: 299 passed, 4 failed, 3 ignored. - The same 4 `emit::synthetic_tests` fail on both, so they are not caused by this PR. Three say "no pipeline for a wave of 32", which WARP cannot run. `gathers_at_a_level_match_the_hardware` fails on a lane mismatch. - The one extra pass is the new test. - Control: I applied only the new test to base. It fails there with `v_exp_f16(0x11c5) = 0x3c00, want 0x3c01`. It passes on head. - `cargo clippy -p victory-shader --all-targets -- -D warnings` on head: clean. - Exhaustive sweep: I ran all 65,536 f16 inputs through the shader on WARP, on base and on head. A temporary test did this, and I did not commit it. - Base and head differ at exactly one input, 0x11c5 (0x3c00 -> 0x3c01). - I compared head against a correctly rounded 2^x table computed with mpmath at 300-bit precision, for every non-NaN input. There are 0 mismatches. - The same mpmath analysis finds 0x11c5 is the only input where rounding the exact result via f32 differs from rounding it once. - So the fix is a hard-coded special case that covers the whole defect and leaves every other input unchanged. - It costs one compare and one select. The comment in the diff reads slightly oddly ("round the exact result up, not the f32 midpoint tie down"), but the code is correct. - **Size caveat:** `lower.rs` is 521,301 bytes alone, which is fine. It adds 738 bytes. - Merged on main with #3597, #3602, #3587 and #3600, the file is 524,409 bytes. That is 121 bytes over the 524,288 limit, so it would need a small offset. - Merged with #3608 on main alone, it is 524,676 bytes, 388 over.
Moon0755 commented 2026-11-27 21:39:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Moon0755 on 2026-11-27T21:39:38Z.


@andrewpozdnakov7-jpg Thank you for catching the round-to-zero regression and sharing 25ce885!

I pushed a follow-up commit (c444dff, with Co-authored-by: andrewpozdnakov7-jpg <[email protected]>) that switches the 0x11c5 nudge to 0x3F80_1001 and adds v_exp_f16_midpoint_preserves_round_to_zero. Verified locally across all three D3D12 hosts (AMD Radeon(TM) Graphics, NVIDIA GeForce RTX 2060 with Max-Q Design, and WARP: 32 readbacks, wrong=[0, 0]), cargo xtask policy (191 files ok), both Clippy targets, and PR CI (run 46070263747 — SUCCESS).

On your RX 6700 XT question: we do not have an RX 6700 XT locally (the 0x11c5 hardware sweep comes from the Leonida project's published RX 6700 XT data, which did not publish separate explicit MODE = 3 sweeps). Mathematically, 2^(0x11c5) lies strictly between 1 + 2^-11 (0x3f801000) and 1 + 2^-10 (0x3f802000), so round-to-zero of the exact result is strictly 0x3c00 and 0x3F80_1001 preserves both modes.

@oni-swr Thanks for the exhaustive 65,536-input mpmath verification! We also tightened the comment in lower.rs, bringing its size down from 521,301 B to 521,110 B (-191 B).

— Neon

<!-- greyfinch-sync:Marvisak/VIctory:comment:7228642497 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3609#issuecomment-7228642497). Originally posted by [Moon0755](https://github.com/Moon0755) on 2026-11-27T21:39:38Z. --- @andrewpozdnakov7-jpg Thank you for catching the round-to-zero regression and sharing `25ce885`! I pushed a follow-up commit (`c444dff`, with `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`) that switches the `0x11c5` nudge to `0x3F80_1001` and adds `v_exp_f16_midpoint_preserves_round_to_zero`. Verified locally across all three D3D12 hosts (`AMD Radeon(TM) Graphics`, `NVIDIA GeForce RTX 2060 with Max-Q Design`, and `WARP`: `32 readbacks, wrong=[0, 0]`), `cargo xtask policy` (`191 files ok`), both Clippy targets, and PR CI ([run 46070263747](https://github.com/Marvisak/VIctory/actions/runs/46070263747) — `SUCCESS`). On your RX 6700 XT question: we do not have an RX 6700 XT locally (the `0x11c5` hardware sweep comes from the Leonida project's published RX 6700 XT data, which did not publish separate explicit `MODE = 3` sweeps). Mathematically, `2^(0x11c5)` lies strictly between `1 + 2^-11` (`0x3f801000`) and `1 + 2^-10` (`0x3f802000`), so round-to-zero of the exact result is strictly `0x3c00` and `0x3F80_1001` preserves both modes. @oni-swr Thanks for the exhaustive 65,536-input `mpmath` verification! We also tightened the comment in `lower.rs`, bringing its size down from `521,301 B` to `521,110 B` (`-191 B`). — Neon
andrewpozdnakov7-jpg commented 2026-11-27 22:25:33 +00:00 (Migrated from github.com)

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


@Moon0755 I checked the native sweep again and need to correct my earlier round-to-zero expectation. The published RX 6700 XT run includes keep16_rtz with the FP16 rounding field set to 3, and its harness reads back MODE before the sweep. It reports identical results under the two rounding settings for all seven FP16 transcendental instructions, including v_exp_f16. Native measurements · MODE check

#3617 adjusts the translator's rounding for those instructions. 4ccc63e combines it with your exact c444dff and keeps the midpoint correction. On app-local WARP, all 16 midpoint and control readbacks pass. The plain, abs and neg variants give 0x3c01 at the midpoint under both settings. The clamped variant and zero input give 0x3c00.

If you have access to a native gfx103x test, a direct run of the midpoint with the rounding field changed inside the kernel would complement the published sweep, which sets it in the kernel descriptor. The combined branch is available for review either way.

Please keep the Git author on a cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if the work is folded into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7229317271 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3609#issuecomment-7229317271). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-27T22:25:33Z. --- @Moon0755 I checked the native sweep again and need to correct my earlier round-to-zero expectation. The published RX 6700 XT run includes `keep16_rtz` with the FP16 rounding field set to 3, and its harness reads back MODE before the sweep. It reports identical results under the two rounding settings for all seven FP16 transcendental instructions, including `v_exp_f16`. [Native measurements](https://github.com/ubiquitarianism/leonida/blob/a73a57e1339be072baf5522351c8ec7f1482b56b/docs/shader_validation.md#L1360-L1425) · [MODE check](https://github.com/ubiquitarianism/leonida/blob/a73a57e1339be072baf5522351c8ec7f1482b56b/tools/f16_trans_sweep.py#L220-L241) #3617 adjusts the translator's rounding for those instructions. [`4ccc63e`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/4ccc63e54222acc47718686f6994bddb22c8e476) combines it with your exact `c444dff` and keeps the midpoint correction. On app-local WARP, all 16 midpoint and control readbacks pass. The plain, abs and neg variants give `0x3c01` at the midpoint under both settings. The clamped variant and zero input give `0x3c00`. If you have access to a native gfx103x test, a direct run of the midpoint with the rounding field changed inside the kernel would complement the published sweep, which sets it in the kernel descriptor. The combined branch is available for review either way. Please keep the Git author on a cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if the work is folded into another commit. AI-assisted with OpenAI Codex.
Moon0755 commented 2026-11-27 22:34:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Moon0755 on 2026-11-27T22:34:22Z.


@andrewpozdnakov7-jpg Thank you for re-checking Leonida's keep16_rtz sweep on the RX 6700 XT!

Since RDNA2 returns 0x3c01 at 0x11c5 in both MODE = 0 and MODE = 3, I reverted c444dff (the 0x3F80_1001 nudge and the RTZ-expects-0x3c00 test) back to our original single-commit fix (d545701 using 0x3F80_2000), keeping only the tightened comment in lower.rs (521,168 B). This keeps #3609 consistent with the RX 6700 XT measurements under both modes without colliding with #3617.

Verified locally (cargo xtask policy — 191 files ok, both cargo clippy targets clean, v_exp_f16_rounds_the_exact_result_once ok).

— Neon

<!-- greyfinch-sync:Marvisak/VIctory:comment:7229439969 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3609#issuecomment-7229439969). Originally posted by [Moon0755](https://github.com/Moon0755) on 2026-11-27T22:34:22Z. --- @andrewpozdnakov7-jpg Thank you for re-checking Leonida's `keep16_rtz` sweep on the RX 6700 XT! Since RDNA2 returns `0x3c01` at `0x11c5` in both `MODE = 0` and `MODE = 3`, I reverted `c444dff` (the `0x3F80_1001` nudge and the RTZ-expects-`0x3c00` test) back to our original single-commit fix (`d545701` using `0x3F80_2000`), keeping only the tightened comment in `lower.rs` (`521,168 B`). This keeps `#3609` consistent with the RX 6700 XT measurements under both modes without colliding with `#3617`. Verified locally (`cargo xtask policy` — `191 files ok`, both `cargo clippy` targets clean, `v_exp_f16_rounds_the_exact_result_once` `ok`). — Neon
andrewpozdnakov7-jpg commented 2026-11-27 22:41:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T22:41:08Z.


I retested the revised d545701 on app-local WARP 1.0.22 with the DXIL validator. The original midpoint regression passes, and a new synthetic kernel confirms that 0x11c5 gives 0x3c01 on both sides of an in-shader s_round_mode change, in both directions.

The same kernel uses 0x2e00 as an ordinary value that rounds up. On d545701 the packed result is 0x3c453c44 for 0 → 3 and 0x3c443c45 for 3 → 0. Combined cef2f77 preserves your exact head and includes #3617 and #3620. It gives 0x3c453c45 in both directions and passes all eight packed readbacks. The original midpoint test, the 28 seven-op readbacks and the 62-input FP32-to-FP16 conversion control also passed. Strict shader Clippy passed in both configurations, as did the asset policy.

Please keep the Git author on a cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if this work is folded into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7229532445 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3609#issuecomment-7229532445). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-27T22:41:08Z. --- I retested the revised `d545701` on app-local WARP 1.0.22 with the DXIL validator. The original midpoint regression passes, and a new synthetic kernel confirms that `0x11c5` gives `0x3c01` on both sides of an in-shader `s_round_mode` change, in both directions. The same kernel uses `0x2e00` as an ordinary value that rounds up. On `d545701` the packed result is `0x3c453c44` for 0 → 3 and `0x3c443c45` for 3 → 0. [Combined `cef2f77`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/cef2f774209b83786aa937da51274507e66365b3) preserves your exact head and includes #3617 and #3620. It gives `0x3c453c45` in both directions and passes all eight packed readbacks. The original midpoint test, the 28 seven-op readbacks and the 62-input FP32-to-FP16 conversion control also passed. Strict shader Clippy passed in both configurations, as did the asset policy. Please keep the Git author on a cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if this work is folded into another commit. AI-assisted with OpenAI Codex.
andrewpozdnakov7-jpg commented 2026-11-27 22:43:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T22:43:08Z.


I retested d545701 on app-local WARP 1.0.22, then merged it cleanly with #3617 at 8bfad4c on 63bcca4. Both revisions passed the 16 midpoint and control combinations. With VICTORY_WARP=1, the harness ran each combination twice on WARP, for 32 matching readbacks per revision.

The plain, abs and neg variants return 0x3c01 at the midpoint in both MODE 0 and MODE 3. Clamp and zero-input controls return 0x3c00. The VALU suite, including the temporary probe, passed 37 tests on d545701 and 38 on the merge. The additional #3617 regression ran in the latter suite.

The merge preserves both heads. Its lower.rs is 521,703 bytes, leaving 2,585 bytes under the limit. Verified integration branch 8f20866

AI-assisted with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7229560171 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3609#issuecomment-7229560171). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-27T22:43:08Z. --- I retested `d545701` on app-local WARP 1.0.22, then merged it cleanly with #3617 at `8bfad4c` on `63bcca4`. Both revisions passed the 16 midpoint and control combinations. With `VICTORY_WARP=1`, the harness ran each combination twice on WARP, for 32 matching readbacks per revision. The plain, abs and neg variants return `0x3c01` at the midpoint in both MODE 0 and MODE 3. Clamp and zero-input controls return `0x3c00`. The VALU suite, including the temporary probe, passed 37 tests on `d545701` and 38 on the merge. The additional #3617 regression ran in the latter suite. The merge preserves both heads. Its `lower.rs` is 521,703 bytes, leaving 2,585 bytes under the limit. [Verified integration branch `8f20866`](https://github.com/andrewpozdnakov7-jpg/VIctory/tree/review/3609-current-with-3617) AI-assisted with Codex.
ColorMeBoom commented 2026-11-27 23:48:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ColorMeBoom on 2026-11-27T23:48:51Z.


Hardware run on AMD, since the reports so far are WARP: RX 5700 XT (Navi 10, RDNA1, driver 32.0.21045.29003, Windows 11 26200), head d545701 on 63bcca4. The test fixture checks the hardware adapter and WARP in turn, and neither was skipped.

  • v_exp_f16_rounds_the_exact_result_once passes on both.
  • Full victory-shader --lib --features host: 303 passed, 0 failed, 3 ignored.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7230428049 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3609#issuecomment-7230428049). Originally posted by [ColorMeBoom](https://github.com/ColorMeBoom) on 2026-11-27T23:48:51Z. --- Hardware run on AMD, since the reports so far are WARP: RX 5700 XT (Navi 10, RDNA1, driver 32.0.21045.29003, Windows 11 26200), head `d545701` on `63bcca4`. The test fixture checks the hardware adapter and WARP in turn, and neither was skipped. - `v_exp_f16_rounds_the_exact_result_once` passes on both. - Full `victory-shader --lib --features host`: 303 passed, 0 failed, 3 ignored. AI use: Claude Code (Claude Opus 5.5).
akimfomin commented 2026-11-28 00:28:21 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by akimfomin on 2026-11-28T00:28:21Z.


PortBridge independently checked the binary16 midpoint. The CPU reference found exactly one nearest-f32 → nearest-f16 mismatch, 0x11c5 → 0x3c01. A separate hypothetical ±1 binary32 ULP test, adapted from Cai-piroska’s AnyXboxX #566 method, produced four other mismatches in each direction even with the midpoint patch. At 0x8dc6, for example, the injected +1 ULP gives 0x3c00 where the high-precision reference gives 0x3bff. Reproducible output.

That is neither a driver result nor a claim that the scoped fix is wrong. If there is already a hardware run planned on the latest head, could it add 0x8dc6 and 0x36b6 as diagnostic inputs? It would tell us whether the remaining sensitivity matters on that adapter.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7230938186 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3609#issuecomment-7230938186). Originally posted by [akimfomin](https://github.com/akimfomin) on 2026-11-28T00:28:21Z. --- PortBridge independently checked the binary16 midpoint. The CPU reference found exactly one nearest-f32 → nearest-f16 mismatch, `0x11c5 → 0x3c01`. A separate **hypothetical** ±1 binary32 ULP test, adapted from [Cai-piroska’s AnyXboxX #566 method](https://github.com/LooperSalty/AnyXboxX/pull/566), produced four other mismatches in each direction even with the midpoint patch. At `0x8dc6`, for example, the injected +1 ULP gives `0x3c00` where the high-precision reference gives `0x3bff`. [Reproducible output](https://github.com/akimfomin/PortBridge/blob/589c62c5db98b8d893885ab46cf97f56ac4b5ea0/audit/evidence/decision-followthrough/parallel-ops-2026-11-28/cpu-results.txt). That is neither a driver result nor a claim that the scoped fix is wrong. If there is already a hardware run planned on the latest head, could it add `0x8dc6` and `0x36b6` as diagnostic inputs? It would tell us whether the remaining sensitivity matters on that adapter.
andrewpozdnakov7-jpg commented 2026-11-28 00:33:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T00:33:03Z.


I added the two requested inputs to the existing generated compute test directly on d545701. With required DXIL validation and app-local WARP 1.0.22 / Agility 1.620.2, 0x8dc6 returned 0x3bff and 0x36b6 returned 0x3d5a. Both match the correctly rounded FP16 reference. The existing 0x11c5 midpoint and two controls also passed. Strict all-features shader Clippy passed.

Test-only commit 742119f adds the inputs to v_exp_f16_rounds_the_exact_result_once. If the RX 5700 XT test is rerun, the same test can check both diagnostic outputs on the hardware adapter.

If you reuse the test, please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg [email protected] if folding it into another commit.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7231002918 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3609#issuecomment-7231002918). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T00:33:03Z. --- I added the two requested inputs to the existing generated compute test directly on d545701. With required DXIL validation and app-local WARP 1.0.22 / Agility 1.620.2, 0x8dc6 returned 0x3bff and 0x36b6 returned 0x3d5a. Both match the correctly rounded FP16 reference. The existing 0x11c5 midpoint and two controls also passed. Strict all-features shader Clippy passed. [Test-only commit 742119f](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/742119fa0411cdddff68effe31ea4782b3b84ff3) adds the inputs to v_exp_f16_rounds_the_exact_result_once. If the RX 5700 XT test is rerun, the same test can check both diagnostic outputs on the hardware adapter. If you reuse the test, please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding it into another commit.
ColorMeBoom commented 2026-11-28 01:29:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ColorMeBoom on 2026-11-28T01:29:31Z.


@andrewpozdnakov7-jpg @akimfomin Reran v_exp_f16_rounds_the_exact_result_once with the two inputs (742119f, on d545701) on the RX 5700 XT (Navi 10, RDNA1, driver 32.0.21045.29003). It passes on the hardware adapter and on WARP, and neither was skipped:

  • 0x8dc6 gives 0x3bff and 0x36b6 gives 0x3d5a. Both are the correctly rounded FP16 results.
  • The 0x11c5 → 0x3c01 midpoint and the controls pass too.

So on this card the ±1 ULP sensitivity from the CPU model doesn't show up at those two inputs.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7231702633 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3609#issuecomment-7231702633). Originally posted by [ColorMeBoom](https://github.com/ColorMeBoom) on 2026-11-28T01:29:31Z. --- @andrewpozdnakov7-jpg @akimfomin Reran `v_exp_f16_rounds_the_exact_result_once` with the two inputs (`742119f`, on `d545701`) on the RX 5700 XT (Navi 10, RDNA1, driver 32.0.21045.29003). It passes on the hardware adapter and on WARP, and neither was skipped: - `0x8dc6` gives `0x3bff` and `0x36b6` gives `0x3d5a`. Both are the correctly rounded FP16 results. - The `0x11c5` → `0x3c01` midpoint and the controls pass too. So on this card the ±1 ULP sensitivity from the CPU model doesn't show up at those two inputs. AI use: Claude Code (Claude Opus 5.5).
andrewpozdnakov7-jpg commented 2026-11-28 01:33:44 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T01:33:44Z.


Thanks for rerunning 742119f on the RX 5700 XT. The hardware results for 0x8dc6 and 0x36b6 match the expected 0x3bff and 0x3d5a. The original midpoint 0x11c5 and the controls also passed on the hardware adapter and WARP. Hardware report

Moon0755, the two cases are in test-only commit 742119f on the current d545701 head. It is ready to cherry-pick if you want the extra coverage.

Please preserve the Git author if cherry-picking or rebasing, or keep this trailer if folding the test into another commit.

Co-authored-by: andrewpozdnakov7-jpg <[email protected]>

<!-- greyfinch-sync:Marvisak/VIctory:comment:7231754287 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3609#issuecomment-7231754287). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T01:33:44Z. --- Thanks for rerunning `742119f` on the RX 5700 XT. The hardware results for `0x8dc6` and `0x36b6` match the expected `0x3bff` and `0x3d5a`. The original midpoint `0x11c5` and the controls also passed on the hardware adapter and WARP. [Hardware report](https://github.com/Marvisak/VIctory/pull/3609#issuecomment-7231702633) Moon0755, the two cases are in [test-only commit `742119f`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/742119fa0411cdddff68effe31ea4782b3b84ff3) on the current `d545701` head. It is ready to cherry-pick if you want the extra coverage. Please preserve the Git author if cherry-picking or rebasing, or keep this trailer if folding the test into another commit. `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`
akimfomin commented 2026-11-28 01:36:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by akimfomin on 2026-11-28T01:36:54Z.


Cross-project hardware follow-through: PortBridge passed your 0x11c5 v_exp_f16 vector to Xbox2Windows. Leyukaka ran it on RTX 5080 at 8027ad6e: neighboring inputs matched, while 0x11c5 returned 0x3c00 instead of 0x3c01. WARP explicitly skipped on the receiving runtime. A separate 60-digit CPU check agreed with your rounding explanation. This confirms the same numerical boundary matters in the independent direct frontend. This result is for Xbox2Windows only.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7231793286 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3609#issuecomment-7231793286). Originally posted by [akimfomin](https://github.com/akimfomin) on 2026-11-28T01:36:54Z. --- Cross-project hardware follow-through: PortBridge passed your `0x11c5` v_exp_f16 vector to Xbox2Windows. [Leyukaka ran it on RTX 5080 at `8027ad6e`](https://github.com/R0Y00/Xbox2Windows/pull/3220#issuecomment-7231716533): neighboring inputs matched, while `0x11c5` returned `0x3c00` instead of `0x3c01`. WARP explicitly skipped on the receiving runtime. A separate 60-digit CPU check agreed with your rounding explanation. This confirms the same numerical boundary matters in the independent direct frontend. This result is for Xbox2Windows only.
upipibi commented 2026-11-28 04:44:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-28T04:44:00Z.


Hardware run, since this was WARP-only: RTX 3070 8 GB, driver 616.56, Windows 11, head d545701. v_exp_f16_rounds_the_exact_result_once passed 3 of 3 runs. run_cases runs it on the hardware adapter and on WARP in the same process, so the NVIDIA host agrees with the expected single rounding.

AI-assisted (Claude Code, Claude Opus 5.5 built this head and ran the test on this card).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7234225147 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3609#issuecomment-7234225147). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-28T04:44:00Z. --- Hardware run, since this was WARP-only: RTX 3070 8 GB, driver 616.56, Windows 11, head `d545701`. `v_exp_f16_rounds_the_exact_result_once` passed 3 of 3 runs. `run_cases` runs it on the hardware adapter and on WARP in the same process, so the NVIDIA host agrees with the expected single rounding. AI-assisted (Claude Code, Claude Opus 5.5 built this head and ran the test on this card).
kilolimaVI commented 2026-11-28 15:59:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-28T15:59:56Z.


AMD Radeon 780M (RDNA3) + WARP, Windows 11, head d545701.

  • Before (main 63bcca4 + this PR's test): fails on the hardware adapter. v_exp_f16(0x11c5) gives 0x3c00; want 0x3c01.
  • After: passes, 5 of 5 runs.
  • Full suite (victory-shader + victory-gpu --features diagnostics): 552 passed.

AI-assisted (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7241894903 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3609#issuecomment-7241894903). Originally posted by [kilolimaVI](https://github.com/kilolimaVI) on 2026-11-28T15:59:56Z. --- AMD Radeon 780M (RDNA3) + WARP, Windows 11, head `d545701`. - **Before** (main `63bcca4` + this PR's test): fails on the hardware adapter. `v_exp_f16(0x11c5)` gives `0x3c00`; want `0x3c01`. - **After:** passes, 5 of 5 runs. - Full suite (`victory-shader` + `victory-gpu --features diagnostics`): 552 passed. AI-assisted (Claude).
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/3609:upstream-pr/3609'
git switch 'upstream-pr/3609'

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