Skip to content

Recompiler: translate ds_append / ds_consume (LDS form) - #918

Closed
maximecmb wants to merge 1 commit into
xcl-dev:mainfrom
maximecmb:recomp-ds-append-consume
Closed

maximecmb wants to merge 1 commit into
xcl-dev:mainfrom
maximecmb:recomp-ds-append-consume

Conversation

@maximecmb

@maximecmb maximecmb commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

ds_append and ds_consume were untranslated (the ISA census, isa_coverage, lists them as missing, and no open PR or issue covers them). Console compute programs use them as a wave-wide counter in LDS, e.g. to compact a list: the counter at M0[15:0] + offset16 grows (append) or shrinks (consume) by the number of active lanes in one atomic, and every active lane gets the value from before the change.

What is in it

  • crates/xcl/src/gpu/recomp/emit.rs: lane 0 of the console wave does one InterlockedAdd on xcl_lds with the wave's EXEC count (nothing for an empty EXEC), and the old value goes to the active lanes through a lane read. In the split wave64 form (32-lane GPUs), the two halves meet before the atomic, so the upper half's earlier LDS stores are done, and the upper half reads the lower half's result (xcl_x_rla_uniform). GDS=1 is reported as unsupported, as for the ADDTID forms.
  • Same file: the consume delta (0 - n) goes through a lane read. With it straight in the atomic, NVIDIA's driver 617.42 refuses the pipeline (CreateComputePipelineState: E_OUTOFMEMORY), although the DXIL is a plain atomicrmw add of sub 0, n.
  • crates/xcl/src/gpu/recomp/tests.rs: a translation test (offset and M0 address in three option sets, GDS rejected), and GPU tests for wave64 (split on 32-lane GPUs) and wave32: active lanes in both halves, inactive lanes untouched, an empty EXEC changes nothing, a full wave's count.

