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

Merged
Kalmarv merged 499 commits from upstream-pr/3203 into main 2026-11-28 19:48:20 +00:00
Kalmarv commented 2026-11-28 19:44:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-28T19:44:08Z.


Merged as 765b2c5b 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.

  • nvidia-dev side (376 non-merge commits not on main, 43 authors): theaustinayers 277, Prime 11, Kalmarv 10, PracticalStudios 8, ryosen0 7, Decodere 5, coolpersonnn 4, and 36 more.
  • main side, kept whole (398 non-merge commits not on nvidia-dev at 5b711248, 19 authors): bmjask 361, theaustinayers 7, Bloxive 5, thehollowedone 5, KOLESNiii 4, and 14 more.
  • Conflict resolutions and adapting code: Kalmarv, made with AI tools (named in the AI use section below). #1435 is Tarosul's commit and #3189 is Royalflamejlh's commit, each cherry-picked with them as its author.
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):

  • #1435 (Tarosul, open, cherry-picked): without it, the title's world on a save crashes 3 of 3 runs in xg::copy_from because the 7-argument XG CopyFromSubresource call is read as 6 arguments.
  • #3189 (Royalflamejlh, open, cherry-picked: "Recompiler: 2-D and 3-D compute groups take the direct DXIL route again"): main routes every compute program with a 2-D or 3-D thread group to the HLSL path; on the merged tree that sent 397 used programs there and made one of them 18 MB of DXIL (584 KB on nvidia-dev).

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 (#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. #2499 / #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 (#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, #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 (#2959/#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 #3189; stock main still has it (driver compile time of the 18 MB form: (in progress)). #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: #1435 in xg.rs, the second merge of main with one test fix, #3189 in the recompiler; suite on the final head: (in progress)). At dc763946: cargo check --workspace --all-targets passes; release build. adccb7d8 adds only #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 #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

<!-- greyfinch-sync:ivall/xcl:issue:5543923195 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3203). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-28T19:44:08Z. --- Merged as 765b2c5b 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. - `nvidia-dev` side (376 non-merge commits not on `main`, 43 authors): theaustinayers 277, Prime 11, Kalmarv 10, PracticalStudios 8, ryosen0 7, Decodere 5, coolpersonnn 4, and 36 more. - `main` side, kept whole (398 non-merge commits not on `nvidia-dev` at `5b711248`, 19 authors): bmjask 361, theaustinayers 7, Bloxive 5, thehollowedone 5, KOLESNiii 4, and 14 more. - Conflict resolutions and adapting code: Kalmarv, made with AI tools (named in the AI use section below). #1435 is Tarosul's commit and #3189 is Royalflamejlh's commit, each cherry-picked with them as its author. | 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): - #1435 (Tarosul, open, cherry-picked): without it, the title's world on a save crashes 3 of 3 runs in `xg::copy_from` because the 7-argument XG `CopyFromSubresource` call is read as 6 arguments. - #3189 (Royalflamejlh, open, cherry-picked: "Recompiler: 2-D and 3-D compute groups take the direct DXIL route again"): `main` routes every compute program with a 2-D or 3-D thread group to the HLSL path; on the merged tree that sent 397 used programs there and made one of them 18 MB of DXIL (584 KB on `nvidia-dev`). 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` (#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. #2499 / #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 (#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`, #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 (#2959/#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 #3189; stock `main` still has it (driver compile time of the 18 MB form: (in progress)). #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: #1435 in `xg.rs`, the second merge of `main` with one test fix, #3189 in the recompiler; suite on the final head: (in progress)). At `dc763946`: `cargo check --workspace --all-targets` passes; release build. `adccb7d8` adds only #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 #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](https://claude.com/claude-code)
Kalmarv commented 2026-11-28 19:44:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-28T19:44:15Z.


Merge of nvidia-dev into main: resolutions

The merge commit has main (10d27297) as its first parent and nvidia-dev (54225f58) as its second.
This file reads from main's side: what comes in from nvidia-dev, and where main's own code changed to carry it.

Rule for every file: both sides' behaviour stays and works. Where the two sides do one job in two ways,
the better one stays (by tests, then by measured numbers, then by a cheap test, then by reading), and the
other's callers use it. Every mechanism that went is listed below with its PR, author, replacement and reason.
Nothing of bmjask's submission rework (#2959-#2965, #3086, #3149, and the runtime parts of
#3100/#3175/#3181/#3182) is dropped. Nothing of nvidia-dev's low-VRAM memory model is dropped either: 16 windows,
mirror tiles, lazy sparse, pack pools, the sparse lock split, texture level pages and the mixed UMA driver window.

How it was done: a 3-way merge of each conflicted file from the common point 4577f09c, resolved per hunk by job.
Git reports 37 conflicted files for a direct merge of the two heads (10d27297 and 54225f58, the count in the
description); 33 of them still conflicted from 4577f09c, the base the 3-way work used. The other files merged without a conflict. One silent loss in the clean part was found and
restored (cached.as_deref() in the translated graphics PSO build); real.rs was then compared line by line
against both sides for others (see "Audit").

Runtime hub: hle/d3d12x/real.rs

Job Kept Brought in from nvidia-dev Dropped
COM method slots Both macros. nvidia-dev's pc_slot!("Iface", "Method") at the call sites both sides touched: it names its interface and needs no CLASSES lock. main's slot!(this, ..) at main's own sites. pc_slot! nothing
Per-call timing Both: main's stall::detail_span and nvidia-dev's api_cost::time_if(look_stats::deep()). They feed different reports, the stall report and XCL_LOOK_STATS, and both are off unless enabled. api_cost/look_stats lines nothing
Driver compile slots nvidia-dev's Slots (Slots::new, closed_to_ahead, the urgent queue, huge_compile_turn, pso_async::note_huge), with main's MEDIUM_COMPILES (XCL_MEDIUM_PSO_*), DriverCompileGate span and DRIVER_BUILDS.waiting() on top. driver_compile_identified has main's signature, and its log line also carries nvidia-dev's stage note. GIANT closed to builds ahead of use; urgent queueing nothing
Driver-blob caching main's DriverBlobs<K> (exact generations, reserve/admit/finish/forget_if), KeepTurn, LoadedBlob (exact-file invalidation), keep_driver_blob, cacheable, and the AMD-off default of XCL_PSO_DISK_CACHE. (a) a small program's slow build is kept on disk (228 ms per 4 KB program per run otherwise); (b) separate compute/graphics keep thresholds (XCL_PSO_DISK_CACHE_MIN_MS); (c) preparation workers keep every blob, on disk only; (d) graphics files named by adapter, driver and memory windows (graphics_file_hash), so two adapters do not share a file; (e) a blob with no RAM room still reaches the disk; (f) the warm-replay receipt for disk-only blobs nvidia-dev's remember_compute_blob, compute_blob_kept, keep_compute_blob, keep_graphics_blob, graphics_pso_through_cache and their unit tests (same job; their behaviour is (a)-(f), and a new test covers (a))
PSO tables (user SGPRs, threads, dispatch remap, root signature) main's API (*_exact, PSO_DISPATCH_REMAP) over nvidia-dev's lock-sharded Sharded storage. Sharded storage main's Mutex<HashMap> storage
Background builds (go_background) main's recipe / keyed / eager submission. Warm (translation ahead of a lazy graphics build) and the compute record, via pso_async::*_with nothing
Two-pass lookup main's two_pass_of_exact nvidia-dev's two_pass_entry (the same function)
Submit path (ExecuteCommandLists) main's submission plan and receipts: submission_plan, SubmissionGate, submit_title_chunk, queue_submit::with, the prepare_title_submission fail-stop, tie_downloads, note_execute_call. watch::wait_while_held and watch::in_driver; submit_cost timings; capture::submit; gpu_profile::note_queue; gpu_times::executed; list_x::note_submitted; the resubmit wait (alloc_pool::wait_for_previous_submits, XCL_RESUBMIT_WAIT_MS) in the gate's prepare step; sparse::send_pending before every Signal. prepare_title_submission(queue, lists) refreshes through nvidia-dev's title_textures::refresh_for, which skips the look for CPU writes when every list was closed before the last look began nothing
Fence GetCompletedValue One hook: nvidia-dev's sparse::settle_readbacks_try, then main's title_textures::safe_fence_value. settle_readbacks_try main's separate hook, whose name clashed with nvidia-dev's fence_completed
Resource / heap / PSO release main's tracked-SRV lifetime gate, release_taking_first, pso_manifest::forget_ready_compute, forget_resource_backing_after_release. last-reference detection (AddRef + Release == 1, so no state is stripped from a new object at the same address), late_release holding of resources and pipelines, the console heap descriptor list nothing
UMA (stage 1) main's allow_driver_remap gate: only the backend made before the title's code runs remakes a window, as #2844's review asked. open_uma with shadow windows, per-segment heaps, and the mixed driver window via remake_window; the one init lock nothing

Pipeline binding: hle/d3d12x/bind.rs (from scratch/merge/r1/bind-decisions.md)

Per-list state: main's BindStateRegistry (#2959 contention bench). nvidia-dev's Sharded<State> users moved onto it.
Pipeline choice: main's retained PipelineResolution everywhere (PreparedNativePipeline, initial_pipeline,
clear_pipeline_state). Carried in from nvidia-dev:

  • the stand-in for an unbuilt pipeline, via resolve_for_indirect InitialFallback;
  • deferred two-pass runs (XCL_TWO_PASS_BATCH=2) and flush_two_pass at Close;
  • whole_ready, which skips a late whole form instead of compiling it on the title thread;
  • dispatch folding over main's valid_dispatch_grid skip, because folding runs the work.
    ABI bind: main's PreparedAbiState, plus nvidia-dev's per-recording heap_bound, console heap bases,
    GPU views, note_arena_full and the lock-free first window. Command-list split: main's
    prepare_split / install_prepared_split, with nvidia-dev's heap and two-pass state carried inside.
    Indirect signatures: main's IndirectSignatureInfo; nvidia-dev's dispatch-mesh companion stays.
    Dropped: nvidia-dev's State::limits side channel (main passes limits explicitly);
    pso_async::gave_standin / waits_for + list_x::defer (main's defer_retained does that job).

Submission and pipelines (G2)

  • pso_async.rs: main's build engine stays whole: bands, ranked preload of earlier-run pipelines, coalescing,
    generations/eviction and pressure. nvidia-dev's known-pipeline preload lane goes into main's ranked preload, which does the same job.
    Ported onto main: nvidia-dev's other ahead lanes (new compute one at a time, spared image-only compute,
    Warm translation, then cold graphics builds, the XCL_PSO_AHEAD cap with 8 GB commit room, build_parks), revocable waits,
    the XCL_GFX_PSO_WAIT_MS / XCL_CS_PSO_WAIT_MS budgets, the wait and put-off logs, the lazy-pipeline stats,
    peek / has_real / describe / waits_for, the Series S (-lockhart) names, and earlier_used_shaders / earlier_used_keys.
    Dropped: nvidia-dev's sharded PENDING, for main's PendingRegistry (same job).
  • list_x.rs: main's single LISTS map, because the rework reads several lists under one lock. main's submission plan
    and submit_effects, which already cover nvidia-dev's write64 signals, sparse readbacks (with nvidia-dev's
    sparse_imm added) and CPU writes. Kept from nvidia-dev: set_compute_pipeline, bound_render_targets, note_submitted,
    defer, apply_*, uav_clear_resource. Dropped: nvidia-dev's 64-way LISTS sharding (2987c19b, no measurement).
  • real/dispatch_chain.rs: main's WholeBuild (OOM retry), IndirectChain and bind_pipeline_exact (DRED label).
    nvidia-dev's off-thread whole worker and Whole / whole_ready are ported onto WholeBuild.
    Dropped: nvidia-dev's own bind(), for bind_pipeline_exact (same job, plus DRED).
  • device_x.rs: main's IndirectSignatureInfo record replaces nvidia-dev's note_signature_dispatches /
    note_root_changing_signature. nvidia-dev's dispatch-mesh companion, indirect guard, capture and failure warning stay.
  • title_list.rs: main's release that keeps the primary (6ae88983, tested), plus nvidia-dev's WRAPPER_OF ABA guard (04a1768c).
    Dropped: nvidia-dev's "forget if not adopted": the same race, and main's form is stricter.
  • fence_x.rs: main's complete_fence_downloads gate after nvidia-dev's settle.
  • host.rs: main's memory_report snapshot replaces nvidia-dev's own K32 / video-memory query. nvidia-dev's lines stay.
  • present.rs: main's file, plus nvidia-dev's presenting(), view_resource() and half_float(). The last is not main's small_float: it has a sign bit and inf/NaN.

Memory model (G1)

  • alloc_pool.rs: main's file (SubmissionGate, receipts, retire_recording, forget_queue, submit_stats,
    reclaim_idle_aside). Brought in from nvidia-dev: wait_for_previous_submits (XCL_RESUBMIT_WAIT_MS), XCL-fence reads via
    real::fence_completed, and the two-pass hooks, run inside SubmissionGate::submit / submit_receipted.
    Dropped: nvidia-dev's park_list / unpin_list / unpin_users / done_with: main's retire_recording and
    reclaim_idle_aside do those jobs.
  • uma.rs: main's #3068 automatic cap on top of nvidia-dev's route-based sizing.
  • dstorage.rs: main's known_writable, EnqueueSetEvent and stall spans, plus nvidia-dev's read_own.
  • gpu/texture.rs: main's Uploader / upload_batch* / plan_batch / submit_batch* (tests/texture_states.rs). Title-texture
    uploads at runtime stay nvidia-dev's texture_upload.rs.
  • console_heap.rs, sparse.rs, vram.rs: nvidia-dev's present-queue list is replaced by main's known_queues_held() (owned refs).
    The rest is filled in by G1 (see below).
  • title_textures.rs, stage 1: one reader of title memory, main's with_title_bytes / read_committed_into, with
    nvidia-dev's mixed-window GPU copy inside it and nvidia-dev's level-page reads. Dropped: nvidia-dev's
    XCL_TEXTURE_SAFE_READ=1, because main's reader always copies outside the committed window.

Recompiler, CLI and preparation (G3 and lead)

  • IO slots: nvidia-dev's layout (IO_LOOP_BUDGET 113, IO_GROUP_LIMIT 114, IO_THREAD_LIMIT 115-117,
    IO_MESH_GROUP_BASE 118). Every writer uses the constants.
  • DispatchX thread limits (both sides did them: main #2959, nvidia-dev 12758ed0/7af6e543): nvidia-dev's form in both
    translators (branch-free, all three axes, folded groups, partner_word), on main's wave-local remap and fail-closed
    xcl_x_dead. Dropped: main's guarded-prologue form.
  • Split-wave64 LDS order: nvidia-dev's runtime xcl_x_lw (XCL_X_LDS_ORDER) with main's dead-partner guard.
    Dropped: main's static LdsGap (22026ba5): the same job, and nvidia-dev's form needs fewer meets and covers direct DXIL.
  • present/preparation.rs: main's file (per-title preparation, corpus replay, pipeline libraries), plus nvidia-dev's
    "only the shaders earlier runs used" filter (LaunchPreparation::only, XCL_PREPARE_ALL=1 for every record) and the
    XCL_PREPARE=0 log line. Stage 1 had dropped the filter without evidence; nvidia-dev's author measured the
    startup about 5x faster with it.
  • theaustinayers' preparation commits, each checked in the merged tree:
    b09acbce (compute pipelines in worker processes), 83bb3436 (one worker builds a pipeline, the others leave it),
    bca429ec (graphics pipelines earlier runs used, built before the title), 626459db (the preparation screen counts each pass),
    #2705, #2794. G3 fills in this part.
  • The precompile takes the runtime window count when --windows is omitted (configured_runtime_windows, nvidia-dev).

Detail: list_x.rs (G2b)

File Resolution PRs
hle/d3d12x/list_x.rs main's file (submission plan, segment effects, receipts and native queue slots, split_recording transaction, defer_retained, write producers, native generations) with nv's additions ported onto it; 66 diff3 hunks against 4577f09c..10f917e5. #2959-#2965, #3086, #3149 (main); nv list below
list_x.rs (list state map) One mechanism: main's single LISTS map kept, nv's 64-way sharded LISTS (2987c19b, no measurements) dropped: the rework reads several lists under one lock (SubmissionPlan::capture, kickoff, split carry) and its tests assert LISTS.try_lock(). nv's every_list kept over the single map; nv's set_compute_pipeline (same commit) kept. nv 2987c19b
list_x.rs (texture state) main's per-segment capture_gpu_write / capture_transitions / publish_submission_effects (with G1, whose title_textures drives nv's state from them). nv's note_gpu_write(list, r) / list_reset / submitted calls dropped as the same job; nv's new GPU writes (ResolveSubresource, ResolveSubresourceRegion) go through note_texture_write(list, dst, dst_sub); nv's note_list_closed / forget_list_closed kept.
list_x.rs (sparse immediates) nv's bottom-of-pipe immediates into GPU-copy windows (sparse_imm, note_imm, imm_by_cpu, IMM_KEEP_MAX) carried through main's SegmentEffects and KickoffEffects; submit_segment_effects and the kickoff call nv's 3-argument sparse::readback_after_execute. note_imm records its range as an in-segment GPU write in main's write producers. Write tracking uses nv's read_back(va) (GPU-copy window or GPU view) in main's note_write. nv sparse/imm
list_x.rs (waits) main's wait_all_on (stops on an unresolved wait) returns nv's "waited on the CPU", which drives nv's mapped_after_wait / XCL_SPLIT_SPARSE=cpu after a split in execute_submission_plan_with_completions and the kickoff, with nv's submit_cost::split timing and XCL_SYNC_TRACE events. Waits are recorded at nv's CPU view (cpu_at). Watchdog: main's stop instead of signalling expired fences (nv/base signalled them); nv's indirect_guard::report_now, wait-edge and queue-progress diagnostics kept before it.
list_x.rs (submits) nv's gpu_times::executed, gpu_profile::note_queue and note_submitted (progress fence, now signalled through real::native_queue_signal) on main's kickoff chunks; real::prepare_title_submission(q, &[this]) replaces nv's title_textures::refresh.
list_x.rs (put-off dispatches) main's split_recording / defer_with / record_deferred. nv's guards moved into defer_with (not while the submit records, not without alloc_pool swap, PutOff counters); nv's defer(list, what) kept for binds without a retained resolution, on defer_with (adopts main's "bounded waits record now"). nv's flush_two_pass before a split's Close, its own allocator kept on title_list::backing (both in prepare_deferred_segment and record_deferred), and the PC allocator a segment records on (alloc_pool::current / Reset's pc_alloc) passed to bind::prepare_split and PreparedNativePipeline::commit. Dropped: nv test a_spare_whose_reset_fails_stays_with_the_list_on_the_software_adapter: main reserves a spare closed without a Reset (the Reset and its failure path come later), so the case it tests does not exist. nv #3036, f43cab27, 9d3dccb2
list_x.rs (other nv) Kept: apply_topology / apply_scissors / apply_stencil_ref, bound_render_targets, uav_clear_resource, note_copy_into, capture ops and api_cost timers beside main's stall::detail_span (one copy_buffer_region_x with both), placements::note_use, lut3d::wrote, depth_in_step, unpin_users on release.

Behaviour changes

  • Direct dispatches past 65,535 groups in a dimension (bind.rs). They are now folded as nvidia-dev does, where main skipped them
    (valid_dispatch_grid). The fold came to nvidia-dev with lukastaro's PR #1428, which is still open on main and was merged into
    nvidia-dev through its world-main branch (fc4481d9). theaustinayers added 9cc53f15 and ca1e6ad6 on top: no more groups than a
    dispatch may have, and no clamp in bundles. It is on by default on nvidia-dev and has no switch. With main's wave-local remap,
    folding applies only to grids that are not remapped; a remapped program that needs a fold runs its remap_fallback::whole_exact
    form folded. This is the direct-dispatch fold. It is not XCL_CLAMP_INDIRECT (clamp.rs), the separate pass over indirect
    dispatches, which stays off unless asked for.
  • Pipelines that no earlier run used (pso_async.rs) are now built ahead of their first use by nvidia-dev's backlog (theaustinayers
    69a48a24 for lazy graphics pipelines and 2ccc646f for compute pipelines of new shaders, on the threads xcl-pso-ahead-*). On main
    they are built at first use. The test a_pipeline_an_earlier_run_used_is_built_ahead_of_its_first_use now has nvidia-dev's assert
    !used::noted(unknown_key); main's assert is_pending(unknown) is removed because it checked the behaviour this replaces.
  • GPU wait watchdog (list_x.rs). By default, main's fail-closed stop: an unresolved GPU wait past XCL_GPU_WAIT_TIMEOUT_MS ends the
    title with its diagnostics (dd84e0ad, #2959 stack). nvidia-dev's behaviour, which releases the expired wait on the CPU, signals the fence
    and goes on, is kept behind XCL_WAIT_TIMEOUT_CONTINUE=1. The tests are an_unresolved_wait_stops_the_title_unless_told_to_continue and
    a_wait_released_on_the_cpu_marks_its_cell_signalled_there. kalmarv decides the default. #2499 (the watchdog's missed wake of an armed
    wait) is still open on main and in neither parent, so this merge does not carry it, and #3130, its nvidia-dev backport by Prime1997,
    is still needed. The continue path does not cover for that bug: a missed wake means the watchdog never fires under either policy.

