Tests: check d16 LDS loads and stores on the GPU #1169

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

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


ds_read_{u8,i8,u16}_d16(_hi), ds_write_b8_d16_hi and ds_write_b16_d16_hi are translated (emit.rs, ds_d16) but had no GPU test. This adds one, test-only.

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs: gpu_ds_d16_loads_stores. The loads read each byte and half of a known dword into one half of a VGPR prefilled with another value; the test checks that the other half is kept and that signed bytes are sign-extended to 16 bits. The stores write from the high half of a VGPR over a known dword, and with two and four lanes writing the same dword, read back by another lane after s_barrier. Runs on every adapter through gpu_waves().

Tested

  • NVIDIA GeForce RTX 3060 12 GB (32-lane waves only), driver 32.0.16.1088; AMD Ryzen 7 5800XT; Windows 11 Pro build 26300; rustc 1.95.0 stable-x86_64-pc-windows-msvc; DXC 1.9.2602.17 from the Windows SDK; debug.
  • cargo test --workspace -- --test-threads=4: 742 passed, 0 failed, 41 ignored (SKIPPED GPU tests: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, no wave64). main 47efa2e on the same machine: 741 / 0 / 41, the same two skipped.
  • cargo test -p xcl --lib -- gpu_ds_d16_loads_stores --nocapture --test-threads=1: 1 passed, not skipped (wave32 pass only on this adapter).
  • Negative controls, each a temporary edit of emit.rs, reverted: ds_read_i8_d16 not sign-extending, ds_read_u8_d16_hi loading into the low half, d16_data taking the low half for the _hi stores. The test fails on each, naming the instruction.

Regression run

  • Not needed: test-only change.

Not tested

  • The wave64 pass (no 64-lane waves on this GPU): AMD and Intel GPUs.
  • Whether a non-atomic read-modify-write in the d16 stores would be caught: the shared-dword case passed here, but a race need not show in one run.
  • Wine, release build.

AI use

  • Claude Code with Claude Opus 5.5: found the untested instructions, wrote the test and this description, ran the tests and negative controls on the machine above.
<!-- greyfinch-sync:ivall/xcl:issue:5472525164 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1178). Originally posted by [jesuarchive](https://github.com/jesuarchive) on 2026-11-24T12:53:42Z. --- `ds_read_{u8,i8,u16}_d16(_hi)`, `ds_write_b8_d16_hi` and `ds_write_b16_d16_hi` are translated (`emit.rs`, `ds_d16`) but had no GPU test. This adds one, test-only. **What is in it** - `crates/xcl/src/gpu/recomp/tests.rs`: `gpu_ds_d16_loads_stores`. The loads read each byte and half of a known dword into one half of a VGPR prefilled with another value; the test checks that the other half is kept and that signed bytes are sign-extended to 16 bits. The stores write from the high half of a VGPR over a known dword, and with two and four lanes writing the same dword, read back by another lane after `s_barrier`. Runs on every adapter through `gpu_waves()`. **Tested** - NVIDIA GeForce RTX 3060 12 GB (32-lane waves only), driver 32.0.16.1088; AMD Ryzen 7 5800XT; Windows 11 Pro build 26300; rustc 1.95.0 `stable-x86_64-pc-windows-msvc`; DXC 1.9.2602.17 from the Windows SDK; debug. - `cargo test --workspace -- --test-threads=4`: 742 passed, 0 failed, 41 ignored (SKIPPED GPU tests: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`, no wave64). `main` `47efa2e` on the same machine: 741 / 0 / 41, the same two skipped. - `cargo test -p xcl --lib -- gpu_ds_d16_loads_stores --nocapture --test-threads=1`: 1 passed, not skipped (wave32 pass only on this adapter). - Negative controls, each a temporary edit of `emit.rs`, reverted: `ds_read_i8_d16` not sign-extending, `ds_read_u8_d16_hi` loading into the low half, `d16_data` taking the low half for the `_hi` stores. The test fails on each, naming the instruction. **Regression run** - Not needed: test-only change. **Not tested** - The wave64 pass (no 64-lane waves on this GPU): AMD and Intel GPUs. - Whether a non-atomic read-modify-write in the d16 stores would be caught: the shared-dword case passed here, but a race need not show in one run. - Wine, release build. **AI use** - Claude Code with Claude Opus 5.5: found the untested instructions, wrote the test and this description, ran the tests and negative controls on the machine above.
towiice commented 2026-11-24 13:07:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by towiice on 2026-11-24T13:07:41Z.

Review: COMMENTED


Tested:

  • Hardware: NVIDIA GeForce GTX 1650 SUPER (Turing TU116, 4 GB VRAM, wave32, driver 610.88), Windows 11 x64 (26H2 / build 26300), DXC v1.9.2609 (01b62ad4), toolchain stable-x86_64-pc-windows-gnullvm (llvm-mingw 23.1.6), debug build.
  • Test command: cargo test -p xcl --lib gpu_ds_d16_loads_stores -- --nocapture
  • Result: 1 passed, 0 failed (0.59 s) — gpu::recomp::tests::gpu_ds_d16_loads_stores passes cleanly on Turing wave32 hardware without skips.

Not tested: full workspace suite, release builds, AMD/Intel GPUs, retail titles (test-only PR).

<!-- greyfinch-sync:ivall/xcl:review:6039730603 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1178#pullrequestreview-6039730603). Originally posted by [towiice](https://github.com/towiice) on 2026-11-24T13:07:41Z. **Review:** COMMENTED --- **Tested:** - Hardware: NVIDIA GeForce GTX 1650 SUPER (Turing TU116, 4 GB VRAM, wave32, driver 610.88), Windows 11 x64 (26H2 / build 26300), DXC v1.9.2609 (`01b62ad4`), toolchain `stable-x86_64-pc-windows-gnullvm` (llvm-mingw 23.1.6), debug build. - Test command: `cargo test -p xcl --lib gpu_ds_d16_loads_stores -- --nocapture` - Result: **1 passed, 0 failed** (0.59 s) — `gpu::recomp::tests::gpu_ds_d16_loads_stores` passes cleanly on Turing wave32 hardware without skips. **Not tested:** full workspace suite, release builds, AMD/Intel GPUs, retail titles (test-only PR).
DavidM1911 commented 2026-11-24 14:06:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T13:04:54Z.


Independent verification on current main 384f7f7 (branch already contains it — clean).

Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug; DXC 1.8.2502.11.

  • cargo test -p xcl --lib gpu_ds_d16: 1 passed, 0 failed — gpu_ds_d16_loads_stores covers d16 LDS load/store on real hardware.

AI use: test runs by Devin (Cognition, SWE-2); no code changes.

<!-- greyfinch-sync:ivall/xcl:comment:7132321889 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1178#issuecomment-7132321889). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T13:04:54Z. --- Independent verification on current `main` `384f7f7` (branch already contains it — clean). **Machine:** Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug; DXC 1.8.2502.11. - `cargo test -p xcl --lib gpu_ds_d16`: **1 passed, 0 failed** — `gpu_ds_d16_loads_stores` covers d16 LDS load/store on real hardware. AI use: test runs by Devin (Cognition, SWE-2); no code changes.
bjarngard commented 2026-11-24 14:06:31 +00:00 (Migrated from github.com)

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


Test report for head 106e1a6 (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_ds_d16_loads_stores passed
  • The test loops over gpu_waves(), so on this adapter both the wave64 and the wave32 pass ran
  • 100 more runs of gpu_ds_d16_loads_stores on the AMD adapter, each a fresh process (--exact --test-threads=1, XCL_REQUIRE_GPU=wave64): 100 passed, 0 failed

Not tested: under GPU load, Intel, Wine.

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:7132773182 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1178#issuecomment-7132773182). Originally posted by [bjarngard](https://github.com/bjarngard) on 2026-11-24T13:23:58Z. --- Test report for head `106e1a6` (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_ds_d16_loads_stores` passed - The test loops over `gpu_waves()`, so on this adapter both the wave64 and the wave32 pass ran - 100 more runs of `gpu_ds_d16_loads_stores` on the AMD adapter, each a fresh process (`--exact --test-threads=1`, `XCL_REQUIRE_GPU=wave64`): 100 passed, 0 failed **Not tested:** under GPU load, Intel, Wine. **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.
github-actions[bot] commented 2026-11-28 08:00:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T08:00:21Z.


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:7236299182 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1178#issuecomment-7236299182). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T08:00:21Z. --- 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 05:00:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:00:28Z.


Triage (#1607) – head 106e1a6

#544 (opened first) also covers the d16 LDS ops (DS_READ_{U8,I8,U16}_D16(_HI), DS_WRITE_B{8,16}_D16_HI) in a 1233-line integration test; this PR is a 74-line per-instruction test in recomp/tests.rs that also checks the kept half and sub-dword writes of neighbouring lanes sharing a dword. #1177 is the companion test of the wide/paired ops, not a duplicate. None of these ops are tested on main.
No problems found in the diff.
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:7301327220 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1178#issuecomment-7301327220). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:00:28Z. --- **Triage (#1607)** – head 106e1a6 #544 (opened first) also covers the d16 LDS ops (`DS_READ_{U8,I8,U16}_D16(_HI)`, `DS_WRITE_B{8,16}_D16_HI`) in a 1233-line integration test; this PR is a 74-line per-instruction test in `recomp/tests.rs` that also checks the kept half and sub-dword writes of neighbouring lanes sharing a dword. #1177 is the companion test of the wide/paired ops, not a duplicate. None of these ops are tested on main. No problems found in the diff. 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/1178:upstream-pr/1178'
git switch 'upstream-pr/1178'

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