Skip to content

Merge nvidia-dev into main (makes #2572 mergeable) - #3203

Merged
Prime1997 merged 499 commits into
xcl-dev:mainfrom
Kalmarv:merge/nvidia-dev-into-main
Nov 28, 2026
Merged

Prime1997 merged 499 commits into
xcl-dev:mainfrom
Kalmarv:merge/nvidia-dev-into-main

Conversation

@Kalmarv

@Kalmarv Kalmarv commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Merged as 765b2c5 on 2026-11-28; the runs below were finished after the merge.

This draft PR brings the nvidia-dev branch into main so the two branches can stop diverging, resolving the 37 conflicted files that keep #2572 from merging. It is not a new 51,000-line change: the added lines are nvidia-dev's already-reviewed work (fitting the title into 16 GB of VRAM, worker-process startup preparation, and build scheduling), main is kept whole (the #2959 submission rework and #3045-#3100 native pipeline libraries), and where both branches solved the same problem, the better implementation was kept.

Merge with a merge commit, not squashed or rebased. Git must record that nvidia-dev's 493 commits are in main, or the next sync of the two branches hits the same conflicts again; a squash would also put 43 authors' commits under one name. Head daae0330 is merge commit f0e8fdd5 (main 10d27297 + nvidia-dev 54225f58), two test follow-ups (1b4117b2, dc763946), #1435 cherry-picked (adccb7d8), a second merge of main at 5b711248 (5eb48388; main had gained #3195-#3198, only README.md conflicted), and #3189 cherry-picked (daae0330). To review only the conflict resolutions, run git show --remerge-diff f0e8fdd5; the full per-job record (RESOLUTIONS.md) is in the first comment below.

Credit
Every commit on both sides stays in history with its original author; nothing is squashed.

Job Taken from Why
Memory model nvidia-dev fits the title in 16 GB VRAM via 16 UMA windows, lazy sparse and level pages
Submission and completion receipts main #2959's submission plan and receipts replace nvidia-dev's per-call locking
Pipeline cache and pipeline libraries main keeps exact-generation driver blobs and native pipeline libraries (#3045-#3100)
Build scheduling main + nvidia-dev main's build gates plus nvidia-dev's build-ahead lanes, bounded waits and one-giant-build rule
Startup preparation nvidia-dev compiles only shaders earlier runs used, in worker processes
Recompiler main + nvidia-dev main's translator with nvidia-dev's LDS order, branch-free thread limits and dispatch folding
GPU-wait watchdog default main fail-closed stop by default; nvidia-dev's continue path stays behind a switch
Diagnostics both they feed separate reports with no overlap

What is in it

Brought over from nvidia-dev:

  • Low-VRAM memory model: keeps memory inside 16 GB VRAM using 16 UMA windows, mirror tiles, lazy sparse allocation, pack pools, a split sparse lock, texture level pages, a mixed UMA driver window and delayed release of resources and pipelines (late_release).
  • Two-pass sizing: two-pass buffer sizing and caps.
  • Startup preparation: builds pipelines in worker processes filtered to shaders earlier runs used (XCL_PREPARE_ALL=1 prepares every record; XCL_PREPARE=0 is logged).
  • Driver builds: limits giant driver compiles to one at a time and never ahead of use, adds bounded pipeline waits (XCL_GFX_PSO_WAIT_MS / XCL_CS_PSO_WAIT_MS), build-ahead lanes and lazy-pipeline stats.
  • Driver-blob keep rules: caches slow builds even for small programs, separates compute and graphics thresholds, and scopes graphics cache filenames per adapter.
  • Recompiler fixes: constant data after the program, partner_word, runtime split-wave64 LDS ordering, and dispatch folding (IO_GROUP_LIMIT / IO_LOOP_BUDGET / FOLD_X).
  • Precompile CLI: defaults to the runtime window count when --windows is omitted.
  • Diagnostics: runtime watches, submit cost, capture, look stats and GPU timers (watch, submit_cost, capture, look_stats, gpu_times).

Carried on top (each drops out once it merges upstream):

One small test commit of ours for the 2-D/3-D routing on the merged tree follows after it passes (in progress).

Where both sides did the same job (full list in the first comment below):

  • Kept from main: submission plan, receipts and native queue slots; retained pipeline generations and BindStateRegistry; exact-generation DriverBlobs cache with LoadedBlob (now carrying nvidia-dev's keep rules); single LISTS map; PendingRegistry; WholeBuild and bind_pipeline_exact; IndirectSignatureInfo; alloc_pool (retire_recording / reclaim_idle_aside); and the memory_report snapshot in host.
  • Kept from nvidia-dev: Slots compile gate (with main's medium-compute gate on top); Sharded PSO tables behind main's API; runtime split-wave64 LDS order over main's static LdsGap; branch-free DispatchX thread limits over main's guarded prologue; the IO slot layout; and pc_slot! at shared call sites.
  • Kept from both: main's stall spans and nvidia-dev's api_cost / look_stats timers (separate reports).

Behaviour changes
For anyone running main today:

  • Direct dispatches over 65,535 groups in a dimension: main skipped them; now they are folded into the other dimensions as on nvidia-dev (D3D12.X: a folded indirect dispatch of a split program runs all its groups #1428 by lukastaro, plus 9cc53f15/ca1e6ad6), so the work still runs. This is only the direct-dispatch fold; the off-by-default XCL_CLAMP_INDIRECT pass for indirect dispatches stays off.
  • Pipelines no earlier run used: main built them at first use; now nvidia-dev's backlog (69a48a24, 2ccc646f) builds them ahead of first use to cut first-use stalls. In a_pipeline_an_earlier_run_used_is_built_ahead_of_its_first_use, main's is_pending(unknown) assert is replaced by nvidia-dev's !used::noted(unknown_key).
  • GPU-wait watchdog: main's fail-closed stop remains the default; nvidia-dev's signal-expired-fences-and-continue behaviour is kept behind XCL_WAIT_TIMEOUT_CONTINUE=1 (one test per path) so default runs do not hide a stuck wait. D3D12.X: the GPU wait watchdog does not miss the wake of an armed wait #2499 / D3D12.X: preserve GPU wait watchdog wakeups on nvidia-dev #3130 (the watchdog's missed wake) are separate and not part of this merge.

Dropped
Every item below was dropped because the other side already does the same job, not because it was wrong:

  • theaustinayers: remember_compute_blob / compute_blob_kept / keep_compute_blob / keep_graphics_blob (9baaa6ff) and graphics_pso_through_cache (4e8657cf) → replaced by main's DriverBlobs / keep_driver_blob, which now carry their rules; 64-way LISTS sharding (2987c19b) → replaced by main's single LISTS map; file claim (83bb3436) → replaced by main's OS-backed claim; XCL_TEXTURE_SAFE_READ (8c0ce9ea) → replaced by main's reader, which always copies outside the committed window.
  • joeypercia: XCL_PRECOMPILE_PARENT whole-form pass (Shaders: a title's preparation workers build split programs' whole forms #2794, on nvidia-dev) → covered by main's prepare_compiled_compute.
  • Kalmarv: park_list / unpin_list / unpin_users / done_with (bf42a6ee) → replaced by main's retire_recording / reclaim_idle_aside.
  • Trey Bertram: empty-shader-slot two-pass key (4e52050c, D3D12.X: empty shader slots keep a two-pass mesh pipeline's cache key #2975) → covered by main's inactive-stage key (the two tests contradicted each other).
  • bmjask: static LdsGap (22026ba5) → replaced by nvidia-dev's runtime split-wave64 LDS order; guarded DispatchX prologue (Tests: compare benchmark regression thresholds #2959/Recompiler: keep DispatchX rendezvous branch wave-uniform #3157) → replaced by nvidia-dev's branch-free thread limits.
  • Other nvidia-dev internals (each replaced by main's equivalent): Sharded PENDING (PendingRegistry), State::limits (explicit limits), gave_standin / waits_for (defer_retained), note_signature_dispatches (IndirectSignatureInfo), dispatch_chain's own bind() (bind_pipeline_exact), and title_list's forget-if-not-adopted (main's primary-keeping release).

Known issues

  • One used compute program translates to 17.5-18 MB of DXIL on main's translator (584 KB on nvidia-dev) because direct DXIL is refused and the HLSL fallback is that large (offline precompile skips it under the 8 MiB cap, while startup preparation compiles it). Fixed on this branch by carrying Recompiler: 2-D and 3-D compute groups take the direct DXIL route again #3189; stock main still has it (driver compile time of the 18 MB form: (in progress)). Recompiler: 2-D and 3-D compute groups take the direct DXIL route again #3189 changes the DXIL of the 397 programs with 2-D/3-D groups, so those need their driver compiles again (in progress).
  • The merged translator's DXIL differs from nvidia-dev's, so an nvidia-dev driver cache does not carry over and one offline precompile is needed. Time on an RTX 5070 Ti with a Ryzen 9 9950X: (in progress). Driver compilation is CPU-bound, and 15 threads already fill the 16 cores.
  • The first smoke at f0e8fdd5 (XCL_PREPARE=0, cold cache) showed no presents for its last 64 s while large compute pipelines built. These were slow builds that finish, not a hang: every wait ended within 10 ms of its driver compile.
  • Known gaps (details in the first comment below): main's hash-batch cap is not enforced on the merged upload path; a page-scan panic panics the submit; unmap_levels does not update TEXEL_STATS; HEAP_FENCES has no forget_queue; some dead code is left in place.

Tested

  • RTX 5070 Ti (driver 610.74), Windows 11 Pro 26200, Rust 1.99.0.
  • At daae0330: cargo check --workspace --all-targets passes (the full suite was run at dc763946; since then: D3D12.X: XG CopyInto/FromSubresource take the newer library's added argument #1435 in xg.rs, the second merge of main with one test fix, Recompiler: 2-D and 3-D compute groups take the direct DXIL route again #3189 in the recompiler; suite on the final head: (in progress)). At dc763946: cargo check --workspace --all-targets passes; release build. adccb7d8 adds only D3D12.X: XG CopyInto/FromSubresource take the newer library's added argument #1435 (xg.rs) and builds in release; the xg module tests on adccb7d8: (in progress).
  • At dc763946, cargo test -p xcl --lib -- --test-threads=4 (debug), skipping the two uma_driver remake tests of Tests: the mixed-window remake tests run in a child process #3187: 2444 passed, 2 failed, 29 ignored. The two failures are link_tests::linked_programs_keep_their_declarations and link_tests::gpu_linked_memory_accessors (DXC 1.9 refuses their WaveSize), and they fail the same way on stock nvidia-dev. The first run on 1b4117b2 failed 7 more: 6 tests whose expectations changed with the merged behaviour (recompiler prologue forms, an LDS-clamp address, a root signature in a bind test, the backlog assert, the copy-back lock test), fixed in dc763946. Also one kernelx test, a_page_whose_move_fails, which passes alone 3/3: it is an address-reuse race between parallel tests, with code identical to nvidia-dev.
  • In progress: the 16-window precompile (xcl shaders --precompile --pipelines --used-only --windows 16), the smoke pair on each side's own precompiled cache, and one world run on a 16 GB NVIDIA card.

Regression run
In progress. The pair is main (commit named in its block) and this head, both with the following recipe:

  • 150 s on an RTX 5070 Ti, 16 UMA windows;
  • startup preparation on, after each side's own offline precompile, so what still compiles in play shows inside the 150 s;
  • the same starting graphics history.

An earlier pair with XCL_PREPARE=0 on cold caches is superseded, because it does not compare the two trees:

  • On NVIDIA, main's run reached only the menu in 150 s, while the merged run was in the world by 32 s. So peak commit was 15,025 MB against 31,546 MB.
  • At the same scene the two commit within main's own swing: +150-390 MB at equal target pages, all in "other".
  • At the heavy scene the merged tree commits 1.0-2.2 GB less than stock nvidia-dev.

Not tested

  • AMD, Intel and NVIDIA cards other than the RTX 5070 Ti.

AI use

  • Claude Code with Claude Opus 5.5: the per-file 3-way conflict resolutions, the adapting code, and RESOLUTIONS.md.
  • Claude Fable 5: coordinating the agents and checking their results.
  • Antigravity with Gemini 4 Neon: writing this pull-request description.

🤖 Generated with Claude Code

theaustinayers and others added 30 commits November 25, 2026 09:11
a_single_split_wave_of_a_compute_group_exchanges_without_a_group_barrier
found the first address of a counter before the start's group barrier
and then accepted any `store i32 0,` after it, so a zero stored to some
other word in between satisfied it. It now takes the value the
counter's getelementptr defines (@xcl_xc without LDS; with LDS the
address built from the `add .., 8189` index into @xcl_lds) and asserts
`store i32 0, i32 addrspace(3)* %N` through exactly that value before
the barrier, for the compute and the 48 / 64 thread mesh cases.

Tested (software adapter, release, agentcargo.ps1 wrapper):
  cargo test --release -p xcl --lib -- --test-threads=4 gpu::dxil::
    151 passed, 0 failed, 3 ignored
  cargo test --release -p xcl --lib -- --test-threads=4 gpu::recomp::
    370 passed, 0 failed, 18 ignored
  cargo test --release -p xcl --lib -- --test-threads=4 barrier
    6 passed, 0 failed, 1 ignored
Not run: the 55 tests that open the hardware GPU themselves; nothing
ran on a GPU.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/wave64-on-wave32.md still said that one console wave per group
(most compute, ES+GS) meets at GroupMemoryBarrierWithGroupSync and that
`XCL_WAVE64_SPIN=1` forces the counters everywhere. Spinning is the
default in the HLSL path (=0 is the switch), the direct translator
spins for one split wave of a compute or mesh group whatever the
variable says (1be95b1), and it leaves split geometry with an ES phase
to the HLSL path while the safe barrier is wanted (685cf9c). The group
barrier is now used only in the tests' kernel form, with
XCL_WAVE64_SPIN=0 in the HLSL path and in the direct ES phase with
XCL_SAFE_BARRIER=0. The doc says so, and that =0 affects the HLSL path
only.

The comment of DxilIr::split (recomp/lower_dxil.rs) said the spin meet
is for a compute group "of one console wave or more"; a group of 32
threads has no partner and no exchange, so it now says "more than 32
threads". Comments and docs only.

Tested (software adapter, release, agentcargo.ps1 wrapper):
  cargo test --release -p xcl --lib -- --test-threads=4 gpu::dxil::
    151 passed, 0 failed, 3 ignored
  cargo test --release -p xcl --lib -- --test-threads=4 gpu::recomp::
    370 passed, 0 failed, 18 ignored
  cargo test --release -p xcl --lib -- --test-threads=4 barrier
    6 passed, 0 failed, 1 ignored
Not run: the 55 tests that open the hardware GPU themselves; nothing
ran on a GPU.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…FE_BARRIER set; split geometry with an ES phase goes to the HLSL path)

From the review of fb55e49 and 1be95b1:

- XCL_SAFE_BARRIER changes what both translators emit and which of them
  takes a compute or mesh program, and was not part of the translated
  cache: one diagnostic run with it at 0 stored DXIL with plain group
  barriers that every later run loaded. The cache is not used while it is
  set;
- the direct translator leaves a split wave64 geometry pass with an ES
  phase to the HLSL path: its exchanges met at plain group barriers, the
  pattern of xcl-dev#1727, while the HLSL path's exchange spins;
- the tests of the split exchange count the group barriers with sync and
  the spin's fences apart, cover mesh groups of 48 and 64 threads and the
  LDS layout, and a mesh pass with 16 heap windows on the HLSL path;
- comments say which exchanges still meet at a group barrier.

Software adapter, whole library suite on the branch: see the branch's last
commit; the tests that open the hardware GPU were not run.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…d, lists are held only for a stop; the stop file has its own thread)

From the review of fb9e302 and e271679:

- a call into the driver that has not returned for 2 s parked every later
  submit of every thread with no time limit: a call that only waited for
  GPU progress which depended on a parked submit then never returned. The
  watch now only logs such a call (when it passes the limit, every 5 s,
  and when it has returned, with its real length); the title's command
  lists are held only while a stop for a driver error is being handled;
- the stop file is read on a thread of its own that calls nothing in the
  driver before the title ends, as bytes (empty, BOM, UTF-16 tolerated);
- the report names pipelines without starting a build and uses the DRED
  labels for graphics pipelines; pass-through DispatchMesh draws are in
  the ring; its lines say "recorded last";
- the memory line carries the video memory budget, so a reader can tell a
  report within the budget from one past it.

Software adapter, whole library suite on the branch: see the branch's last
commit; the tests that open the hardware GPU were not run.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A lane may run 65 536 loop passes before LOOP_GUARD ends its loops, so
that console code looping on a count XCL gave it wrong does not keep the
GPU busy for minutes. That bound is per lane: the work it allows grows
with the dispatch, and a large dispatch outlasts the 2 s Windows waits
before it removes the device.

WindNew:CS_AdvectFromParentStep (a542b07e605c8fd7, 4 x 4 x 4 threads) is
dispatched as 16 x 16 x 16 groups and loops while a counter differs from
a count in title memory. Run alone on an RTX 3060 Ti with synthetic
inputs, the translated program takes 1.0 ms with a count of 0, 6.7 ms
with 64, 25 ms with 256 – and with a count that never comes 111 ms when
the loop is ended after 256 passes and 485 ms after 1024 (0.47 ms a
pass), which is 31 s for 65 536. That is the dispatch left open when the
device was removed (xcl-dev#1452).

A compute dispatch whose group counts are known now passes its share of
2^28 loop passes for one group in a free io slot (IO_LOOP_BUDGET), and
in a compute program every entry of a loop has its own count of passes:
that share among the group's threads, between 1024 and 65 536 a lane.
Up to 4096 lanes nothing changes; at 16 x 16 x 16 groups of 64 threads
one entry of a loop ends after 1024 passes. The lane's budget of 65 536
for all its loops stays, so loops inside one another are not cut to one
loop's share: only a loop that runs away on its own is ended early. A
slot of 0 (an indirect dispatch, the test runner) leaves 65 536, and
programs without a loop, other stages and the direct translator emit
what they did.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 4bad505)

Conflicts resolved in: crates/xcl/src/hle/d3d12x/bind.rs (bind_abi takes
the PR's groups argument and keeps the tree's heap_bound check; the
indirect path keeps skip_named_cs and indirect_guard::check and passes
None; translated_dispatch keeps skip_named_cs and the gpu_profile span
and passes Some([x, y, z])).
The direct DXIL translator's compute programs are to count each entry of
a loop against the dispatch's share, as the HLSL path does since the
previous commit. An inner loop's count has to start afresh each time the
loop is entered, and the translator lowers blocks one by one with no
idea of which loop holds which: Cfg only knows the loop headers.

cfg::loop_parents gives, for each loop header of the (reducible) Cfg, the
header of the loop directly around it, or none. A loop is its header and
every block that reaches one of its back edges (an edge into the header
from a block at or after it in the reverse post-order) without passing
the header; the loop around it is the smallest other loop that holds its
header. Nothing calls it yet.

Tested (software adapter, the tests are CFG-only):
  agentcargo.ps1 ... 'test','--release','-p','xcl','--lib','--',
  '--test-threads=4','loop_parents': 5 passed, 0 failed, 0 ignored
  (one loop, two in a row, a loop in a loop, three deep, two back edges
  to one header, an inner loop entered from two blocks, a loop whose
  header is the entry block).
Not run: the 54 tests that open the hardware GPU themselves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commits made the HLSL path's compute loops end an entry
after the dispatch's share of passes for a thread (IO_LOOP_BUDGET), so
that a large dispatch whose loop count never comes does not outlast the
time Windows gives the GPU before it resets the driver. Compute programs
run through the direct DXIL translator here, and it kept only the lane's
budget of 65 536 passes for all its loops, which a retail title's program
dispatched as 16 x 16 x 16 groups turns into about 31 s of GPU time.

The plain form of a compute program with a loop now loads the slot once
in the entry block and makes cap = slot == 0 ? 65 536 : clamp(slot /
threads per group, DISPATCH_LOOP_PASSES_MIN, 65 536), the HLSL path's
xcl_cap. Each loop header b has a variable VAR_LOOP_PASSES + b (1 << 30
and up: above the temporaries and the reload variables), set to cap at
the entry; a loop's head, before the lane's budget, leaves to the
program's end when its count is 0, else counts it down, and sets the
counts of the loops directly inside it (cfg::loop_parents) back to cap.
In a reducible CFG every path that enters a loop passes the head of the
loop around it, so that is a fresh count on every entry. A loop that
runs out ends the lane's program, where the HLSL path goes on after the
loop; both only end a loop that ran away. The lane's budget stays as it
was. Programs without a loop and every other entry emit what they did;
the compact form and the per-lane form keep the lane's budget alone.

Tested (software adapter):
  agentcargo.ps1 ... 'test','--release','-p','xcl','--lib','--',
  '--test-threads=4','direct_compute_loops_count_each_entry': 1 passed
  (ran: one load of the slot and two decrements for one loop; for the
  loop entered three times one count set at the entry and the inner one
  set back on the outer head's path – the test fails with the reset
  taken out; a loop-free compute program and a kernel with the loop have
  neither; wave32 and split wave64)
  ... 'gpu::dxil::': 158 passed, 0 failed, 3 ignored
  ... 'gpu::recomp::': 373 passed, 0 failed, 18 ignored
Not run: gpu_direct_compute_loop_passes_follow_the_dispatch (65 536,
5000, 1024 and 65 536 passes for the four shares, three entries of 1024
under a share of 1024, a 1025th pass ending the program, wave32 and split
wave64) printed SKIPPED (no wave32 on the software adapter); and the 54
tests that open the hardware GPU themselves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A switch to compare with the loop bound of before: with
XCL_DISPATCH_LOOP_BUDGET=0 (read once, recomp::dispatch_loop_budget_wanted)
a direct dispatch (bind.rs) and a dispatch of a console command list
(console_list.rs) leave IO_LOOP_BUDGET at 0, the value an indirect
dispatch already passes. Both translators then give every loop of a
compute program the lane's 65 536 passes, as before the dispatch's share
(the translated code is the same: only the slot changes). The README's
list of switches says so.

Tested (software adapter, the whole library suite on this commit):
  agentcargo.ps1 ... 'test','--release','-p','xcl','--lib','--',
  '--test-threads=4': 1350 passed, 0 failed, 24 ignored; 179 GPU tests
  of those passed printed SKIPPED (no wave32 / wave64 on the software
  adapter), among them gpu_compute_loop_passes_follow_the_dispatch and
  gpu_direct_compute_loop_passes_follow_the_dispatch
  ... 'hle::d3d12x::': 350 passed, 0 failed, 1 ignored
Not run: the 54 tests that open the hardware GPU themselves; the switch
itself on a title (it changes only what the runtime writes to the slot).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dispatch_loop_budget_wanted only decides what a dispatch writes to
IO_LOOP_BUDGET, but it sat in gpu/recomp/mod.rs, which build.rs hashes
into XCL_TRANSLATOR_SOURCE_ID; the direct translator's cache identity is
built on that ID too. So any later edit of the switch, even of its doc
comment, would throw away every translated shader of both translators
while no translated code changed. It now lives in hle/d3d12x/bind.rs
(pub(super)), beside bind_abi, its one caller there, and
console_list.rs calls it through super::bind. Behaviour is unchanged.
This commit itself changes recomp/mod.rs once more (the removal), so
the translator source ID changes with it, as it already did in this
series (the picked upstream commit edits mod.rs and emit.rs; the direct
translator's commit d9a247b changes XCL_DIRECT_DXIL_SOURCE_ID, which
its message did not say): every cached translation of both translators
is made again once.

Tested on the software adapter, release, the tree with all of this
series' follow-up commits (agentcargo.ps1 -Key w5pages):
  'test','--release','-p','xcl','--lib','--','--test-threads=4',
  'hle::d3d12x::': 350 passed, 0 failed, 1 ignored
  ... the whole library suite: 1352 passed, 0 failed, 24 ignored;
  179 GPU tests of those passed printed SKIPPED (no wave32 / wave64)
Not run: the 54 tests that open the hardware GPU themselves; the switch
on a title.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The switch's line said every loop of a translated compute program ends
an entry after its dispatch's share. Not so for an ExecuteIndirect
dispatch (its group counts are in a GPU buffer: the slot stays 0), for
the direct translator's compact form (20 000 instructions and more) and
for XCL_PER_LANE, which keep only the thread's 65 536 passes; and the
direct translator ends the thread's program where the HLSL path only
ends the loop. Someone comparing with XCL_DISPATCH_LOOP_BUDGET=0 could
take a runaway loop on one of those paths for a bug in the bound.

Docs only; no test. Not run: anything on the hardware GPU.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
loop_parents_of_a_loop_with_two_back_edges only half guarded what it is
named for: the inner loop lay on the path of the back edge that comes
first in the header's preds, so a body built from that edge alone
(find instead of filter) still held it and the test passed; its comment
also named the wrong edge. Now each of the two back edges (3 -> 1,
5 -> 1) has an inner loop of its own (2, 4), so dropping either edge
leaves one inner loop outermost. Checked: with the body taken from the
first back edge only, the test fails (and passes again without).

loop_parents_of_a_split_loop adds the one shape make_reducible actually
splits (a loop entered in the middle): loop_parents on the final graph
gives the single loop at 3, with no parent.

cfg.rs is hashed into XCL_DIRECT_DXIL_SOURCE_ID with its tests, so this
commit makes the direct translator's cache entries again once.

Tested on the software adapter, release (agentcargo.ps1 -Key w5pages):
  'test','--release','-p','xcl','--lib','--','--test-threads=4','loop':
  42 passed, 0 failed, 0 ignored (all six loop_parents_* tests ran)
  ... 'gpu::dxil::': 159 passed, 0 failed, 3 ignored
  ... the whole library suite: 1352 passed, 0 failed, 24 ignored;
  179 GPU tests of those passed printed SKIPPED (no wave32 / wave64)
Not run: the 54 tests that open the hardware GPU themselves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
direct_compute_loops_count_each_entry is the only test of the direct
translator's per-entry loop counts that runs off the hardware (the GPU
test prints SKIPPED there). It counted the slot's load, the decrements
and the count phis, but never that a count of 0 leaves the loop: a
check that branched the wrong way would still pass it. Now, for the
one loop and for both loops of the nested program, the count phi feeds
an icmp eq ..., 0 whose br i1 takes the block that returns.

Checked: with the count's branch inverted (cond_br(none, cont, end))
the test fails at the new assertion, and passes again without. (Taking
the branch out altogether already failed the old test: the count is
then dead and leaves the module with the cap's computation, so
loop_counts finds no extractvalue of the load.)

Tested on the software adapter, release (agentcargo.ps1 -Key w5pages):
  'test','--release','-p','xcl','--lib','--','--test-threads=4',
  'gpu::dxil::': 159 passed, 0 failed, 3 ignored;
  direct_compute_loops_count_each_entry ran (no SKIPPED), wave32 and
  split wave64; gpu_direct_compute_loop_passes_follow_the_dispatch
  printed SKIPPED (no wave32)
  ... the whole library suite: 1352 passed, 0 failed, 24 ignored;
  179 GPU tests of those passed printed SKIPPED (no wave32 / wave64)
Not run: the 54 tests that open the hardware GPU themselves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No test that runs without a GPU compiled the HLSL path's new loop
counts (xcl_gb, xcl_cap, uint xcl_n<k> = xcl_cap;):
gpu_compute_loop_passes_follow_the_dispatch returns before its DXC
compile when no GPU is ready. compute_loop_counts_compile compiles
endless_loop_program and endless_loop_entered_three_times as compute
programs, wave32 and wave64, with cs_6_6 whenever DXC is there
(SKIPPED "no DXC" otherwise, as the file's other DXC checks gate).

Tested on the software adapter, release (agentcargo.ps1 -Key w5pages):
  'test','--release','-p','xcl','--lib','--','--test-threads=4',
  'gpu::recomp::': 374 passed, 0 failed, 18 ignored;
  compute_loop_counts_compile ran (no SKIPPED)
  ... the whole library suite: 1352 passed, 0 failed, 24 ignored;
  179 GPU tests of those passed printed SKIPPED (no wave32 / wave64)
Not run: the 54 tests that open the hardware GPU themselves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ink with the dispatch, in both translators)

Upstream pull request xcl-dev#2291 (its commit cherry-picked, author kept) gives
every entry of a loop in a compute program its own count of passes: the
dispatch's share of 2^28 passes for a thread group among the group's
threads, between 1024 and 65 536. The lane's budget of 65 536 for all its
loops is per lane, so the GPU time it allows grows with the dispatch: a
retail title's program of 4 x 4 x 4 threads dispatched as 16 x 16 x 16
groups with a loop count that never comes was measured upstream at about
31 s on a mid-range GPU, past the time Windows gives a GPU before it
resets the driver.

That commit covers the HLSL path. Compute programs here run through the
direct DXIL translator, so its plain form gets the same bound: the loop
directly around each loop of the CFG (cfg::loop_parents), a count for
each loop set at the program's entry and set back at the head of the loop
around it, from the same io slot. A loop that runs out ends the thread's
program there. ExecuteIndirect dispatches, the compact form and the
per-lane form keep the lane's budget alone.
XCL_DISPATCH_LOOP_BUDGET=0 leaves the slot empty: as before.

Software adapter, whole library suite on the branch: 1352 passed, 0
failed, 24 ignored; 54 tests that open the hardware GPU not run; the GPU
tests of the bound (gpu_direct_compute_loop_passes_follow_the_dispatch,
gpu_compute_loop_passes_follow_the_dispatch) printed SKIPPED there and
have not run on this tree.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…patch chains, list Reset xcl-dev#139) into world-main

Conflicts:
- gpu/recomp/runner.rs (dispatch_with): every memory window u2..u5 is
  bound to mem as before, and the chain's scratch buffer is made after
  them; record_dispatch_chain or Dispatch runs as upstream has it.
- hle/d3d12x/bind.rs, execute_indirect: upstream's switch to the whole
  pipeline of a split program runs after bind_abi, before the ei_work
  RAN note; when the whole pipeline cannot be built the dispatch is
  noted SKIPPED in ei_work as well as counted.
- hle/d3d12x/bind.rs, translated_dispatch: named programs are still
  skipped, bind_abi still gets the group counts (the loop budget's io
  slot), and one gpu_profile span (one watch ring note) is around the
  whole dispatch_chain::dispatch; the span is closed before its error
  is returned.
- hle/d3d12x/console_list.rs: the same span around
  dispatch_chain::dispatch, closed before an error is returned.
- hle/d3d12x/pso_async.rs, submit_as: the lanes of the backlog
  (push(p, known), ahead_cap) are kept; a sent pipeline goes to the
  workers through upstream's enqueue.
- hle/d3d12x/pso_async.rs, resolve_spared: send_spared is kept (the
  spared lane of the backlog).
- hle/d3d12x/real.rs, forget_pso: dispatch_chain::forget is added
  before the sharded TRANSLATED_COMPUTE.remove.
- hle/d3d12x/real.rs, compute pipeline creation: upstream's
  compute_container returns (hr, time, reused) and the caller finishes
  the pipeline. The huge-program refusal log, the DRED label,
  PSO_USER_SGPRS (in its sharded form), PSO_SHADERS and the GPU
  profile's note_compute are in the caller, and the chain path records
  the same PSO_USER_SGPRS, PSO_SHADERS and profile note for its first
  piece.
- hle/d3d12x/title_list.rs: both sides' tests are kept.

Changed after the textual merge:
- pso_async.rs send_spared: its fallback without a backlog sent an
  Arc<Pending> to the worker queue, which now takes closures; it goes
  through enqueue.
- real.rs: upstream's chain path wrote PSO_USER_SGPRS through the old
  Mutex<Option<HashMap>> form; it uses the sharded map's insert.

Tested (software adapter, release; the tests that open the hardware
GPU themselves are not run by the test wrapper):
- check -p xcl --tests: builds, no new warnings
- test --lib gpu::dxil::     168 passed, 0 failed, 3 ignored
- test --lib gpu::recomp::   374 passed, 0 failed, 18 ignored
- test --lib hle::d3d12x::   352 passed, 0 failed, 1 ignored
- test --lib dispatch_chain  8 passed, 0 failed; 7 of them printed
  SKIPPED (no wave32 GPU / no wave64) before their GPU part
- test --lib title_list      5 passed, 0 failed
- test --lib (whole library) 1363 passed, 0 failed, 24 ignored;
  186 tests printed SKIPPED
Not run: the 54 tests that open the hardware GPU themselves, every
GPU part of the dispatch chain tests, a retail title, smoke runs.

Not settled here: a single split wave64 compute group sets up the
spin exchange's xcl_xc counters (and uses group-shared atomics when it
exchanges), which split_compute refuses, so such a program is never
split and stays whole. The wave64 cases of
dispatch_chain_wave64_live_loops_and_exchange,
dispatch_chain_oversized_loop_matches_whole and
dispatch_chain_divergent_forward_edges_3d expect a chain and would
fail on a GPU with wave32 support.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ing them

After the merge of upstream's dispatch chains, a single split wave64 of a
compute group (64 threads, two hardware wave32 halves) meets its other half
through group-shared counters its entry zeroes (Partner::Spin, xcl-dev#1741), and the
exchange's running number (VAR_XK) counts from the program's start. A later
piece of a chain is a new dispatch: its prefix zeroes the counters again, so
its first exchange waits for a count they never reach, stalls for 2^20 polls
and then reads 0 for the other half. split_compute refused every such program
only by accident (the xcl_xc global, the atomics and the TGSM fences), and
upstream's wave64 chain tests still expected a chain: on a GPU with wave32
they panic at chain.expect(...).

- kernel.rs finish_dispatch: a program with a split thread id and the spin
  exchange is not given to split_compute at all; it is built whole as before
  (optimize + finish_optimized, the same output as try_finish), with a log
  line when it is above XCL_DIRECT_SPLIT_INSTRUCTIONS saying why.
- split.rs tests: compare() and dispatch_chain_divergent_forward_edges_3d now
  build and check the program on the CPU before the wave32 skip. At 64 threads
  they assert that split_compute keeps the program whole and run only the
  whole program on the GPU; at 32 threads they still require a chain of at
  least 3 pieces and compare it with the whole one. On the merged tree the
  64-thread case fails on the software adapter this way (chain None where the
  test expected a chain). compare()'s loop blocks register their edges with
  the translator's SSA (lw.block / lw.br / lw.cond_br): the spin exchange
  reads VAR_XK / VAR_XDEAD through it, and with raw blocks the 64-thread whole
  program failed validation (a PHI with no entries).
- kernel.rs test a_split_wave64_compute_program_stays_whole: a 64-thread
  split program with exchanges before and after 40 cuttable blocks goes
  through finish_dispatch with a piece limit and comes out whole and valid.

Tested (agentcargo wrapper, software adapter, release):
  test --release -p xcl --lib -- --test-threads=4 gpu::dxil::
  169 passed, 0 failed, 3 ignored. The CPU halves of the chain tests ran;
  their GPU halves printed SKIPPED (no wave32 GPU): dispatch_chain_wave32_live_loops,
  dispatch_chain_wave64_live_loops_and_exchange, dispatch_chain_oversized_loop_matches_whole,
  dispatch_chain_divergent_forward_edges_3d, dispatch_chain_payload_*.
Not run: the 54 tests that open the hardware GPU themselves (the wrapper skips
them); no GPU run of the whole 64-thread fixtures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
build_pieces (upstream's dispatch chains) sent up to compile_threads()-1
helper jobs to queue(), the workers that build what a bind waits for, from
whatever thread called it. When the caller is a backlog worker building a
compute pipeline ahead of its first use (the "new compute, one at a time"
lane, or a spared image-only build), those helpers ran its piece driver
compiles at normal priority on the bind workers, and a pipeline a bind then
sent with enqueue waited behind the pieces of one nobody uses yet. That is
what the backlog lanes exist to prevent, and it also broke the lane's one at
a time rule.

A backlog worker's build that nobody waits for (Demand: preload_thread set,
no waiters) now drains every piece on its own thread. A build a title's
thread waits for, a bind worker's build and a title thread's own build fan
out as before.

Test: pso_async::used_tests::a_build_ahead_keeps_its_pieces_on_its_own_thread
(six 20 ms pieces under a backlog build nobody waits for all run on the
caller). Without the change it fails: [0, 0, 0, 0, 0, 1].

Tested (agentcargo wrapper, software adapter, release):
  test --release -p xcl --lib -- --test-threads=4 pso_async
  30 passed, 0 failed, 0 ignored.
Not run: the 54 tests that open the hardware GPU themselves; no title run.
Not changed: helpers still lose JOB_START / JOB_HUGE / PRELOAD_STEP, and a
title thread's own build gives its helpers no "wanted" status (review notes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s caller

build_pieces collects one result per piece from a channel. When a piece job
panicked on a helper (a bind worker of queue()), that worker thread died
without sending its result; the caller's own drain still holds a Sender, so
recv().iter().take(count) never ended: a title thread building the program
hung for ever and the pool lost a worker for good. On the caller's thread the
panic went up through the whole build.

Each piece now runs under catch_unwind; a panic gives 0 (a failed piece), so
dispatch_chain::build gets every result, sees the failure and the program is
built whole as for any other failed piece.

Test: pso_async::used_tests::a_piece_that_panics_fails_and_the_others_are_built
(eight pieces, every second one panics, on the caller or on helpers: the
results are [1, 0, 3, 0, 5, 0, 7, 0]).

Tested (agentcargo wrapper, software adapter, release):
  test --release -p xcl --lib -- --test-threads=4 pso_async
  31 passed, 0 failed, 0 ignored.
Not run: the 54 tests that open the hardware GPU themselves; no title run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hook

Upstream's chain set its tail pieces (record_dispatch_chain), the whole form
of a split program in a Dispatch fallback, and the whole form before an
ExecuteIndirect with list.SetPipelineState on the title's list. On a list XCL
adopted that call reaches XCL's own hook (cl_set_pipeline_state), which this
branch keeps for the title's calls: bind_abi binds a dispatch's compute
pipeline past it with list_x::set_compute_pipeline. Through the hook each
piece:
- became list_x's bound pipeline, so a Wait64 mid-list split or KickoffX
  started the next segment with the last tail piece as its first pipeline;
- pushed a DRED marker (XCL_DRED=1) with no label (only the first piece is
  labelled), so a fault in piece 2..n or in the whole form was reported as
  "a stand-in, or not translated" instead of the program.

record_dispatch_chain now takes the setter. dispatch_chain::dispatch binds
pieces and the whole form past the hook on an adopted list, and with the
plain call on a list XCL did not adopt; execute_indirect binds the whole form
with list_x::set_compute_pipeline. The test runner keeps the plain call.
With the hook out of the way the tail pieces need no DRED labels: the marker
of the title's own SetPipelineState names the program for the whole chain.

No test fails without this: seeing it needs an adopted list with a chain of
real pipelines recorded on it, and the software adapter cannot create the
pieces (WaveSize 32).

Tested (agentcargo wrapper, software adapter, release):
  test --release -p xcl --lib -- --test-threads=4 dispatch_chain
  8 passed, 0 failed, 0 ignored (the GPU halves printed SKIPPED, no wave32 GPU).
  test --release -p xcl --lib -- --test-threads=4 hle::d3d12x::
  354 passed, 0 failed, 1 ignored.
Not run: the 54 tests that open the hardware GPU themselves; no title run,
no DRED run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n its call

A split compute program's whole (unsplit) form is built on first need in the
calling thread: the first ExecuteIndirect of the program, a Dispatch in a
bundle, one with no backing allocator, or one whose scratch is too large or
cannot be made. That is a driver compile of a program above
XCL_DIRECT_SPLIT_INSTRUCTIONS, the size class splitting exists for, on one of
the title's threads, outside pso_async: no Held, so title_held() stayed false
and kernelx Sleep and the frame clock counted the seconds against the title.

Chain::whole now runs its build (and the wait for another thread's build of
the same form) inside pso_async::pc_call(), the guard every other long PC call
of the title uses, so the title is held while it lasts.

Left as it was: the whole form is still built synchronously and outside the
compute pipeline wait budget (XCL_CS_PSO_WAIT_MS); building it on the PSO
workers when the chain is built and skipping the ExecuteIndirect while it
builds is a larger change.

No test fails without this: it needs a chain of real pipelines, which the
software adapter cannot create (WaveSize 32).

Tested (agentcargo wrapper, software adapter, release):
  test --release -p xcl --lib -- --test-threads=4 dispatch_chain
  8 passed, 0 failed, 0 ignored (the GPU halves printed SKIPPED, no wave32 GPU).
Not run: the 54 tests that open the hardware GPU themselves; no title run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
translated_compute_pso_once logs a huge compute program the driver refuses
(record, DXIL size, driver cache name, HRESULT, time in the driver), because
note_translation_error alone does not reach the log. Upstream's chain builds
its pieces and the whole form through compute_container directly, so a
refused huge piece or whole form left no such line: a refused whole form
before an ExecuteIndirect logged only "ExecuteIndirect whole compute PSO:
whole compute pipeline".

PipelineBuilder::pipeline now logs the same warning for a program of
huge_pso_bytes() or more. Logging only: no test.

Tested (agentcargo wrapper, software adapter, release):
  test --release -p xcl --lib -- --test-threads=4 dispatch_chain
  8 passed, 0 failed, 0 ignored (the GPU halves printed SKIPPED, no wave32 GPU).
Not run: the 54 tests that open the hardware GPU themselves; no title run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every chained Dispatch of upstream's split programs creates its own committed
scratch buffer (DEFAULT heap, zero-filled), of groups x dwords_per_group x 4
bytes, and keeps it until its allocator is reset or released. dwords_per_group
is the stride (1 + the words of every value live across any cut) times the
group's threads, so a 16x16x16 grid of 32-thread groups takes stride x 512 KiB;
at stride 100 that is 50 MB for one dispatch, and the only limit was 4 GiB per
dispatch. Fifty such dispatches a frame with three frames in flight would hold
about 7.5 GB.

The bytes every not yet released chained dispatch holds are now counted
(SCRATCH_HELD: taken before the buffer is made, given back when it cannot be
made and when its Recording is dropped at the allocator's Reset or Release).
A dispatch that would take them past XCL_DIRECT_SPLIT_SCRATCH_MB (default
1024 MiB) runs the whole program instead, as one whose scratch could not be
made, with a log line (the first four, then powers of two). The periodic
"compute split" line also gives the MiB held. README: the variable.

Left as it was: one buffer per dispatch, zero-filled, made on the title's
thread. Keeping one buffer per recording, grown to the largest size asked,
needs a key per recording (two recordings on one allocator may run at once)
and is a larger change.

Test: dispatch_chain::tests::scratch_is_taken_up_to_its_cap (the budget takes
what fits, refuses what would pass the cap without taking anything, takes
again what was given back, and does not overflow).

Tested (agentcargo wrapper, software adapter, release):
  test --release -p xcl --lib -- --test-threads=4 dispatch_chain
  9 passed, 0 failed, 0 ignored (the GPU halves printed SKIPPED, no wave32 GPU).
Not run: the 54 tests that open the hardware GPU themselves; no title run, so
the default cap was not measured against a title's real use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The xcl-split-counts thread starts in every run and logged "compute split: 0
programs split, ..." every 10 s, also in runs that split nothing. Each line
also takes the log lock from a thread end_title suspends with the others.
log_counts now writes its line only when a count (or the scratch held) has
changed since the last one. Logging only: no test.

Tested (agentcargo wrapper, software adapter, release):
  test --release -p xcl --lib -- --test-threads=4 dispatch_chain
  9 passed, 0 failed, 0 ignored (the GPU halves printed SKIPPED, no wave32 GPU).
Not run: the 54 tests that open the hardware GPU themselves; no title run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h its own vtable

class_for asks an adopted object for its most derived interface and
releases the result with the Release of the object it asked. Without the
debug layer both are the same object. With it (XCL_D3D12_DEBUG=1)
QueryInterface gives another object, and the first object's Release on it
read a null pointer in D3D12Core 1.5 s into a retail title's start: the
debug layer could not be used on that title at all.

The result is released through the vtable it has itself.

Tested: a retail title with XCL_D3D12_DEBUG=1 on an NVIDIA RTX 5090
(driver 621.14): before, an access violation in D3D12Core at 1.46 s; after,
442 s with the layer's messages in the log. No unit test: the path needs
the debug layer's wrapping objects.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
On the PC a command list must not be executed again before its previous
execution is done (debug layer id 553). A console lets a title do it, and
a retail title submits the same recording again about once a second in
its world. XCL only noted it (note_resubmits). In a run on an NVIDIA RTX
5090 that had done it 128 times the device was removed with shader memory
faults (nvlddmkm: "Graphics SM Warp Exception: MMU Fault", 0x887a0006)
2 min 40 s into the world, with DRED inside an ExecuteIndirect of a small
compute program that reads nothing by an address of its own. A run of the
same build with the debug layer on, which slows the submits enough that
no list was ever submitted again while still on the GPU, ended after
442 s without a fault. That is one run each: the link is not proven.

A submit now waits for the previous submits of its lists that the GPU has
not finished, 2 s at most for all of them (XCL_RESUBMIT_WAIT_MS; 0: as
before), polling XCL's own fence of that submit; past the limit the lists
go as they are, logged.

Tested: cargo test --release -p xcl --lib alloc_pool on the software
adapter: 8 passed, 0 failed (new: a_resubmit_waits_for_the_previous_submit:
the limit ends a wait for a submit that never finishes, no limit means no
wait, a submit that finishes ends the wait). Not run on a title yet.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…program

The PC takes at most 65 535 thread groups a dimension in a Dispatch; with
more its behaviour is not defined (the debug layer's warning id 1296). A
retail title dispatches 82 606 x 1 x 1 groups in its world every frame,
which reached the PC call as it was. The first eight such dispatches are
logged with the console compute program, so that the program is known
before such a dispatch is run in parts.

No behaviour change. Not tested beyond the build.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…spatch chains for split direct compute programs, list Reset xcl-dev#139)

Upstream's 13 commits are merged with the fork's dispatch path (the skip
of named programs, the loop budget's io slot, one profile span and one
ring note for a whole chain), its backlog lanes and its sharded maps.

A single split wave64 of a compute group exchanges through counters in
group-shared memory here; each piece of a chain would zero them again
while the exchange's running number counts from the program's start, so
such programs are kept whole, explicitly. Chains apply to programs of
32 threads a group. Pieces of a build ahead stay on its own worker, a
piece whose build panics fails instead of hanging its caller, the pieces
and the whole form are bound past the list hook, and the scratch chained
dispatches hold together is capped (XCL_DIRECT_SPLIT_SCRATCH_MB).

Software adapter, whole library suite on the branch: 1367 passed, 0
failed, 24 ignored; 54 tests that open the hardware GPU not run. The
chain tests' GPU parts printed SKIPPED there.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…s of those formats

XCL_TRACE_FRAME logs one line for each distinct (VS, PS, render target)
drawn, 160 at most. A busy frame of a retail title fills those with its
first passes within a second, and the passes looked for (the ones that
draw into its lighting target) never got a line.
XCL_TRACE_FORMATS=26,29 (DXGI format numbers) leaves out the draws into
targets of other formats.

Diagnostic only. Tested on a retail title on an NVIDIA RTX 5090: with
XCL_TRACE_FORMATS=26 the trace listed 61 kinds, 35 of them the
stencil-tested passes into the 2560x1440 lighting target.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…arrier

In the HLSL split-wave64 form a group of one console wave (64 threads or
fewer) is just the two 32-lane halves, and they take the same branches
(on exchanged, wave-uniform state), so both reach every exchange. Since
xcl-dev#798 they met through the bounded counter spin there too, which costs
about 2.3x the group barrier per exchange on Ampere (xcl-dev#1244: 13.2 ms vs
5.7 ms on an RTX 3080 in bench_split_wave64, 64-thread groups, one
exchange per iteration; 3.6x vs 1.55x wave32 on an RTX 3070).

x64_spin_for picks the form: groups of more than one console wave keep
the counters (a barrier would wait for other console waves); one-wave
groups now get the barrier, as the direct DXIL translator does
(Partner::Present, xcl-dev#1426). XCL_WAVE64_SPIN=1 forces the counters
everywhere, for debugging a desynchronised pair (wrong output instead
of a hang); =0 keeps the barrier, as before.

Assisted-by: Claude Code (Claude Opus 5.5)
…ed T# samples

A title's menus fill XCL_TRACE_FRAME's list of draw kinds long before its
world draws, so the kinds looked for (the geometry pass into the colour
target) never got a line.

- XCL_TRACE_AFTER_S=<seconds>: no kind is listed before that time of the
  run; each kind listed then also gets its root arguments, and the view
  heaps are counted once at that point.
- XCL_TRACE_SLOTS=<n>: the first n slots of each table instead of 4, all
  eight words of their image descriptors, the image they describe, the
  slot's own index in the shared heap and the resource the T#'s index
  names there (console_heap::named_by_index): a T# the title copied as
  memory carries its source slot's index.
- XCL_TRACE_PROBES=<n>: n texture probes instead of 4; a probe reads every
  level of the first slice, not level 0 only (a streamed texture has only
  its small levels at first).
- XCL_DUMP_SHADERS=ps,<hash>: the dump of only those stages or shaders.

Diagnostics only, all behind their switches. Tested: the dump list's test
(software adapter: 4 passed with the trace tests). On a retail title
(NVIDIA RTX 5090) the trace with XCL_TRACE_SLOTS=8 printed the image and
index of the UI draws' slots. NOT exercised in a run: the probe of every
level and the kinds after XCL_TRACE_AFTER_S (the four runs ended before
the world: three in the driver with frame dumps every 120 presents on,
one in a texture upload that read a page the title had just unmapped).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@brainhay5

Copy link
Copy Markdown

Retest on the current tip fa204595 (after #3243 direct-DXIL-by-default and 22 other commits): still stalls.

run last present frames compute PSOs blob supplied
fa204595 run 1 82.4 s 1800 158 148
fa204595 run 2 66.7 s 1500 176 163

Same shape as the 7db2f391 runs above, and on a warm cache (~94 % of compute PSOs supplied), so this is not a cold-cache or compile-cost effect.

That makes it 8 for 8 across f0e8fdd5 / 7db2f391 / fa204595 versus 7 for 7 on e429936c / 10d27297, with the two heads alternated within the same session. The behavioural change is still at the merge; the cause remains undiagnosed.

@lucsoft lucsoft mentioned this pull request Nov 29, 2026
Royalflamejlh added a commit to Royalflamejlh/xcl that referenced this pull request Nov 29, 2026
main has merged nvidia-dev (xcl-dev#3203): its two-pass mesh, sparse and upload
paths now submit through real::native_queue_execute / _signal / _wait.
Those already carry xcl-dev#867's UnadoptGuard and unwrap_fence; the conflicts
and the main-only submit paths were resolved as follows.

Taken from main, the stack's version dropped (main does the same):
- recomp/dxc.rs (3): xcl-dev#688's private DXC heaps; main's form (3842807)
  falls back on any failure and never destroys a heap.
- device_x.rs (10): xcl-dev#3091 (cherry-pick 511a297); main's 7e24237 keeps
  interned shader copies for base pipelines. xcl-dev#3091's tests and its
  real.rs test counter (GRAPHICS_FALLBACK_ATTEMPTS) and README line go;
  xcl-dev#2753's console_bytes is re-applied on main's file.
- bind.rs (16): the stack's only change there was xcl-dev#1803, merged in main.
  main's file, plus the xcl-dev#2816 feedback-copy UnadoptGuard in
  poll_two_pass_feedback (ed887d2, from linux/stack-nvidia-dev).
- pso.rs: main has daae033 (multidimensional groups take direct DXIL,
  xcl-dev#3189's change), so the stack-only commit is in main; translate calls
  take main's translate_compute_rodata / translate_entry_rodata_rt32.
- list_x.rs tests: xcl-dev#3090's barrier tests were in twice (cherry-pick and
  main's merge); the cherry-picked copy goes.
- runner.rs device(), xbox.rs Fssm::rodata: added on both sides; one copy.
- README.md: the precompile-wrapper paragraph was added on both sides;
  one copy.

Both kept:
- build.rs (2): TRANSLATION_GLUE_REVISION "pso-glue-v5-linux-multidimensional-
  direct" (main's v5 + the stack suffix); translator sources keep xcl-dev#2229's
  cfg.rs and code_loads.rs, drop dxc.rs as main does.
- dxil/kernel.rs (6): TRANSLATOR_VERSION 13 (main 12; the stack's xcl-dev#2229
  head output differs, as on linux/stack-nvidia-dev); main's rt32 entry
  points with xcl-dev#2229's code_loads.
- dxil/lower.rs (4), lower_mem.rs (3), lower_window.rs (1), recomp/emit.rs
  (11), recomp/mod.rs (3), recomp/tests.rs (1), core_tests.rs: main has
  an earlier copy of xcl-dev#2229 (41f1a85); xcl-dev#2229's head (code_loads, xcl_cload
  / xcl_gload(hi, a)) is kept over it, as on linux/stack-nvidia-dev;
  main's loop_ids, IO slots, ps_mask_live_scc and rt32 mask kept beside
  it, and main's duplicate core_tests copy of the rodata test goes.
  lower_mem.rs keeps the stack's scratch_ptr insert-before-terminator line.
- real.rs (6): the class scan keeps `own` with main's
  release_through_its_own_vtable; xcl-dev#2477's in-place patch after main's
  two-pass defer hooks; q_signal_pc / q_wait_pc beside main's page
  mappings; the title ExecuteCommandLists keeps xcl-dev#867's list guards inside
  main's watch::in_driver scope; test modules of both.
- list_x.rs (1): xcl-dev#867's allocator / PSO guards with main's `on = pc_alloc`.
- sparse.rs (1): main's new_state, with xcl-dev#867's raw fences for the sparse
  and readback fences and the async readback fence pairs (as on
  linux/stack-nvidia-dev); pc_execute (main's texture_upload submit path)
  unadopts its list for the submit.
- title_textures.rs (1): main's early fence creation, as a raw fence.
- dstorage.rs (4): xcl-dev#2864's unpack cache on main's Cow source and stage
  buffers.
- xg.rs (2): main's copy_args (adccb7d) covers xcl-dev#684's argument fix;
  xcl-dev#684's destination guard kept.
- present.rs (1), gpu_compute_e2e.rs (1), README.md (2): tests and text
  of both.

linux/README.md: main line updated; xcl-dev#1599, xcl-dev#2082, xcl-dev#1803, xcl-dev#3090, xcl-dev#688,
xcl-dev#3091 and the stack-only multidimensional row leave the table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Royalflamejlh added a commit to Royalflamejlh/xcl that referenced this pull request Nov 29, 2026
…ev#3203)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
raylitebull pushed a commit that referenced this pull request Nov 30, 2026
Brings main's ~650 commits since amd-dev branched (2c717a0, 2026-11-27),
including the nvidia-dev merge (#3203), into amd-dev. amd-dev took the same
nvidia-dev line in its own merge; where both carry it, main's version is
kept, with amd-dev's own commits applied on top. Where amd-dev's own code
and main disagree and the right resolution was unclear, main's behaviour
is kept; the PR lists those places.
einfachama added a commit to einfachama/xcl that referenced this pull request Dec 1, 2026
The list of the pipelines a title used was kept out of tests with
cfg!(test), which only the crate's own unit tests have: the integration
tests in tests/ link the crate without it, so they read the user's
used-pipelines.txt and add their pipelines to it. After full test runs with
XCL_SAMPLE_RPF on an RTX 4060, the user's list held 10 keys (gpu_pso_e2e,
run alone into an empty cache, writes 9 keys, 4 of them among those 10), and
every later run of my retail title built its pipelines of those shaders
ahead: 228 translated pipelines at its first menu instead of 6 (measured
on Nov 24's main, before xcl-dev#3203).

The list is now read and written only when a title runs (state::boot set).
The new integration test fails without the change: the pipeline of a key in
the list was built ahead. It turns off building ahead the pipelines no run
used (XCL_PSO_AHEAD=0), which main does since xcl-dev#3203 and which would hide
that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.