Detail: recompiler, DXIL translator, shaders CLI, README (G3)

Per file (both sides kept unless a decision below says one form wins):

  • gpu/dxil/cfg.rs: both. nv loop_parents (+tests) and main Succs / succ_of -> Succs (+tests).
  • gpu/dxil/coverage.rs: main's mode table; every mode goes through nv's translate_entry_rodata (rodata kept).
  • gpu/dxil/kernel.rs: both. nv rodata API (translate_entry_with/translate_compute_rodata/translate_entry_rodata), compute_init/compute_gate, partner_word, loop_passes (IO_LOOP_BUDGET); main heap_flat/reads_heap_flat, real_lds_access, graphics refusals, wave-local remap. Split-wave64 LDS refusal lifted when lds_order_wanted() (decision b).
  • gpu/dxil/module/split.rs: one test with nv's split -> chain None and main's ResBind checks.
  • gpu/dxil/robustness_tests.rs: main's barrier test; split-LDS refusal test runs only when the LDS order is off.
  • gpu/recomp/dxc.rs: union of imports and both sides' code.
  • gpu/recomp/emit.rs: both. nv rodata (CODE_ADDRESS_HI), partner_word, xcl_x_lw LDS order, IO_GROUP_LIMIT/FOLD_X group unfold (xcl_gid), loop budget; main dispatch_remap, xcl_x_dead fail-closed meet, empty-wave early return, its split-wave fixes.
  • gpu/recomp/mod.rs: nv IO slot layout (decision c); Options carries rodata and no_remap; writes_lds only when the order is on.
  • gpu/recomp/pso.rs: both; nv compute_path/compute_shape/note_compute_path kept (gpu_profile.rs, targets.rs use them).
  • gpu/recomp/runner.rs: main (nv had no change past base).
  • gpu/recomp/tests.rs: both sides' tests, duplicates removed; main's LdsGap and guarded-thread-limit tests rewritten to assert the kept forms (counts in decision a/b), not weakened: each still checks the HLSL it targets.
  • shaders.rs: main's whole-form/claim/corpus code; nv runtime window count when --windows is omitted; nv LaunchPreparation.only + startup.only filter + --used-only worker flag restored (b09acbce).
  • README.md: lead's resolution already keeps both (nv ray-tracing row and lockhart line, main Expiry and AMD medium-lane text).

