Shaders: discover offline pipeline recipes and prepare them before launch #2829
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2829
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2829"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@bmjask on GitHub · 2026-11-26 16:00 UTC · original
bmjask:shaders/parallel-pso-preparation→nvidia-dev· +2805 −170 · 22 files · 9 commits · openStacked on #2828 against
nvidia-dev. Related to #2088.What and why
Known pipeline recipes can be prepared before guest entry. A verified driver artifact survives a diagnostics-only rebuild when the adapter, driver, translation settings and pipeline layout are unchanged. The offline command and the game window use the same staged corpus and validate native completion before reporting success.
What is in it
Discover shader sources and fixed-state variants from archive tables using a local layout profile. Stage one or more journals as a single deduplicated native workload.
Run
xcl shaders <folder> --prepare-corpus --threads 8for offline graphics, two-pass mesh and compute preparation. Select up to 32 workers.Gate ordinary launch on preparation. The game window draws a progress-lit wireframe and reports progress and stalls. Cancellation and failed staged recipes prevent guest entry.
Reuse verified pack DXIL and compute, graphics and both mesh-pass blobs. Corrupt proofs and missing or replaced output files fall back to preparation.
Recover optional recorded history after a torn append. Unknown history tags and missing optional sources leave usable records available. A staged job still requires all sources and every frame. The history reader and its regression build on thehollowedone's review.
Restore
XCL_PREPARE=0for unstaged startup andXCL_PREPARE_GRAPHICS=0for optional graphics history. A staged corpus retains its launch gate.Tested
Revision
dea6ae17changes tested on Windows 11 build 26200, Core i9-12900K, GeForce RTX 4090 driver 610.88, rustc 1.100.0 MSVC, debug.python -B -m unittest discover -s scripts/pso_corpus -qreported 15 passed, 0 failed and 0 skipped.cargo test --locked -p xcl --lib shaders::warm -- --test-threads=1reported 3 passed, 0 failed, 0 ignored and no skips. The targetedhistory_reader_keeps_verified_entries_after_an_incomplete_final_appendtest also passed (1 passed, 0 failed, 0 ignored and no skips).On clean head
e2b2eaf2, two separately linked Windows debug executables differing only in a progress diagnostic ran the standalone corpus command on the same adapter and cache. The second executable verified both known graphics recipes (classic and two-pass mesh) and the compute recipe from disk. All 3 completed with exit 0. A subsequent direct worker reported 2 verified recipes and 0 driver blob loads/writes.cargo test --locked -p xcl --lib warm_settings_ignore_worker_identity -- --test-threads=1: 1 passed, 0 failed, 0 ignored, no skips.On
e2b2eaf2,cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --nocapture: 1,837 passed, 8 failed, 48 ignored across 40 targets, 27 SKIPPED notices. Failures covered compute thread limits, a deferred sparse mapping, two texture-upload tests, the AS-slot mesh diagnostic, async compute registration, split compute and two-pass cleanup. All preparation receipt, history recovery and headless launch-gate tests passed. GPU skips do not count as hardware coverage.Hosted Windows CI on this head exited in sparse tests with
DXGI_ERROR_DEVICE_REMOVEDafter a 3 GiB GPU-view reservation. The software-adapter detection proposal #2837 describes this symptom.The following evidence is from earlier revisions of this PR:
Windows x64.
python -B -m unittest discover -s scripts/pso_corpus -vpassed 15 tests, with zero failures or skips.Staged 84,228 graphics and mesh recipes plus 2,734 compute recipes from local journals. Readback verified the counts. Archive discovery requires a profile for the archive revision.
A local archive-layout profile produced 84,796 distinct source-derived recipes. Separate inputs provided static derivative mappings. The staged set includes byte-for-byte matches for all 82,612 recipes in a held-out capture. Other titles need suitable profiles.
On a GeForce RTX 4090, the public offline command prepared 24/24 archive-derived recipes (8 classic graphics, 8 two-pass mesh, 8 compute), wrote 32 native blobs, and exited successfully in 39.1 s with 2 workers and an initially empty application cache. A separate three-recipe test confirmed a second process could restore both mesh blobs.
The repository's test title prepared 768/768 generated compute recipes in its own window and returned 0. The old preparation-disable settings were set during this run. A headless failure test also passed. With 48 sources supplied both loose and staged, native submissions in the loose pass fell from 48 to zero, all 48 staged recipes were confirmed, and both title runs exited successfully. Separate mixed and fully covered packs verified worker routing.
cargo build --workspace --lockedpassed on Windows x64. On head1eb656b4,cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-outputreported 1,762 passed, 5 failed and 48 ignored across 40 targets. Sixteen reported-pass tests logged 26 skipped GPU subcases. All five failing tests also failed on the clean #2828 base: two texture upload tests, the AS-slot mesh diagnostic, async compute registration, and two-pass state cleanup. All head launcher end-to-end tests passed.Regression run
The current head has no paired retail smoke results. The earlier main and nvidia-dev reports in review comments cannot supply a clean run of this head.
Not tested
Current-head retail gameplay, paired regression smoke and AMD hardware. Complete native compilation of the largest staged corpus on this branch. Gameplay coverage beyond supplied recipes and matched history.
AI use
Codex, GPT-6, implemented and reviewed the changes and ran the checks.
@Anon64 on GitHub · 2026-11-26 16:24 UTC · original · edited 2026-11-26 16:31 UTC
Regression run of
aac27a6on a newer retail title: the smoke run could not be made, because the title never started within it.Setup: RTX 3060 12 GB (NVIDIA 581.80), i9-14900KF, Windows 11 26200, release builds of main
b49be18(this PR's base) and of this PR's exact head,scripts/smoke.ps1 -Game <title>for 60 s withXCL_NETWORK=0and A pressed every 4 s from 20 s. XCL's DXIL cache on this machine is warm (18 GB, filled by runs and warm-ups ofmainandnvidia-devtoday).xcl runprintedprecompiling 26503 shaders into …\xcl\dxil (31 compile threads; 4 memory windows, split wave64 for a GPU with 32-lane waves)and was still precompiling whensmoke.ps1gave up withXCL printed no log path, so noxcl-smokeblock exists for this head.So with this PR, a launch on this title starts with a pass over every shader record of the pack, even with a warm cache. Unless that is meant to happen on every launch, it looks like the discovery picks up all records instead of the recipes earlier runs recorded, or the cache keys it looks up differ from the ones
mainwrites. It also meansscripts/smoke.ps1cannot measure this PR on a large title; the 60 s window has no room for a launch-time pass.Update: this head is 36,287 added lines in 98 files against
b49be18, so it carries most ofnvidia-devwith it. The sameprecompiling 26503 shaderspass at launch happened here onnvidia-devaf2cecc4itself the first time its shader preparation ran (it later took about 2 minutes once a run had recorded what it used). So the pass is most likelynvidia-dev's preparation, not something this PR's own commits add, and the smoke run would need eitherXCL_PREPARE=0or a first launch to completion before it. Splitting this PR's own commits from thenvidia-devones would make it measurable againstmain.Update 2: with
XCL_PREPARE=0the head still started with the sameprecompiling 26503 shaderspass, and the smoke run failed the same way (main ran normally, 1466 frames). Reading the head:present::preparation::before_guest(fromhost.rs:83) returns early only when there is neither a staged corpus nor any run history, or when graphics arenull, and no environment variable gates it, soXCL_PREPARE=0fromnvidia-devno longer turns it off. On a machine that has run the title before, every launch begins with this pass. A switch to turn it off (or keepingXCL_PREPARE=0) would letscripts/smoke.ps1and anyone comparing againstmainmeasure the rest of the PR.Not tested: how long the pass takes to finish here; a second launch after it finishes; the suite on this head; AMD.
AI use: Claude Code (Claude Opus 5.5) ran these on this machine and wrote this report.
@KDenKC on GitHub · 2026-11-26 16:24 UTC · original
Source review of
1eb656b4, no run, plus a question about real data.shaders.rs:2105-2107now returnsErr("… title graphics recipes lack matching shader sources")when any of the title's own recorded graphics recipes (local_missing) has no matching shader. Onaf2cecc4, with only theused-*files of one earlier run, the retail title logged:The preparation went on and the title started (RTX 5090, two runs). With this head, would those 3 now be found through the new
embeddedmap, or would they count aslocal_missingand stop the launch on the second run? If it is the latter, logging them as before and preparing the rest would keep a relaunch from failing on recipes the pack cannot supply.Not tested: this head in the title.
AI use: Gemini (Antigravity) flagged it in a review. Claude Code (Claude Opus 5.5) checked the source at
1eb656b4and our logs and wrote this.@upipibi on GitHub · 2026-11-26 17:12 UTC · original
Source review of
1eb656b4, no run. A relaunch can fail for good after a run that ended mid-write.graphics_in_workers(shaders.rs:2065) now reads the title's history file,used-graphics-pipelines.bin, with the strictread_complete_payloads. Onmainthis wasgfx_records::read. The strict reader fails on a trailing partial entry ("damaged graphics job at byte N"). That file is appended to while the title runs, and bothWriter::open(gfx_records.rs:559, "a cut-short tail is cut off") and the comment atgfx_records.rs:486treat a partial tail as normal.If a run ends mid-append, the
?stops the next launch before the title starts. OnlyWriter::opentrims the tail, and it runs after the title starts. So every later launch fails the same way until the file is deleted. An entry from another build version stops it the same way ("Unrecognized graphics history entry", line 2069).Reading the history file with
gfx_records::read, and keeping the strict reader for worker job files, would avoid both.AI-assisted (Claude Code, Claude Opus 5.5): traced in the source at this head.
@MatyEjsr on GitHub · 2026-11-26 17:24 UTC · original · edited 2026-11-26 21:42 UTC
Independent Windows / RTX 3090 verification of exact PR #2829 head
1eb656b4b1af9daa9c71a612bd84995f2b8d9c3c(stacked on #2828 againstnvidia-devaf2cecc4; currentlyMERGEABLEwithorigin/nvidia-devateae01502, 38 commits ahead).System
0ef1bc3862026-11-09) MSVC, DXC 1.9.2602.17 (dxil1.9.2602.17, Windows SDK 10.0.26100.0)Tested
python -B -m unittest discover -s scripts/pso_corpus -v: 15 passed, 0 failed, 0 skipped (0.066 s).cargo build --workspace --locked -j 8: passed (debug, 14.75 s);cargo build --release -p xcl --locked -j 8: passed (48.41 s).cargo test --workspace --locked --no-fail-fast -j 8 -- --test-threads=8 --nocapture: 1,762 passed, 5 failed, 48 ignored across 40 top-level targets.--test-threads=1) reproduce all 5 failures deterministically (matching the 5 pre-existing failures on the #2828 /af2cecc4base noted in the PR description):hle::d3d12x::texture_upload::tests::pieces_hold_the_texels_of_their_levels&gpu_parts_of_a_texture_go_up_and_the_rest_stays(texture_upload.rs:1002:17: attempt to multiply with overflow)console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly(d3d12_mesh_stream.rs:96:5:["MS: no NGG hardware variant"])async_compute_pso_registers_real_pso_and_not_standin(gpu_compute_e2e.rs:535:5:TRANSLATED_COMPUTEcleanup)two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs(gpu_two_pass_cache_e2e.rs:649:5:left: 3, right: 0)SKIPPEDsubcases/tests (not counted as passing GPU coverage): 21no wave64, 3per-lane form: refused (unsupported)(wave32 f16 arithmetic/packed, f32 conversions), 2no heap windows(XCL_HEAP_WINDOWS=1opt-in), 3no d3d12SDKLayers.dll/no D3D12 debug layer.Retail smoke check (no
xcl-smoke v1block for PR head)scripts/smoke.ps1 -Seconds 60 -Title c1cc91a4 -StartupTimeoutSeconds 120, clean data root, warm DXIL cache,XCL_PREPAREunset): killed at 180 s withXCL printed no log pathwhile still precompiling (Shader preparation: 3601 of 26503 records processed after 177 s).XCL_PREPARE=0,XCL_PREPARE_GRAPHICS=0): also killed at 180 s withXCL printed no log pathwhile still precompiling (Shader preparation: 8809 of 26503 records processed after 177 s).crates/xcl/src/hle/d3d12x/present/preparation.rs:36-52removed theXCL_PREPARE=0early return andearlier_used_shaders()filter, andcrates/xcl/src/shaders.rs:1798-1800(prepare_title_inputs) removedXCL_PREPARE_GRAPHICS=0. Onnvidia-dev(ea0698d4, 37 commits ahead of this PR'saf2cecc4base and 1 commit behind currentorigin/nvidia-deveae01502),XCL_PREPARE=0lets the title boot within the 60 s smoke window:local_missing != 0relaunch error (shaders.rs:2105-2108) on retail data.Not tested
XCL_HEAP_WINDOWS=1/XCL_DIRECT_DXIL=1, offline--prepare-corpuson a staged archive profile, exactaf2cecc4base smoke run, and gameplay past pre-launch shader preparation on1eb656b4.AI use
1eb656b4, ran the tests and smoke attempts, verified the source lines, and wrote/audited this report.@thehollowedone on GitHub · 2026-11-26 17:39 UTC · original
Follow-up to the truncated-history review, tested on exact head
1eb656b4.I reproduced the launch gate with the repository's synthetic test title and a title-scoped
used-graphics-pipelines.bincontaining a valid file header followed by two bytes of a frame header. On the unmodified head,xcl runstopped before guest entry withdamaged graphics job at byte 12(exit 2). With the candidate below, preparation passed that gate and entered the synthetic title. That title later aborted under my minimal null-renderer test configuration, so this check does not establish a successful full title run.The smallest fix I found is a history-specific reader that accepts only an incomplete final frame header or payload and retains the verified prefix. A complete frame with a bad checksum or unsupported entry still fails. Completed worker job files retain their strict reader. Replacing the call with the older
gfx_records::readwould also ignore complete corrupt frames and read errors, so it is too permissive here. A future file-format version still fails closed; any migration policy is a separate decision.The new regression was red on the unmodified reader (0 passed, 1 failed) and green with this change (1 passed, 0 failed, 0 ignored; no skips):
cargo test --offline --locked -p xcl --lib history_reader_keeps_verified_entries_after_an_incomplete_final_append -- --test-threads=1 --nocapture. It covers a cut frame header, a cut payload, strict worker-job rejection, bad checksum, and unsupported complete entry.cargo build --offline --locked -p xcl --bin xclpassed on both revisions. The fullcargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4on the candidate reported 1,762 passed, 7 failed, 48 ignored, with 26 GPU subcase skip notices; the failures were in the shader-cache, texture-upload, mesh-stream, async-compute and two-pass-cache tests. I did not rerun that full suite on the unmodified head, so I cannot attribute those failures to or exclude this patch.Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (driver 621.35), rustc 1.99.1 MSVC. Synthetic inputs only. Not tested: retail title, paired clean smoke, AMD or Intel. This is a candidate for the author, not a merge-readiness claim.
Candidate diff against
1eb656b4AI use: Codex (GPT-6.2 Sol) traced the path, wrote and ran the candidate and tests; GPT-6.2 Astra reviewed the reader design. I checked the review points and results.
1eb656b4b1toe2b2eaf22e@andrewDoing on GitHub · 2026-11-27 00:09 UTC · original
I checked the missing-source behavior on head
1eb656b4with synthetic, well-formed records and no game files. In a host-sidegraphics_in_workerstest:2 of 2 title graphics recipes lack matching shader sources.1 of 2 title graphics recipes lack matching shader sources; preparation still stopped before workers launched.The test passed 1/1 with zero reported skips. Normal title first-use capture was observed in source to write a recipe; staged or worker inputs can also include shader entries. This synthetic check does not determine whether the missing sources reported for GTA VI can be recovered from its actual inputs.
AI use: OpenAI Codex with GPT-6.2 Astra constructed and ran the synthetic test and inspected the source; Codex coordinated and prepared this report.
@andrewDoing on GitHub · 2026-11-27 00:16 UTC · original
Retested the all-missing historical-source case from my earlier report on updated head
e2b2eaf22e903624c3428b0f0a08c9cfa10e0963, with the same synthetic test-only overlay. Empty title history succeeded. With two well-formed recipes and no matching local shader sources, preparation now reporteddeferring 2 of 2, started zero workers, and returned success. The same all-missing input returned an error on the earlier head1eb656b4.The updated test passed 1/1 without a reported skip. Mixed-source worker execution and GTA VI title behavior were not tested in this retest.
AI use: OpenAI Codex with GPT-6.2 Astra inspected the updated source and ran the synthetic test; Codex coordinated and prepared this report.
@andrewDoing on GitHub · 2026-11-27 00:19 UTC · original
Follow-up to my missing-source retest: on
e2b2eaf22e903624c3428b0f0a08c9cfa10e0963, I tested mixed synthetic title history with two unresolved shader recipes and one complete two-pass mesh plus pixel shader recipe. The parent deferred 2/3 and launched one exact-head worker; it reported 1 pipeline made, 0 failed, and two blobs kept. The history file was byte-identical afterward.The parent test contained a test-only override pointing at the real worker binary. This is a synthetic local integration, not a GTA VI title run or proof that its missing shader sources are recoverable.
AI use: OpenAI Codex with GPT-6.2 Astra built and ran the synthetic test; Codex coordinated and prepared this report.
@JJAutoCompare on GitHub · 2026-11-27 00:21 UTC · original
Tested:
e2b2eaf22e903624c3428b0f0a08c9cfa10e0963on Windows 11 build 26200, Ryzen 7 3800X, Rust 1.100.0 MSVC, debug, Python 3.12.10.python -B -m unittest discover -s scripts/pso_corpus -q: 15 passed.cargo test --offline --locked -j 2 -p xcl --lib --no-runfollowed by the selected warm settings, corpus, graphics record, and staged-worker filters: 22 passed, 0 failed, 0 ignored or skipped. Worker identity and Windows environment casing preserved warm settings identity, and a backend change did not. The inherited history test retained verified entries after an incomplete append. The staged-worker test refused missing or mismatched shader inputs before graphics pipeline creation.Not tested: Actual prelaunch GPU cache reuse, retail titles, and the full workspace suite.
AI use: T3 Code / Codex (
gpt-6.2-sol) ran and reran the checks and wrote this report.@andrewDoing on GitHub · 2026-11-27 00:35 UTC · original
Another synthetic prelaunch check on head
e2b2eaf22e903624c3428b0f0a08c9cfa10e0963: two complete mesh recipes were prepared by the real worker in fresh processes. All five runs succeeded with zero failed recipes.The receipt identity includes the ordered recipe list, so reordered grouping triggers native revalidation even though driver blobs can still be reused. This is a synthetic test, not a GTA VI launch or measured performance regression.
AI use: OpenAI Codex with GPT-6.2 Astra built and ran the synthetic test; Codex coordinated and prepared this report.
@KDenKC on GitHub · 2026-11-27 06:21 UTC · original
@bmjask, a question about the archive-layout profile. On
nvidia-dev+ #2794 (RTX 5090), the next cold-compile cost after whole-form compute is 135 graphics builds of 1 s or more, none of them in the first-use history (details: #2088 7211419072). Recipe discovery from the archive tables looks like the approach that covers them, so we'd like to teste2b2eaf2in the retail title (1.0.2.1).scripts/pso_corpus/has the schema (archive-profile.md),pso_archive.pyandstage.py, but not the profile itself. Is the profile for the retail title's archive revision something you can publish, or is there a recipe for building one from a local copy (which tables and offsets it reads)? With it, we'd run--prepare-corpusinto a scratch folder, check whether the 135 slow builds come out as full stage-and-state matches, and post time to the first world frame with and without it.AI use: Gemini (Antigravity) read the scripts and thread; Claude Code (Claude Opus 5.5) checked them and wrote this comment.
@thehollowedone on GitHub · 2026-11-27 10:22 UTC · original
Focused review of #2829 head
e2b2eaf2: a staged classic graphics recipe with a console geometry shader and depth bounds enabled can report successful native preparation with depth bounds off. The recipe keeps that flag, andprepare_graphicspasses it totranslated_graphics_pso_once. Its GS branch drops the flag attranslated_gs_pso, which emitsDEPTH_STENCILfor both cases. Becausefinish_two_passhashes the resulting stream, the two cases can also share the same mesh-graphics cache identity. This is a preparation/correctness gap; I did not measure a title render.I added a synthetic stream regression locally on the exact head. Before the correction,
cargo test --offline --locked -j 4 -p xcl --lib gs_mesh_stream_preserves_depth_bounds_state -- --test-threads=1failed 0 passed, 1 failed, 0 ignored: native subobject 11 (DEPTH_STENCIL) instead of 21 (DEPTH_STENCIL1). With the candidate diff below,cargo test --offline --locked -j 4 -p xcl --lib depth_bounds -- --test-threads=1passed 3 passed, 0 failed, 0 ignored, zero skips. The new test also checks the two native cache keys differ.git diff --checkpassed.Candidate fix and regression
This needs a real GPU recipe/replay check on a depth-bounds-capable adapter and a clean-head paired smoke before merge. I did not run those or the full workspace suite on this uncommitted candidate. No proprietary inputs were used. AI use: Codex (GPT-6.2 Sol) wrote and ran the local regression and fix; Codex (GPT-6.2 Astra) independently traced the path.
@thehollowedone on GitHub · 2026-11-27 10:52 UTC · original · edited 2026-11-27 10:55 UTC
Follow-up to my depth-bounds finding: I checked the geometry-shader path with a native GPU worker replay and ran clean-commit smoke checks. The unmodified PR head is
e2b2eaf; the proposed correction is a local, unpushed commit92c26a56on top of it.On Windows 11 build 26300, RTX 3080 Ti (621.35), Ryzen 7 9800X3D, the new synthetic VS+GS worker test makes both native pipelines, one with depth bounds and one without. On the unchanged PR head it failed: both recipes produced the same mesh-pipeline cache entry. With the local correction it passed cold and warm replay: two distinct mesh entries, one shared compute entry, two pipelines made, zero failures.
cargo test --offline --locked -j 4 -p xcl --lib depth_bounds -- --nocapture --test-threads=1: 4 passed, 0 failed, 0 ignored, 0 skips on the candidate.The full
cargo test --workspace --offline --locked --no-fail-fast -j 4 -- --test-threads=4 --show-outputwas also run on both revisions with isolated writable DXIL caches. Unchanged PR head: 1,841 passed, 9 failed, 48 ignored, 26 GPU skip notices. Local candidate: 1,843 passed, 9 failed, 48 ignored, 26 GPU skip notices. The same seven distinct test names account for the nine failures on both; the two added depth-bounds tests pass. Thus this check does not establish a green workspace suite for either revision.The following
xcl-smokeblocks came fromscripts/smoke.ps1on clean release builds ofmain, the exact PR head, and the local candidate. Each used the same anonymous title, adapter, 60-second duration,XCL_PREPARE=0, and a separate writable DXIL cache. These runs covered startup without menu input; they did not exercise world load or visually validate depth-bounds rendering. The candidate block cannot serve as this PR's required head block unless the change is adopted, pushed, and rerun on that new clean head.Generated smoke blocks
main:PR head:
Local candidate:
The bounded correction forwards
depth_boundsintotranslated_gs_pso, emitsDEPTH_STENCIL1when enabled, and preserves the oldDEPTH_STENCILsubobject otherwise. Its unit regression checks the subobject and distinct native cache keys; the worker regression checks the GPU compilation and cold/warm reuse. The earlier comment has the core candidate diff. I can share the new test diff if useful. AI use: Codex (GPT-6.2 Sol) integrated and ran the correction and checks; Codex (GPT-6.2 Astra) built and ran the synthetic GPU replay.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.