Skip to content

[upstream #918] Recompiler: translate ds_append / ds_consume (LDS form) - #170

Closed
ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/918
Closed

ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/918

Conversation

@ufoptg

@ufoptg ufoptg commented Nov 24, 2026

Copy link
Copy Markdown
Owner

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: GTA6.Xbox.v1.0.2.1-CYBERLEEK
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: GTA6.Xbox.v1.0.2.1-CYBERLEEK
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


Mirror of xcl-dev#918 (auto-synced, do not edit).

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>
@ufoptg

ufoptg commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

Upstream PR xcl-dev#918 was closed or merged.

@ufoptg ufoptg closed this Nov 25, 2026
@ufoptg
ufoptg deleted the upstream-pr/918 branch November 25, 2026 00:07
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.

2 participants