Decisions (same job, two ways):

  • (a) DispatchX thread limits: nv's branch-free form (one io.Load3(IO_THREAD_LIMIT) - 1, one all() compare, no branch around the entry ballot) kept in both translators, adapted to main's remap (xcl_cg.x /= ratio) and fail-closed xcl_x_dead; main's guarded WaveActiveAllTrue form (#2959, #3157) dropped: a branch around the split-wave rendezvous is what nv's form removes.
  • (b) Split-wave64 LDS order: nv's run-time xcl_x_lw bits (9b455a1a, 67a08dbe) over main's static LdsGap (22026ba5): the run-time form also orders across loop back edges and branch targets. Main's dead-partner guard kept on the meet. Direct-DXIL split-LDS refusal (dbe6b30b) lifted when the order is on; recomp/lower_dxil per-lane refusal kept (nv's order skips the per-lane bridge).
  • (c) IO slots: nv layout (IO_THREAD_LIMIT, IO_GROUP_LIMIT, IO_LOOP_BUDGET, CODE_ADDRESS_HI); runtime writers must use these constants (bind/real/list_x).
  • (d) Compact tables: main's single MAX_TABLE_WORDS; nv's wave32_only parameter dropped (main's limit covers both).
  • (e) Precompile whole forms: main's prepare_compiled_compute / split_whole_roots kept; nv's XCL_PRECOMPILE_PARENT whole-form pass (#2794) dropped as covered.
  • (f) Pipeline claim: main's OS-backed Claim supersedes nv 83bb3436's file claim.

Austin's six nv commits (shaders.rs side; preparation.rs/real.rs sides are the lead's):

  • b09acbce: worker pipelines present in main (#2555); the used-only part was missing -> restored: LaunchPreparation.only, startup.only filter by real::shader_key, pipelines_in_workers passes --used-only when only is set and pso_async::earlier_used_keys() is non-empty.
  • 83bb3436: superseded by main's OS-backed Claim (decision f).
  • bca429ec: graphics_in_workers / graphics_worker present; real.rs part is lead decision 4(c).
  • 626459db: its shaders.rs lines all present; preparation.rs part is the lead's.
  • #2705: workers_for_commit present.
  • #2794: covered by main's prepare_compiled_compute (decision e).

Known gaps

  • main's per-batch cap on hash updates (STAGING/CHUNK) is not enforced on the merged upload path. Unverified whether the upload ring size bounds it.
  • A panic in fill_pages_parallel or in the page scan panics the submit. Only the texture-upload batch catches a panic and retries.
  • vram::unmap_levels (nvidia-dev's give-back of zero lazy levels) does not update TEXEL_STATS.
  • console_heap HEAP_FENCES has no forget_queue, so its records stay keyed by the raw queue address.
  • Dead code left in place (lib warnings): LegacyParityUpload::Planned, the hash-batch helpers, rbq_value and title_textures::refresh.
    main's list_x has dead functions of its own; they are listed by the build.

Audit

  • real.rs: compared line by line against base 4577f09c, main and nvidia-dev, grouped by function (scripts in the merge notes).
    Every line both sides kept is in the tree. Every line one side deleted has a replacement. One line lost in the clean part of the
    merge (main's cached-blob argument to create_graphics_pso_cached) was restored.
  • Lock order on the sparse copy back: the queue's submit lease, then rb_submit. Every caller of readback_after_execute runs inside
    its queue's lease (list_x 3576, 3638 and 5361). This is written as a comment in sparse::submit_async_readback_inner.

Tests

RTX 5070 Ti, driver 610.74, Rust 1.99.0, at dc763946.

  • cargo check --workspace --all-targets passes; the release build passes.
  • cargo test -p xcl --lib -- --test-threads=4, skipping the two uma_driver remake tests (#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, which fail the same way on stock nvidia-dev (DXC 1.9 and WaveSize).
  • Tests whose expectations changed with the merged behaviour (dc763946):
    • recomp compute_prologues_leave_the_lanes_past_a_thread_limit_out_of_exec and wave_local_remap_decision_and_console_ids: the prologue keeps nvidia-dev's form without a remap and main's divided console group with one;
    • dxil a_single_split_wave_of_a_compute_group_exchanges_without_a_group_barrier: it now uses a thread-dependent LDS address, because main's min/max folding turned the constant address into a constant clamp;
    • bind execute_indirect_native_snapshot_ignores_a_later_registry_alias: the test sets a graphics root signature;
    • pso_async a_pipeline_an_earlier_run_used_is_built_ahead_of_its_first_use: it takes nvidia-dev's assert (the backlog);
    • sparse readback_after_execute_records_outside_state_lock_and_drops_excess_outside_locks: it waits on the submitting token.
  • kernelx a_page_whose_move_fails_stays_mapped_where_it_was failed once with parallel tests and passes alone 3/3. It is an address-reuse race between tests, and the code is identical to nvidia-dev.
  • Not run: the workspace integration and e2e tests (crates/xcl/tests), and any GPU other than the RTX 5070 Ti.

Carried on top

Each of these drops out when it merges upstream.

  • #1435 (open, Tarosul, 14c8a2d1) is cherry-picked as adccb7d8.
    • Without it, the world on the prologue-skip save crashes stock nvidia-dev 3 of 3 runs in xg::copy_from. The title calls XG CopyInto/FromSubresource with seven arguments, and stock reads them the six-argument way (STOCK-CRASH.md).
    • Neither parent has the fix. It changes xg.rs only, not shader output.
  • #3189 (open, Royalflamejlh, f4e0ab92) is cherry-picked as daae0330.
    • It removes main's direct_compute_needs_hlsl (d9403543), which sent every 2-D/3-D compute group to HLSL; nvidia-dev never had it.
    • 397 used programs took the HLSL path that way. Two of them were oversized: 56c0cd3b at 18 MB against 584 KB, and af3c3f1c at 165 KB against 24 KB.
    • It bumps the translation glue revision (v4 to v5), so everything is retranslated, but only those 397 programs get new DXIL.

Second merge of main (5eb48388)

  • main 5b711248 brings bmjask's #3195-#3198 (bounded history-backed launch preparation, exact graphics recipes in manifests, preparing the exact graphics history at launch, timing).
  • The code merges without conflicts. README keeps nvidia-dev's Series S line, with main's XCL_PREPARE_HISTORY_PRESENT paragraph after it.
  • The nvidia-dev test a_peek_changes_nothing gets main's new Pending::manifest_recipe field.
  • main's bounded preparation stays opt-in; the used-only startup preparation stays the default.

Precompile measurements (RTX 5070 Ti, Ryzen 9 9950X 16 cores / 32 threads)

Run: xcl shaders --precompile --pipelines --used-only --windows 16 at dc763946, on a cache with the used lists of a stock nvidia-dev world run (1761 used compute programs, 3037 used keys).

  • Translation took 112 s: 1876 compiled, 132 cached.
  • Compute pipelines are built largest DXIL first. The first ~140 have about 0.93-1.22 MB of pipeline DXIL and no driver blob.
  • One process with 15 driver compiles at once: about 7/min beside another precompile, about 10/min alone.
  • The same process restarted with 28 compiles at once: 11-14/min, so only 1.2-1.4x, at 96% CPU.
  • The cost is plain CPU work in the driver's compiler: about 130 thread-s per ~0.95 MB pipeline at 28 threads, and about 90 at 15. Separate measurements (locum replay, one thread) put 1.0-1.3 MB states at 114-184 s each.
  • 15 threads already fill the 16 physical cores, and more threads only add SMT.
  • Worker processes were not tried: with the CPU saturated they cannot add compute. That is the opposite of the "processes 5x faster" reading, and it holds on this CPU only.
  • About 841 of the used compute pipelines have 256 KB of DXIL or more (64 have 1 MB or more), according to the stock world-run log.
  • The pipelines' size, not the way they are scheduled, sets the precompile time: about an hour for this set on this CPU.
  • Graphics pipelines are built only by the startup preparation (graphics_in_workers), never by the CLI.

Our open PRs against nvidia-dev that touch these files

They need rebasing onto this merge:

  • #3184 (integer RTV clears with non-finite channels) touches real.rs.
  • #3187 (the mixed-window remake tests run in a child process) touches uma_driver.rs. It is not conflicted here, but the lib test binary needs it on NVIDIA.
  • #3188 (lazy level pages vs a live aliased page) touches vram.rs.
  • #3056 (two-pass indirect groups D3D12 forbids) touches bind.rs.

Split notes (for a later PR that splits the hub files; nothing is moved in this merge)

  • real.rs, pipeline path: driver_cache (module), DriverBlobs/KeepTurn/keep_driver_blob*, Slots/compile turns,
    translated__pso, go_background/run_owned_build/warm_graphics, finish_two_pass, StreamPipeline, PSO tables.
  • real.rs, memory model: open_uma, init_with_remap, HeapUma/mem_heap_release, resource release and late_release
    holding, title_address, depth_uav.
  • real.rs, submission: q_execute_command_lists, prepare_title_submission, queue_dispatch, q_signal_x*, the fence hooks.
  • Crossing points: prepare_title_submission (submission -> title_textures memory), the resource-release hook
    (memory -> pso_manifest), and bind_pipeline_exact (bind -> pipeline).
  • bind.rs: pipeline resolution (PipelineResolution, PreparedNativePipeline, two-pass runs) vs the ABI/memory part
    (PreparedAbiState, ensure_view_heap, uma windows, folding).
  • list_x.rs: submission plan / submit_effects vs recording state.
<!-- greyfinch-sync:ivall/xcl:comment:7244767794 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3203#issuecomment-7244767794). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-28T19:44:15Z. --- # Merge of `nvidia-dev` into `main`: resolutions The merge commit has `main` (10d27297) as its first parent and `nvidia-dev` (54225f58) as its second. This file reads from main's side: what comes in from nvidia-dev, and where main's own code changed to carry it. Rule for every file: both sides' behaviour stays and works. Where the two sides do one job in two ways, the better one stays (by tests, then by measured numbers, then by a cheap test, then by reading), and the other's callers use it. Every mechanism that went is listed below with its PR, author, replacement and reason. Nothing of bmjask's submission rework (#2959-#2965, #3086, #3149, and the runtime parts of #3100/#3175/#3181/#3182) is dropped. Nothing of nvidia-dev's low-VRAM memory model is dropped either: 16 windows, mirror tiles, lazy sparse, pack pools, the sparse lock split, texture level pages and the mixed UMA driver window. How it was done: a 3-way merge of each conflicted file from the common point 4577f09c, resolved per hunk by job. Git reports 37 conflicted files for a direct merge of the two heads (10d27297 and 54225f58, the count in the description); 33 of them still conflicted from 4577f09c, the base the 3-way work used. The other files merged without a conflict. One silent loss in the clean part was found and restored (`cached.as_deref()` in the translated graphics PSO build); real.rs was then compared line by line against both sides for others (see "Audit"). ## Runtime hub: `hle/d3d12x/real.rs` | Job | Kept | Brought in from nvidia-dev | Dropped | |---|---|---|---| | COM method slots | Both macros. nvidia-dev's `pc_slot!("Iface", "Method")` at the call sites both sides touched: it names its interface and needs no CLASSES lock. main's `slot!(this, ..)` at main's own sites. | `pc_slot!` | nothing | | Per-call timing | Both: main's `stall::detail_span` and nvidia-dev's `api_cost::time_if(look_stats::deep())`. They feed different reports, the stall report and XCL_LOOK_STATS, and both are off unless enabled. | api_cost/look_stats lines | nothing | | Driver compile slots | nvidia-dev's `Slots` (`Slots::new`, `closed_to_ahead`, the urgent queue, `huge_compile_turn`, `pso_async::note_huge`), with main's `MEDIUM_COMPILES` (XCL_MEDIUM_PSO_*), `DriverCompileGate` span and `DRIVER_BUILDS.waiting()` on top. `driver_compile_identified` has main's signature, and its log line also carries nvidia-dev's stage note. | GIANT closed to builds ahead of use; urgent queueing | nothing | | Driver-blob caching | main's `DriverBlobs<K>` (exact generations, reserve/admit/finish/forget_if), `KeepTurn`, `LoadedBlob` (exact-file invalidation), `keep_driver_blob`, `cacheable`, and the AMD-off default of XCL_PSO_DISK_CACHE. | (a) a small program's slow build is kept on disk (228 ms per 4 KB program per run otherwise); (b) separate compute/graphics keep thresholds (XCL_PSO_DISK_CACHE_MIN_MS); (c) preparation workers keep every blob, on disk only; (d) graphics files named by adapter, driver and memory windows (`graphics_file_hash`), so two adapters do not share a file; (e) a blob with no RAM room still reaches the disk; (f) the warm-replay receipt for disk-only blobs | nvidia-dev's `remember_compute_blob`, `compute_blob_kept`, `keep_compute_blob`, `keep_graphics_blob`, `graphics_pso_through_cache` and their unit tests (same job; their behaviour is (a)-(f), and a new test covers (a)) | | PSO tables (user SGPRs, threads, dispatch remap, root signature) | main's API (`*_exact`, `PSO_DISPATCH_REMAP`) over nvidia-dev's lock-sharded `Sharded` storage. | `Sharded` storage | main's `Mutex<HashMap>` storage | | Background builds (`go_background`) | main's recipe / keyed / eager submission. | `Warm` (translation ahead of a lazy graphics build) and the compute record, via `pso_async::*_with` | nothing | | Two-pass lookup | main's `two_pass_of_exact` | | nvidia-dev's `two_pass_entry` (the same function) | | Submit path (`ExecuteCommandLists`) | main's submission plan and receipts: `submission_plan`, `SubmissionGate`, `submit_title_chunk`, `queue_submit::with`, the `prepare_title_submission` fail-stop, `tie_downloads`, `note_execute_call`. | `watch::wait_while_held` and `watch::in_driver`; `submit_cost` timings; `capture::submit`; `gpu_profile::note_queue`; `gpu_times::executed`; `list_x::note_submitted`; the resubmit wait (`alloc_pool::wait_for_previous_submits`, XCL_RESUBMIT_WAIT_MS) in the gate's prepare step; `sparse::send_pending` before every Signal. `prepare_title_submission(queue, lists)` refreshes through nvidia-dev's `title_textures::refresh_for`, which skips the look for CPU writes when every list was closed before the last look began | nothing | | Fence GetCompletedValue | One hook: nvidia-dev's `sparse::settle_readbacks_try`, then main's `title_textures::safe_fence_value`. | settle_readbacks_try | main's separate hook, whose name clashed with nvidia-dev's `fence_completed` | | Resource / heap / PSO release | main's tracked-SRV lifetime gate, `release_taking_first`, `pso_manifest::forget_ready_compute`, `forget_resource_backing_after_release`. | last-reference detection (AddRef + Release == 1, so no state is stripped from a new object at the same address), `late_release` holding of resources and pipelines, the console heap descriptor list | nothing | | UMA (stage 1) | main's `allow_driver_remap` gate: only the backend made before the title's code runs remakes a window, as #2844's review asked. | `open_uma` with shadow windows, per-segment heaps, and the mixed driver window via `remake_window`; the one `init` lock | nothing | ## Pipeline binding: `hle/d3d12x/bind.rs` (from scratch/merge/r1/bind-decisions.md) Per-list state: main's `BindStateRegistry` (#2959 contention bench). nvidia-dev's `Sharded<State>` users moved onto it. Pipeline choice: main's retained `PipelineResolution` everywhere (`PreparedNativePipeline`, `initial_pipeline`, `clear_pipeline_state`). Carried in from nvidia-dev: - the stand-in for an unbuilt pipeline, via `resolve_for_indirect` `InitialFallback`; - deferred two-pass runs (XCL_TWO_PASS_BATCH=2) and `flush_two_pass` at Close; - `whole_ready`, which skips a late whole form instead of compiling it on the title thread; - dispatch folding over main's `valid_dispatch_grid` skip, because folding runs the work. ABI bind: main's `PreparedAbiState`, plus nvidia-dev's per-recording `heap_bound`, console heap bases, GPU views, `note_arena_full` and the lock-free first window. Command-list split: main's `prepare_split` / `install_prepared_split`, with nvidia-dev's heap and two-pass state carried inside. Indirect signatures: main's `IndirectSignatureInfo`; nvidia-dev's dispatch-mesh companion stays. **Dropped:** nvidia-dev's `State::limits` side channel (main passes limits explicitly); `pso_async::gave_standin` / `waits_for` + `list_x::defer` (main's `defer_retained` does that job). ## Submission and pipelines (G2) - `pso_async.rs`: main's build engine stays whole: bands, ranked preload of earlier-run pipelines, coalescing, generations/eviction and pressure. nvidia-dev's known-pipeline preload lane goes into main's ranked preload, which does the same job. Ported onto main: nvidia-dev's other ahead lanes (new compute one at a time, spared image-only compute, Warm translation, then cold graphics builds, the XCL_PSO_AHEAD cap with 8 GB commit room, build_parks), revocable waits, the XCL_GFX_PSO_WAIT_MS / XCL_CS_PSO_WAIT_MS budgets, the wait and put-off logs, the lazy-pipeline stats, peek / has_real / describe / waits_for, the Series S (`-lockhart`) names, and `earlier_used_shaders` / `earlier_used_keys`. **Dropped:** nvidia-dev's sharded PENDING, for main's `PendingRegistry` (same job). - `list_x.rs`: main's single LISTS map, because the rework reads several lists under one lock. main's submission plan and `submit_effects`, which already cover nvidia-dev's write64 signals, sparse readbacks (with nvidia-dev's `sparse_imm` added) and CPU writes. Kept from nvidia-dev: `set_compute_pipeline`, `bound_render_targets`, `note_submitted`, `defer`, `apply_*`, `uav_clear_resource`. **Dropped:** nvidia-dev's 64-way LISTS sharding (2987c19b, no measurement). - `real/dispatch_chain.rs`: main's `WholeBuild` (OOM retry), `IndirectChain` and `bind_pipeline_exact` (DRED label). nvidia-dev's off-thread whole worker and `Whole` / `whole_ready` are ported onto `WholeBuild`. **Dropped:** nvidia-dev's own `bind()`, for `bind_pipeline_exact` (same job, plus DRED). - `device_x.rs`: main's `IndirectSignatureInfo` record replaces nvidia-dev's `note_signature_dispatches` / `note_root_changing_signature`. nvidia-dev's dispatch-mesh companion, indirect guard, capture and failure warning stay. - `title_list.rs`: main's release that keeps the primary (6ae88983, tested), plus nvidia-dev's WRAPPER_OF ABA guard (04a1768c). **Dropped:** nvidia-dev's "forget if not adopted": the same race, and main's form is stricter. - `fence_x.rs`: main's `complete_fence_downloads` gate after nvidia-dev's settle. - `host.rs`: main's `memory_report` snapshot replaces nvidia-dev's own K32 / video-memory query. nvidia-dev's lines stay. - `present.rs`: main's file, plus nvidia-dev's `presenting()`, `view_resource()` and `half_float()`. The last is not main's `small_float`: it has a sign bit and inf/NaN. ## Memory model (G1) - `alloc_pool.rs`: main's file (SubmissionGate, receipts, `retire_recording`, `forget_queue`, `submit_stats`, `reclaim_idle_aside`). Brought in from nvidia-dev: `wait_for_previous_submits` (XCL_RESUBMIT_WAIT_MS), XCL-fence reads via `real::fence_completed`, and the two-pass hooks, run inside `SubmissionGate::submit` / `submit_receipted`. **Dropped:** nvidia-dev's `park_list` / `unpin_list` / `unpin_users` / `done_with`: main's `retire_recording` and `reclaim_idle_aside` do those jobs. - `uma.rs`: main's #3068 automatic cap on top of nvidia-dev's route-based sizing. - `dstorage.rs`: main's `known_writable`, EnqueueSetEvent and stall spans, plus nvidia-dev's `read_own`. - `gpu/texture.rs`: main's `Uploader` / `upload_batch*` / `plan_batch` / `submit_batch*` (tests/texture_states.rs). Title-texture uploads at runtime stay nvidia-dev's `texture_upload.rs`. - `console_heap.rs`, `sparse.rs`, `vram.rs`: nvidia-dev's present-queue list is replaced by main's `known_queues_held()` (owned refs). The rest is filled in by G1 (see below). - `title_textures.rs`, stage 1: one reader of title memory, main's `with_title_bytes` / `read_committed_into`, with nvidia-dev's mixed-window GPU copy inside it and nvidia-dev's level-page reads. **Dropped:** nvidia-dev's `XCL_TEXTURE_SAFE_READ=1`, because main's reader always copies outside the committed window. ## Recompiler, CLI and preparation (G3 and lead) - IO slots: nvidia-dev's layout (IO_LOOP_BUDGET 113, IO_GROUP_LIMIT 114, IO_THREAD_LIMIT 115-117, IO_MESH_GROUP_BASE 118). Every writer uses the constants. - DispatchX thread limits (both sides did them: main #2959, nvidia-dev 12758ed0/7af6e543): nvidia-dev's form in both translators (branch-free, all three axes, folded groups, partner_word), on main's wave-local remap and fail-closed `xcl_x_dead`. **Dropped:** main's guarded-prologue form. - Split-wave64 LDS order: nvidia-dev's runtime `xcl_x_lw` (XCL_X_LDS_ORDER) with main's dead-partner guard. **Dropped:** main's static `LdsGap` (22026ba5): the same job, and nvidia-dev's form needs fewer meets and covers direct DXIL. - `present/preparation.rs`: main's file (per-title preparation, corpus replay, pipeline libraries), plus nvidia-dev's "only the shaders earlier runs used" filter (`LaunchPreparation::only`, XCL_PREPARE_ALL=1 for every record) and the XCL_PREPARE=0 log line. Stage 1 had dropped the filter without evidence; nvidia-dev's author measured the startup about 5x faster with it. - theaustinayers' preparation commits, each checked in the merged tree: b09acbce (compute pipelines in worker processes), 83bb3436 (one worker builds a pipeline, the others leave it), bca429ec (graphics pipelines earlier runs used, built before the title), 626459db (the preparation screen counts each pass), #2705, #2794. G3 fills in this part. - The precompile takes the runtime window count when `--windows` is omitted (`configured_runtime_windows`, nvidia-dev). ## Detail: list_x.rs (G2b) | File | Resolution | PRs | |---|---|---| | `hle/d3d12x/list_x.rs` | `main`'s file (submission plan, segment effects, receipts and native queue slots, `split_recording` transaction, `defer_retained`, write producers, native generations) with nv's additions ported onto it; 66 diff3 hunks against 4577f09c..10f917e5. | #2959-#2965, #3086, #3149 (main); nv list below | | `list_x.rs` (list state map) | **One mechanism:** `main`'s single `LISTS` map kept, nv's 64-way sharded `LISTS` (2987c19b, no measurements) dropped: the rework reads several lists under one lock (`SubmissionPlan::capture`, kickoff, split carry) and its tests assert `LISTS.try_lock()`. nv's `every_list` kept over the single map; nv's `set_compute_pipeline` (same commit) kept. | nv 2987c19b | | `list_x.rs` (texture state) | `main`'s per-segment `capture_gpu_write` / `capture_transitions` / `publish_submission_effects` (with G1, whose `title_textures` drives nv's state from them). nv's `note_gpu_write(list, r)` / `list_reset` / `submitted` calls dropped as the same job; nv's new GPU writes (ResolveSubresource, ResolveSubresourceRegion) go through `note_texture_write(list, dst, dst_sub)`; nv's `note_list_closed` / `forget_list_closed` kept. | | | `list_x.rs` (sparse immediates) | nv's bottom-of-pipe immediates into GPU-copy windows (`sparse_imm`, `note_imm`, `imm_by_cpu`, `IMM_KEEP_MAX`) carried through `main`'s `SegmentEffects` and `KickoffEffects`; `submit_segment_effects` and the kickoff call nv's 3-argument `sparse::readback_after_execute`. `note_imm` records its range as an in-segment GPU write in `main`'s write producers. Write tracking uses nv's `read_back(va)` (GPU-copy window or GPU view) in `main`'s `note_write`. | nv sparse/imm | | `list_x.rs` (waits) | `main`'s `wait_all_on` (stops on an unresolved wait) returns nv's "waited on the CPU", which drives nv's `mapped_after_wait` / `XCL_SPLIT_SPARSE=cpu` after a split in `execute_submission_plan_with_completions` and the kickoff, with nv's `submit_cost::split` timing and `XCL_SYNC_TRACE` events. Waits are recorded at nv's CPU view (`cpu_at`). Watchdog: `main`'s stop instead of signalling expired fences (nv/base signalled them); nv's `indirect_guard::report_now`, wait-edge and queue-progress diagnostics kept before it. | | | `list_x.rs` (submits) | nv's `gpu_times::executed`, `gpu_profile::note_queue` and `note_submitted` (progress fence, now signalled through `real::native_queue_signal`) on `main`'s kickoff chunks; `real::prepare_title_submission(q, &[this])` replaces nv's `title_textures::refresh`. | | | `list_x.rs` (put-off dispatches) | `main`'s `split_recording` / `defer_with` / `record_deferred`. nv's guards moved into `defer_with` (not while the submit records, not without `alloc_pool` swap, `PutOff` counters); nv's `defer(list, what)` kept for binds without a retained resolution, on `defer_with` (adopts main's "bounded waits record now"). nv's `flush_two_pass` before a split's Close, its own allocator kept on `title_list::backing` (both in `prepare_deferred_segment` and `record_deferred`), and the PC allocator a segment records on (`alloc_pool::current` / Reset's `pc_alloc`) passed to `bind::prepare_split` and `PreparedNativePipeline::commit`. **Dropped:** nv test `a_spare_whose_reset_fails_stays_with_the_list_on_the_software_adapter`: main reserves a spare closed without a Reset (the Reset and its failure path come later), so the case it tests does not exist. | nv #3036, f43cab27, 9d3dccb2 | | `list_x.rs` (other nv) | Kept: `apply_topology` / `apply_scissors` / `apply_stencil_ref`, `bound_render_targets`, `uav_clear_resource`, `note_copy_into`, capture ops and `api_cost` timers beside `main`'s `stall::detail_span` (one `copy_buffer_region_x` with both), `placements::note_use`, `lut3d::wrote`, `depth_in_step`, `unpin_users` on release. | | ## Behaviour changes - Direct dispatches past 65,535 groups in a dimension (bind.rs). They are now folded as nvidia-dev does, where main skipped them (`valid_dispatch_grid`). The fold came to nvidia-dev with lukastaro's PR #1428, which is still open on main and was merged into nvidia-dev through its world-main branch (fc4481d9). theaustinayers added 9cc53f15 and ca1e6ad6 on top: no more groups than a dispatch may have, and no clamp in bundles. It is on by default on nvidia-dev and has no switch. With main's wave-local remap, folding applies only to grids that are not remapped; a remapped program that needs a fold runs its `remap_fallback::whole_exact` form folded. This is the direct-dispatch fold. It is not `XCL_CLAMP_INDIRECT` (clamp.rs), the separate pass over indirect dispatches, which stays off unless asked for. - Pipelines that no earlier run used (pso_async.rs) are now built ahead of their first use by nvidia-dev's backlog (theaustinayers 69a48a24 for lazy graphics pipelines and 2ccc646f for compute pipelines of new shaders, on the threads xcl-pso-ahead-*). On main they are built at first use. The test a_pipeline_an_earlier_run_used_is_built_ahead_of_its_first_use now has nvidia-dev's assert !used::noted(unknown_key); main's assert is_pending(unknown) is removed because it checked the behaviour this replaces. - GPU wait watchdog (list_x.rs). By default, main's fail-closed stop: an unresolved GPU wait past XCL_GPU_WAIT_TIMEOUT_MS ends the title with its diagnostics (dd84e0ad, #2959 stack). nvidia-dev's behaviour, which releases the expired wait on the CPU, signals the fence and goes on, is kept behind XCL_WAIT_TIMEOUT_CONTINUE=1. The tests are an_unresolved_wait_stops_the_title_unless_told_to_continue and a_wait_released_on_the_cpu_marks_its_cell_signalled_there. kalmarv decides the default. #2499 (the watchdog's missed wake of an armed wait) is still open on main and in neither parent, so this merge does not carry it, and #3130, its nvidia-dev backport by Prime1997, is still needed. The continue path does not cover for that bug: a missed wake means the watchdog never fires under either policy. ## Detail: recompiler, DXIL translator, shaders CLI, README (G3) Per file (both sides kept unless a decision below says one form wins): - gpu/dxil/cfg.rs: both. nv loop_parents (+tests) and main Succs / succ_of -> Succs (+tests). - gpu/dxil/coverage.rs: main's mode table; every mode goes through nv's translate_entry_rodata (rodata kept). - gpu/dxil/kernel.rs: both. nv rodata API (translate_entry_with/translate_compute_rodata/translate_entry_rodata), compute_init/compute_gate, partner_word, loop_passes (IO_LOOP_BUDGET); main heap_flat/reads_heap_flat, real_lds_access, graphics refusals, wave-local remap. Split-wave64 LDS refusal lifted when lds_order_wanted() (decision b). - gpu/dxil/module/split.rs: one test with nv's split -> chain None and main's ResBind checks. - gpu/dxil/robustness_tests.rs: main's barrier test; split-LDS refusal test runs only when the LDS order is off. - gpu/recomp/dxc.rs: union of imports and both sides' code. - gpu/recomp/emit.rs: both. nv rodata (CODE_ADDRESS_HI), partner_word, xcl_x_lw LDS order, IO_GROUP_LIMIT/FOLD_X group unfold (xcl_gid), loop budget; main dispatch_remap, xcl_x_dead fail-closed meet, empty-wave early return, its split-wave fixes. - gpu/recomp/mod.rs: nv IO slot layout (decision c); Options carries rodata and no_remap; writes_lds only when the order is on. - gpu/recomp/pso.rs: both; nv compute_path/compute_shape/note_compute_path kept (gpu_profile.rs, targets.rs use them). - gpu/recomp/runner.rs: main (nv had no change past base). - gpu/recomp/tests.rs: both sides' tests, duplicates removed; main's LdsGap and guarded-thread-limit tests rewritten to assert the kept forms (counts in decision a/b), not weakened: each still checks the HLSL it targets. - shaders.rs: main's whole-form/claim/corpus code; nv runtime window count when --windows is omitted; nv LaunchPreparation.only + startup.only filter + --used-only worker flag restored (b09acbce). - README.md: lead's resolution already keeps both (nv ray-tracing row and lockhart line, main Expiry and AMD medium-lane text). Decisions (same job, two ways): - (a) DispatchX thread limits: nv's branch-free form (one io.Load3(IO_THREAD_LIMIT) - 1, one all() compare, no branch around the entry ballot) kept in both translators, adapted to main's remap (xcl_cg.x /= ratio) and fail-closed xcl_x_dead; main's guarded WaveActiveAllTrue form (#2959, #3157) dropped: a branch around the split-wave rendezvous is what nv's form removes. - (b) Split-wave64 LDS order: nv's run-time xcl_x_lw bits (9b455a1a, 67a08dbe) over main's static LdsGap (22026ba5): the run-time form also orders across loop back edges and branch targets. Main's dead-partner guard kept on the meet. Direct-DXIL split-LDS refusal (dbe6b30b) lifted when the order is on; recomp/lower_dxil per-lane refusal kept (nv's order skips the per-lane bridge). - (c) IO slots: nv layout (IO_THREAD_LIMIT, IO_GROUP_LIMIT, IO_LOOP_BUDGET, CODE_ADDRESS_HI); runtime writers must use these constants (bind/real/list_x). - (d) Compact tables: main's single MAX_TABLE_WORDS; nv's wave32_only parameter dropped (main's limit covers both). - (e) Precompile whole forms: main's prepare_compiled_compute / split_whole_roots kept; nv's XCL_PRECOMPILE_PARENT whole-form pass (#2794) dropped as covered. - (f) Pipeline claim: main's OS-backed Claim supersedes nv 83bb3436's file claim. Austin's six nv commits (shaders.rs side; preparation.rs/real.rs sides are the lead's): - b09acbce: worker pipelines present in main (#2555); the used-only part was missing -> restored: LaunchPreparation.only, startup.only filter by real::shader_key, pipelines_in_workers passes --used-only when only is set and pso_async::earlier_used_keys() is non-empty. - 83bb3436: superseded by main's OS-backed Claim (decision f). - bca429ec: graphics_in_workers / graphics_worker present; real.rs part is lead decision 4(c). - 626459db: its shaders.rs lines all present; preparation.rs part is the lead's. - #2705: workers_for_commit present. - #2794: covered by main's prepare_compiled_compute (decision e). ## Known gaps - main's per-batch cap on hash updates (STAGING/CHUNK) is not enforced on the merged upload path. Unverified whether the upload ring size bounds it. - A panic in fill_pages_parallel or in the page scan panics the submit. Only the texture-upload batch catches a panic and retries. - vram::unmap_levels (nvidia-dev's give-back of zero lazy levels) does not update TEXEL_STATS. - console_heap HEAP_FENCES has no forget_queue, so its records stay keyed by the raw queue address. - Dead code left in place (lib warnings): LegacyParityUpload::Planned, the hash-batch helpers, rbq_value and title_textures::refresh. main's list_x has dead functions of its own; they are listed by the build. ## Audit - real.rs: compared line by line against base 4577f09c, main and nvidia-dev, grouped by function (scripts in the merge notes). Every line both sides kept is in the tree. Every line one side deleted has a replacement. One line lost in the clean part of the merge (main's cached-blob argument to create_graphics_pso_cached) was restored. - Lock order on the sparse copy back: the queue's submit lease, then rb_submit. Every caller of readback_after_execute runs inside its queue's lease (list_x 3576, 3638 and 5361). This is written as a comment in sparse::submit_async_readback_inner. ## Tests RTX 5070 Ti, driver 610.74, Rust 1.99.0, at dc763946. - `cargo check --workspace --all-targets` passes; the release build passes. - `cargo test -p xcl --lib -- --test-threads=4`, skipping the two uma_driver remake tests (#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`, which fail the same way on stock nvidia-dev (DXC 1.9 and WaveSize). - Tests whose expectations changed with the merged behaviour (dc763946): - recomp `compute_prologues_leave_the_lanes_past_a_thread_limit_out_of_exec` and `wave_local_remap_decision_and_console_ids`: the prologue keeps nvidia-dev's form without a remap and main's divided console group with one; - dxil `a_single_split_wave_of_a_compute_group_exchanges_without_a_group_barrier`: it now uses a thread-dependent LDS address, because main's min/max folding turned the constant address into a constant clamp; - bind `execute_indirect_native_snapshot_ignores_a_later_registry_alias`: the test sets a graphics root signature; - pso_async `a_pipeline_an_earlier_run_used_is_built_ahead_of_its_first_use`: it takes nvidia-dev's assert (the backlog); - sparse `readback_after_execute_records_outside_state_lock_and_drops_excess_outside_locks`: it waits on the submitting token. - kernelx `a_page_whose_move_fails_stays_mapped_where_it_was` failed once with parallel tests and passes alone 3/3. It is an address-reuse race between tests, and the code is identical to nvidia-dev. - Not run: the workspace integration and e2e tests (`crates/xcl/tests`), and any GPU other than the RTX 5070 Ti. ## Carried on top Each of these drops out when it merges upstream. - #1435 (open, Tarosul, 14c8a2d1) is cherry-picked as adccb7d8. - Without it, the world on the prologue-skip save crashes stock nvidia-dev 3 of 3 runs in `xg::copy_from`. The title calls XG CopyInto/FromSubresource with seven arguments, and stock reads them the six-argument way (STOCK-CRASH.md). - Neither parent has the fix. It changes xg.rs only, not shader output. - #3189 (open, Royalflamejlh, f4e0ab92) is cherry-picked as daae0330. - It removes main's direct_compute_needs_hlsl (d9403543), which sent every 2-D/3-D compute group to HLSL; nvidia-dev never had it. - 397 used programs took the HLSL path that way. Two of them were oversized: 56c0cd3b at 18 MB against 584 KB, and af3c3f1c at 165 KB against 24 KB. - It bumps the translation glue revision (v4 to v5), so everything is retranslated, but only those 397 programs get new DXIL. ## Second merge of main (5eb48388) - main 5b711248 brings bmjask's #3195-#3198 (bounded history-backed launch preparation, exact graphics recipes in manifests, preparing the exact graphics history at launch, timing). - The code merges without conflicts. README keeps nvidia-dev's Series S line, with main's `XCL_PREPARE_HISTORY_PRESENT` paragraph after it. - The nvidia-dev test `a_peek_changes_nothing` gets main's new `Pending::manifest_recipe` field. - main's bounded preparation stays opt-in; the used-only startup preparation stays the default. ## Precompile measurements (RTX 5070 Ti, Ryzen 9 9950X 16 cores / 32 threads) Run: `xcl shaders --precompile --pipelines --used-only --windows 16` at dc763946, on a cache with the used lists of a stock nvidia-dev world run (1761 used compute programs, 3037 used keys). - Translation took 112 s: 1876 compiled, 132 cached. - Compute pipelines are built largest DXIL first. The first ~140 have about 0.93-1.22 MB of pipeline DXIL and no driver blob. - One process with 15 driver compiles at once: about 7/min beside another precompile, about 10/min alone. - The same process restarted with 28 compiles at once: 11-14/min, so only 1.2-1.4x, at 96% CPU. - The cost is plain CPU work in the driver's compiler: about 130 thread-s per ~0.95 MB pipeline at 28 threads, and about 90 at 15. Separate measurements (locum replay, one thread) put 1.0-1.3 MB states at 114-184 s each. - 15 threads already fill the 16 physical cores, and more threads only add SMT. - Worker processes were not tried: with the CPU saturated they cannot add compute. That is the opposite of the "processes 5x faster" reading, and it holds on this CPU only. - About 841 of the used compute pipelines have 256 KB of DXIL or more (64 have 1 MB or more), according to the stock world-run log. - The pipelines' size, not the way they are scheduled, sets the precompile time: about an hour for this set on this CPU. - Graphics pipelines are built only by the startup preparation (`graphics_in_workers`), never by the CLI. ## Our open PRs against nvidia-dev that touch these files They need rebasing onto this merge: - #3184 (integer RTV clears with non-finite channels) touches `real.rs`. - #3187 (the mixed-window remake tests run in a child process) touches `uma_driver.rs`. It is not conflicted here, but the lib test binary needs it on NVIDIA. - #3188 (lazy level pages vs a live aliased page) touches `vram.rs`. - #3056 (two-pass indirect groups D3D12 forbids) touches `bind.rs`. ## Split notes (for a later PR that splits the hub files; nothing is moved in this merge) - real.rs, pipeline path: driver_cache (module), DriverBlobs/KeepTurn/keep_driver_blob*, Slots/compile turns, translated_*_pso*, go_background/run_owned_build/warm_graphics, finish_two_pass, StreamPipeline, PSO tables. - real.rs, memory model: open_uma, init_with_remap, HeapUma/mem_heap_release, resource release and late_release holding, title_address, depth_uav. - real.rs, submission: q_execute_command_lists, prepare_title_submission, queue_dispatch, q_signal_x*, the fence hooks. - Crossing points: `prepare_title_submission` (submission -> title_textures memory), the resource-release hook (memory -> pso_manifest), and `bind_pipeline_exact` (bind -> pipeline). - bind.rs: pipeline resolution (PipelineResolution, PreparedNativePipeline, two-pass runs) vs the ABI/memory part (PreparedAbiState, ensure_view_heap, uma windows, folding). - list_x.rs: submission plan / submit_effects vs recording state.
fromthemoonx commented 2026-11-28 20:13:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-28T20:13:41Z.


Update: fixed by #3213. The test passes 3 of 3 on main beeb81b, same RTX 3060.


Full workspace suite on main 765b2c5 after this merge, on NVIDIA: 1 failure, in an integration test that the lib-only runs above don't reach. gpu_compute_e2e::a_preparation_worker_also_builds_a_split_programs_whole_form passes on nvidia-dev 54225f5 and fails 3 of 3 on the merged tree.

Tested: RTX 3060 12 GB (driver 610.88, wave32 only), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug.

result
cargo test --workspace --no-fail-fast -- --test-threads=4, 765b2c5 2593 passed, 1 failed, 49 ignored; 28 SKIPPED lines. e2e debug-layer messages unchanged (3× error id 93, 1× error id 1046, 1× warning id 820, 2× warning id 926, 8× id 0)
a_preparation_worker_also_builds_a_split_programs_whole_form alone nvidia-dev 54225f5: passes. f0e8fdd5 (the first merge), 5eb48388, daae0330, 765b2c5: fails 3 of 3 each

The failure (gpu_compute_e2e.rs:355) is no split program:. The precompile's output has no split compute programs: 1 (N pieces) line, though it made 6 pipelines:

precompiling 1 shaders into …\cache (15 compile threads; 1 memory windows, split wave64 for a GPU with 32-lane waves)
compiled 1, already cached 0, errors 0, skipped (GS – paired at pipeline creation) 0, time 0.3 s
pipelines: 0 compute programs (0 used earlier: first), 7 driver compiles at once
pipelines made on the GPU 6, refused 0
pipelines loaded from the driver cache 0
fresh GPU pipeline creations 6: driver blobs saved 6, unavailable 0, persistence disabled 0, cache writes failed 0

On the merged tree, split_programs is counted only in Pipelines::make_selected when c.dispatch_chain has 2 or more pieces, and the precompile calls it with path_override: None. So with this test's settings (XCL_DIRECT_DXIL=1, XCL_DIRECT_SPLIT_INSTRUCTIONS=12, --windows 1), the program arrives without a dispatch chain of 2+ pieces. Either it is no longer split, or the 6 pipelines come from another path. I did not trace which. It already fails at f0e8fdd5, before #3189 (daae0330) came in, so it is not from that change (#3210 also saw this test fail on merged main).

Not tested: AMD; a title; a release build.

AI use: Claude Code (Claude Opus 5.5) ran the suite and the checks and wrote this comment.

<!-- greyfinch-sync:ivall/xcl:comment:7245130176 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3203#issuecomment-7245130176). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-11-28T20:13:41Z. --- *Update:* fixed by #3213. The test passes 3 of 3 on `main` `beeb81b`, same RTX 3060. --- **Full workspace suite on `main` `765b2c5` after this merge, on NVIDIA: 1 failure, in an integration test that the lib-only runs above don't reach. `gpu_compute_e2e::a_preparation_worker_also_builds_a_split_programs_whole_form` passes on `nvidia-dev` `54225f5` and fails 3 of 3 on the merged tree.** **Tested:** RTX 3060 12 GB (driver 610.88, wave32 only), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug. | | result | |---|---| | `cargo test --workspace --no-fail-fast -- --test-threads=4`, `765b2c5` | 2593 passed, 1 failed, 49 ignored; 28 `SKIPPED` lines. e2e debug-layer messages unchanged (3× error id 93, 1× error id 1046, 1× warning id 820, 2× warning id 926, 8× id 0) | | `a_preparation_worker_also_builds_a_split_programs_whole_form` alone | `nvidia-dev` `54225f5`: passes. `f0e8fdd5` (the first merge), `5eb48388`, `daae0330`, `765b2c5`: fails 3 of 3 each | The failure (`gpu_compute_e2e.rs:355`) is `no split program:`. The precompile's output has no `split compute programs: 1 (N pieces)` line, though it made 6 pipelines: ``` precompiling 1 shaders into …\cache (15 compile threads; 1 memory windows, split wave64 for a GPU with 32-lane waves) compiled 1, already cached 0, errors 0, skipped (GS – paired at pipeline creation) 0, time 0.3 s pipelines: 0 compute programs (0 used earlier: first), 7 driver compiles at once pipelines made on the GPU 6, refused 0 pipelines loaded from the driver cache 0 fresh GPU pipeline creations 6: driver blobs saved 6, unavailable 0, persistence disabled 0, cache writes failed 0 ``` On the merged tree, `split_programs` is counted only in `Pipelines::make_selected` when `c.dispatch_chain` has 2 or more pieces, and the precompile calls it with `path_override: None`. So with this test's settings (`XCL_DIRECT_DXIL=1`, `XCL_DIRECT_SPLIT_INSTRUCTIONS=12`, `--windows 1`), the program arrives without a dispatch chain of 2+ pieces. Either it is no longer split, or the 6 pipelines come from another path. I did not trace which. It already fails at `f0e8fdd5`, before #3189 (`daae0330`) came in, so it is not from that change (#3210 also saw this test fail on merged `main`). **Not tested:** AMD; a title; a release build. **AI use:** Claude Code (Claude Opus 5.5) ran the suite and the checks and wrote this comment.
brainhay5 commented 2026-11-29 00:38:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brainhay5 on 2026-11-29T00:38:49Z.


Stall regression on the merged result: 7db2f391 stops presenting at ~60 s where 10d27297 does not

RTX 5070 Ti 16 GB, driver 32.0.16.1088, Ryzen 7 5800X3D, 64 GB, Windows 11 22631. Retail 1.0.2.1 (TitleId 7952987A), default path (XCL_PREPARE=0, no XCL_DIRECT_DXIL or XCL_HEAP_WINDOWS), 420–600 s runs, press-A every 3 s. "Last present" is the final frames presented line in the log.

head last present result
10d27297 (first parent) 233.7 / 142.2 / 206.7 s no stall
54225f58 (second parent) 67.6 / 68.2 s stalls
f0e8fdd5 (the merge) 62.4 s stalls
7db2f391 (current main) 65.2 / 78.0 / 57.8 / 58.3 / 66.2 / 66.2 s stalls 6/6

Every stalling run ends in the same shape: presents stop in the 46–86 s band, VRAM parked at ~15.2 GB of 16,303 MiB, GPU at 0 %, no device loss and no crash. The non-stalling runs reach 1800 frames with VRAM still climbing.

Two of the six 7db2f391 runs had XCL_ACTIVITY unset and compute supply at 117/136, so neither the activity sampler nor a cold cache explains it. Two of the three 10d27297 runs were taken after the failures, in the same session (19:14 and 19:25), so this is not drift between sessions either.

I have not diagnosed the cause, and I am not claiming your resolution dropped code. The measurement only places the behaviour change at the merge: first parent keeps going, second parent stalls, the merge stalls. Either git show --remerge-diff f0e8fdd5 on the submission path or nvidia-dev's low-VRAM memory model interacting with this title would fit the data.

Not tested: world rendering (the title is in its front end throughout), other GPUs, other titles. GPU state and thread stacks at the stop are not captured here.

Independent tester, no code changes.

<!-- greyfinch-sync:ivall/xcl:comment:7248255930 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3203#issuecomment-7248255930). Originally posted by [brainhay5](https://github.com/brainhay5) on 2026-11-29T00:38:49Z. --- **Stall regression on the merged result: `7db2f391` stops presenting at ~60 s where `10d27297` does not** RTX 5070 Ti 16 GB, driver 32.0.16.1088, Ryzen 7 5800X3D, 64 GB, Windows 11 22631. Retail 1.0.2.1 (TitleId `7952987A`), default path (`XCL_PREPARE=0`, no `XCL_DIRECT_DXIL` or `XCL_HEAP_WINDOWS`), 420–600 s runs, press-A every 3 s. "Last present" is the final `frames presented` line in the log. | head | last present | result | | --- | --- | --- | | `10d27297` (first parent) | 233.7 / 142.2 / 206.7 s | no stall | | `54225f58` (second parent) | 67.6 / 68.2 s | stalls | | `f0e8fdd5` (the merge) | 62.4 s | stalls | | `7db2f391` (current `main`) | 65.2 / 78.0 / 57.8 / 58.3 / 66.2 / 66.2 s | **stalls 6/6** | Every stalling run ends in the same shape: presents stop in the 46–86 s band, VRAM parked at ~15.2 GB of 16,303 MiB, GPU at 0 %, no device loss and no crash. The non-stalling runs reach 1800 frames with VRAM still climbing. Two of the six `7db2f391` runs had `XCL_ACTIVITY` unset and compute supply at 117/136, so neither the activity sampler nor a cold cache explains it. Two of the three `10d27297` runs were taken *after* the failures, in the same session (19:14 and 19:25), so this is not drift between sessions either. I have not diagnosed the cause, and I am **not** claiming your resolution dropped code. The measurement only places the behaviour change at the merge: first parent keeps going, second parent stalls, the merge stalls. Either `git show --remerge-diff f0e8fdd5` on the submission path or `nvidia-dev`'s low-VRAM memory model interacting with this title would fit the data. **Not tested:** world rendering (the title is in its front end throughout), other GPUs, other titles. GPU state and thread stacks at the stop are not captured here. Independent tester, no code changes.
brainhay5 commented 2026-11-29 02:09:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brainhay5 on 2026-11-29T02:09:45Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7249248916 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3203#issuecomment-7249248916). Originally posted by [brainhay5](https://github.com/brainhay5) on 2026-11-29T02:09:45Z. --- **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.
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!3203
No description provided.