Skip to content

Follow-ups to the nvidia-dev merge (#3203): lost diagnostics, stale tests, dead code - #3216

Open
Kalmarv wants to merge 9 commits into
xcl-dev:mainfrom
Kalmarv:followup/post-merge-fixes
Open

Kalmarv wants to merge 9 commits into
xcl-dev:mainfrom
Kalmarv:followup/post-merge-fixes

Conversation

@Kalmarv

@Kalmarv Kalmarv commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Fixes what #3203 (the nvidia-dev merge) left behind. That is the one problem here; each commit stands alone
and builds on its own, so a maintainer can ask for any of them to be split out.

Three runtime commits connect code the merge put side by side without connecting it: the submit-cost report
lost two stages, lazy levels that give their pages back stayed in the resident texel count, and a retired
queue's descriptor-release fence stayed in HEAP_FENCES. Three more remove or gate code the merge left
without a caller. Three fix or add tests: one the merge dropped, one main test that fails when run alone (not
caused by the merge: it fails on main), and one of #3189's direct route on nvidia-dev's thread limits.

What is in it

Runtime:

  • real.rs: the submit-cost lists and after stages are counted again, and call is the refresh only
    (diagnostics).
  • vram.rs: unmap_levels takes the lost levels' texels off the resident count, as map_levels adds them.
  • console_heap.rs, present.rs: a retired queue's fence leaves HEAP_FENCES with the queue's other caches.

Dead code:

  • sparse.rs, title_textures.rs: main's batch hash-plan cap goes (the merged ring_room bounds a batch to the
    same number of updates); title_textures::refresh is test-only.
  • pso_async.rs: submit_eager goes; submit_lazy_keyed / submit_recipe_keyed are test-only.
  • real/two_pass_identity.rs: main's #[allow(dead_code)] back on two_pass_cs_key.

Tests:

  • list_x.rs: a spare whose Reset fails in reset_stand_in stays with the list.
  • real/dispatch_chain.rs: the split ExecuteIndirect allocator-reset test adopts its list. It fails on main
    when run alone (panicked ... adopted class); not caused by Merge nvidia-dev into main (makes #2572 mergeable) #3203.
  • gpu/recomp/tests.rs: 2-D groups through the direct route and the HLSL path under DispatchX limits.

Tested

  • NVIDIA GeForce RTX 5070 Ti, driver 610.74; AMD Ryzen 9 9950X; Windows 11 Pro 10.0.26200; rustc 1.99.0; debug.
  • cargo check --workspace --all-targets: no errors.
  • cargo test -p xcl --lib -- hle::d3d12x::vram:: hle::d3d12x::console_heap:: hle::d3d12x::present:: hle::d3d12x::sparse:: hle::d3d12x::title_textures:: hle::d3d12x::pso_async:: hle::d3d12x::bind:: hle::d3d12x::submit_cost:: hle::d3d12x::list_x:: hle::d3d12x::title_list:: hle::d3d12x::real:: <the three 2-D group tests> --test-threads=4:
    test result: ok. 902 passed; 0 failed; 3 ignored; 0 measured; 1582 filtered out; finished in 15.77s
    SKIPPED: hle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heap: no heap windows (opt-in: XCL_HEAP_WINDOWS=1)
    SKIPPED: hle::d3d12x::pso_async::backlog_tests::a_parked_giant_build_ahead_leaves_the_lane_of_new_compute_pipelines_to_the_next: no build ahead (XCL_PSO_PRELOAD=0, XCL_PSO_AHEAD=0 or short of commit) (short of commit: a title run was going beside it)
  • failed_binding_keeps_indirect_commands_until_allocator_reset --exact, alone:
    test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 2486 filtered out; finished in 0.23s; on main 765b2c5 (beeb81b changes only tests/gpu_compute_e2e.rs):
    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 2483 filtered out; finished in 0.29s (adopted class).
  • cargo test --workspace --no-fail-fast -- --test-threads=4 with three --skips (below), on head b6c4490: 41 test
    binaries, summed from their test result lines: 2594 passed, 0 failed, 49 ignored. The lib binary:
    test result: ok. 2455 passed; 0 failed; 29 ignored; 0 measured; 3 filtered out; finished in 40.19s
    • skipped with --skip, because they end the lib test process on NVIDIA (also on nvidia-dev 54225f5):
      a_refused_gpu_upload_segment_becomes_custom, mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment,
      failed_restore_stops_before_importing_an_unbacked_window
    • SKIPPED on this adapter: 21 wave64 cases (no wave64: gpu::recomp::lower::tests x4, gpu::recomp::lower_dxil::tests
      x14, gpu::recomp::tests x2, gpu::dxil::kernel::dispatch_chain_native_wave64_builds_whole); 3 f16/f32 per-lane
      wave32 cases refused (V_MUL_F16, V_PK_MUL_F16, V_CVT_F16_F32, gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics);
      two_pass_binds_set_the_shared_view_heap and heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)

Regression run
Main (daae033, whose tree is main 765b2c5; main has since gained #3213, a test-only change, and this PR is based on it):

xcl-smoke v1
commit: daae0330b95c43b868f8957c29dc4ccae90ac8ef
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 150
exit: 0x0
frames shown: 2770 (PresentX 2770)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 35252 MB

This PR (b6c4490):

xcl-smoke v1
commit: b6c449087b80499088bdce247d041d532ffea17e
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 150
exit: 0x0
frames shown: 2887 (PresentX 2887)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 34360 MB

Both are the same 150 s recipe on the same cache, pasted from the runner; the head run had the GPU and machine to itself.
Startup preparation ended / first press that reached the title / window end: main 81.6 s / 125.0 s / 231 s,
this PR 67.3 s / 125.0 s / 218 s. The cache was warmer for the head run (PC-SBM is used in place and the head ran after main), so its preparation
ended 14 s earlier; the first press reached the title at 125.0 s in both. A main rerun alone on the fully warm cache
gave 3709 frames with preparation ending at 40 s: frame totals follow the preparation time (first-screen frames before
the press at 125.0 s), and in the 60 s after the press the two builds are equal (this PR 1322 presents, main 1300).
Both runs end with 0 0 0: that is the stall #3214 fixes (precompiled compute blobs not found in play), present on main and not touched here.

Not tested

  • AMD and Intel GPUs.
  • The submit-cost numbers on a title (the change is diagnostics only; no run read the report).
  • The resident texel count on a streaming title that lets levels go (only the unit test).

AI use

  • Claude Code, Claude Opus 5.5: wrote the commits, the tests and this description, and ran the tests above.
  • Claude Code, Claude Fable 5: coordinated the work and read the description.

🤖 Generated with Claude Code

Kalmarv and others added 9 commits November 28, 2026 15:43
The submit-cost report has a lists stage (the title's lists mapped to their PC lists and noted for
the queue) and an after stage (XCL's work after each chunk's driver call). nvidia-dev's submit path
fed both. The merge took main's submission plan for that path and lost the two calls, so both
stages read 0, and the after time showed up in the report's 'splits' (exec minus driver, after and
previous submits). The call stage also took in the list mapping, where nvidia-dev counted only the
refresh.

call is the refresh (prepare_title_submission) again. lists is the mapping before it, without the
put-off dispatches' waits for their builds, plus the queue notes after it. after is measured per
chunk from the driver call's return to the chunk's note_submitted. Diagnostics only.

cargo check --workspace --all-targets passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 2f52d2df75bcd56ad23f7839db71f40132399652)
…xel count

`vram::unmap_levels` (nvidia-dev's zero lazy levels) took a level group's pages away but left
main's `TEXEL_STATS` resident count and the texture's `resident_texels` where `map_levels` had put
them, so `XCL_ACTIVITY`'s resident texels only ever grew while a streaming title let levels go.
The bookkeeping of both directions is now two `TexelMeta` methods; `unmap_levels` takes the lost
groups' texels off, as `map_levels` added them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 0bc1e46dba6c3e75487f894c0ee34b82cc0c1c0d)
`console_heap`'s HEAP_FENCES keeps one fence per title queue address, signalled on that queue to
prove released descriptor ranges idle. `present::invalidate_queue_caches` forgets a retired queue
in every other address-keyed cache but not here, so the map kept a fence for every queue address
the title ever used. It is not a correctness bug: the fence is XCL's own and its values only grow,
so a later queue at the same address carries on with it safely. The entry now goes with the
queue; retired ranges wait on clones of the fence, which stay valid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 009c2042e06ef8f590978a700863523f831b681e)
MAX_BATCH_HASH_UPDATES, batch_hash_plan_would_overflow and the
PreparedDirtyBatch methods hash_plan_would_overflow / append_hashes are
main's (5b71124 sparse.rs:2082), whose upload loop checked the cap before
each staged copy (sparse.rs:3338). The merged upload path never calls
them. It plans hashes in submit_upload, one per whole 64-byte chunk of a
staged copy, and its ring_room already bounds the batch.

The ring bounds those updates. Every staged copy goes through ring_room
first, which allows a copy ending at ring position `end` only while
end - ring_free <= STAGING (after reclaiming, and after submitting the
open batch if needed). ring_free only moves to the end position of a
submitted batch whose fence has completed, so it is never past the open
batch's ring_start. The copies of one batch therefore sit inside
[ring_start, end) and span at most STAGING bytes. That makes at most
STAGING / CHUNK hash updates per batch, which is exactly the old
MAX_BATCH_HASH_UPDATES (16 MB of HashUpdate). A runtime check would
never trip.

append_hash_updates stays as a test helper (#[cfg(test)]) for the hash
plan tests, without its debug_assert on the removed constant.
batch_hash_plan_is_bounded_by_staging tested only the removed cap and
goes. prepared_dirty_batch_keeps_exact_hash_plan_and_rollback_point keeps
its slot, ring_start, exact-update and allocation-reuse checks.

title_textures::refresh: tests only. The KickoffX path (nvidia-dev's
list_x) and main's real.rs call both became prepare_title_submission ->
refresh_for in the merge, so no runtime caller is missing. Its tests
still use it, so it is #[cfg(test)] rather than deleted.

cargo check --workspace --all-targets passes; cargo test -p xcl --lib on the three hash-plan tests: 3 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 38aad0a537b2872ea9a21232eb37429a041d8e6f)
- pso_async::submit_eager: no caller left; submit() and real.rs call submit_eager_with, and
  nvidia-dev had no entry point behind it.
- submit_lazy_keyed / submit_recipe_keyed: only pso_async and bind tests call them (real.rs uses
  the *_with forms), so they become #[cfg(test)].

cargo check --workspace --all-targets passes; pso_async:: and bind:: tests pass
(pso_async:: + bind:: 305 passed, 0 failed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 8ae1c6271bccac5382cf8e2ab350b395ed627007)
main declared two_pass_identity with #[allow(dead_code)], because its identities are consumed by
the next stacked cache stage. The merge took nvidia-dev's plain module line, whose real.rs called
two_pass_cs_key; main's real.rs does not, so the function warns. The allow goes back on that one
function.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 0a3b3e27779a8006986161ad7496d4bbee7c2efb)
The merge dropped nvidia-dev's a_spare_whose_reset_fails_stays_with_the_list_on_the_software_adapter,
because main reserves a put-off dispatch's segment closed, without a Reset, so the case it set
up no longer exists. A spare's Reset can still fail in reset_stand_in, though: it pops a spare to
record a list reset while the list's last submit is on the GPU, and on a failed Reset it gives the
spare back with put_spare. The test is restored for that path, on the software adapter (WARP).
It is again the only user of title_list::spares_for_test, which warned unused in the test build.

Checked: it fails when the put_spare on that path is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit bb40cb5ff94fac73c2a3a1ad658a4e8dba30d96c)
failed_binding_keeps_indirect_commands_until_allocator_reset made a plain
PC command list, but execute_indirect binds the slicer and pieces through
real::bind_pipeline_exact, which calls the list's original SetPipelineState
by its slot in the adopted class. Run alone (or first), slot_of finds no
class for the raw list and panics "adopted class"; in the full suite another
test has already filled the cached slot. Fails the same way on main
5b71124 run alone (--exact): not caused by the nvidia-dev merge.

The test now adopts the list as a title's is (as indirect_guard's tests do)
and closes it through the list's own Close, not XCL's hook.

Tested: RTX 5070 Ti, debug, --exact alone: 1 passed (main 5b71124 without
it: panicked "adopted class"); hle::d3d12x::real::dispatch_chain:: 17 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 8371147f97467fe21630b5a9f8e4246b2fed22bc)
… direct route and the HLSL path under DispatchX limits

xcl-dev#3189 sends 2-D and 3-D compute groups to the direct DXIL route again. On this tree the thread
limits come from nvidia-dev's branch-free compute gate, not main's prologue, so this test checks the
combination xcl-dev#3189's own tests could not: 2x2 groups of 8x8 threads with DispatchX limits 0x0, 11x0,
0x13, 11x13 and 3x5, split wave64 and wave32. Barrier-free, the direct form, the HLSL path and the
expected table agree. With an s_barrier the direct translator refuses any group of several hardware
waves (an older rule in dxil/lower.rs), and the HLSL path matches the table.

cargo test -p xcl --lib -- direct_compute_translates_2d_and_3d_groups
gpu_direct_compute_waves_take_consecutive_threads_of_2d_and_3d_groups
gpu_2d_group_direct_route_matches_the_hlsl_path_under_thread_limits --test-threads=1 (RTX 5070 Ti,
610.74): 3 passed, 0 failed, no SKIPPED. Dropping the Y limit from the expected table makes the
GPU test fail at the direct form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 761fb7232f12ba091eb755758309320099042f2e)
(cherry picked from commit 72c875cd38df49d547d0fd000f37d028170b27e7)

@Prime1997 Prime1997 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving on a merge-check run on an RTX 3060 Ti 8 GB (driver 32.0.16.1714, i5-10400, Windows 11 Pro 26200, Rust 1.100.0).

  • Head b6c449087b80499088bdce247d041d532ffea17e merged cleanly onto main 7db2f391, and the workspace builds.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on the merge: 2,597 passed, 0 failed, 49 ignored, 29 SKIPPED (21 of them no wave64). All of this PR's new and restored tests pass.
  • The test fix holds here: failed_binding_keeps_indirect_commands_until_allocator_reset passes alone on the merge and fails alone on main ("adopted class"), and cargo test -p xcl --lib -- --test-threads=4 indirect gives 41 passed on the merge where main ends in an access violation.
  • 60 s scripts/smoke.ps1 with XCL_PREPARE=0: 1,411 frames against 1,385 on main, peak commit 15,598 MB against 15,626 MB, no device removal, no crash.
  • Whole diff read, no blocking finding.
  • One thing seen once, reported so it is not lost: in a second suite run on the merge, e2e incomplete_discovered_corpus_blocks_headless_title_entry sat for 21 minutes until its test title was ended by hand, then passed. It did not come back in 20 runs of that test alone or 15 runs of the whole e2e harness on four threads, on the merge or on main. Nothing in this diff explains it.

AI use: Claude Code ran the builds, tests and smoke on Prime's PC and wrote this text. Approving is Prime's decision.

I use a temporary Discord to coordinate my work. Anyone helping test XCL or compare results is welcome. Test coordination on Discord

@andrewDoing

Copy link
Copy Markdown
Contributor

One remaining attribution ambiguity on b6c44908: the residual labeled splits also contains time spent acquiring the per-queue CPU lease, including on a single-chunk submit with no split. q_execute_command_lists starts EXEC before entering queue_submit::with; DRIVER, PREVIOUS and AFTER all start inside its closure. outside_part labels the full remainder EXEC − DRIVER − AFTER − PREVIOUS as splits.

I isolated the exact PR lease and formatter on Windows/Ryzen 7 5700X3D. One CPU thread held a queue turn for 40 ms; the submitting thread requested either that queue or an independent queue, then did an empty native-work stand-in. Four same-queue controls produced 40.04–40.66 ms “splits”, 0.00 split waits, 0.00 splits per submit. All four independent-queue controls rounded to 0.00 ms. These are single-observation formatter inputs, not an actual 1,024-submit title trace.

A low-overhead correction would label that remainder “other execution (including queue acquisition and split work)” while keeping the explicit split count and measured split waits/sparse time. If the two need separate figures, time from immediately before the per-chunk with to closure entry, expose that as queue-turn acquisition, and subtract it from residual execution. The restored LISTS and AFTER timers can remain as proposed.

AI assistance: OpenAI Codex traced the call boundaries, ran the bounded exact-source CPU controls and drafted this report.

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Review (head b6c4490, diff read, not a merge-check; it conflicts with main, so not built or run):

  • One commit is already on main: 95bc093 (adopt the list and use its original Close in failed_binding_keeps_indirect_commands_until_allocator_reset) duplicates main's e8a3666 (D3D12.X: indirect dispatches of a split program run its direct pieces #3499) and is the only conflict (real/dispatch_chain.rs); drop it and rebase. The rest merges cleanly and isn't on main yet.
  • Scope: three runtime fixes, three dead-code removals and three tests in one PR; CONTRIBUTING asks for one logical change per PR.
  • submit_cost::after starts too late (real.rs ~11603-11609): it starts when submit_title_chunk returns, so the gate's post-driver work (finish_marked, two_pass_after_submit, finish_title_submission) still lands in "splits", which the commit message says it no longer does.
  • two_pass_identity.rs ~281: the restored #[allow(dead_code)] // consumed by main's next stacked cache stage points at nothing (main has no caller); #[cfg(test)] would match the other dead-code commits.
  • The console-heap test calls forget_queue_fence directly, so the new present.rs (~599) hookup is untested, and the vram test only checks the TexelMeta helpers, not unmap_levels. The suite ran with three tests skipped, and the commits still carry "cherry picked from" lines. The subject has no area prefix.

Fine: the unmap_levels texel subtraction mirrors map_levels, the HEAP_FENCES entry is dropped outside the lock and retired ranges keep their fence clones, the removed hash-plan cap, submit_eager and title_textures::refresh had no runtime callers, and the newly test-only submit_lazy_keyed / submit_recipe_keyed only have test callers.

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants