Tests: the sparse VRAM test's scalar loads take no s0 offset #1446

Closed
upipibi wants to merge 1 commit from upstream-pr/1456 into main
upipibi commented 2026-11-24 16:20:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by upipibi on 2026-11-24T16:20:42Z.


gpu_sparse_vram_descriptors_buffers_and_xmem encodes its three S_LOADs without SOFFSET, so the field is 0. That is s0, not NULL (0x7D), and the translation adds it: … + (uint64_t)s0 on every scalar load. s0 is the low dword of the argument table's address, so each load reads at its base plus those bits. That is right only while the table sits at a 4 GiB-aligned offset of window 3, i.e. when no other test allocated there first. In parallel runs the test then takes garbage descriptors and never writes its output: submit 1 lane 0 mismatch, left 0, right 1077. That is the failure reported on #1356, where it came before the device hangs.

Test-only.

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs, gpu_sparse_vram_descriptors_buffers_and_xmem:
    • the three loads take SOFFSET NULL (0x7D);
    • the test allocates a 64 KiB block in window 3 before the table, so the table's low bits are never 0. A load that adds s0 then fails on every run, not only in parallel ones.

Tested

  • NVIDIA GeForce RTX 3070, driver 616.56; Windows 11 Pro 26100; Rust 1.100.0 MSVC; debug. The test run on its own (--exact):
    • main 930e8b4 as it is: passes. With one extra window-3 allocation before the table: fails with the reported message (left 0, right 1077).
    • With SOFFSET NULL: passes, with and without the extra allocation.
    • This head (309b45a): passes 3 of 3. With the SOFFSET change taken out (the extra allocation kept): fails every time with the same message.
  • cargo build --workspace + cargo test --workspace --no-fail-fast -- --test-threads=4 at 309b45a (on main b7aa9f3): 770 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.

Regression run
Not needed: test-only change.

