Recompiler: zero VDATA[0:1] on out-of-bounds buffer_atomic_*_x2 with GLC #1157

Open
b3IKK wants to merge 1 commit from upstream-pr/1166 into main
b3IKK commented 2026-11-24 12:46:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-24T12:46:53Z.


32-bit buffer_atomic zeroes VDATA on out-of-bounds active lanes when GLC == 1, but buffer_atomic_*_x2 passed and(act, ok) as both the memory-operation predicate and the GLC writeback predicate in atomic64, leaving the previous input values in VDATA[0:1] on out-of-bounds active lanes.

This splits act and optional ok in atomic64 so memory operations remain gated on and(act, ok) while GLC writes t_old (initialized to 0) for all active lanes, matching 32-bit buffer_atomic and leaving flat_atomic unchanged.

What is in it

  • crates/xcl/src/gpu/recomp/emit.rs: pass act and Some(ok) separately to atomic64 from buffer_atomic so active out-of-bounds GLC lanes write 0 to VDATA[0:1].
  • crates/xcl/src/gpu/recomp/tests.rs: add GPU test gpu_buffer_atomic_x2_oob_glc_zeroes_vdata covering active in-bounds, active out-of-bounds, and inactive out-of-bounds lanes for BUFFER_ATOMIC_ADD_X2 with GLC = 1 (verified failing before the fix).

Tested

  • hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1)
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 742 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2 no wave64 — gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware)
  • cargo test -p xcl --lib gpu_buffer_atomic_x2_oob_glc_zeroes_vdata: 1 passed, 0 failed (failed on the GPU before the fix, leaving input values in VDATA[0:1])

Regression run

main:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1226 (PresentX 1226)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15341 MB

PR:

xcl-smoke v1
commit: 43c43996a72476891a4e976444ed468405b3e055
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1643 (PresentX 1643)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14582 MB

Not tested

  • AMD GPUs and native wave64 hardware
  • other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine

AI use

  • OpenCode, Gemini 4 Neon: audited emit.rs, wrote the fix and GPU test, ran the test suite and scripts/smoke.ps1 regression runs, and drafted this PR description.
<!-- greyfinch-sync:ivall/xcl:issue:5472422478 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1166). Originally posted by [b3IKK](https://github.com/b3IKK) on 2026-11-24T12:46:53Z. --- 32-bit `buffer_atomic` zeroes `VDATA` on out-of-bounds active lanes when `GLC == 1`, but `buffer_atomic_*_x2` passed `and(act, ok)` as both the memory-operation predicate and the `GLC` writeback predicate in `atomic64`, leaving the previous input values in `VDATA[0:1]` on out-of-bounds active lanes. This splits `act` and optional `ok` in `atomic64` so memory operations remain gated on `and(act, ok)` while `GLC` writes `t_old` (initialized to `0`) for all active lanes, matching 32-bit `buffer_atomic` and leaving `flat_atomic` unchanged. **What is in it** - `crates/xcl/src/gpu/recomp/emit.rs`: pass `act` and `Some(ok)` separately to `atomic64` from `buffer_atomic` so active out-of-bounds `GLC` lanes write `0` to `VDATA[0:1]`. - `crates/xcl/src/gpu/recomp/tests.rs`: add GPU test `gpu_buffer_atomic_x2_oob_glc_zeroes_vdata` covering active in-bounds, active out-of-bounds, and inactive out-of-bounds lanes for `BUFFER_ATOMIC_ADD_X2` with `GLC = 1` (verified failing before the fix). **Tested** - hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (`stable-x86_64-pc-windows-msvc`), DXC 1.9.2609.5, debug (`scripts/test.ps1`) and release (`scripts/smoke.ps1`) - `.\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`): 742 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2 `no wave64` — `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware`) - `cargo test -p xcl --lib gpu_buffer_atomic_x2_oob_glc_zeroes_vdata`: 1 passed, 0 failed (failed on the GPU before the fix, leaving input values in `VDATA[0:1]`) **Regression run** main: ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1226 (PresentX 1226) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15341 MB ``` PR: ``` xcl-smoke v1 commit: 43c43996a72476891a4e976444ed468405b3e055 gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1643 (PresentX 1643) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14582 MB ``` **Not tested** - AMD GPUs and native wave64 hardware - other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine **AI use** - OpenCode, Gemini 4 Neon: audited `emit.rs`, wrote the fix and GPU test, ran the test suite and `scripts/smoke.ps1` regression runs, and drafted this PR description.
bjarngard commented 2026-11-24 14:06:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bjarngard on 2026-11-24T13:05:03Z.


Test report for head 43c4399 (AMD, native wave64)

Tested

  • AMD Radeon(TM) Graphics (Ryzen 9 9950X iGPU, RDNA2, native wave64), driver 32.0.21043.5001; Windows 11 build 26300; Rust 1.99.1 MSVC; DXC 1.9.2602.17; debug
  • XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 742 passed, 0 failed, 41 ignored, no SKIPPED
  • With XCL_REQUIRE_GPU=wave64: gpu_buffer_atomic_x2_oob_glc_zeroes_vdata passed

Not tested: retail titles, RDNA3/RDNA4.

AI use: the tests were run and this report was written by an AI agent, Claude Code (Claude Opus 5.5), on the hardware above. The numbers are copied from the actual test output.

<!-- greyfinch-sync:ivall/xcl:comment:7132325344 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1166#issuecomment-7132325344). Originally posted by [bjarngard](https://github.com/bjarngard) on 2026-11-24T13:05:03Z. --- Test report for head `43c4399` (AMD, native wave64) **Tested** - AMD Radeon(TM) Graphics (Ryzen 9 9950X iGPU, RDNA2, native wave64), driver 32.0.21043.5001; Windows 11 build 26300; Rust 1.99.1 MSVC; DXC 1.9.2602.17; debug - `XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4`: 742 passed, 0 failed, 41 ignored, no SKIPPED - With `XCL_REQUIRE_GPU=wave64`: `gpu_buffer_atomic_x2_oob_glc_zeroes_vdata` passed **Not tested:** retail titles, RDNA3/RDNA4. **AI use:** the tests were run and this report was written by an AI agent, Claude Code (Claude Opus 5.5), on the hardware above. The numbers are copied from the actual test output.
JoaoPauluu commented 2026-11-24 14:06:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-24T13:57:10Z.


A run on Linux with vkd3d-proton, where the shaders go through dxil-spirv to Vulkan instead of a Windows driver's DXIL compiler.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257 (DXIL → SPIR-V through dxil-spirv), DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. 43c4399 as it is (based on 47efa2e), no uncommitted changes. The lib test binary runs under Wine, one test per process (--exact).
  • gpu::recomp::tests::gpu_buffer_atomic_x2_oob_glc_zeroes_vdata: ok, no SKIPPED.

Not tested

  • whether the new test fails without the fix on this stack; the rest of the suite on this head; native Windows; AMD / native wave64.

AI use

  • Claude Code (Claude Opus 5.5) built the head, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
<!-- greyfinch-sync:ivall/xcl:comment:7133589616 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1166#issuecomment-7133589616). Originally posted by [JoaoPauluu](https://github.com/JoaoPauluu) on 2026-11-24T13:57:10Z. --- A run on Linux with vkd3d-proton, where the shaders go through dxil-spirv to Vulkan instead of a Windows driver's DXIL compiler. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257 (DXIL → SPIR-V through dxil-spirv), DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `43c4399` as it is (based on `47efa2e`), no uncommitted changes. The lib test binary runs under Wine, one test per process (`--exact`). - `gpu::recomp::tests::gpu_buffer_atomic_x2_oob_glc_zeroes_vdata`: **ok**, no SKIPPED. **Not tested** - whether the new test fails without the fix on this stack; the rest of the suite on this head; native Windows; AMD / native wave64. **AI use** - Claude Code (Claude Opus 5.5) built the head, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
luckyteagirl commented 2026-11-25 07:05:24 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-25T06:10:08Z.


Independent RX 6800M GPU check on exact PR head 43c43996a72476891a4e976444ed468405b3e055.

Tested

  • Windows 11 build 26200, Ryzen 9 5980HX, Radeon RX 6800M driver 30.0.13002.13003, Rust 1.99.0 MSVC, DXC/DXIL 1.9.2609.5.
  • XCL_ADAPTER=6800M XCL_REQUIRE_GPU=wave64 cargo test --locked -p xcl --lib -j 2 gpu_buffer_atomic_x2_oob_glc_zeroes_vdata -- --test-threads=1 --show-output: 1 passed, 0 failed, 0 ignored in 1.16 s. The log has no SKIPPED line; with XCL_REQUIRE_GPU=wave64, absence of wave64 capability would fail the test. This exercises the PR's active out-of-bounds 64-bit buffer atomic GLC writeback check on the discrete GPU.

I did not run the full workspace suite, a pre-fix negative control on this machine, or a retail title smoke comparison. This result checks the focused regression only; the PR predates the current main head. No game data was used or uploaded.

AI-assisted testing and report drafting with OpenAI Codex (GPT-6); I checked the exact revision and test log before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7154512020 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1166#issuecomment-7154512020). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-25T06:10:08Z. --- Independent RX 6800M GPU check on exact PR head `43c43996a72476891a4e976444ed468405b3e055`. **Tested** - Windows 11 build 26200, Ryzen 9 5980HX, Radeon RX 6800M driver `30.0.13002.13003`, Rust 1.99.0 MSVC, DXC/DXIL 1.9.2609.5. - `XCL_ADAPTER=6800M XCL_REQUIRE_GPU=wave64 cargo test --locked -p xcl --lib -j 2 gpu_buffer_atomic_x2_oob_glc_zeroes_vdata -- --test-threads=1 --show-output`: **1 passed, 0 failed, 0 ignored** in 1.16 s. The log has no `SKIPPED` line; with `XCL_REQUIRE_GPU=wave64`, absence of wave64 capability would fail the test. This exercises the PR's active out-of-bounds 64-bit buffer atomic GLC writeback check on the discrete GPU. I did not run the full workspace suite, a pre-fix negative control on this machine, or a retail title smoke comparison. This result checks the focused regression only; the PR predates the current `main` head. No game data was used or uploaded. AI-assisted testing and report drafting with OpenAI Codex (GPT-6); I checked the exact revision and test log before posting.
DavidM1911 commented 2026-11-25 08:08:19 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T07:46:48Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7156243246 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1166#issuecomment-7156243246). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T07:46:48Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
github-actions[bot] commented 2026-11-28 20:19:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T20:19:17Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7245199982 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1166#issuecomment-7245199982). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T20:19:17Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 04:58:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:58:04Z.


Triage (#1607) – head 43c4399

No open or merged PR makes the same change; main still passes and(act, ok) to atomic64 for buffer_atomic_*_x2, so an active out-of-bounds lane keeps VDATA with GLC=1, while the 32-bit path already returns 0. The split of the memory guard from the GLC write-back in emit.rs:atomic64 is correct (_old starts at 0), and the test covers in-bounds, OOB-active and OOB-inactive lanes.
The PR conflicts with main (atomic64 moved to ~line 4450) and needs a rebase.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7301285156 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1166#issuecomment-7301285156). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:58:04Z. --- **Triage (#1607)** – head 43c4399 No open or merged PR makes the same change; main still passes `and(act, ok)` to `atomic64` for `buffer_atomic_*_x2`, so an active out-of-bounds lane keeps VDATA with GLC=1, while the 32-bit path already returns 0. The split of the memory guard from the GLC write-back in `emit.rs:atomic64` is correct (`_old` starts at 0), and the test covers in-bounds, OOB-active and OOB-inactive lanes. The PR conflicts with main (atomic64 moved to ~line 4450) and needs a rebase. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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/1166:upstream-pr/1166'
git switch 'upstream-pr/1166'

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