Shaders: round scaled and normalized D16 buffer loads to nearest even #2841

Open
dooprazol wants to merge 5 commits from upstream-pr/2843 into main
dooprazol commented 2026-11-25 22:02:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by dooprazol on 2026-11-25T22:02:47Z.


Use the existing bitwise narrowing implementation for scaled and normalized D16 buffer loads. For example, 2051 rounds to 2052. The synthetic shader regression failed before the fix and passed afterward. On b2a97b1, cargo test --locked -p victory-shader passed on Linux with 166 passed and 3 ignored. On the initial base, cargo test --workspace failed during Linux compilation on both clean and patched trees.The Windows shader tests were type-checked. No RX 9060 XT dispatch or gameplay was tested. The device-loss reports remain open.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5499936806 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843). Originally posted by [dooprazol](https://github.com/dooprazol) on 2026-11-25T22:02:47Z. --- Use the existing bitwise narrowing implementation for scaled and normalized D16 buffer loads. For example, 2051 rounds to 2052. The synthetic shader regression failed before the fix and passed afterward. On b2a97b1, cargo test --locked -p victory-shader passed on Linux with 166 passed and 3 ignored. On the initial base, cargo test --workspace failed during Linux compilation on both clean and patched trees.The Windows shader tests were type-checked. No RX 9060 XT dispatch or gameplay was tested. The device-loss reports remain open.
kotekompotek commented 2026-11-25 22:11:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T22:11:38Z.

Review: COMMENTED


Correct: D16 conversions of scaled/normalized formats are always round-to-nearest-even in the ISA — VALU MODE's rtz applies only to explicit v_cvt_f16_f32. narrow16_bits parameterizing the direction keeps the MODE-sensitive path and the fixed-RNE path sharing one implementation. The legacy_half_conversion test flag checks the right observable. LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:review:6065694809 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#pullrequestreview-6065694809). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T22:11:38Z. **Review:** COMMENTED --- Correct: D16 conversions of scaled/normalized formats are always round-to-nearest-even in the ISA — VALU MODE's rtz applies only to explicit v_cvt_f16_f32. narrow16_bits parameterizing the direction keeps the MODE-sensitive path and the fixed-RNE path sharing one implementation. The legacy_half_conversion test flag checks the right observable. LGTM.
oni-swr commented 2026-11-25 23:06:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T22:29:36Z.


Independent Windows verification of a0a2e525 against current main (f3578e38).

  • The synthetic D16 USCALED lowering test passed on the corrected PR-head build. With the same test and its test-only intrinsic probe added to current main, the assertion failed because the lowering still emitted legacyF32ToF16. This check inspects the emitted code.
  • The earlier forced-WARP shader suite had 299 passed, 4 failed, 3 ignored on the PR and 298 passed, 4 failed, 3 ignored on main. The four failures were identical. The force flag also routed the harness's hardware-labelled cases through WARP. With that override removed and a local guard refusing hardware device creation, the explicit WARP gather case passed on the PR. It logged Microsoft Basic Render Driver (0x1414:0x008c, software flag 0x2) with the SDK dxil.dll configured. The full suite was not rerun with this harness change.

Claude Code (claude-opus-5-5) ran the shader suites and rebuilt the PR after detecting stale Cargo artifacts. Codex (gpt-6.2-sol) checked the corrected logs, ran the targeted main comparison and verified the adapter with the focused WARP run. Synthetic data only.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7176429163 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#issuecomment-7176429163). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T22:29:36Z. --- <!-- oni-swr warp verification a0a2e525b5c52968b2972ee0ff902b54ca9aa8b8 --> Independent Windows verification of `a0a2e525` against current `main` (`f3578e38`). - The synthetic D16 USCALED lowering test passed on the corrected PR-head build. With the same test and its test-only intrinsic probe added to current `main`, the assertion failed because the lowering still emitted `legacyF32ToF16`. This check inspects the emitted code. - The earlier forced-WARP shader suite had 299 passed, 4 failed, 3 ignored on the PR and 298 passed, 4 failed, 3 ignored on main. The four failures were identical. The force flag also routed the harness's hardware-labelled cases through WARP. With that override removed and a local guard refusing hardware device creation, the explicit WARP gather case passed on the PR. It logged Microsoft Basic Render Driver (`0x1414:0x008c`, software flag `0x2`) with the SDK `dxil.dll` configured. The full suite was not rerun with this harness change. Claude Code (claude-opus-5-5) ran the shader suites and rebuilt the PR after detecting stale Cargo artifacts. Codex (gpt-6.2-sol) checked the corrected logs, ran the targeted main comparison and verified the adapter with the focused WARP run. Synthetic data only.
fuzeofficlal commented 2026-11-25 23:06:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T22:47:25Z.


Reviewed and verified a0a2e525 on Windows 11 (RTX 5090 + WARP + dxil.dll) against main (f3578e3):

  • Splitting narrow16 into narrow16_bits(f, rtz) and routing d16_channels (Uscaled | Sscaled | Unorm | Snorm) through narrow16_bits(f, false) cleanly enforces portable IEEE round-to-nearest-even (including ±0.0, ±Inf, quiet NaN payload, subnormal sticky bit, and USCALED 65520..=65535 -> +Inf) regardless of VALU MODE, while keeping Uint/Sint (& 0xFFFF) and Float (legacyF32ToF16) intact.
  • Local verification: cargo test --locked -p victory-shader --lib d16 5/5 passed (including d16_scaled_buffer_load_uses_portable_rounding and the updated tbuffer_d16_loads_pack_two_channels_per_dword), emit::lower::tests 34/34 passed, cargo clippy --locked -p victory-shader --all-targets -- -D warnings 0 warnings, cargo xtask policy (190 files ok).
  • Three small notes for maintainers/author:
    1. crates/victory-shader/src/emit/lower.rs is at 521,634 bytes (2,654 bytes under the 512 KiB xtask policy cap).
    2. The branch currently carries a merge commit (a0a2e52) that also adds #[cfg(windows)] on 3 Validator::load sites in lower.rs — rebasing onto main would keep the history linear.
    3. Scope is buffer D16 loads (d16_channels); image D16 paths are untouched.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7176789512 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#issuecomment-7176789512). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T22:47:25Z. --- Reviewed and verified `a0a2e525` on Windows 11 (RTX 5090 + WARP + `dxil.dll`) against `main` (`f3578e3`): - Splitting `narrow16` into `narrow16_bits(f, rtz)` and routing `d16_channels` (`Uscaled | Sscaled | Unorm | Snorm`) through `narrow16_bits(f, false)` cleanly enforces portable IEEE round-to-nearest-even (including `±0.0`, `±Inf`, quiet NaN payload, subnormal sticky bit, and `USCALED` `65520..=65535 -> +Inf`) regardless of `VALU MODE`, while keeping `Uint`/`Sint` (`& 0xFFFF`) and `Float` (`legacyF32ToF16`) intact. - Local verification: `cargo test --locked -p victory-shader --lib d16` 5/5 passed (including `d16_scaled_buffer_load_uses_portable_rounding` and the updated `tbuffer_d16_loads_pack_two_channels_per_dword`), `emit::lower::tests` 34/34 passed, `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` 0 warnings, `cargo xtask policy` (`190 files ok`). - Three small notes for maintainers/author: 1. `crates/victory-shader/src/emit/lower.rs` is at `521,634` bytes (`2,654` bytes under the 512 KiB `xtask policy` cap). 2. The branch currently carries a merge commit (`a0a2e52`) that also adds `#[cfg(windows)]` on 3 `Validator::load` sites in `lower.rs` — rebasing onto `main` would keep the history linear. 3. Scope is buffer D16 loads (`d16_channels`); image D16 paths are untouched.
dooprazol commented 2026-11-25 23:06:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by dooprazol on 2026-11-25T22:51:31Z.


Confirmed on Windows 11 with a Radeon RX 9060 XT 16 GB at a0a2e525. The focused tbuffer_d16_loads_pack_two_channels_per_dword test passed (1 passed, 0 failed). Local DXGI logging identified the physical adapter as warp=false name=AMD Radeon RX 9060 XT. WARP also ran separately.

The numerical checks included 2051 → 2052, −2051 → −2052, and 2049 → 2048. This run used synthetic buffer data only.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7176868632 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#issuecomment-7176868632). Originally posted by [dooprazol](https://github.com/dooprazol) on 2026-11-25T22:51:31Z. --- Confirmed on Windows 11 with a Radeon RX 9060 XT 16 GB at a0a2e525. The focused tbuffer_d16_loads_pack_two_channels_per_dword test passed (1 passed, 0 failed). Local DXGI logging identified the physical adapter as warp=false name=AMD Radeon RX 9060 XT. WARP also ran separately. The numerical checks included 2051 → 2052, −2051 → −2052, and 2049 → 2048. This run used synthetic buffer data only.
AwsAli05 commented 2026-11-25 23:15:45 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by AwsAli05 on 2026-11-25T23:15:45Z.

Review: COMMENTED


The focused portable-rounding test passed on Windows at a0a2e525. The distinction between fixed D16 rounding and VALU's configurable rounding is the part I would pin with a second case. Run the same halfway USCALED load after selecting round-toward-zero with the existing MODE fixture. 2051 should still produce 2052. That would catch accidentally routing this path through mode-sensitive narrow16, which would still satisfy the current check for absence of the legacy DXIL conversion.

AI-assisted review and test.

<!-- greyfinch-sync:Marvisak/VIctory:review:6066282858 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#pullrequestreview-6066282858). Originally posted by [AwsAli05](https://github.com/AwsAli05) on 2026-11-25T23:15:45Z. **Review:** COMMENTED --- The focused portable-rounding test passed on Windows at `a0a2e525`. The distinction between fixed D16 rounding and VALU's configurable rounding is the part I would pin with a second case. Run the same halfway USCALED load after selecting round-toward-zero with the existing MODE fixture. 2051 should still produce 2052. That would catch accidentally routing this path through mode-sensitive `narrow16`, which would still satisfy the current check for absence of the legacy DXIL conversion. AI-assisted review and test.
Marvisak commented 2026-11-26 04:06:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T03:24:26Z.


Automated triage for the maintainers.

Verdict: needs work. The code does what the title says. In crates/victory-shader/src/emit/lower.rs, narrow16 is split into narrow16_bits(f, rtz), and the D16 packing loop sends Uscaled/Sscaled/Unorm/Snorm channels through narrow16_bits(f, false) instead of legacyF32ToF16. Float keeps legacyF32ToF16 and the integer formats keep the mask. It merges cleanly.

What is missing is evidence for the console behaviour it encodes. This changes emulation results, and the tests (tbuffer_d16_loads_pack_two_channels_per_dword's new rows, d16_uscaled_keeps_nearest_even_in_valu_rtz_mode) check the emitted conversion against the values the PR expects (2051 to 2052, and RNE under MODE RTZ), not against the console. Please point to something that shows the console's D16 format conversion rounds to nearest even and ignores the VALU MODE round bits: a hardware capture, the public ISA documentation, or the title's own data depending on it. Two further points: why should Float (f32 data narrowed to f16) still use the host's legacyF32ToF16 rounding when the scaled and normalized formats do not? And the #[cfg(windows)] additions on the three Validator::load test sites are unrelated, so they would fit better in a separate PR.

CI: not run on this head yet (awaiting workflow approval).


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7181691206 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#issuecomment-7181691206). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T03:24:26Z. --- <!-- victory-triage v1 head=628ab8900ca4ac04b5b7a2f1342193484821bb67 verdict=needs-work at=2026-11-26T03:24:26Z --> Automated triage for the maintainers. **Verdict: needs work.** The code does what the title says. In `crates/victory-shader/src/emit/lower.rs`, `narrow16` is split into `narrow16_bits(f, rtz)`, and the D16 packing loop sends `Uscaled`/`Sscaled`/`Unorm`/`Snorm` channels through `narrow16_bits(f, false)` instead of `legacyF32ToF16`. `Float` keeps `legacyF32ToF16` and the integer formats keep the mask. It merges cleanly. What is missing is evidence for the console behaviour it encodes. This changes emulation results, and the tests (`tbuffer_d16_loads_pack_two_channels_per_dword`'s new rows, `d16_uscaled_keeps_nearest_even_in_valu_rtz_mode`) check the emitted conversion against the values the PR expects (2051 to 2052, and RNE under MODE RTZ), not against the console. Please point to something that shows the console's D16 format conversion rounds to nearest even and ignores the VALU MODE round bits: a hardware capture, the public ISA documentation, or the title's own data depending on it. Two further points: why should `Float` (f32 data narrowed to f16) still use the host's `legacyF32ToF16` rounding when the scaled and normalized formats do not? And the `#[cfg(windows)]` additions on the three `Validator::load` test sites are unrelated, so they would fit better in a separate PR. CI: not run on this head yet (awaiting workflow approval). --- _Generated by [Claude Code](https://claude.ai/code)_
Jackster commented 2026-11-26 16:06:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T16:06:34Z.


AMD check on a Radeon RX 7900 XTX (gfx1100, 32.0.32029.2010), victory-shader built with --features host:

  • Test-only on 63bcca4: 2 of 6 d16_ cases fail on the hardware backend (format 9 of 0x00000803 → 0x00006801, want 0x00006802).
  • With the PR: 6/6 pass.

Synthetic only. AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7197192833 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#issuecomment-7197192833). Originally posted by [Jackster](https://github.com/Jackster) on 2026-11-26T16:06:34Z. --- AMD check on a Radeon RX 7900 XTX (gfx1100, 32.0.32029.2010), `victory-shader` built with `--features host`: - Test-only on 63bcca4: 2 of 6 `d16_` cases fail on the hardware backend (format 9 of `0x00000803` → `0x00006801`, want `0x00006802`). - With the PR: 6/6 pass. Synthetic only. AI-assisted.
kilolimaVI commented 2026-11-26 20:53:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-26T20:53:38Z.


NEW-284 verification on current head, Windows 11, toolchain 1.98.1, --test-threads=1, AMD Radeon 780M (RDNA3 iGPU) and WARP (VICTORY_WARP=1).

  • cargo test -p victory-shader -p victory-gpu --locked --no-fail-fast: no failures on the 780M; on WARP only the four synthetic_tests failures main 63bcca4 also has (fixed by #2225).
  • New tests pass on both: d16_scaled_buffer_load_uses_portable_rounding, d16_uscaled_keeps_nearest_even_in_valu_rtz_mode.
  • The branch is 3 commits behind main (3 tests main has are not on it yet); tested as-is.

AI-assisted (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7203178291 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#issuecomment-7203178291). Originally posted by [kilolimaVI](https://github.com/kilolimaVI) on 2026-11-26T20:53:38Z. --- NEW-284 verification on current head, Windows 11, toolchain 1.98.1, `--test-threads=1`, AMD Radeon 780M (RDNA3 iGPU) and WARP (`VICTORY_WARP=1`). - `cargo test -p victory-shader -p victory-gpu --locked --no-fail-fast`: no failures on the 780M; on WARP only the four synthetic_tests failures main 63bcca4 also has (fixed by #2225). - New tests pass on both: `d16_scaled_buffer_load_uses_portable_rounding`, `d16_uscaled_keeps_nearest_even_in_valu_rtz_mode`. - The branch is 3 commits behind main (3 tests main has are not on it yet); tested as-is. AI-assisted (Claude).
dooprazol commented 2026-11-26 22:04:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by dooprazol on 2026-11-26T22:04:31Z.


To follow up on the Float question, I ran a synthetic D16 buffer-load test on Windows 11 at commit 628ab890 with a local diagnostic patch. The physical Radeon RX 9060 XT (warp=false, vendor 0x1002) and Microsoft WARP returned identical bits in all four cases.

The input was 2051 in each format. An explicit v_cvt_f16_f32 in the same shader served as the control.

VALU mode 16_USCALED D16 load 32_FLOAT D16 load VALU control
RNE 0x6802 (2052) 0x6801 (2050) 0x6802 (2052)
RTZ 0x6802 (2052) 0x6801 (2050) 0x6801 (2050)

The VALU control changed from 2052 to 2050, confirming that the mode switch took effect. For this halfway input, the existing Float path truncated to 2050 in both modes. The USCALED path rounded to the nearest even value, 2052, in both modes. This format distinction matches the buffer D16 conversion rule in AMD’s RDNA 3 ISA, “D16 Instructions”.

This test measured VIctory’s translated shader on the two PC backends using synthetic data. Native console behavior remains unverified.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7204334400 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#issuecomment-7204334400). Originally posted by [dooprazol](https://github.com/dooprazol) on 2026-11-26T22:04:31Z. --- To follow up on the `Float` question, I ran a synthetic D16 buffer-load test on Windows 11 at commit `628ab890` with a local diagnostic patch. The physical Radeon RX 9060 XT (`warp=false`, vendor `0x1002`) and Microsoft WARP returned identical bits in all four cases. The input was 2051 in each format. An explicit `v_cvt_f16_f32` in the same shader served as the control. | VALU mode | `16_USCALED` D16 load | `32_FLOAT` D16 load | VALU control | |---|---|---|---| | RNE | `0x6802` (2052) | `0x6801` (2050) | `0x6802` (2052) | | RTZ | `0x6802` (2052) | `0x6801` (2050) | `0x6801` (2050) | The VALU control changed from 2052 to 2050, confirming that the mode switch took effect. For this halfway input, the existing `Float` path truncated to 2050 in both modes. The `USCALED` path rounded to the nearest even value, 2052, in both modes. This format distinction matches the buffer D16 conversion rule in [AMD’s RDNA 3 ISA, “D16 Instructions”](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna3-shader-instruction-set-architecture-feb-2023_0.pdf). This test measured VIctory’s translated shader on the two PC backends using synthetic data. Native console behavior remains unverified.
fuzeofficlal commented 2026-11-26 22:20:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T22:20:24Z.

Review: CHANGES_REQUESTED


Verified on 628ab890:

  • cargo xtask policy: 191 files ok; crates/victory-shader/src/emit/lower.rs size is 521,634 bytes.
  • rustfmt --edition 2024 --check: clean on all PR-modified hunks in lower.rs and valu_tests.rs.
  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings (default and --all-features): clean.
  • cargo test --locked -p victory-shader --lib -- --test-threads=1 emit::valu_tests:: emit::lower::: 70 passed, 0 failed under both VICTORY_WARP=0 and VICTORY_WARP=1, including d16_scaled_buffer_load_uses_portable_rounding and d16_uscaled_keeps_nearest_even_in_valu_rtz_mode.

narrow16_bits(f, false) fixes RNE rounding for explicit-format tbuffer_load_format_d16_* (Uscaled, Sscaled, Unorm, Snorm), independently of VALU MODE. One blocking gap and a couple of minor items remain:

  1. buffer_load_format_d16_{x,xy,xyz,xyzw} (MUBUF descriptor-format loads) bypasses the fix (crates/victory-shader/src/emit/lower.rs:9389, 9799, 9874): d16_channels is only reached in the explicit-format (tbuffer_load_format_*) path; descriptor-format MUBUF D16 loads still pack channels with dx.op.legacyF32ToF16 (opcode 130, RTZ), misrounding normalized/scaled midpoints.
  2. Minor/scope notes: UNORM/SNORM still double-round through f32 on four 16-bit codes (16_UNORM 0xFFAF/0xFFEF, 16_SNORM 0x7FF7/0x8009 off by 1 ULP vs native RDNA2), and lower.rs:11603, 11657, 11708 include three unrelated #[cfg(windows)] additions.
<!-- greyfinch-sync:Marvisak/VIctory:review:6081075947 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#pullrequestreview-6081075947). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T22:20:24Z. **Review:** CHANGES_REQUESTED --- Verified on `628ab890`: - `cargo xtask policy`: `191 files ok`; `crates/victory-shader/src/emit/lower.rs` size is `521,634` bytes. - `rustfmt --edition 2024 --check`: clean on all PR-modified hunks in `lower.rs` and `valu_tests.rs`. - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` (default and `--all-features`): clean. - `cargo test --locked -p victory-shader --lib -- --test-threads=1 emit::valu_tests:: emit::lower::`: **70 passed, 0 failed** under both `VICTORY_WARP=0` and `VICTORY_WARP=1`, including `d16_scaled_buffer_load_uses_portable_rounding` and `d16_uscaled_keeps_nearest_even_in_valu_rtz_mode`. `narrow16_bits(f, false)` fixes RNE rounding for explicit-format `tbuffer_load_format_d16_*` (`Uscaled`, `Sscaled`, `Unorm`, `Snorm`), independently of VALU `MODE`. One blocking gap and a couple of minor items remain: 1. **`buffer_load_format_d16_{x,xy,xyz,xyzw}` (MUBUF descriptor-format loads) bypasses the fix (`crates/victory-shader/src/emit/lower.rs:9389, 9799, 9874`)**: `d16_channels` is only reached in the explicit-format (`tbuffer_load_format_*`) path; descriptor-format MUBUF D16 loads still pack channels with `dx.op.legacyF32ToF16` (opcode 130, RTZ), misrounding normalized/scaled midpoints. 2. **Minor/scope notes**: `UNORM`/`SNORM` still double-round through `f32` on four 16-bit codes (`16_UNORM` `0xFFAF`/`0xFFEF`, `16_SNORM` `0x7FF7`/`0x8009` off by 1 ULP vs native RDNA2), and `lower.rs:11603, 11657, 11708` include three unrelated `#[cfg(windows)]` additions.
dooprazol commented 2026-11-26 22:39:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by dooprazol on 2026-11-26T22:39:54Z.


Thanks for spotting the descriptor-format path. I reproduced the rounding issue in buffer_load_format_d16_x on Windows 11 with a physical Radeon RX 9060 XT and Microsoft WARP. Both backends returned the same results.

I ran the same synthetic test twice at 628ab890: first with only the regression test added, then with a local candidate fix. Each row used 32 lanes with the same input.

Descriptor format Before With local fix Expected
R16_UNORM 0x2801 0x2802 0x2802
R16_SNORM 0xac01 0xac02 0xac02
R32_FLOAT 0x6801 0x6801 0x6801
R16_UINT 0x0803 0x0803 0x0803

Before the fix, all 32 lanes failed for each normalized format on each backend. With the local fix, all 32 lanes matched the expected value in every row. The FLOAT and UINT controls passed in both runs.

Coverage is limited to the single-channel descriptor load and these four inputs. The candidate fix is still local. Synthetic data only.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7204878506 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#issuecomment-7204878506). Originally posted by [dooprazol](https://github.com/dooprazol) on 2026-11-26T22:39:54Z. --- Thanks for spotting the descriptor-format path. I reproduced the rounding issue in `buffer_load_format_d16_x` on Windows 11 with a physical Radeon RX 9060 XT and Microsoft WARP. Both backends returned the same results. I ran the same synthetic test twice at `628ab890`: first with only the regression test added, then with a local candidate fix. Each row used 32 lanes with the same input. | Descriptor format | Before | With local fix | Expected | |---|---|---|---| | R16_UNORM | `0x2801` | `0x2802` | `0x2802` | | R16_SNORM | `0xac01` | `0xac02` | `0xac02` | | R32_FLOAT | `0x6801` | `0x6801` | `0x6801` | | R16_UINT | `0x0803` | `0x0803` | `0x0803` | Before the fix, all 32 lanes failed for each normalized format on each backend. With the local fix, all 32 lanes matched the expected value in every row. The FLOAT and UINT controls passed in both runs. Coverage is limited to the single-channel descriptor load and these four inputs. The candidate fix is still local. Synthetic data only.
fuzeofficlal commented 2026-11-26 23:39:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T23:39:50Z.

Review: CHANGES_REQUESTED


The VIEW_NORMALIZED flag plumbing, VIEW_STRIDE_BITS update ((1 << 29) - 1), MTBUF/MUBUF D16 lowering (narrow16_bits(f, false)), and tests look solid overall:

  • lower.rs stays under the 512 KiB limit (521,698 bytes).
  • cargo xtask policy and cargo clippy -p victory-shader -p victory-gpu (default and --features diagnostics, --tests -- -D warnings) pass cleanly.
  • All 36 emit::valu_tests (including tbuffer_d16_loads_pack_two_channels_per_dword and d16_uscaled_keeps_nearest_even_in_valu_rtz_mode) and emit::stride_tests::mubuf_d16_descriptor_rounding pass on both hardware GPU and WARP with dxil.dll validation.
  • Additional live MUBUF buffer_load_format_d16_x testing under VALU MODE=RTZ confirmed nearest-even rounding on both hardware GPU and WARP for R16_UNORM, R16_SNORM, R8_UNORM (254/255 -> 0x3bf8), R8_SNORM, R8G8B8A8_UNORM, and R10G10B10A2_UNORM.

One concrete gap reproduced on both hardware GPU and WARP:

normalized_buffer_format omits D3D12 BGRA UNORM typed buffer formats (87, 88, and optional 85, 86, 115)

  • crates/victory-shader/src/emit/shader.rs:29-32
pub fn normalized_buffer_format(format: u32) -> bool {
    matches!(format, 11 | 13 | 24 | 28 | 31 | 35 | 37 | 49 | 51 | 56 | 58 | 61 | 63)
}

Querying ID3D12Device::CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT) on both hardware GPU and WARP shows:

  • DXGI_FORMAT_B8G8R8A8_UNORM (87): D3D12_FORMAT_SUPPORT1_BUFFER = true and TYPED_UNORDERED_ACCESS_VIEW = true on both hardware GPU and WARP.
  • DXGI_FORMAT_B8G8R8X8_UNORM (88): D3D12_FORMAT_SUPPORT1_BUFFER = true on both hardware GPU and WARP.
  • DXGI_FORMAT_B5G6R5_UNORM (85), DXGI_FORMAT_B5G5R5A1_UNORM (86), and DXGI_FORMAT_B4G4R4A4_UNORM (115): D3D12_FORMAT_SUPPORT1_BUFFER = true and TYPED_UNORDERED_ACCESS_VIEW = true on WARP.

victory-gpu already accepts 87 and 88 as 4-byte view/element formats (crates/victory-gpu/src/resource.rs:125, crates/victory-gpu/src/descriptor/host.rs:2404-2407). Because normalized_buffer_format(87) returns false, view_kind / view_strides omits VIEW_NORMALIZED, causing B8G8R8A8_UNORM MUBUF D16 loads to fall back to legacyF32ToF16 (RTZ) instead of nearest-even.

Reproduced live on both hardware GPU and WARP with buffer_load_format_d16_x (R = 254, 254 / 255.0 = 0x3f7e_feff):

  • R8G8B8A8_UNORM (28): stride_entry = 0x20000004, result = 0x3bf8 (nearest even).
  • B8G8R8A8_UNORM (87): stride_entry = 0x4, result = 0x3bf7 (truncated, 1 ULP off on both hardware and WARP).

Fix: Include 85 | 86 | 87 | 88 | 115 in normalized_buffer_format (zero impact on lower.rs size) and add a B8G8R8A8_UNORM case to mubuf_d16_descriptor_rounding / descriptor::host::tests.

<!-- greyfinch-sync:Marvisak/VIctory:review:6081562692 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#pullrequestreview-6081562692). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T23:39:50Z. **Review:** CHANGES_REQUESTED --- The `VIEW_NORMALIZED` flag plumbing, `VIEW_STRIDE_BITS` update (`(1 << 29) - 1`), MTBUF/MUBUF D16 lowering (`narrow16_bits(f, false)`), and tests look solid overall: - `lower.rs` stays under the 512 KiB limit (`521,698` bytes). - `cargo xtask policy` and `cargo clippy -p victory-shader -p victory-gpu` (default and `--features diagnostics`, `--tests -- -D warnings`) pass cleanly. - All 36 `emit::valu_tests` (including `tbuffer_d16_loads_pack_two_channels_per_dword` and `d16_uscaled_keeps_nearest_even_in_valu_rtz_mode`) and `emit::stride_tests::mubuf_d16_descriptor_rounding` pass on both hardware GPU and WARP with `dxil.dll` validation. - Additional live MUBUF `buffer_load_format_d16_x` testing under VALU `MODE=RTZ` confirmed nearest-even rounding on both hardware GPU and WARP for `R16_UNORM`, `R16_SNORM`, `R8_UNORM` (`254/255 -> 0x3bf8`), `R8_SNORM`, `R8G8B8A8_UNORM`, and `R10G10B10A2_UNORM`. One concrete gap reproduced on both hardware GPU and WARP: ### `normalized_buffer_format` omits D3D12 BGRA UNORM typed buffer formats (`87`, `88`, and optional `85`, `86`, `115`) - `crates/victory-shader/src/emit/shader.rs:29-32` ```rust pub fn normalized_buffer_format(format: u32) -> bool { matches!(format, 11 | 13 | 24 | 28 | 31 | 35 | 37 | 49 | 51 | 56 | 58 | 61 | 63) } ``` Querying `ID3D12Device::CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT)` on both hardware GPU and WARP shows: - `DXGI_FORMAT_B8G8R8A8_UNORM` (`87`): `D3D12_FORMAT_SUPPORT1_BUFFER = true` and `TYPED_UNORDERED_ACCESS_VIEW = true` on **both** hardware GPU and WARP. - `DXGI_FORMAT_B8G8R8X8_UNORM` (`88`): `D3D12_FORMAT_SUPPORT1_BUFFER = true` on **both** hardware GPU and WARP. - `DXGI_FORMAT_B5G6R5_UNORM` (`85`), `DXGI_FORMAT_B5G5R5A1_UNORM` (`86`), and `DXGI_FORMAT_B4G4R4A4_UNORM` (`115`): `D3D12_FORMAT_SUPPORT1_BUFFER = true` and `TYPED_UNORDERED_ACCESS_VIEW = true` on WARP. `victory-gpu` already accepts `87` and `88` as 4-byte view/element formats (`crates/victory-gpu/src/resource.rs:125`, `crates/victory-gpu/src/descriptor/host.rs:2404-2407`). Because `normalized_buffer_format(87)` returns `false`, `view_kind` / `view_strides` omits `VIEW_NORMALIZED`, causing `B8G8R8A8_UNORM` MUBUF D16 loads to fall back to `legacyF32ToF16` (RTZ) instead of nearest-even. Reproduced live on both hardware GPU and WARP with `buffer_load_format_d16_x` (`R = 254`, `254 / 255.0 = 0x3f7e_feff`): - `R8G8B8A8_UNORM` (`28`): `stride_entry = 0x20000004`, result = `0x3bf8` (nearest even). - `B8G8R8A8_UNORM` (`87`): `stride_entry = 0x4`, result = `0x3bf7` (truncated, 1 ULP off on both hardware and WARP). **Fix:** Include `85 | 86 | 87 | 88 | 115` in `normalized_buffer_format` (zero impact on `lower.rs` size) and add a `B8G8R8A8_UNORM` case to `mubuf_d16_descriptor_rounding` / `descriptor::host::tests`.
kotekompotek commented 2026-11-27 03:20:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-27T03:20:29Z.


WARP verification of head 8bd21f58 (NEW-284 claim: #1633)

Environment: Windows 10 22H2, WARP software adapter (VICTORY_WARP=1 VICTORY_D3D12_WARP=1), rust 1.98.1 msvc. Important local caveat: both adapters on this machine cap at SM 6.2, so SM-6.6 pipeline execution is impossible here for upstream code equally (proven: upstream's own SM-6.6 pipeline tests fail at creation on unmodified main 63bcca43). victory-gpu runs use --features diagnostics — WARP selection is feature-gated there — and --test-threads=1 serial.

victory-shader --lib: 215 passed / 90 failed / 3 ignored vs baseline 214/88/3 — zero regressions. Every test present in both trees has identical status; the arithmetic is fully explained by the 3 new tests (the failure counts are dominated by environmental no-SM-6.6-device skips-as-failures, identical on main).

  • emit::lower::tests::d16_scaled_buffer_load_uses_portable_rounding: PASS — the core correctness claim at lowering level: D16 scaled/normalized buffer loads lower to the portable bitwise round-to-nearest-even instead of host-dependent legacyF32ToF16
  • GPU-backed mubuf_d16_descriptor_rounding / d16_uscaled_keeps_nearest_even_in_valu_rtz_mode fail only environmentally (no SM 6.6 hardware device; skipped) — cannot execute on any adapter of this machine, upstream equally
  • victory-gpu side: updated integer_typed_buffer_views_are_marked_in_the_stride_table (R16_SNORM → VIEW_NORMALIZED): PASS
  • resource_tracking integration: 3 passed / 1 ignored

Verdict: verification supports at lowering level; GPU execution of the rounding tests needs an SM 6.6 machine.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7208906361 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#issuecomment-7208906361). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-27T03:20:29Z. --- **WARP verification of head `8bd21f58`** (NEW-284 claim: #1633) Environment: Windows 10 22H2, WARP software adapter (`VICTORY_WARP=1 VICTORY_D3D12_WARP=1`), rust 1.98.1 msvc. Important local caveat: both adapters on this machine cap at **SM 6.2**, so SM-6.6 pipeline execution is impossible here for upstream code equally (proven: upstream's own SM-6.6 pipeline tests fail at creation on unmodified main `63bcca43`). victory-gpu runs use `--features diagnostics` — WARP selection is feature-gated there — and `--test-threads=1` serial. **victory-shader `--lib`: 215 passed / 90 failed / 3 ignored vs baseline 214/88/3 — zero regressions.** Every test present in both trees has identical status; the arithmetic is fully explained by the 3 new tests (the failure counts are dominated by environmental no-SM-6.6-device skips-as-failures, identical on main). - `emit::lower::tests::d16_scaled_buffer_load_uses_portable_rounding`: **PASS** — the core correctness claim at lowering level: D16 scaled/normalized buffer loads lower to the portable bitwise round-to-nearest-even instead of host-dependent `legacyF32ToF16` - GPU-backed `mubuf_d16_descriptor_rounding` / `d16_uscaled_keeps_nearest_even_in_valu_rtz_mode` fail only environmentally (`no SM 6.6 hardware device; skipped`) — cannot execute on any adapter of this machine, upstream equally - victory-gpu side: updated `integer_typed_buffer_views_are_marked_in_the_stride_table` (R16_SNORM → VIEW_NORMALIZED): PASS - `resource_tracking` integration: 3 passed / 1 ignored Verdict: verification supports at lowering level; GPU execution of the rounding tests needs an SM 6.6 machine.
dooprazol commented 2026-11-27 11:38:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by dooprazol on 2026-11-27T11:38:41Z.


Thanks for catching this. Fixed in a0957b5. I reproduced the BGRA rounding issue on a physical Radeon RX 9060 XT and on WARP. With R = 254/255, all 32 BGRA lanes returned 0x3bf7 before the fix and 0x3bf8 afterward on both backends. The RGBA control returned 0x3bf8 in both runs.

The descriptor test covers all five newly classified formats. The GPU readback covered B8G8R8A8_UNORM (87).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7217311850 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#issuecomment-7217311850). Originally posted by [dooprazol](https://github.com/dooprazol) on 2026-11-27T11:38:41Z. --- Thanks for catching this. Fixed in a0957b5. I reproduced the BGRA rounding issue on a physical Radeon RX 9060 XT and on WARP. With R = 254/255, all 32 BGRA lanes returned 0x3bf7 before the fix and 0x3bf8 afterward on both backends. The RGBA control returned 0x3bf8 in both runs. The descriptor test covers all five newly classified formats. The GPU readback covered B8G8R8A8_UNORM (87).
kilolimaVI commented 2026-11-27 11:58:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-27T11:58:42Z.


SM 6.6 run of the latest head a0957b5 (including the BGRA fix), which kotekompotek's SM 6.2 machine couldn't execute: Windows 11, AMD Radeon 780M (RDNA3), toolchain 1.98.1, --no-fail-fast -- --test-threads=1. WARP: VICTORY_WARP=1 (+ VICTORY_D3D12_WARP=1 --features diagnostics for victory-gpu).

780M WARP
mubuf_d16_descriptor_rounding ok ok
d16_uscaled_keeps_nearest_even_in_valu_rtz_mode ok ok
d16_scaled_buffer_load_uses_portable_rounding ok ok
normalized_buffer_formats_load_correctly_rounded_quotients, ..._load_their_ends_exactly, normalized_codes_truncate_back_to_themselves ok ok
tbuffer_d16_loads_pack_two_channels_per_dword, d16_typed_buffer_accesses_pass_bits_through_integer_views, d16_x_loads_read_r16_uint_and_r16_float_views ok ok
integer_typed_buffer_views_are_marked_in_the_stride_table, normalized_attributes_are_interpolated_in_their_own_range (victory-gpu) ok ok
victory-shader lib 305 passed, 0 failed 301 passed, 4 failed
victory-gpu lib 228 passed, 0 failed 243 passed, 0 failed

The four WARP failures are the synthetic_tests ones main has with VICTORY_WARP=1 (fixed by #2225). So the GPU-backed rounding tests execute and pass on RDNA3 hardware, alongside your RX 9060 XT (RDNA4) results.

AI-assisted (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7217693732 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#issuecomment-7217693732). Originally posted by [kilolimaVI](https://github.com/kilolimaVI) on 2026-11-27T11:58:42Z. --- SM 6.6 run of the latest head a0957b5 (including the BGRA fix), which kotekompotek's SM 6.2 machine couldn't execute: Windows 11, AMD Radeon 780M (RDNA3), toolchain 1.98.1, `--no-fail-fast -- --test-threads=1`. WARP: `VICTORY_WARP=1` (+ `VICTORY_D3D12_WARP=1 --features diagnostics` for victory-gpu). | | 780M | WARP | |---|---|---| | `mubuf_d16_descriptor_rounding` | ok | ok | | `d16_uscaled_keeps_nearest_even_in_valu_rtz_mode` | ok | ok | | `d16_scaled_buffer_load_uses_portable_rounding` | ok | ok | | `normalized_buffer_formats_load_correctly_rounded_quotients`, `..._load_their_ends_exactly`, `normalized_codes_truncate_back_to_themselves` | ok | ok | | `tbuffer_d16_loads_pack_two_channels_per_dword`, `d16_typed_buffer_accesses_pass_bits_through_integer_views`, `d16_x_loads_read_r16_uint_and_r16_float_views` | ok | ok | | `integer_typed_buffer_views_are_marked_in_the_stride_table`, `normalized_attributes_are_interpolated_in_their_own_range` (victory-gpu) | ok | ok | | victory-shader lib | 305 passed, 0 failed | 301 passed, 4 failed | | victory-gpu lib | 228 passed, 0 failed | 243 passed, 0 failed | The four WARP failures are the synthetic_tests ones main has with `VICTORY_WARP=1` (fixed by #2225). So the GPU-backed rounding tests execute and pass on RDNA3 hardware, alongside your RX 9060 XT (RDNA4) results. AI-assisted (Claude).
andrewpozdnakov7-jpg commented 2026-11-27 11:59:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T11:59:23Z.


I merged a0957b5 into current main 63bcca4 and ran the D16 tests on WARP 1.0.22 with DXIL validation. All seven regular D16 tests passed, including the BGRA format case. With the same fixtures on main, the descriptor rounding test and both explicit-format rounding tests failed. The full runs were 297 passed / 7 failed / 5 ignored on main and 301 / 4 / 5 on the merged branch. The four remaining failures are identical on both revisions. Strict shader and GPU Clippy and the asset policy passed.

I also checked the four exact-normalization cases @fuzeofficlal noted. On both MTBUF and MUBUF, WARP gave the expected single-rounding value on main and moved one FP16 step away with this PR:

Format and input Exact and main #2843
R16_UNORM ffaf 3bfd 3bfe
R16_UNORM ffef 3bff 3c00
R16_SNORM 7ff7 3bff 3c00
R16_SNORM 8009 bbff bc00

Reproducer 081045c contains the current-main merge and two opt-in probes. Filter for rounding_four_edge_codes and pass -- --ignored --nocapture --test-threads=1. The probes compare against rounding the exact normalized fractions once. Both pass on main and both report the mismatch with this PR. The MUBUF comparison checked all 32 lanes per input. #1940 covers the explicit-format side of single rounding. The descriptor-format cases would still need a check of their own.

Synthetic Windows/WARP testing only. AI-assisted with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7217706228 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#issuecomment-7217706228). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-27T11:59:23Z. --- I merged `a0957b5` into current main `63bcca4` and ran the D16 tests on WARP 1.0.22 with DXIL validation. All seven regular D16 tests passed, including the BGRA format case. With the same fixtures on main, the descriptor rounding test and both explicit-format rounding tests failed. The full runs were 297 passed / 7 failed / 5 ignored on main and 301 / 4 / 5 on the merged branch. The four remaining failures are identical on both revisions. Strict shader and GPU Clippy and the asset policy passed. I also checked the four exact-normalization cases @fuzeofficlal noted. On both MTBUF and MUBUF, WARP gave the expected single-rounding value on main and moved one FP16 step away with this PR: | Format and input | Exact and main | #2843 | | --- | --- | --- | | R16_UNORM `ffaf` | `3bfd` | `3bfe` | | R16_UNORM `ffef` | `3bff` | `3c00` | | R16_SNORM `7ff7` | `3bff` | `3c00` | | R16_SNORM `8009` | `bbff` | `bc00` | [Reproducer `081045c`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/081045c18b4d2dd0d01806594f628b5482b7669e) contains the current-main merge and two opt-in probes. Filter for `rounding_four_edge_codes` and pass `-- --ignored --nocapture --test-threads=1`. The probes compare against rounding the exact normalized fractions once. Both pass on main and both report the mismatch with this PR. The MUBUF comparison checked all 32 lanes per input. #1940 covers the explicit-format side of single rounding. The descriptor-format cases would still need a check of their own. Synthetic Windows/WARP testing only. AI-assisted with Codex.
kilolimaVI commented 2026-11-27 12:04:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-27T12:04:23Z.


@andrewpozdnakov7-jpg ran your probes (081045c, a0957b5 + the two rounding_four_edge_codes tests) on AMD hardware: Windows 11, Radeon 780M (RDNA3), --ignored --nocapture --test-threads=1, paired hardware + WARP backends.

The hardware gives the same bits as WARP in all eight cases, 32/32 lanes each:

input 780M = WARP one rounding
R16_UNORM (MUBUF 56 / MTBUF 7) 0xffaf 0x3bfe 0x3bfd
0xffef 0x3c00 0x3bff
R16_SNORM (MUBUF 58 / MTBUF 8) 0x7ff7 0x3c00 0x3bff
0x8009 0xbc00 0xbbff

So the double rounding at these edge codes comes from the translated shader, not from WARP; it reproduces on RDNA3 silicon too. (Note on my earlier comment: the PR's own tests pass, but they don't cover these four codes.)

AI-assisted (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7217806486 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#issuecomment-7217806486). Originally posted by [kilolimaVI](https://github.com/kilolimaVI) on 2026-11-27T12:04:23Z. --- @andrewpozdnakov7-jpg ran your probes (081045c, a0957b5 + the two `rounding_four_edge_codes` tests) on AMD hardware: Windows 11, Radeon 780M (RDNA3), `--ignored --nocapture --test-threads=1`, paired hardware + WARP backends. The hardware gives the same bits as WARP in all eight cases, 32/32 lanes each: | | input | 780M = WARP | one rounding | |---|---|---|---| | R16_UNORM (MUBUF 56 / MTBUF 7) | `0xffaf` | `0x3bfe` | `0x3bfd` | | | `0xffef` | `0x3c00` | `0x3bff` | | R16_SNORM (MUBUF 58 / MTBUF 8) | `0x7ff7` | `0x3c00` | `0x3bff` | | | `0x8009` | `0xbc00` | `0xbbff` | So the double rounding at these edge codes comes from the translated shader, not from WARP; it reproduces on RDNA3 silicon too. (Note on my earlier comment: the PR's own tests pass, but they don't cover these four codes.) AI-assisted (Claude).
andrewpozdnakov7-jpg commented 2026-11-27 13:32:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T13:32:12Z.


I resolved the conflict between #2843 and #1940 on current main 63bcca4. Combined branch 8bcc0bf retains both PR histories. MTBUF uses #1940's exact 32-bit normalization and keeps #2843's USCALED/SSCALED rounding. MUBUF selects the exact UNORM16 or SNORM16 path from the buffer view's format flags. The byte-stride bits and the integer-view flags retain their existing interpretation.

The four codes in the Radeon 780M report now return 3bfd, 3bff, 3bff and bbff on both MTBUF and MUBUF with app-local WARP 1.0.22. The same MUBUF fixture at 081045c was wrong in all 32 lanes per code and now matches all 32. An independent CPU model of the new runtime conversion matched the exact rational reference for all 131,072 UNORM16/SNORM16 code values.

All 11 D16 tests passed, including the BGRA, RTZ, float and integer controls and the Int64ShaderOps check across the explicit normalized formats. The GPU descriptor classification test passed. Full shader run: 305 passed, 4 failed, 3 ignored. All four failures also occur on the same WARP with main. Strict all-feature/all-target shader and GPU Clippy and the asset check passed.

@kilolimaVI could you repeat cargo test --locked -p victory-shader --lib d16 -- --nocapture --test-threads=1 at 8bcc0bf on the Radeon 780M? The MUBUF four-code probe is now a regular test, and the MTBUF fixture includes the same four codes.

If folding the integration into a new commit, please retain Git authorship or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> for this contribution.

AI-assisted with Codex. Synthetic buffers only.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7219604380 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#issuecomment-7219604380). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-27T13:32:12Z. --- I resolved the conflict between #2843 and #1940 on current main `63bcca4`. [Combined branch 8bcc0bf](https://github.com/andrewpozdnakov7-jpg/VIctory/tree/review/exact-d16-buffer-normalization) retains both PR histories. MTBUF uses #1940's exact 32-bit normalization and keeps #2843's USCALED/SSCALED rounding. MUBUF selects the exact UNORM16 or SNORM16 path from the buffer view's format flags. The byte-stride bits and the integer-view flags retain their existing interpretation. The four codes in the Radeon 780M report now return `3bfd`, `3bff`, `3bff` and `bbff` on both MTBUF and MUBUF with app-local WARP 1.0.22. The same MUBUF fixture at `081045c` was wrong in all 32 lanes per code and now matches all 32. An independent CPU model of the new runtime conversion matched the exact rational reference for all 131,072 UNORM16/SNORM16 code values. All 11 D16 tests passed, including the BGRA, RTZ, float and integer controls and the Int64ShaderOps check across the explicit normalized formats. The GPU descriptor classification test passed. Full shader run: 305 passed, 4 failed, 3 ignored. All four failures also occur on the same WARP with main. Strict all-feature/all-target shader and GPU Clippy and the asset check passed. @kilolimaVI could you repeat `cargo test --locked -p victory-shader --lib d16 -- --nocapture --test-threads=1` at `8bcc0bf` on the Radeon 780M? The MUBUF four-code probe is now a regular test, and the MTBUF fixture includes the same four codes. If folding the integration into a new commit, please retain Git authorship or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` for this contribution. AI-assisted with Codex. Synthetic buffers only.
kilolimaVI commented 2026-11-27 15:40:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-27T15:40:38Z.


@andrewpozdnakov7-jpg repeated on the Radeon 780M at 8bcc0bf (review/exact-d16-buffer-normalization), Windows 11, toolchain 1.98.1: cargo test --locked -p victory-shader --lib d16 -- --nocapture --test-threads=1.

The four codes are right now, on the hardware and on WARP, 0/32 lanes wrong each:

input 780M WARP one rounding
R16_UNORM (MUBUF 56) 0xffaf 0x3bfd 0x3bfd 0x3bfd
0xffef 0x3bff 0x3bff 0x3bff
R16_SNORM (MUBUF 58) 0x7ff7 0x3bff 0x3bff 0x3bff
0x8009 0xbbff 0xbbff 0xbbff

All 11 D16 tests pass (including mubuf_d16_rounding_four_edge_codes, tbuffer_d16_loads_of_16_bit_norms_round_once, d16_normalized_format_loads_do_not_require_int64, tbuffer_d16_loads_saturate_32_bit_integers). Whole victory-shader lib on the 780M: 309 passed, 0 failed, 3 ignored. So on RDNA3 the combined branch fixes the four codes that were wrong at 081045c, with nothing else regressing.

AI-assisted (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7222347532 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2843#issuecomment-7222347532). Originally posted by [kilolimaVI](https://github.com/kilolimaVI) on 2026-11-27T15:40:38Z. --- @andrewpozdnakov7-jpg repeated on the Radeon 780M at 8bcc0bf (review/exact-d16-buffer-normalization), Windows 11, toolchain 1.98.1: `cargo test --locked -p victory-shader --lib d16 -- --nocapture --test-threads=1`. The four codes are right now, on the hardware and on WARP, 0/32 lanes wrong each: | | input | 780M | WARP | one rounding | |---|---|---|---|---| | R16_UNORM (MUBUF 56) | `0xffaf` | `0x3bfd` | `0x3bfd` | `0x3bfd` | | | `0xffef` | `0x3bff` | `0x3bff` | `0x3bff` | | R16_SNORM (MUBUF 58) | `0x7ff7` | `0x3bff` | `0x3bff` | `0x3bff` | | | `0x8009` | `0xbbff` | `0xbbff` | `0xbbff` | All 11 D16 tests pass (including `mubuf_d16_rounding_four_edge_codes`, `tbuffer_d16_loads_of_16_bit_norms_round_once`, `d16_normalized_format_loads_do_not_require_int64`, `tbuffer_d16_loads_saturate_32_bit_integers`). Whole `victory-shader` lib on the 780M: 309 passed, 0 failed, 3 ignored. So on RDNA3 the combined branch fixes the four codes that were wrong at 081045c, with nothing else regressing. 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/2843:upstream-pr/2843'
git switch 'upstream-pr/2843'

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