Tested by others

  • RTX 5070, by marquezinii (https://github.com/xcl-dev/xcl/pull/1456#issuecomment-7140082109), thanks: <lib test exe> --test-threads=32 gpu::. On main f4ce27c 1 of 8 runs failed: this test's mismatch first, then 0x887a0006 and 20 more gpu::recomp tests on 0x887A0005 / 0x887A0006. With this PR, 10 of 10 clean. So the 0x887A0006 hangs from #1356 follow this test's garbage loads.

Not tested

  • AMD, Wine.
  • AMD, Wine.

AI use

  • Claude Code (Claude Opus 5.5) found the cause, wrote the change and ran the tests.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:6586367085 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1456). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-24T16:20:42Z. --- `gpu_sparse_vram_descriptors_buffers_and_xmem` encodes its three `S_LOAD`s without `SOFFSET`, so the field is 0. That is s0, not NULL (0x7D), and the translation adds it: `… + (uint64_t)s0` on every scalar load. s0 is the low dword of the argument table's address, so each load reads at its base plus those bits. That is right only while the table sits at a 4 GiB-aligned offset of window 3, i.e. when no other test allocated there first. In parallel runs the test then takes garbage descriptors and never writes its output: `submit 1 lane 0 mismatch`, left 0, right 1077. That is the failure reported on #1356, where it came before the device hangs. Test-only. **What is in it** - `crates/xcl/src/gpu/recomp/tests.rs`, `gpu_sparse_vram_descriptors_buffers_and_xmem`: - the three loads take `SOFFSET` NULL (0x7D); - the test allocates a 64 KiB block in window 3 before the table, so the table's low bits are never 0. A load that adds s0 then fails on every run, not only in parallel ones. **Tested** - NVIDIA GeForce RTX 3070, driver 616.56; Windows 11 Pro 26100; Rust 1.100.0 MSVC; debug. The test run on its own (`--exact`): - `main` `930e8b4` as it is: passes. With one extra window-3 allocation before the table: fails with the reported message (left 0, right 1077). - With `SOFFSET` NULL: passes, with and without the extra allocation. - This head (`309b45a`): passes 3 of 3. With the `SOFFSET` change taken out (the extra allocation kept): fails every time with the same message. - `cargo build --workspace` + `cargo test --workspace --no-fail-fast -- --test-threads=4` at `309b45a` (on `main` `b7aa9f3`): 770 passed, 0 failed, 41 ignored. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. **Regression run** Not needed: test-only change. **Tested by others** - RTX 5070, by marquezinii (https://github.com/xcl-dev/xcl/pull/1456#issuecomment-7140082109), thanks: `<lib test exe> --test-threads=32 gpu::`. On `main` `f4ce27c` 1 of 8 runs failed: this test's mismatch first, then `0x887a0006` and 20 more `gpu::recomp` tests on `0x887A0005` / `0x887A0006`. With this PR, 10 of 10 clean. So the `0x887A0006` hangs from #1356 follow this test's garbage loads. **Not tested** - AMD, Wine. - AMD, Wine. **AI use** - Claude Code (Claude Opus 5.5) found the cause, wrote the change and ran the tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DarkPanda69 commented 2026-11-24 17:06:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-24T16:51:01Z.


AMD run, which this PR lists as not tested, plus an NVIDIA one.

Tested: pass, head 309b45a applied on its base main b7aa9f3, debug, 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:

  • AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010, native wave64: 189 passed, 0 failed, 18 ignored, 0 SKIPPED. gpu_sparse_vram_descriptors_buffers_and_xmem ok.
  • NVIDIA RTX 3060, driver 32.0.16.1088, waves 32 only: 189 passed, 0 failed, 18 ignored, 2 SKIPPED (no wave64). Same test ok.

No hang or device removal on either. I can't say whether this explains the 0x887A0006 hangs on #1356: I only saw that PR fail its split-wave64 assert here, not hang.

Not tested: Wine; the whole workspace suite.

AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7138302824 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1456#issuecomment-7138302824). Originally posted by [DarkPanda69](https://github.com/DarkPanda69) on 2026-11-24T16:51:01Z. --- AMD run, which this PR lists as not tested, plus an NVIDIA one. **Tested:** pass, head `309b45a` applied on its base `main` `b7aa9f3`, debug, 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`: - AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010, native wave64: 189 passed, 0 failed, 18 ignored, 0 SKIPPED. `gpu_sparse_vram_descriptors_buffers_and_xmem` ok. - NVIDIA RTX 3060, driver 32.0.16.1088, waves 32 only: 189 passed, 0 failed, 18 ignored, 2 SKIPPED (no wave64). Same test ok. No hang or device removal on either. I can't say whether this explains the `0x887A0006` hangs on #1356: I only saw that PR fail its split-wave64 assert here, not hang. **Not tested:** Wine; the whole workspace suite. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
marquezinii commented 2026-11-24 18:09:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by marquezinii on 2026-11-24T18:02:57Z.


On Not tested ("whether the 0x887A0006 hangs came only from this"): on an RTX 5070 the gpu:: tests run with 32 threads hang the device on main, with this test's mismatch first, and did not in 20 runs with this PR.

Tested

  • NVIDIA GeForce RTX 5070 12 GB, driver 621.40; Ryzen 5 5600X (12 threads), 32 GB; Windows 11 Pro 26300; Rust 1.99.1 MSVC; DXC 1.9.2602.17; debug.
  • The xcl lib test binary run directly: <xcl lib test exe> --test-threads=32 gpu::.
build runs failed tests aborted (exit code 6) clean
main f4ce27c 8 1 2 5
this PR, 309b45a 10 0 0 10
main 9e3831e 10 0 1 9
9e3831e + this PR + #1523, cherry-picked 10 0 0 10
  • The failed run on f4ce27c: gpu_sparse_vram_descriptors_buffers_and_xmem first (submit 1 lane 0 mismatch, left 0, right 1077), then D3D12 device removed: 0x887a0006 and 20 more gpu::recomp tests failing on 0x887A0005 / 0x887A0006.
  • I did not look into the two aborted runs. A whole-lib run on f4ce27c that I caught with procdump ended in 0xC0000374 (heap corruption), noticed in an allocation of null::tests::device_queue_fence_resource_roundtrip; that test is where it was found, not what corrupted the heap, and I have not tied it to this test.
  • cargo test --workspace -- --test-threads=4 on f4ce27c: 700 passed, 0 failed, 41 ignored; SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.

Not tested

  • AMD, Wine; this PR's head on the full workspace suite.

AI use: Claude Code (Claude Opus 5.5) ran the builds and runs and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7140082109 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1456#issuecomment-7140082109). Originally posted by [marquezinii](https://github.com/marquezinii) on 2026-11-24T18:02:57Z. --- On **Not tested** ("whether the `0x887A0006` hangs came only from this"): on an RTX 5070 the `gpu::` tests run with 32 threads hang the device on `main`, with this test's mismatch first, and did not in 20 runs with this PR. **Tested** - NVIDIA GeForce RTX 5070 12 GB, driver 621.40; Ryzen 5 5600X (12 threads), 32 GB; Windows 11 Pro 26300; Rust 1.99.1 MSVC; DXC 1.9.2602.17; debug. - The `xcl` lib test binary run directly: `<xcl lib test exe> --test-threads=32 gpu::`. | build | runs | failed tests | aborted (exit code 6) | clean | |---|---|---|---|---| | `main` `f4ce27c` | 8 | 1 | 2 | 5 | | this PR, `309b45a` | 10 | 0 | 0 | 10 | | `main` `9e3831e` | 10 | 0 | 1 | 9 | | `9e3831e` + this PR + #1523, cherry-picked | 10 | 0 | 0 | 10 | - The failed run on `f4ce27c`: `gpu_sparse_vram_descriptors_buffers_and_xmem` first (`submit 1 lane 0 mismatch`, left 0, right 1077), then `D3D12 device removed: 0x887a0006` and 20 more `gpu::recomp` tests failing on `0x887A0005` / `0x887A0006`. - I did not look into the two aborted runs. A whole-lib run on `f4ce27c` that I caught with procdump ended in `0xC0000374` (heap corruption), noticed in an allocation of `null::tests::device_queue_fence_resource_roundtrip`; that test is where it was found, not what corrupted the heap, and I have not tied it to this test. - `cargo test --workspace -- --test-threads=4` on `f4ce27c`: 700 passed, 0 failed, 41 ignored; SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. **Not tested** - AMD, Wine; this PR's head on the full workspace suite. **AI use:** Claude Code (Claude Opus 5.5) ran the builds and runs and drafted this report.
DavidM1911 commented 2026-11-24 19:07:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T18:52:50Z.


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

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7141280990 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1456#issuecomment-7141280990). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T18:52:50Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
upstream-sync closed this pull request 2026-11-24 21:29:02 +00:00
upipibi commented 2026-11-24 21:29:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by upipibi on 2026-11-24T21:14:05Z.


Closing in favour of #614. Its first commit is this change (SOFFSET 125 = 0x7D), and its second commit (tests take d3d12x::backend() instead of calling real::init() again) fixes the parallel hang in #1727: 0 of 4 whole-lib runs hung on an RTX 3070 with #614, against 3 of 4 on main (numbers). Thanks to marquezinii and DavidM1911 for the runs here.

<!-- greyfinch-sync:ivall/xcl:comment:7144657784 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1456#issuecomment-7144657784). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-24T21:14:05Z. --- Closing in favour of #614. Its first commit is this change (`SOFFSET` 125 = `0x7D`), and its second commit (tests take `d3d12x::backend()` instead of calling `real::init()` again) fixes the parallel hang in #1727: 0 of 4 whole-lib runs hung on an RTX 3070 with #614, against 3 of 4 on `main` ([numbers](https://github.com/xcl-dev/xcl/issues/1727#issuecomment-7144654315)). Thanks to marquezinii and DavidM1911 for the runs here.

Pull request closed

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!1446
No description provided.