Tested

  • NVIDIA GeForce RTX 5080 (driver 617.42, 32-lane waves: the split wave64 form), AMD Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug, DXC 1.9.2602.17 (Windows SDK 10.0.26100.0)
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 718 passed, 0 failed, 41 ignored
  • SKIPPED on this adapter (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware; no XCL_SAMPLE_* variables were set, so the game-data tests ran nothing
  • cargo test -p xcl --lib ds_append_consume: 3 passed

Regression run
main:

xcl-smoke v1
commit: 1ec4c98cda119432a4b3f205e146fba2d6f8379a
gpu: NVIDIA GeForce RTX 5080
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 823 (PresentX 823)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15479 MB

This PR:

xcl-smoke v1
commit: 8594f9d87fa553f278070e41b4153e2d6a5fcd60
gpu: NVIDIA GeForce RTX 5080
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1636 (PresentX 1636)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15041 MB

The PR's run came second and found the shader / pipeline caches the first one filled: its higher frame count is that, not this change.

Not tested

  • the native wave64 form (an AMD GPU with 64-lane waves): only the split form and wave32 ran here
  • a wave32 program in 64-lane hardware waves (two console waves per hardware wave)
  • a retail title reaching these instructions: the regression run does not show whether this title runs ds_append / ds_consume
  • the GDS form (not translated)

AI use

  • Claude Code, Claude Opus 5.5: found the gap, wrote the code, the tests and this description, and ran the tests listed under Tested.

🤖 Generated with Claude Code

Both were untranslated (the isa_coverage census listed them as missing).
The counter at M0[15:0] + offset16 grows / shrinks by the wave's active
lane count in one atomic, and every active lane gets its old value. Lane 0
of the console wave does the atomic; in the split wave64 form the halves
meet first, so the upper half's earlier LDS stores are done, and the upper
half reads the lower half's result. GDS=1 is reported as unsupported.

The consume delta goes through a lane read: with `0 - n` straight in the
groupshared atomic add, NVIDIA's driver 617.42 refuses the pipeline
(E_OUTOFMEMORY), although the DXIL is a plain atomicrmw add of sub 0, n.

Tests: translation (address, three option sets, GDS rejected) and GPU runs
for wave64 (split on 32-lane GPUs) and wave32.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eizispark

Copy link
Copy Markdown

Hardware check of 8594f9d87fa553f278070e41b4153e2d6a5fcd60 (verified clean merge with main 09940bb): pass.

Tested

  • Hardware: AMD Radeon RX 9070 XT (RDNA4, driver 32.0.32015.16001), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11, rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profile
  • cargo test --workspace -- --test-threads=4: 715 passed, 3 failed, 41 ignored (GPU tests skipped on this adapter: none; the 3 failures are the pre-existing concurrent placed_title_textures_share_vram_and_preserve_pixels contention and 2 downstream PoisonErrors — cargo test -p xcl --lib hle::d3d12x -- --test-threads=1: 114 passed, 0 failed, 1 ignored)
  • Native wave64 + wave32 GPU tests: gpu::recomp::tests::ds_append_consume_translate_and_reject_gds, gpu::recomp::tests::gpu_ds_append_consume_wave64 (native 64-lane wave on RDNA4), gpu::recomp::tests::gpu_ds_append_consume_wave32 (32-lane wave), gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware, and gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask — all ok

Regression run
main (beaa245):

xcl-smoke v1
commit: beaa245ca04e212f064efc7cafcdce104bc5c0a2
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1660 (PresentX 1660)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14862 MB

PR (8594f9d):

xcl-smoke v1
commit: 8594f9d87fa553f278070e41b4153e2d6a5fcd60
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1669 (PresentX 1669)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14729 MB

Not tested

  • wave32-only GPUs (split-wave64 path); ds_append / ds_consume in a wave32 program running in 64-lane hardware waves; gameplay past the menus

AI use

  • Antigravity (Gemini 4 Carbon) ran the build, test suite, and scripts/smoke.ps1 harness on this machine and formatted this report.

@Evan-Lowry

Copy link
Copy Markdown

Independent RDNA2 hardware check — pass

Tested clean head 8594f9d87fa553f278070e41b4153e2d6a5fcd60 on Radeon RX 6800 (driver 32.0.21045.29003), Ryzen 5 5600, Windows 11 26300.10075, Rust 1.100.0 (x86_64-pc-windows-gnullvm, debug), and DXC 1.9.2609.5.

  • cargo test --offline --locked -p xcl --lib ds_append_consume -- --nocapture: 3 passed, 0 failed, 0 ignored, no GPU skips with XCL_SPLIT_WAVE64 unset, and the same counts with XCL_SPLIT_WAVE64=1. Both runs selected XCL_ADAPTER=Radeon RX 6800 and set XCL_REQUIRE_GPU=wave64.
  • cargo test --offline --locked -p xcl --lib gpu_wave32_program_in_wave64_hardware -- --nocapture: 1 passed, 0 failed, 0 ignored, no GPU skips. This control required native wave64 hardware support.
  • cargo test --offline --locked -p xcl --lib gpu::recomp::tests:: -- --test-threads=1: 120 passed, 0 failed, 17 ignored, no explicit GPU skips.

Not tested Full workspace suite, MSVC build, or a retail-title smoke run. All XCL_SAMPLE_* variables were unset.

AI use Codex (GPT-6, exact variant unavailable) ran the tests and formatted this report.

@DarkPanda69

DarkPanda69 commented Nov 24, 2026 •

Copy link
Copy Markdown

Test report for head 8594f9d87.

Setup

  • Each PR's diff applied on main 077ce40 (all applied cleanly), debug build, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17.
  • cargo test -p xcl --lib -- gpu::recomp --test-threads=4, once with XCL_ADAPTER=radeon and once with XCL_ADAPTER=3060.
    • AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010: waves 32..64, so wave64 programs run in native 64-lane waves.
    • NVIDIA RTX 3060 (Ampere), driver 32.0.16.1088: 32 only, so wave64 programs run in the split form.
  • Not run per PR: the whole workspace suite (the recompiler tests only) and a retail smoke run.

Tested: pass on both GPUs, including the native wave64 form you listed as not tested.

  • RX 9070 XT (native wave64): 191 passed, 0 failed, 18 ignored, 0 SKIPPED. gpu_ds_append_consume_wave32 and gpu_ds_append_consume_wave64 ok.
  • RTX 3060 (split wave64): 191 passed, 0 failed, 18 ignored, 2 SKIPPED (no wave64). Both new tests ok.

Not tested: a title reaching these instructions.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

Note: these runs check that the translated HLSL matches the test's reference model, in 64-lane and in 32-lane waves. They cannot show that the model matches the hardware (on #925 both had the same mistake, and the test still passed).

@SlopTart

Copy link
Copy Markdown

Linux / AMD RDNA3 datapoint.

Merged state: head 8594f9d onto main 6efdabc, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 723 passed, 7 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows. ds_append/ds_consume LDS form green on wave64.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. My Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants