Skip to content

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

Draft
KDenKC wants to merge 1 commit into
xcl-dev:mainfrom
KDenKC:test/submit-order-harness
Draft

KDenKC wants to merge 1 commit into
xcl-dev:mainfrom
KDenKC:test/submit-order-harness

Conversation

@KDenKC

@KDenKC KDenKC commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot added area:d3d12 D3D12.X runtime, command lists, resources, sparse memory area:tests Unit, integration, e2e tests, or testtitle gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) labels Dec 1, 2026
@KDenKC

KDenKC commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

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

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Review (head 6e1a5ce, 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
KDenKC force-pushed the test/submit-order-harness branch from 6e1a5ce to 51929d1 Compare December 1, 2026 08:36
@KDenKC

KDenKC commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

@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

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

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

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.

A recording is a stand-in PC list that keeps the words XCL's hooks send its
ResourceBarrier (the title's legacy barriers through resource_barrier_x,
its enhanced barriers through 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, which is
what the debug layer reports as 527 / 538. The debug layer itself is not
used: it is one per process, and turning it on would remove the devices of
the tests running beside these. The textures are WARP resources (their
descriptions are read); nothing runs on the GPU.

The cases here hold on main: the model itself, two lists submitted in their
recording order (direct and compute), and a list submitted again that ends
where it starts. The cases that do not hold (a list recorded before another
but submitted after it, a list reset unsubmitted, KickoffX segments) come
with the change that makes them hold.

Part A of the plan on xcl-dev#3094 (7298369429).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KDenKC
KDenKC force-pushed the test/submit-order-harness branch from 51929d1 to b911d16 Compare December 1, 2026 08:48
@KDenKC

KDenKC commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

@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

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Re-review (head b911d16; the diff from 51929d1, 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.

@github-actions github-actions Bot added the needs-pr-check Failing the PR description check (CONTRIBUTING.md) label Dec 1, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:d3d12 D3D12.X runtime, command lists, resources, sparse memory area:tests Unit, integration, e2e tests, or testtitle gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) needs-pr-check Failing the PR description check (CONTRIBUTING.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants