shader: lower scalar-offset returning compute atomic adds #2374

Merged
R0Y00 merged 1 commit from upstream-pr/2382 into main 2026-11-25 14:47:08 +00:00
R0Y00 commented 2026-11-25 14:34:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T14:34:01Z.


Refs #1723, #1412. Extends the startup compute path in #2331.

Translate a returning 32-bit buffer atomic add addressed by a scalar byte offset with no vector address. Preserve the old value in the destination VGPR. The source-built programs exercise register offsets 0 and 32, add instruction immediates 0 and 4, and write the observed old value to a separate word. Both positive cases compare 320 words per adapter. Dropping the register offset, immediate, return value or observer store produces a mismatch.

Windows 11 26200.9974, x64 MSVC Release, commit 4a8b0439. The portable check and both D3D12 dispatch tests (hardware and WARP) passed, 3/3 with zero skips.

cmake --build --preset release --target offscreen_check
ctest --preset release --no-tests=error -j 1 -R '^startup_compute_buffer_atomics(_warp|_hardware)?$' -V

This change covers one instruction form through a fixed-table UAV. Dynamic descriptor-heap loads and complete application producer bindings remain separate work.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6606892118 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2382). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T14:34:01Z. --- Refs #1723, #1412. Extends the startup compute path in #2331. Translate a returning 32-bit buffer atomic add addressed by a scalar byte offset with no vector address. Preserve the old value in the destination VGPR. The source-built programs exercise register offsets 0 and 32, add instruction immediates 0 and 4, and write the observed old value to a separate word. Both positive cases compare 320 words per adapter. Dropping the register offset, immediate, return value or observer store produces a mismatch. Windows 11 26200.9974, x64 MSVC Release, commit 4a8b0439. The portable check and both D3D12 dispatch tests (hardware and WARP) passed, 3/3 with zero skips. ```powershell cmake --build --preset release --target offscreen_check ctest --preset release --no-tests=error -j 1 -R '^startup_compute_buffer_atomics(_warp|_hardware)?$' -V ``` This change covers one instruction form through a fixed-table UAV. Dynamic descriptor-heap loads and complete application producer bindings remain separate work.
upstream-sync closed this pull request 2026-11-25 15:01:53 +00:00
RavenCurseBurg commented 2026-11-25 15:02:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T14:46:03Z.


I ran tests/startup_compute_buffer_atomics_check.py --dispatch <dxc> <offscreen_check> hardware on 4a8b0439 with the Intel UHD 770 selected (8086:a780, driver 32.0.101.5973). Both scalar-offset programs dispatched two groups and compared all 320 words with zero mismatches. The four new controls first differed at word 1 (dropped scalar offset), 0 (dropped immediate), 16 (dropped GLC return), and 16 (dropped observer store). At word 16 the latter two produced 00000006 and c5c5c5c5 respectively, against c5c5c5c4. The local debug layer was unavailable.

The portable controls passed with and without LLVM 15.0.7's clang -cc1as -triple amdgcn-amd-amdhsa -target-cpu gfx1013 -filetype asm -show-encoding as the --llvm-mc encoding provider.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7165782144 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2382#issuecomment-7165782144). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T14:46:03Z. --- I ran `tests/startup_compute_buffer_atomics_check.py --dispatch <dxc> <offscreen_check> hardware` on `4a8b0439` with the Intel UHD 770 selected (8086:a780, driver 32.0.101.5973). Both scalar-offset programs dispatched two groups and compared all 320 words with zero mismatches. The four new controls first differed at word 1 (dropped scalar offset), 0 (dropped immediate), 16 (dropped GLC return), and 16 (dropped observer store). At word 16 the latter two produced `00000006` and `c5c5c5c5` respectively, against `c5c5c5c4`. The local debug layer was unavailable. The portable controls passed with and without LLVM 15.0.7's `clang -cc1as -triple amdgcn-amd-amdhsa -target-cpu gfx1013 -filetype asm -show-encoding` as the `--llvm-mc` encoding provider.
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
R0Y00/Xbox2Windows!2374
No description provided.