Tests: the ExecuteIndirect bind test takes the warp-test lock #3609

Open
fromthemoonx wants to merge 1 commit from upstream-pr/3609 into main
fromthemoonx commented 2026-12-01 19:21:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-01T19:21:33Z.


hle::d3d12x::bind::tests::later_queue_completion_during_sleep_reclaims_before_wait_deadline fails in parallel runs of its module: 10 of 30 runs of hle::d3d12x::bind::tests:: at --test-threads=8 on main 6bfb5c5 (bind.rs:10023, result is Stopped, not Progressed). It does not fail at 1 or 2 threads.

The fence-wait tests take lock_warp_tests because they count on the process-wide fenced two-pass batches (FENCED_RES / FENCED_BYTES). execute_indirect_reads_the_arguments_written_before_it does not take it. Once another test has hooked the device, its allocator Reset / Release go through alloc_reset / alloc_release -> console_list::allocator_reset -> release_allocator_res, which calls reclaim_fenced. I took backtraces of every reclaim_fenced call from that test in parallel runs (scratch change, not in this PR); run alone it makes none. In a failing run (an earlier scratch log of every caller) it reclaimed while FENCED_BYTES was 67371008, the waiting test's two batches (64 MiB + 256 KiB). It took the later batch the waiting test had just completed. The waiting test's own reclaim then found nothing, its scripted clock ran to the deadline, and wait_oldest_fenced_until returned Stopped. wait_oldest_fenced_reclaims_in_flight_buffer_before_refusing also failed once in 30 module runs of the same tree with a test-only PR merged (#3511); it did not fail in the 60 runs with this change.

What is in it

  • crates/xcl/src/hle/d3d12x/bind.rs (tests only): execute_indirect_reads_the_arguments_written_before_it takes lock_warp_tests like the other tests that reach the fenced batches. No runtime code changes. bind.rs counts as a runtime file for pr_check.py, so this needs the test-only label instead of a smoke pair.

Tested

  • RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, rustc 1.100.0, debug.
  • hle::d3d12x::bind::tests:: --test-threads=8: 60 of 60 runs pass with this change (30 more on the current head 756325f8, rebased onto main f07e426d, also 30 of 30), against 20 of 30 on main 6bfb5c5 (10 failures of later_queue_completion_during_sleep_reclaims_before_wait_deadline).
  • execute_indirect_reads_the_arguments_written_before_it still runs here (not skipped): 1 passed.
  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4 on 756325f8: 2904 passed, 0 failed, 51 ignored. SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same as main.

Not tested

  • AMD, and machines with fewer cores, where the module's thread count differs.
  • The failure rate in whole-suite runs: I measured it at module level only (the whole suite ran once, above).

AI use

  • Claude Code (Claude Opus 5.5): found the cause with the logging run, wrote the change and this description, and ran the tests above.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5592828282 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3609). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-12-01T19:21:33Z. --- `hle::d3d12x::bind::tests::later_queue_completion_during_sleep_reclaims_before_wait_deadline` fails in parallel runs of its module: 10 of 30 runs of `hle::d3d12x::bind::tests::` at `--test-threads=8` on `main` `6bfb5c5` (`bind.rs:10023`, `result` is `Stopped`, not `Progressed`). It does not fail at 1 or 2 threads. The fence-wait tests take `lock_warp_tests` because they count on the process-wide fenced two-pass batches (`FENCED_RES` / `FENCED_BYTES`). `execute_indirect_reads_the_arguments_written_before_it` does not take it. Once another test has hooked the device, its allocator `Reset` / `Release` go through `alloc_reset` / `alloc_release` -> `console_list::allocator_reset` -> `release_allocator_res`, which calls `reclaim_fenced`. I took backtraces of every `reclaim_fenced` call from that test in parallel runs (scratch change, not in this PR); run alone it makes none. In a failing run (an earlier scratch log of every caller) it reclaimed while `FENCED_BYTES` was 67371008, the waiting test's two batches (64 MiB + 256 KiB). It took the later batch the waiting test had just completed. The waiting test's own reclaim then found nothing, its scripted clock ran to the deadline, and `wait_oldest_fenced_until` returned `Stopped`. `wait_oldest_fenced_reclaims_in_flight_buffer_before_refusing` also failed once in 30 module runs of the same tree with a test-only PR merged (#3511); it did not fail in the 60 runs with this change. **What is in it** - `crates/xcl/src/hle/d3d12x/bind.rs` (tests only): `execute_indirect_reads_the_arguments_written_before_it` takes `lock_warp_tests` like the other tests that reach the fenced batches. No runtime code changes. `bind.rs` counts as a runtime file for `pr_check.py`, so this needs the `test-only` label instead of a smoke pair. **Tested** - RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, rustc 1.100.0, debug. - `hle::d3d12x::bind::tests:: --test-threads=8`: 60 of 60 runs pass with this change (30 more on the current head `756325f8`, rebased onto `main` `f07e426d`, also 30 of 30), against 20 of 30 on `main` `6bfb5c5` (10 failures of `later_queue_completion_during_sleep_reclaims_before_wait_deadline`). - `execute_indirect_reads_the_arguments_written_before_it` still runs here (not skipped): 1 passed. - `cargo build --workspace`, then `cargo test --workspace --no-fail-fast -- --test-threads=4` on `756325f8`: 2904 passed, 0 failed, 51 ignored. SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same as `main`. **Not tested** - AMD, and machines with fewer cores, where the module's thread count differs. - The failure rate in whole-suite runs: I measured it at module level only (the whole suite ran once, above). **AI use** - Claude Code (Claude Opus 5.5): found the cause with the logging run, wrote the change and this description, and ran the tests above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Foniass commented 2026-12-01 20:37:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T20:37:57Z.


Review (head 45ab946c, diff read, not a merge-check; checks red):

  • The new comment names a path the test does not take. The comment at bind.rs ~5592 (and the description) says the test's submits reclaim the fenced batches through two_pass_submitted, but two_pass_submitted (~162-195) never calls reclaim_fenced, and the test submits with queue.ExecuteCommandLists on a queue it never adopts (~5680), so the submit does not reach alloc_pool::two_pass_after_submit either. The reclaim comes from another caller of reclaim_fenced (release_allocator_res or take_free, ~653 / ~667); the comment should name that, or the next person chasing this race will look in the wrong place.

Fine: test-only; the guard is the first local, so it is held until the test's lists and allocators are dropped, and taking the same lock_warp_tests the fence-wait tests use is the right fix for sharing FENCED_RES / FENCED_BYTES. The red check is PR description asking for smoke blocks because bind.rs counts as a runtime file; the test-only label is what clears it.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7325013470 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3609#issuecomment-7325013470). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T20:37:57Z. --- Review (head 45ab946c, diff read, not a merge-check; checks red): - **The new comment names a path the test does not take.** The comment at `bind.rs` ~5592 (and the description) says the test's submits reclaim the fenced batches through `two_pass_submitted`, but `two_pass_submitted` (~162-195) never calls `reclaim_fenced`, and the test submits with `queue.ExecuteCommandLists` on a queue it never adopts (~5680), so the submit does not reach `alloc_pool::two_pass_after_submit` either. The reclaim comes from another caller of `reclaim_fenced` (`release_allocator_res` or `take_free`, ~653 / ~667); the comment should name that, or the next person chasing this race will look in the wrong place. Fine: test-only; the guard is the first local, so it is held until the test's lists and allocators are dropped, and taking the same `lock_warp_tests` the fence-wait tests use is the right fix for sharing `FENCED_RES` / `FENCED_BYTES`. The red check is `PR description` asking for smoke blocks because `bind.rs` counts as a runtime file; the `test-only` label is what clears it. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
fromthemoonx commented 2026-12-01 21:07:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-01T21:07:28Z.


You're right, thanks: two_pass_submitted does not call reclaim_fenced. I had placed the call at bind.rs:221 in the wrong function; it is in TwoPassBuf::try_make_with_cap.

I took backtraces of every reclaim_fenced call from execute_indirect_reads_the_arguments_written_before_it (scratch change, not pushed). Run alone, the test makes none. In parallel runs of hle::d3d12x::bind::tests:: at 8 threads, all of its calls come through the allocator hooks another test has installed on the device:

  • alloc_reset -> reset_pc_allocator -> console_list::allocator_reset -> release_allocator_res -> reclaim_fenced
  • alloc_release -> alloc_pool::forget -> console_list::allocator_reset -> release_allocator_res -> reclaim_fenced

The comment and the commit message now name that path. The head is 756325f8, rebased onto main f07e426d; the description is updated. On that head: hle::d3d12x::bind::tests:: at 8 threads 30 of 30, and the whole suite 2904 passed, 0 failed, 51 ignored.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:ivall/xcl:comment:7325781548 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3609#issuecomment-7325781548). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-12-01T21:07:28Z. --- You're right, thanks: `two_pass_submitted` does not call `reclaim_fenced`. I had placed the call at `bind.rs:221` in the wrong function; it is in `TwoPassBuf::try_make_with_cap`. I took backtraces of every `reclaim_fenced` call from `execute_indirect_reads_the_arguments_written_before_it` (scratch change, not pushed). Run alone, the test makes none. In parallel runs of `hle::d3d12x::bind::tests::` at 8 threads, all of its calls come through the allocator hooks another test has installed on the device: - `alloc_reset` -> `reset_pc_allocator` -> `console_list::allocator_reset` -> `release_allocator_res` -> `reclaim_fenced` - `alloc_release` -> `alloc_pool::forget` -> `console_list::allocator_reset` -> `release_allocator_res` -> `reclaim_fenced` The comment and the commit message now name that path. The head is `756325f8`, rebased onto `main` `f07e426d`; the description is updated. On that head: `hle::d3d12x::bind::tests::` at 8 threads 30 of 30, and the whole suite 2904 passed, 0 failed, 51 ignored. AI use: Claude Code (Claude Opus 5.5).
Foniass commented 2026-12-01 21:13:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T21:13:14Z.


Follow-up review (head 756325f8, since 45ab946c, diff read, not a merge-check; checks red):

  • The new comment names a path the test does not take: fixed. The comment at bind.rs ~5592 now says the reclaim comes from allocator Reset / Release through alloc_reset / alloc_release to release_allocator_res, which is the real path: alloc_reset (real.rs ~11578) and alloc_release (~11546, via alloc_pool::forget) both reach console_list::allocator_reset (~432), which calls release_allocator_res and so reclaim_fenced (bind.rs ~653); the test calls alloc.Reset() (~5714) and drops its allocators.

New: none.

Fine: the code is otherwise unchanged and test-only. PR description is red only because bind.rs counts as a runtime file; the test-only label clears it.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7325924762 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3609#issuecomment-7325924762). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T21:13:14Z. --- Follow-up review (head 756325f8, since 45ab946c, diff read, not a merge-check; checks red): - **The new comment names a path the test does not take:** fixed. The comment at `bind.rs` ~5592 now says the reclaim comes from allocator `Reset` / `Release` through `alloc_reset` / `alloc_release` to `release_allocator_res`, which is the real path: `alloc_reset` (`real.rs` ~11578) and `alloc_release` (~11546, via `alloc_pool::forget`) both reach `console_list::allocator_reset` (~432), which calls `release_allocator_res` and so `reclaim_fenced` (`bind.rs` ~653); the test calls `alloc.Reset()` (~5714) and drops its allocators. New: none. Fine: the code is otherwise unchanged and test-only. `PR description` is red only because `bind.rs` counts as a runtime file; the `test-only` label clears it. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
bmjask commented 2026-12-02 15:52:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T15:52:09Z.


@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.

<!-- greyfinch-sync:ivall/xcl:comment:7351061200 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3609#issuecomment-7351061200). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T15:52:09Z. --- @Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
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/3609:upstream-pr/3609'
git switch 'upstream-pr/3609'

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