HLSL pixel masks: adjacent Wave32 carry destinations lose s21 on WQM triangle edges #2584

Open
opened 2026-11-26 05:34:23 +00:00 by github-bot · 5 comments
Owner

@⁠akimfomin on GitHub · 2026-11-26 00:15 UTC · original

On XCL e1d84b7d9153f86a97d2ec5d209d196046fc0bea, a 76-byte Wave32 pixel program exposes an incorrect HLSL result at triangle edges on an RTX 4070 Ti SUPER (Windows, driver 617.14, DXC 1.9.2609.5).

The first v_add_co_u32 writes its carry to s21. The second writes to s20. The program then reads the full population of s21. Treating the second destination as a two-register overwrite can hide the live value in s21. With whole-quad mode enabled, red (the returned population) differs from green (the independently computed count in the same invocation) at 668/2,953 covered pixel-draws. The full-screen triangle alone passes. A single triangle edge differs at 176/496.

Forcing whole reconstruction or using the ordinary direct DXIL path yields zero mismatches across four geometries. A narrowly scoped liveness correction on the HLSL path also gave zero mismatches and bit-identical images to both controls, with WQM enabled and disabled. A separate 72-byte program is the WQM-off control. Frequency in applications and independent AMD/Intel results are open.

PortBridge reproduction, assembly and raw GPU readbacks. We can provide the focused patch and regression separately for review. PortBridge used Codex for the witness and technical analysis. All reported GPU measurements were executed on physical hardware.

**@⁠akimfomin** on GitHub · 2026-11-26 00:15 UTC · [original](https://github.com/xcl-dev/xcl/issues/2584) On XCL `e1d84b7d9153f86a97d2ec5d209d196046fc0bea`, a 76-byte Wave32 pixel program exposes an incorrect HLSL result at triangle edges on an RTX 4070 Ti SUPER (Windows, driver 617.14, DXC 1.9.2609.5). The first `v_add_co_u32` writes its carry to `s21`. The second writes to `s20`. The program then reads the full population of `s21`. Treating the second destination as a two-register overwrite can hide the live value in `s21`. With whole-quad mode enabled, red (the returned population) differs from green (the independently computed count in the same invocation) at 668/2,953 covered pixel-draws. The full-screen triangle alone passes. A single triangle edge differs at 176/496. Forcing whole reconstruction or using the ordinary direct DXIL path yields zero mismatches across four geometries. A narrowly scoped liveness correction on the HLSL path also gave zero mismatches and bit-identical images to both controls, with WQM enabled and disabled. A separate 72-byte program is the WQM-off control. Frequency in applications and independent AMD/Intel results are open. [PortBridge reproduction, assembly and raw GPU readbacks](https://github.com/akimfomin/PortBridge/tree/23a211a8fcf85541fc10188b776c3b6bff20eba9/research/pipeline-readiness/structural-suite/night/wave32-carry). We can provide the focused patch and regression separately for review. PortBridge used Codex for the witness and technical analysis. All reported GPU measurements were executed on physical hardware.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:34:23 +00:00
Author
Owner

@⁠DarkPanda69 on GitHub · 2026-11-26 00:33 UTC · original

Independent AMD result, plus a second NVIDIA generation: the bug reproduces on both an RX 9070 XT and an RTX 3060, and your fix commit makes the test pass on both, with nothing else changing in the GPU suite.

On main 08db802 (the parent of akimfomin/xcl@d3e7725), debug, Windows 11 Pro 26200, card chosen with XCL_ADAPTER, cargo test -p xcl --lib -- gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges:

RX 9070 XT (RDNA4, 32.0.32029.2010) RTX 3060 (Ampere, 32.0.16.1088)
only the new GPU test from d3e7725 (tests.rs), recompiler unchanged FAILED: mask popcount at 32, left 10.0, right 16.0 FAILED: mask popcount at 0, left 12.0, right 16.0
the whole commit d3e7725 ok ok

With the whole commit, cargo test -p xcl --lib -- gpu:: --test-threads=4 against main on both cards:

  • RX 9070 XT: 704 → 706 passed, 2 failed (the AMD fuzz seeds of #2115, the same on main), 6 SKIPPED both.
  • RTX 3060: 706 → 708 passed, 0 failed, 24 SKIPPED both.
  • The only result changes are the two new tests, gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges and wave32_carry_into_s20_preserves_a_whole_read_of_s21, both ok.

Not tested: Intel, XCL_DIRECT_DXIL=1 (your report says the direct path was already right), a title.
AI use: Claude Code (Claude Opus 5.5) read the commit, ran the tests on this machine and wrote this comment.

**@⁠DarkPanda69** on GitHub · 2026-11-26 00:33 UTC · [original](https://github.com/xcl-dev/xcl/issues/2584#issuecomment-7178879816) Independent AMD result, plus a second NVIDIA generation: the bug reproduces on both an RX 9070 XT and an RTX 3060, and your fix commit makes the test pass on both, with nothing else changing in the GPU suite. On `main` `08db802` (the parent of akimfomin/xcl@d3e7725), debug, Windows 11 Pro 26200, card chosen with `XCL_ADAPTER`, `cargo test -p xcl --lib -- gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges`: | | RX 9070 XT (RDNA4, 32.0.32029.2010) | RTX 3060 (Ampere, 32.0.16.1088) | |---|---|---| | only the new GPU test from `d3e7725` (`tests.rs`), recompiler unchanged | **FAILED**: `mask popcount at 32`, left 10.0, right 16.0 | **FAILED**: `mask popcount at 0`, left 12.0, right 16.0 | | the whole commit `d3e7725` | ok | ok | With the whole commit, `cargo test -p xcl --lib -- gpu:: --test-threads=4` against `main` on both cards: - RX 9070 XT: 704 → 706 passed, 2 failed (the AMD fuzz seeds of #2115, the same on `main`), 6 SKIPPED both. - RTX 3060: 706 → 708 passed, 0 failed, 24 SKIPPED both. - The only result changes are the two new tests, `gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges` and `wave32_carry_into_s20_preserves_a_whole_read_of_s21`, both ok. Not tested: Intel, `XCL_DIRECT_DXIL=1` (your report says the direct path was already right), a title. AI use: Claude Code (Claude Opus 5.5) read the commit, ran the tests on this machine and wrote this comment.
Author
Owner

@⁠akimfomin on GitHub · 2026-11-26 00:20 UTC · original · edited 2026-11-26 00:57 UTC

The focused fix is ready for review on top of XCL 08db802: implementation and regression tests. It keeps the stock HLSL output identical across 195 tested open configurations while fixing this witness. A broader correction had unnecessarily selected full ballots in Microsoft MiniEngine, so the linked change uses the narrower rule.

For a short independent physical check, run cargo test --release --locked -p xcl --lib gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges -- --test-threads=1 --nocapture. PortBridge Test Lab #87 accepts the pass/fail/skip, GPU and driver. AMD or Intel results and a maintainer title smoke would help assess readiness. The branch is available for testing; an upstream merge has not been requested. Codex assisted this investigation.

Update, 26 November. Thank you to DarkPanda69 for checking the baseline and fix on the RX 9070 XT and RTX 3060. On our RTX 4070 Ti SUPER, Windows 11, driver 617.14, the complete locked workspace suite at the same fix commit returned 1,431 passed, 0 failed and 47 ignored, with 28 explicit skips inside test bodies. The authored guest triangle rendered and read back on hardware. The fix also merges cleanly with main b49be18 in a local merge-tree check. A paired real-title smoke remains open. Commands, toolchain and complete sanitized logs. OpenAI Codex (GPT-6) assisted with this run.

**@⁠akimfomin** on GitHub · 2026-11-26 00:20 UTC · [original](https://github.com/xcl-dev/xcl/issues/2584#issuecomment-7178646899) · edited 2026-11-26 00:57 UTC The focused fix is ready for review on top of XCL `08db802`: [implementation and regression tests](https://github.com/akimfomin/xcl/commit/d3e7725f9f48c39c18e7b6e011ec76423edb0004). It keeps the stock HLSL output identical across 195 tested open configurations while fixing this witness. A broader correction had unnecessarily selected full ballots in Microsoft MiniEngine, so the linked change uses the narrower rule. For a short independent physical check, run `cargo test --release --locked -p xcl --lib gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges -- --test-threads=1 --nocapture`. [PortBridge Test Lab #87](https://github.com/akimfomin/PortBridge/issues/87) accepts the pass/fail/skip, GPU and driver. AMD or Intel results and a maintainer title smoke would help assess readiness. The branch is available for testing; an upstream merge has not been requested. Codex assisted this investigation. Update, 26 November. Thank you to DarkPanda69 for [checking the baseline and fix on the RX 9070 XT and RTX 3060](https://git.gtahub.st/github/xcl-dev--xcl/issues/2584). On our RTX 4070 Ti SUPER, Windows 11, driver 617.14, the complete locked workspace suite at the same fix commit returned 1,431 passed, 0 failed and 47 ignored, with 28 explicit skips inside test bodies. The authored guest triangle rendered and read back on hardware. The fix also merges cleanly with main `b49be18` in a local merge-tree check. A paired real-title smoke remains open. [Commands, toolchain and complete sanitized logs](https://github.com/akimfomin/PortBridge/blob/929c53bddb836f7cea1483f3658f96c319662545/research/pipeline-readiness/structural-suite/night/full-workspace/README.md). OpenAI Codex (GPT-6) assisted with this run.
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-26 01:05 UTC · original

Independent RDNA2 check of the patch linked in #2584: the focused pixel carry fixture passes on my RX 6800M.

Setup: clean detached akimfomin/xcl patch commit d3e7725f9f48c39c18e7b6e011ec76423edb0004 (parent XCL main 08db8020d323bf478964fcc586152cce54959cfc); Windows 11 Home build 26200; Ryzen 9 5980HX; AMD Radeon RX 6800M, driver 30.0.13002.13003; Rust 1.99.0 MSVC; DXC/dxil 1.9.2609.5. Debug lib-test binary built in an isolated target under a free-memory guard; the guard did not stop the build or test.

Tested: With XCL_ADAPTER=6800M, XCL_REQUIRE_GPU=wave64, and pinned XCL_DXC_DIR, I ran the exact gpu::recomp::tests::gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges fixture directly from that built binary using --exact --test-threads=1 --nocapture: 1 passed, 0 failed, 0 ignored, 0 measured, 1332 filtered out, 0.92 s, no SKIPPED line. An earlier guarded Cargo invocation of the same fixture also passed; its XCL_REQUIRE_GPU=1 value was not a recognized requirement token, so the corrected direct run above is the result I rely on.

Limit: This checks the Wave32-intended HLSL translation and rendered output on the selected RX 6800M. The pixel shader's physical wave width is not forced or recorded by the fixture, so I cannot claim it executed as native Wave32. I did not run the same witness on the parent commit, a full suite, or a title smoke pair. No game files were used.

AI use: Codex (GPT-6) and a Codex Luna subagent prepared the clean checkout, ran and checked the focused tests, and wrote this report.

**@⁠luckyteagirl** on GitHub · 2026-11-26 01:05 UTC · [original](https://github.com/xcl-dev/xcl/issues/2584#issuecomment-7179418085) **Independent RDNA2 check of the patch linked in #2584:** the focused pixel carry fixture passes on my RX 6800M. **Setup:** clean detached `akimfomin/xcl` patch commit `d3e7725f9f48c39c18e7b6e011ec76423edb0004` (parent XCL `main` `08db8020d323bf478964fcc586152cce54959cfc`); Windows 11 Home build 26200; Ryzen 9 5980HX; AMD Radeon RX 6800M, driver `30.0.13002.13003`; Rust 1.99.0 MSVC; DXC/dxil 1.9.2609.5. Debug lib-test binary built in an isolated target under a free-memory guard; the guard did not stop the build or test. **Tested:** With `XCL_ADAPTER=6800M`, `XCL_REQUIRE_GPU=wave64`, and pinned `XCL_DXC_DIR`, I ran the exact `gpu::recomp::tests::gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges` fixture directly from that built binary using `--exact --test-threads=1 --nocapture`: **1 passed, 0 failed, 0 ignored, 0 measured, 1332 filtered out**, 0.92 s, no `SKIPPED` line. An earlier guarded Cargo invocation of the same fixture also passed; its `XCL_REQUIRE_GPU=1` value was not a recognized requirement token, so the corrected direct run above is the result I rely on. **Limit:** This checks the Wave32-intended HLSL translation and rendered output on the selected RX 6800M. The pixel shader's physical wave width is not forced or recorded by the fixture, so I cannot claim it executed as native Wave32. I did not run the same witness on the parent commit, a full suite, or a title smoke pair. No game files were used. **AI use:** Codex (GPT-6) and a Codex Luna subagent prepared the clean checkout, ran and checked the focused tests, and wrote this report.
Author
Owner

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

luckyteagirl, thank you for checking the corrected requirement setting and recording the exact adapter. I added your RX 6800M run to the evidence record as a pass on the patched compiler. DarkPanda69, your side-by-side runs on the RX 9070 XT and RTX 3060 establish that the parent fails and the fix passes on those two cards.

I’m stepping back from routine work on PortBridge. For anyone continuing this fix, the narrow HLSL patch with regression and full test log are available. The remaining upstream step is the paired smoke on the same lawfully available title for a human-reviewed PR. The normal HLSL patch can travel on its own. The optional direct-DXIL optimization is a separate experiment. I welcome follow-ups here. Codex assisted with the handover.

**@⁠akimfomin** on GitHub · 2026-11-26 02:26 UTC · [original](https://github.com/xcl-dev/xcl/issues/2584#issuecomment-7180805669) luckyteagirl, thank you for checking the corrected requirement setting and recording the exact adapter. I added your RX 6800M run to [the evidence record](https://github.com/akimfomin/PortBridge/issues/87) as a pass on the patched compiler. DarkPanda69, your side-by-side runs on the RX 9070 XT and RTX 3060 establish that the parent fails and the fix passes on those two cards. I’m stepping back from routine work on PortBridge. For anyone continuing this fix, the [narrow HLSL patch with regression](https://github.com/akimfomin/xcl/commit/d3e7725f9f48c39c18e7b6e011ec76423edb0004) and [full test log](https://github.com/akimfomin/PortBridge/blob/929c53bddb836f7cea1483f3658f96c319662545/research/pipeline-readiness/structural-suite/night/full-workspace/README.md) are available. The remaining upstream step is the paired smoke on the same lawfully available title for a human-reviewed PR. The normal HLSL patch can travel on its own. The optional direct-DXIL optimization is a separate experiment. I welcome follow-ups here. Codex assisted with the handover.
Author
Owner

@⁠itsSio on GitHub · 2026-11-26 05:29 UTC · original

Verified on two NVIDIA GPUs (RTX 5080 and RTX 2080 SUPER) and prepared on top of main (b49be183) as fork draft PR itsSio/xcl#9 (recomp/wave32-pixel-mask-carry, commit 382469c656ea95be862361fcca419fceecaa2784, preserving Co-authored-by: akimfomin <[email protected]>, omitting the unrelated README line), including the paired retail scripts/smoke.ps1 runs.

Tested

  • Pre-fix check on PC 1 (RTX 5080, b49be183 + new GPU test only, DXC 1.9.2609.5, XCL_ADAPTER=NVIDIA): gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges FAILED as expected (mask popcount at 0: left 12.0, right 16.0).
  • PC 1: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro build 26200.9974, rustc 1.97.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug build (XCL_ADAPTER=NVIDIA).
    • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1437 passed, 0 failed, 47 ignored, 25 SKIPPED lines (both new tests pass).
  • PC 2: NVIDIA GeForce RTX 2080 SUPER (driver 32.0.16.1088), AMD Ryzen 5 5600X, 16 GB RAM, Windows 11 Pro build 26200.8653, rustc 1.99.1 (stable-x86_64-pc-windows-msvc), Windows SDK 10.0.26100 DXC 1.8.2502.11, debug build (XCL_ADAPTER=NVIDIA).
    • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1437 passed, 0 failed, 47 ignored, 29 SKIPPED lines (both new tests pass).
  • Paired 60 s retail scripts/smoke.ps1 on PC 1 (RTX 5080, release builds, XCL_DXC_DIR = DXC 1.9.2609.5):

main (b49be183):

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 5080
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1019 (PresentX 1019)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14670 MB

Rebased fix (382469c6, warm cache):

xcl-smoke v1
commit: 382469c656ea95be862361fcca419fceecaa2784
gpu: NVIDIA GeForce RTX 5080
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1670 (PresentX 1670)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13881 MB

Not tested

  • AMD / Intel GPUs on this rebased commit, retail scripts/smoke.ps1 on the RTX 2080 SUPER, Linux / Wine / vkd3d-proton, and past-world-load visual scenes.

AI use
Ran via Samaritan:

  • Google Antigravity CLI (Claude Opus 5.5 (High)): rebased akimfomin's fix onto main (382469c6), reviewed the diff, ran the pre-fix failure repro, and ran the dual-PC workspace test suites and release build.
  • Google Antigravity CLI (Gemini 4 Neon (High)): reviewed the diff, ran the RTX 5080 scripts/smoke.ps1 run, ran scripts/pr_check.py --local, and wrote this comment.
**@⁠itsSio** on GitHub · 2026-11-26 05:29 UTC · [original](https://github.com/xcl-dev/xcl/issues/2584#issuecomment-7183532233) Verified on two NVIDIA GPUs (RTX 5080 and RTX 2080 SUPER) and prepared on top of `main` (`b49be183`) as fork draft PR `itsSio/xcl#9` (`recomp/wave32-pixel-mask-carry`, commit `382469c656ea95be862361fcca419fceecaa2784`, preserving `Co-authored-by: akimfomin <[email protected]>`, omitting the unrelated README line), including the paired retail `scripts/smoke.ps1` runs. **Tested** - Pre-fix check on PC 1 (RTX 5080, `b49be183` + new GPU test only, DXC `1.9.2609.5`, `XCL_ADAPTER=NVIDIA`): `gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges` **FAILED** as expected (`mask popcount at 0: left 12.0, right 16.0`). - PC 1: NVIDIA GeForce RTX 5080 (driver `32.0.16.1088`), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro build 26200.9974, `rustc 1.97.0` (`stable-x86_64-pc-windows-msvc`), DXC `1.9.2609.5`, debug build (`XCL_ADAPTER=NVIDIA`). - `cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4`: **1437 passed, 0 failed, 47 ignored**, 25 `SKIPPED` lines (both new tests pass). - PC 2: NVIDIA GeForce RTX 2080 SUPER (driver `32.0.16.1088`), AMD Ryzen 5 5600X, 16 GB RAM, Windows 11 Pro build 26200.8653, `rustc 1.99.1` (`stable-x86_64-pc-windows-msvc`), Windows SDK 10.0.26100 DXC `1.8.2502.11`, debug build (`XCL_ADAPTER=NVIDIA`). - `cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4`: **1437 passed, 0 failed, 47 ignored**, 29 `SKIPPED` lines (both new tests pass). - Paired 60 s retail `scripts/smoke.ps1` on PC 1 (RTX 5080, release builds, `XCL_DXC_DIR` = DXC `1.9.2609.5`): `main` (`b49be183`): ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 5080 title: retail-title seconds: 60 exit: 0x0 frames shown: 1019 (PresentX 1019) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14670 MB ``` Rebased fix (`382469c6`, warm cache): ``` xcl-smoke v1 commit: 382469c656ea95be862361fcca419fceecaa2784 gpu: NVIDIA GeForce RTX 5080 title: retail-title seconds: 60 exit: 0x0 frames shown: 1670 (PresentX 1670) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13881 MB ``` **Not tested** - AMD / Intel GPUs on this rebased commit, retail `scripts/smoke.ps1` on the RTX 2080 SUPER, Linux / Wine / vkd3d-proton, and past-world-load visual scenes. **AI use** Ran via Samaritan: - Google Antigravity CLI (Claude Opus 5.5 (High)): rebased `akimfomin`'s fix onto `main` (`382469c6`), reviewed the diff, ran the pre-fix failure repro, and ran the dual-PC workspace test suites and release build. - Google Antigravity CLI (Gemini 4 Neon (High)): reviewed the diff, ran the RTX 5080 `scripts/smoke.ps1` run, ran `scripts/pr_check.py --local`, and wrote this comment.
This discussion has been locked. Commenting is limited to contributors.
No description provided.