Tests: a harness for barrier states across submission orders #3559

Open
KDenKC wants to merge 1 commit from upstream-pr/3559 into main
KDenKC commented 2026-12-01 04:44:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KDenKC on 2026-12-01T04:44:40Z.


Part A of the plan announced on #3094 (7298369429): resolving barrier states at submission instead of in recording order. This part is test-only: the harness the later parts' regressions use, with the cases that already hold on main.

A recording is a stand-in PC list that keeps the words XCL's hooks send its ResourceBarrier (a title's legacy barriers through list_x::resource_barrier_x, its enhanced barriers through list_x::uav_barrier_x). A CPU model of the GPU runs recordings in a chosen submission order and reports each transition whose before-state is not the state the texture is in at that point: what the debug layer reports as 527 / 538. The debug layer itself is not used, because it is one per process and turning it on would remove the devices of the tests running beside these (gpu::agility::enable_debug_layer). The textures are WARP resources (barrier_groups reads their descriptions); nothing runs on the GPU, and without a WARP device the tests are skipped.

The cases that do not hold on main (a list recorded before another but submitted after it, thehollowedone's discriminator; a list reset unsubmitted; KickoffX segments) come with the change that makes them hold, so that every test here passes. One thing the harness showed on the way: a texture whose first move is a legacy barrier is not tracked by barrier_groups (note_legacy_state only follows tracked textures; #3489), so the cases here start each texture with an enhanced barrier that names its layout.

Related: #3094, #3489

@thehollowedone, you offered to review the harness and its source: thank you. The case you named (B recorded while its texture is in the old state, A submitted before B, B's barriers corrected at submission) is the first of the red cases that come with part C.

What is in it (one commit)

  • crates/xcl/src/hle/d3d12x/submit_order_tests.rs (new, test-only): Recording (a stand-in list), Gpu (the model), and four tests: the_gpu_model_reports_a_before_state_the_texture_is_not_in, lists_submitted_in_their_recording_order_start_where_the_one_before_left_off, a_list_submitted_again_that_ends_where_it_starts_finds_its_states, compute_lists_submitted_in_their_recording_order_find_their_states.
  • crates/xcl/src/hle/d3d12x/mod.rs: #[cfg(test)] mod submit_order_tests; (two lines; no runtime change).

Tested

  • NVIDIA GeForce RTX 3090 24 GB (VM), driver 621.24, Intel i7-10700T, Windows 11 build 26300.9974, Rust 1.99.1, debug, on this head b911d16c:
    • the harness's five tests (submit_order_tests: the_gpu_model_reports_a_before_state_the_texture_is_not_in, lists_submitted_in_their_recording_order_start_where_the_one_before_left_off, a_list_submitted_again_that_ends_where_it_starts_finds_its_states, compute_lists_submitted_in_their_recording_order_find_their_states, an_unanswered_slot_is_recorded_not_a_crash): 5 passed, 0 failed (also on an RTX 5090 machine, MSVC, debug).
    • cargo test --workspace --no-fail-fast -- --test-threads=4 (leaving out the 3 uma_driver tests that need a GPU upload segment this VM does not have): 2886 passed, 6 failed, 51 ignored; 28 SKIPPED (the VM's usual: no wave64, no heap windows, and others). Four failures are this VM's on main too (stream_recheck_keeps_the_whole_upload_baseline_over_partial_uploads, stream_recheck_partial_upload_without_an_entry_queues_a_whole_upload, stream_recheck_schedule_catches_late_writes_and_resets_milestones, test_title_runs_and_game_folder_is_untouched). The other two, gpu_scale_args_reports_uncapped_group_count_feedback and placed_title_textures_share_vram_and_preserve_pixels, passed when run alone, on this head and on main d0832e61 (1 passed, 0 failed each): failures of the parallel run on this VM, not of this diff, which touches only its own test module.

Regression run
None: the diff is test-only (a new test module and its #[cfg(test)] line in mod.rs), so the runtime is unchanged; a maintainer may apply the test-only label.

Not tested

  • The cases that do not hold on main (they come with the change, parts B and C).
  • A run with the D3D12 debug layer (the model stands in for its 527 / 538 checks).

AI use

  • Claude Code (Claude Opus 5.5, Claude Sonnet 5.5), Codex (GPT-6.2-Sol), Antigravity (Gemini 4 Neon, Gemini 3.8 Flash): an agent swarm wrote, tested, reviewed and described this change.

🤖 Generated with Claude Code
https://claude.ai/code/session_013oPUFCA9W9F8Qb5MPK33bR

<!-- greyfinch-sync:ivall/xcl:issue:5579201861 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3559). Originally posted by [KDenKC](https://github.com/KDenKC) on 2026-12-01T04:44:40Z. --- Part A of the plan announced on #3094 ([7298369429](https://github.com/xcl-dev/xcl/pull/3094#issuecomment-7298369429)): resolving barrier states at submission instead of in recording order. This part is test-only: the harness the later parts' regressions use, with the cases that already hold on `main`. A recording is a stand-in PC list that keeps the words XCL's hooks send its `ResourceBarrier` (a title's legacy barriers through `list_x::resource_barrier_x`, its enhanced barriers through `list_x::uav_barrier_x`). A CPU model of the GPU runs recordings in a chosen submission order and reports each transition whose before-state is not the state the texture is in at that point: what the debug layer reports as 527 / 538. The debug layer itself is not used, because it is one per process and turning it on would remove the devices of the tests running beside these (`gpu::agility::enable_debug_layer`). The textures are WARP resources (`barrier_groups` reads their descriptions); nothing runs on the GPU, and without a WARP device the tests are skipped. The cases that do not hold on `main` (a list recorded before another but submitted after it, thehollowedone's discriminator; a list reset unsubmitted; KickoffX segments) come with the change that makes them hold, so that every test here passes. One thing the harness showed on the way: a texture whose first move is a legacy barrier is not tracked by `barrier_groups` (`note_legacy_state` only follows tracked textures; #3489), so the cases here start each texture with an enhanced barrier that names its layout. Related: #3094, #3489 @thehollowedone, you offered to review the harness and its source: thank you. The case you named (B recorded while its texture is in the old state, A submitted before B, B's barriers corrected at submission) is the first of the red cases that come with part C. **What is in it** (one commit) - `crates/xcl/src/hle/d3d12x/submit_order_tests.rs` (new, test-only): `Recording` (a stand-in list), `Gpu` (the model), and four tests: `the_gpu_model_reports_a_before_state_the_texture_is_not_in`, `lists_submitted_in_their_recording_order_start_where_the_one_before_left_off`, `a_list_submitted_again_that_ends_where_it_starts_finds_its_states`, `compute_lists_submitted_in_their_recording_order_find_their_states`. - `crates/xcl/src/hle/d3d12x/mod.rs`: `#[cfg(test)] mod submit_order_tests;` (two lines; no runtime change). **Tested** - NVIDIA GeForce RTX 3090 24 GB (VM), driver 621.24, Intel i7-10700T, Windows 11 build 26300.9974, Rust 1.99.1, debug, on this head `b911d16c`: - the harness's five tests (`submit_order_tests`: `the_gpu_model_reports_a_before_state_the_texture_is_not_in`, `lists_submitted_in_their_recording_order_start_where_the_one_before_left_off`, `a_list_submitted_again_that_ends_where_it_starts_finds_its_states`, `compute_lists_submitted_in_their_recording_order_find_their_states`, `an_unanswered_slot_is_recorded_not_a_crash`): 5 passed, 0 failed (also on an RTX 5090 machine, MSVC, debug). - `cargo test --workspace --no-fail-fast -- --test-threads=4` (leaving out the 3 `uma_driver` tests that need a GPU upload segment this VM does not have): 2886 passed, 6 failed, 51 ignored; 28 `SKIPPED` (the VM's usual: no wave64, no heap windows, and others). Four failures are this VM's on `main` too (`stream_recheck_keeps_the_whole_upload_baseline_over_partial_uploads`, `stream_recheck_partial_upload_without_an_entry_queues_a_whole_upload`, `stream_recheck_schedule_catches_late_writes_and_resets_milestones`, `test_title_runs_and_game_folder_is_untouched`). The other two, `gpu_scale_args_reports_uncapped_group_count_feedback` and `placed_title_textures_share_vram_and_preserve_pixels`, passed when run alone, on this head and on `main` `d0832e61` (1 passed, 0 failed each): failures of the parallel run on this VM, not of this diff, which touches only its own test module. **Regression run** None: the diff is test-only (a new test module and its `#[cfg(test)]` line in `mod.rs`), so the runtime is unchanged; a maintainer may apply the `test-only` label. **Not tested** - The cases that do not hold on `main` (they come with the change, parts B and C). - A run with the D3D12 debug layer (the model stands in for its 527 / 538 checks). **AI use** - Claude Code (Claude Opus 5.5, Claude Sonnet 5.5), Codex (GPT-6.2-Sol), Antigravity (Gemini 4 Neon, Gemini 3.8 Flash): an agent swarm wrote, tested, reviewed and described this change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_013oPUFCA9W9F8Qb5MPK33bR
KDenKC commented 2026-12-01 04:45:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KDenKC on 2026-12-01T04:45:33Z.


The only change outside the new test file is the #[cfg(test)] mod submit_order_tests; declaration in hle/d3d12x/mod.rs, so PR checks counts it as a runtime change. Could a maintainer apply the test-only label after looking at the diff?

AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 3.8 Flash.

<!-- greyfinch-sync:ivall/xcl:comment:7301069997 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3559#issuecomment-7301069997). Originally posted by [KDenKC](https://github.com/KDenKC) on 2026-12-01T04:45:33Z. --- The only change outside the new test file is the `#[cfg(test)] mod submit_order_tests;` declaration in `hle/d3d12x/mod.rs`, so `PR checks` counts it as a runtime change. Could a maintainer apply the `test-only` label after looking at the diff? AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 3.8 Flash.
Foniass commented 2026-12-01 07:07:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:07:08Z.


Review (head 6e1a5ce4, diff read, not a merge-check; draft, test-only):

  • The stand-in list's function table (submit_order_tests.rs ~59-64) fills only GetType and ResourceBarrier and leaves every other slot at 0. If a path under resource_barrier_x ever calls another PC function (e.g. the depth-twin CopyTextureRegion copies for a kept depth buffer), the whole lib test binary takes an access violation instead of one test failing. Filling the unused slots with a function that panics would keep a failure local.
  • The harness only has cases that hold on main, so its value as a regression check depends on the later parts.
  • PR description fails without smoke blocks; the diff is test-only (a #[cfg(test)] module), so it needs the test-only label.

Fine: it drives the real uav_barrier_x -> barrier_groups::transitions -> resource_barrier_x path through real::orig_fn with slots 8 and 26 right (only the GPU state check is modelled), it skips without WARP or with XCL_BARRIER_GROUPS=0, and CI ran all four tests.

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

<!-- greyfinch-sync:ivall/xcl:comment:7303666185 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3559#issuecomment-7303666185). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T07:07:08Z. --- Review (head 6e1a5ce4, diff read, not a merge-check; draft, test-only): - The stand-in list's function table (`submit_order_tests.rs` ~59-64) fills only GetType and ResourceBarrier and leaves every other slot at 0. If a path under `resource_barrier_x` ever calls another PC function (e.g. the depth-twin CopyTextureRegion copies for a kept depth buffer), the whole lib test binary takes an access violation instead of one test failing. Filling the unused slots with a function that panics would keep a failure local. - The harness only has cases that hold on main, so its value as a regression check depends on the later parts. - `PR description` fails without smoke blocks; the diff is test-only (a `#[cfg(test)]` module), so it needs the `test-only` label. Fine: it drives the real `uav_barrier_x` -> `barrier_groups::transitions` -> `resource_barrier_x` path through `real::orig_fn` with slots 8 and 26 right (only the GPU state check is modelled), it skips without WARP or with `XCL_BARRIER_GROUPS=0`, and CI ran all four tests. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
KDenKC commented 2026-12-01 08:36:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KDenKC on 2026-12-01T08:36:49Z.


@Foniass thanks: done in the PR's one commit, now 51929d1c. Every slot of the stand-in's two tables that it does not answer holds its own small function, which records its slot number on the recording and returns 0; dropping a recording with a recorded call fails that test and names the slots. Not a panicking function: a panic cannot unwind out of an extern "system" call, so it would abort the whole test binary just as the jump to address 0 did. A new test, an_unanswered_slot_is_recorded_not_a_crash, calls slot 12 and checks it is recorded. Harness tests: 5 passed (local, RTX 5090 machine); the whole suite on this head is running and goes into the description.

AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 4 Hydrogen.

<!-- greyfinch-sync:ivall/xcl:comment:7305550533 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3559#issuecomment-7305550533). Originally posted by [KDenKC](https://github.com/KDenKC) on 2026-12-01T08:36:49Z. --- @Foniass thanks: done in the PR's one commit, now `51929d1c`. Every slot of the stand-in's two tables that it does not answer holds its own small function, which records its slot number on the recording and returns 0; dropping a recording with a recorded call fails that test and names the slots. Not a panicking function: a panic cannot unwind out of an `extern "system"` call, so it would abort the whole test binary just as the jump to address 0 did. A new test, `an_unanswered_slot_is_recorded_not_a_crash`, calls slot 12 and checks it is recorded. Harness tests: 5 passed (local, RTX 5090 machine); the whole suite on this head is running and goes into the description. AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 4 Hydrogen.
Foniass commented 2026-12-01 08:46:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:46:12Z.


Re-review (head 51929d1c, diff read, not a merge-check; PR description red, test-only). Follow-up to my review of 6e1a5ce4.

  • The slots the stand-in doesn't answer: fixed. Each one now records its number, and the recording fails its test on drop. You're right that a panicking function would have aborted the binary too: a panic can't unwind out of an extern "system" call. an_unanswered_slot_is_recorded_not_a_crash checks it.
  • Nit: both tables are 64 slots long. A call to a later ID3D12GraphicsCommandList slot (DispatchMesh 78, the enhanced Barrier 79) would still read past them. Nothing under resource_barrier_x makes one today.
  • Tested is out of date. It names 6e1a5ce4 and four tests; this head has five. Your comment says the suite run on this head is going in.
  • The doc comment of the new test cites "(#3559, Foniass)": the PR and a reviewer's handle. The reason in the test itself would age better.
  • Still needs the test-only label for PR description.
  • Unchanged from before: every case holds on main, so the harness doesn't cover #3094's bug yet; that comes with parts B and C. After #3527 (#3489) the comments about starting each texture with an enhanced barrier will be stale. The tests still pass either way.

Fine: the model's checks are explicit asserts. They would catch a break in the legacy-to-LAST sync, in the move out of the undefined layout, or in the compute-list legalisation that strips 0x80. It runs on WARP, so no-GPU CI covers it.

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

<!-- greyfinch-sync:ivall/xcl:comment:7305760429 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3559#issuecomment-7305760429). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:46:12Z. --- Re-review (head 51929d1c, diff read, not a merge-check; `PR description` red, test-only). Follow-up to my review of 6e1a5ce4. - **The slots the stand-in doesn't answer: fixed.** Each one now records its number, and the recording fails its test on drop. You're right that a panicking function would have aborted the binary too: a panic can't unwind out of an `extern "system"` call. `an_unanswered_slot_is_recorded_not_a_crash` checks it. - Nit: both tables are 64 slots long. A call to a later `ID3D12GraphicsCommandList` slot (DispatchMesh 78, the enhanced `Barrier` 79) would still read past them. Nothing under `resource_barrier_x` makes one today. - **Tested is out of date.** It names `6e1a5ce4` and four tests; this head has five. Your comment says the suite run on this head is going in. - The doc comment of the new test cites "(#3559, Foniass)": the PR and a reviewer's handle. The reason in the test itself would age better. - Still needs the `test-only` label for `PR description`. - Unchanged from before: every case holds on main, so the harness doesn't cover #3094's bug yet; that comes with parts B and C. After #3527 (#3489) the comments about starting each texture with an enhanced barrier will be stale. The tests still pass either way. Fine: the model's checks are explicit asserts. They would catch a break in the legacy-to-`LAST` sync, in the move out of the undefined layout, or in the compute-list legalisation that strips 0x80. It runs on WARP, so no-GPU CI covers it. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
KDenKC commented 2026-12-01 08:49:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KDenKC on 2026-12-01T08:49:18Z.


@Foniass thanks: both tables are now 128 slots (past DispatchMesh 78 and the enhanced Barrier 79), and the test's doc comment keeps only the reason. Head b911d16c; Tested gets this head, the five harness tests and the suite counts when its run lands.

AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 4 Hydrogen.

<!-- greyfinch-sync:ivall/xcl:comment:7305829271 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3559#issuecomment-7305829271). Originally posted by [KDenKC](https://github.com/KDenKC) on 2026-12-01T08:49:18Z. --- @Foniass thanks: both tables are now 128 slots (past DispatchMesh 78 and the enhanced `Barrier` 79), and the test's doc comment keeps only the reason. Head `b911d16c`; Tested gets this head, the five harness tests and the suite counts when its run lands. AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 4 Hydrogen.
Foniass commented 2026-12-01 08:54:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:54:22Z.


Re-review (head b911d16c; the diff from 51929d1c, 4 lines). Both nits are addressed: the two tables now have 128 slots each, past DispatchMesh (78) and the enhanced Barrier (79), and the new test's doc comment states its reason. Still open from my last comment: the Tested section on this head, and the test-only label.

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

<!-- greyfinch-sync:ivall/xcl:comment:7305940997 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3559#issuecomment-7305940997). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:54:22Z. --- Re-review (head b911d16c; the diff from 51929d1c, 4 lines). Both nits are addressed: the two tables now have 128 slots each, past DispatchMesh (78) and the enhanced Barrier (79), and the new test's doc comment states its reason. Still open from my last comment: the Tested section on this head, and the `test-only` label. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Foniass commented 2026-12-01 10:16:13 +00:00 (Migrated from github.com)

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


Triage (#1607) – head b911d16

No open or merged PR adds this harness. It is test-only: a new submit_order_tests.rs and a #[cfg(test)] line in mod.rs. It is part A of the plan from #3094, and #3558 by the same author is related but separate.
Nits: the comment on the stand-in table says DispatchMesh is slot 78 and Barrier 79, but they are 79 and 80 (d3d12_layout.rs). The WARP textures are not adopted, so barrier_groups::forget never runs for them, and their LAST entries outlive the test inside a shared test process.
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:7307928637 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3559#issuecomment-7307928637). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T10:16:13Z. --- **Triage (#1607)** – head b911d16 No open or merged PR adds this harness. It is test-only: a new `submit_order_tests.rs` and a `#[cfg(test)]` line in `mod.rs`. It is part A of the plan from #3094, and #3558 by the same author is related but separate. Nits: the comment on the stand-in table says DispatchMesh is slot 78 and Barrier 79, but they are 79 and 80 (`d3d12_layout.rs`). The WARP textures are not adopted, so `barrier_groups::forget` never runs for them, and their `LAST` entries outlive the test inside a shared test process. 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/3559:upstream-pr/3559'
git switch 'upstream-pr/3559'

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