Skip to content

Shaders: warm runtime-selected graphics DXIL variants in --precompile - #2613

Open
Decodere wants to merge 1 commit into
xcl-dev:mainfrom
Decodere:fix-precompile-runtime-graphics-variants-2600
Open

Decodere wants to merge 1 commit into
xcl-dev:mainfrom
Decodere:fix-precompile-runtime-graphics-variants-2600

Conversation

@Decodere

@Decodere Decodere commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Routes console vertex (hw == 4) and pixel (hw == 5) FSSM variants in xcl shaders --precompile through recomp::pso::console_to_dxil_in_outcome, warming the exact translated/v2 runtime cache variants (including XCL_DIRECT_DXIL=all direct graphics variants), distinguishing cache hits from fresh compiles, preserving exact incomplete-translation skip semantics for both standalone --precompile and hosted prepare_for_launch (#2555), and explicitly reporting standalone PS sampler_base=0 coverage alongside static-sampler shift counts. Part of #2600, Part of #2508, Part of #1833.

What is in it

  • crates/xcl/src/gpu/recomp/pso.rs:
    • Adds console_to_dxil_in_status(blob, stage, sampler_base, split_wave64, windows) -> Result<(Compiled, bool), String> (with console_to_dxil_in delegating to it) returning whether the result came from the in-memory or translated/v2 disk cache (true) vs fresh translation/compilation (false).
    • Adds shared INCOMPLETE_TRANSLATION_PREFIX (used across console_translation, finish_two_pass, and compile_console_mesh), typed CompileOutcome::{Compiled, Incomplete, Failed}, and console_to_dxil_in_outcome(...) so both cold translations and .err-cached lookups distinguish incomplete translations (!Translation::complete()) from hard parse/interface/DXC failures.
  • crates/xcl/src/shaders.rs (precompile):
    • Warms at most one runtime Stage::Vertex (hw == 4) and one runtime Stage::Pixel (hw == 5) FSSM variant per container via recomp::pso::console_to_dxil_in_outcome(&blob, stage, 0, graphics_split, windows) (and uses console_to_dxil_in_status for compute), incrementing cached on cache hits and compiled only on fresh compiles.
    • On CompileOutcome::Incomplete(_), falls through to the existing per-program recomp::translate loop (keeping Mode::Vertex / Mode::Pixel arms and graphics_split selection intact) so both standalone --precompile and hosted prepare_for_launch (when merged with xcl run: prepare shaders in the game window before title execution #2555 8b957bec) preserve exact skip behavior (0 errors, 1 skip on startup) without aborting launch on unsupported shaders (addressing @CryingLaughing's report).
    • Tracks ps_base0, ps_static_samplers, and vs_static_samplers from Compiled.samplers and prints an explicit runtime-path coverage summary line when standalone PS or static-sampler VS records are warmed.
  • crates/xcl/tests/shaders_e2e.rs:
    • Updates xbox_shader_with_osg for #1942's shared container helper.
    • Keeps fresh-process end-to-end tests precompile_warms_direct_vs_ps_and_hits_in_fresh_process (XCL_DIRECT_DXIL=all) and precompile_warms_hlsl_static_samplers_and_reports_base_shift (XCL_DIRECT_DXIL=0) and adds precompile_skips_incomplete_vs_while_warming_supported_vs verifying cold + warm .err-cached --precompile skips an unsupported v_cvt_off_f32_i4 VS (0 errors) while warming a supported VS (compiled 1 -> 0, already cached 0 -> 1) and confirming CompileOutcome::Incomplete + zero-DXC cache hit in a fresh process.

Tested

  • hardware (GPU + driver, CPU), Rust version, debug / release: Windows 11 Home (build 26200), NVIDIA GeForce RTX 4060 8 GB (driver 621.14, 32-lane waves), Intel Core i5-11400F (6C/12T), 32 GB RAM, rustc 1.100.0, DXC 1.9.2609.5, debug + release.
  • cargo clippy --all-targets -- -A clippy::approx_constant: 0 new warnings or errors across all 3 modified files (pso.rs, shaders.rs, shaders_e2e.rs).
  • Debug WARP (XCL_ADAPTER=warp, XCL_WARP=1):
    • cargo test -p xcl --lib -- shaders:: --test-threads=4 --nocapture: 10 passed, 0 failed, 0 ignored
    • cargo test -p xcl --test shaders_e2e -- --test-threads=1 --nocapture: 11 passed, 0 failed, 0 ignored
    • cargo test -p xcl --lib -- gpu::recomp::pso:: --test-threads=4 --nocapture: 27 passed, 0 failed, 1 ignored
  • Release RTX 4060:
    • cargo test --release -p xcl --lib -- shaders:: --test-threads=4 --nocapture: 10 passed, 0 failed, 0 ignored
    • cargo test --release -p xcl --test shaders_e2e -- --test-threads=1 --nocapture: 11 passed, 0 failed, 0 ignored (fresh_child_timing: mode=direct warm_translate_dxc_ms=3.501 native_pso_ms=1.228; mode=hlsl warm_translate_dxc_ms=3.064 native_pso_ms=0.815)
    • cargo test --release -p xcl --lib -- gpu::recomp::pso:: --test-threads=4 --nocapture: 27 passed, 0 failed, 1 ignored
    • cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1445 passed, 0 failed, 47 ignored across 38 top-level workspace targets (SKIPPED GPU/host tests: wave64-only GPU tests on 32-lane RTX 4060, 3 per-lane wave32 refused subcases, 3 debug-layer tests without d3d12SDKLayers.dll, heap_window_out_of_memory_falls_back_to_the_switch_form without XCL_HEAP_WINDOWS=1, and pso_measurement_compiles_an_exact_synthetic_record without Windows Developer Mode; 0 skipped in shaders_e2e).
  • Live 3-way merge check against origin/main (8b957bec, including #2555 startup preparation): git merge-tree --write-tree origin/main HEAD exits 0; in a temporary detached merge 8b957bec + d68c74e5, a synthetic prepare_for_launch test (supported VS + unsupported v_cvt_off_f32_i4 VS under XCL_DIRECT_DXIL=all, XCL_UMA_WINDOWS=4, WARP adapter) passed both cold (compiled 1, already cached 0, errors 0, skipped (runtime pairing or unsupported translation) 1) and warm .err-cached (compiled 0, already cached 1, errors 0, skipped (runtime pairing or unsupported translation) 1) runs returning Ok(()).

Regression run

main (e120925e3abc9956a8b9bae631969d32e8ccd43c, exact parent and ancestor of origin/main 8b957bec):

xcl-smoke v1
commit: e120925e3abc9956a8b9bae631969d32e8ccd43c
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1608 (PresentX 1608)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14006 MB

PR:

xcl-smoke v1
commit: d68c74e55cf5837d7fee81f8eee52472d91dd9b6
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1555 (PresentX 1555)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14016 MB

Not tested

  • 64-lane AMD hardware (wave64 GPU tests skipped on 32-lane RTX 4060), D3D12 debug-layer tests (d3d12SDKLayers.dll not installed on host), XCL_HEAP_WINDOWS=1, and pso_measurement_compiles_an_exact_synthetic_record (Windows Developer Mode disabled).
  • Full 26,503-record retail shader archive cold --precompile / #2555 prepare_for_launch run (covered via isolated synthetic console VS/PS containers in shaders_e2e and the temporary 8b957bec + d68c74e5 prepare_for_launch check).
  • The 47 #[ignore] tests.

AI use

  • Google Antigravity (Gemini 4 Neon) implemented console_to_dxil_in_status, CompileOutcome / console_to_dxil_in_outcome, the precompile runtime graphics warming, incomplete-translation fallthrough, cache-hit accounting, and coverage reporting, plus the fresh-process direct, HLSL static-sampler, and incomplete-VS tests, ran all clippy, WARP, RTX 4060, workspace, 8b957bec merge prepare_for_launch, and paired 60 s smoke verifications, and drafted this PR description.

@DarkPanda69

DarkPanda69 commented Nov 26, 2026 •

Copy link
Copy Markdown

Update for head d68c74e: same result. The diff no longer applies as a patch on main 8b957be, so I merged the branch into it (shaders.rs auto-merged, no conflicts). shaders_e2e gives 11 passed, 0 failed, no SKIPPED, on both the RX 9070 XT and the RTX 3060. shaders:: gives 10 passed, 0 failed on both, with the same 1 SKIPPED as before.

Update for head 2d229b9: rerun on main b49be18, same cards and --nocapture. shaders_e2e gives 10 passed, 0 failed, no SKIPPED, on both the RX 9070 XT and the RTX 3060. shaders:: gives 10 passed, 0 failed on both, with the same 1 SKIPPED as main (pso_measurement_compiles_an_exact_synthetic_record).

64-lane AMD run (listed as untested) on an RX 9070 XT, plus an RTX 3060: both new end-to-end tests pass on both cards, with no skips.

Head a3312c0 applied on main b49be18, debug, Windows 11 Pro 26200, card chosen with XCL_ADAPTER:

  • cargo test -p xcl --test shaders_e2e -- --nocapture: 10 passed, 0 failed, no SKIPPED on both cards, with precompile_warms_direct_vs_ps_and_hits_in_fresh_process and precompile_warms_hlsl_static_samplers_and_reports_base_shift among them.
  • cargo test -p xcl --lib -- shaders::: 10 passed, 0 failed on both cards. 1 SKIPPED, the same on main: pso_measurement_compiles_an_exact_synthetic_record (cannot disable the driver cache).

Not tested: the D3D12 debug-layer tests (no d3d12SDKLayers.dll here either), a retail pack, Intel.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

@luckyteagirl

Copy link
Copy Markdown
Contributor

Tested — AMD Radeon RX 6800M

  • Exact PR head: a3312c055cf3a31f77bcb7b1e278b7479d29dc41 (clean detached worktree). Windows 11 Home 10.0.26200, Ryzen 9 5980HX, RX 6800M driver 30.0.13002.13003, rustc 1.99.0, DXC 1.9.2609.5, debug build.
  • Set XCL_ADAPTER=6800M, XCL_REQUIRE_GPU=1, and XCL_DXC_DIR to the local DXC 1.9.2609 x64 directory. Ran cargo test --locked -p xcl --test shaders_e2e -j 1 precompile_warms_ -- --test-threads=1 --nocapture in an isolated target directory under a memory guard: 2 passed, 0 failed, 0 ignored, 8 filtered; no SKIPPED lines; guard did not trigger.
  • Direct VS+PS fresh-process cache hit: warm_translate_dxc_ms=5.452, native_pso_ms=5.909.
  • HLSL static-sampler/base-shift fresh-process case: warm_translate_dxc_ms=4.994, native_pso_ms=18.077.

The child tests assert warm translated/v2 hits and zero DXC compiles on those hits. The numeric native PSO timings show that both cases reached CreateGraphicsPipelineState. The child inherits XCL_ADAPTER=6800M; this machine's matching hardware adapter is the RX 6800M. The helper only falls back to WARP when no adapter matches, so this is RX 6800M native-driver evidence rather than a pass inferred from the outer test status alone.

Not tested: full workspace suite on this head, release profile, a retail shader archive or paired title smoke, other GPUs, and whether the changed path improves title behavior. Timings are single samples, not a performance comparison.

AI use: OpenAI Codex (GPT-6; exact serving variant unavailable) and a Luna subagent selected the focused test, ran it, checked the exact-head log and adapter-selection code, and drafted this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

Thanks!

— Devin

@luckyteagirl luckyteagirl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The new VS/PS path increments compiled after every successful console_to_dxil_in, including a hit from its in-memory or translated disk cache. That function returns only Compiled, so a second --precompile run can report compiled 2, already cached 0 for graphics variants even when both came from the cache. The HLSL loop below distinguishes hits. Could the graphics path expose/count the cache outcome (or use a separate warmed counter) and add a warm second-run assertion for the summary? Source review at a3312c055cf3a31f77bcb7b1e278b7479d29dc41; I did not run the precompile command. AI-assisted review with Codex.

@SzczepanGrela

SzczepanGrela commented Nov 26, 2026 •

Copy link
Copy Markdown

Updated RX 9070 / Wine verification for head d68c74e55cf5837d7fee81f8eee52472d91dd9b6, current main 8b957bec6f82495aec940944c6bf47faa02db590, and their automatic three-way integration using merge base e120925e3abc9956a8b9bae631969d32e8ccd43c. The integrated preparation preserved the unsupported-VS skip while warming the supported runtime variant in both direct and HLSL modes.

Tested

RX 9070 (RADV GFX1201), Mesa 26.3.1-arch3.5, Ryzen 7 7700, CachyOS kernel 7.3.0-5-cachyos, GE-Proton11-12 / Wine 11.0 Staging, native d3d12/d3d12core/dxgi, vkd3d-proton 8293130ebe370b1+ (local asserts-disabled build), DXC 1.9.2602.17, Rust 1.97.1, release x86_64-pc-windows-gnu.

Built each source copy with cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --test shaders_e2e --lib --no-run. Ran the resulting executables through Wine with --nocapture --test-threads=1 and --nocapture --test-threads=4, selecting shaders::tests:: for the unit target. Upstream tests and assertions were unchanged. The only added fixture, on main and the integration, was an append-only #[cfg(test)] caller of prepare_for_launch.

Source shaders_e2e, threads 1 shaders_e2e, threads 4 shaders::tests::, each thread mode
main 8 passed, 0 failed 8 passed, 0 failed 6 passed, 1 failed
exact PR head 11 passed, 0 failed 11 passed, 0 failed 6 passed, 1 failed
integration 11 passed, 0 failed 11 passed, 0 failed 6 passed, 1 failed

All counts have 0 ignored. The unit failure on all three sources was pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache ... Not implemented. (0x80004001), but XCL_REQUIRE_GPU=wave64. This is retained as a failure, not counted as GPU coverage. The six unit passes include retail_pack_sample returning early because XCL_SAMPLE_RPF was unset, one skip message per unit invocation. No retail data was loaded.

Both graphics fresh-process cases passed their cold compiled 2, already cached 0, errors 0, warm compiled 0, already cached 2, errors 0, translated-cache and zero-DXC assertions. The HLSL case also checked the separate PS(base=1) variant. Eight native graphics PSO creations completed across exact-head/integration and the two thread modes, with numeric native-PSO markers and no capability skips. The new incomplete-VS end-to-end case passed in all four PR/integration invocations.

The additional preparation check used one supported VS and one v_cvt_off_f32_i4 VS, with XCL_DIRECT_DXIL=all and 0, XCL_UMA_WINDOWS=4, XCL_HEAP_WINDOWS=0, and the device-selected graphics split form (true). Each source/backend had separate cold, warm and fresh cached-only probe processes, 12 processes total:

  • Both main and integration returned Ok(()), progress 2/2, errors 0, and skipped (runtime pairing or unsupported translation) 1. Cold reported compiled 1, already cached 0; warm reported compiled 0, already cached 1.
  • Before the probe, the integration already had a supported translated/v2 .bin and an incomplete-translation .err. Fresh-process probes reused both without DXC compilation, and cold/warm/probe cache snapshots stayed byte-identical.
  • Main had only the DXC cache after preparation. Its direct cached-only probe missed. Its HLSL probe succeeded using that DXC cache, with zero DXC compiles, and created the translated entry during the probe. Thus the HLSL result is not evidence that main cannot reuse earlier DXC work.
  • Original synthetic shader files remained byte-identical. No unexpected harness failure, device removal, or capability skip occurred in the end-to-end or preparation checks.

An initial local probe incorrectly expected the HLSL main control to miss. I corrected that local expectation after checking the DXC and translated-cache paths, retained its logs, rebuilt the affected test binaries, and repeated the complete 24-invocation comparison above. Source, executable and cache hashes and raw counts were checked separately.

Environment: XCL_ADAPTER=AMD Radeon RX 9070, XCL_REQUIRE_GPU=wave64, XCL_NETWORK=0, XCL_DXC_THREADS=1, native DLL overrides, and private enabled application/driver cache directories.

Not tested

Full workspace suite, guest entry or hosted xcl run, retail archives, smoke runs, shader execution/rendered-image correctness, forced hard-error paths, native Windows, other GPUs, or performance/FPS. The preparation fixture called the preparation function directly. No title-level regression claim.

AI use

OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the changes, prepared the local fixture, built and ran the comparisons, independently checked source bytes, raw logs and cache snapshots, and wrote this update. Publication authorized by the account owner.

@Decodere
Decodere force-pushed the fix-precompile-runtime-graphics-variants-2600 branch from a3312c0 to 2d229b9 Compare November 26, 2026 06:43
@Decodere

Copy link
Copy Markdown
Contributor Author

Thanks @luckyteagirl and @SzczepanGrela — pushed 2d229b9f addressing both review items:

  1. Cache-hit accounting (@luckyteagirl): added recomp::pso::console_to_dxil_in_status returning (Compiled, bool) (from_cache) and wired it into shaders.rs::precompile (CS, VS, and PS) so in-memory and translated/v2 hits increment already cached instead of compiled. Both shaders_e2e tests now verify cold compiled 2, already cached 0, errors 0 followed by a warm second --precompile run reporting compiled 0, already cached 2, errors 0.
  2. Native PSO error handling (@SzczepanGrela): changed time_native_graphics_pso to return Result<Option<f64>, String> so root-signature and CreateGraphicsPipelineState failures fail the test with the exact error / HRESULT once a D3D12 device is created, while genuine no-device environments route through runner::skip_test("no D3D12 device").
  3. Re-verified release WARP & RTX 4060 shaders_e2e (10/0/0, 0 skipped), full release workspace (1437/0/47), and paired 60 s RTX 4060 smoke (1546 frames, 60 60 60, 0 removals/crashes).

@KDenKC

KDenKC commented Nov 26, 2026 •

Copy link
Copy Markdown

Correction (see 7193409689 below): the cleaner control, main with its own full --precompile (graphics included), also has almost no gap: median 23 ms, max 129 ms over 38 large pipelines. So most of the 4,024 ms → 6 ms below comes from precompiling graphics at all, not from this PR alone. This PR's own share in this measure is about 23 → 6 ms median (129 → 8 ms max).

Retail title, RTX 5090: the large graphics pipelines now start their driver compile within milliseconds instead of seconds. One 600 s run per side. Our control's precompile was compute-only (see Not tested).

Setup: RTX 5090 32 GB (driver 621.24), Ryzen 7 9800X3D, Windows 11, release, XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_PSO_TRACE=1 XCL_NETWORK=0.

  • PR side: main b49be18 + this PR at a3312c05 + Shaders: --precompile --pipelines also builds a split program's whole form #2551 (3567b2e). 2d229b9f differs only in the counters and tests. xcl shaders <pack> --precompile --used-only --pipelines (graphics included) took 42.3 min: 26,503 shaders, 0 errors; PS warmed at assumed sampler_base=0: 12101 (5765 with static samplers); VS with static samplers shifting paired PS base: 173; 2,812 pipelines, 0 refused.
  • Control: main b49be18, precompiled with --only cs.
  • Both: a 200 s warm-up, then 600 s on a copy of the warmed cache.

Large graphics pipelines (≥ 200 KB DXIL) in the world-start stall (no frames shown). Gap = time from the previous driver compile finishing to this one starting, from the driver compile start/finish trace lines:

control this PR
pipelines 31 34
median gap 4,024 ms 6 ms
longest gap 7,144 ms 8 ms

The rest of the stall is the NVIDIA driver's own compile, which this PR does not change. Run-wide graphics compiles with no driver blob: 1,328 taking 106.7 s on the control, 1,447 taking 131.1 s here.

Run totals: both reached 600 s with no removal or crash. Frames shown: 2,163 (control) vs 2,117. Two-second windows with no frame after 120 s: 206 vs 215 of 240. These totals are not a fair A/B, for two reasons:

  • The PR side hit about 100 s more of cold huge compute pipelines (314 s vs 214 s). --used-only came from a 200 s run that never reached them.
  • The control's exe had a warmer NVIDIA shader cache from earlier runs under the same name.

Not tested

  • main with its own full --precompile (graphics included) as the control. That is the cleaner A/B for this PR, and we can run it if useful.
  • A pair with identical NVIDIA cache warmth and full compute coverage.
  • 2d229b9f itself (only its diff against a3312c05 was read).
  • AMD, Intel, Linux.
  • Shifted sampler_base > 0 pixel shader paths.

AI use: Claude Code (Claude Opus 5.5) built and ran both sides. Gemini (Antigravity) extracted the trace numbers. Claude Code recomputed the gap table from the raw logs and wrote this.

@DavidM1911

Copy link
Copy Markdown
Contributor

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

@Aniseto

Aniseto commented Nov 26, 2026

Copy link
Copy Markdown

Ran the shaders end-to-end tests at 2d229b9:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

XCL_ADAPTER=nvidia cargo test -p xcl --test shaders_e2e -- --nocapture
10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out      (exit 0)

Both new fresh-process tests pass here. The timings printed on this adapter were warm_translate_dxc_ms=3.738 native_pso_ms=12.321 (direct VS+PS) and warm_translate_dxc_ms=3.191 native_pso_ms=21.054 (HLSL static-sampler VS+PS). They are single runs, not a benchmark.

What this adds: the hardware reports in the thread are on an RTX 4060 (Ada) and WARP, at the earlier head a3312c0. This is a Blackwell wave32 part at the current head 2d229b9, which addressed the review findings.

Not tested: a full retail shader archive, a paired 60 s smoke run, the whole workspace suite, AMD and Intel GPUs, native wave64, Wine, release profile, title data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 26, 2026
bmjask pushed a commit to bmjask/xcl that referenced this pull request Nov 26, 2026
Route standalone VS and PS variants through the exact runtime console_to_dxil_in path so precompile warms translated/v2 serialization and the selected HLSL/direct-DXIL backend instead of only manually warming HLSL output.

Selection matches the runtime's first hardware VS/PS FSSM and exact stage, split, windows, and base-zero keys. Paired PS variants with nonzero VS sampler bases remain cold because the shader archive has no pipeline pairing data.

GNU Windows-target cargo check passed. Fresh-cache Windows probes, GPU execution, and retail smoke were not available on this host.

Adapted from PR xcl-dev#2613.
Assisted-by: Codex (GPT-5.6-sol)
@KDenKC

KDenKC commented Nov 26, 2026

Copy link
Copy Markdown

Correction to 7186156070, with the cleaner control I offered there. main b49be18 with its own full --precompile --used-only --pipelines (graphics included, 42 min, 0 errors), the same recipe otherwise (200 s warm-up, then 600 s):

large graphics pipelines (≥ 200 KB) in the world-start stall control: main, compute-only precompile main, full precompile this PR + #2551, full precompile
count 31 38 34
median gap before the driver compile 4,024 ms 23 ms 6 ms
longest gap 7,144 ms 129 ms 8 ms

So the large drop in my earlier comment comes mostly from precompiling graphics at all, which main already does. In this measure, this PR takes it from ~23 ms to ~6 ms median (129 to 8 ms worst). I've put a note at the top of the earlier comment.

The full-precompile main run used an exe name with a warmer NVIDIA cache. The gap is XCL-side, so that shouldn't move it, but I'm noting it. That run ended with the #2403 removal at 577 s.

AI use: Claude Code (Claude Opus 5.5) ran the control, recomputed the gaps from the trace lines and wrote this.

@Prime1997 Prime1997 mentioned this pull request Nov 26, 2026
bmjask pushed a commit to bmjask/xcl that referenced this pull request Nov 26, 2026
Route standalone VS and PS variants through the exact runtime console_to_dxil_in path so precompile warms translated/v2 serialization and the selected HLSL/direct-DXIL backend instead of only manually warming HLSL output.

Selection matches the runtime's first hardware VS/PS FSSM and exact stage, split, windows, and base-zero keys. Paired PS variants with nonzero VS sampler bases remain cold because the shader archive has no pipeline pairing data.

GNU Windows-target cargo check passed. Fresh-cache Windows probes, GPU execution, and retail smoke were not available on this host.

Adapted from PR xcl-dev#2613.
Assisted-by: Codex (GPT-5.6-sol)
@CryingLaughing

Copy link
Copy Markdown

Hosted xcl run verification on current main after #2555. The supported vertex shader warmed correctly. An unsupported loose vertex shader also exposed a startup regression.

Five launches compared clean main 8b957bec6f82495aec940944c6bf47faa02db590 with its unmodified Git three-way merge with PR head 2d229b9f76b605edffed09419328dc2245b97e8a (tree 7a620e2bf3335ace3a34de65826b4c964985ad8b). RTX 4080 driver 621.01, Core i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 x64 MSVC, DXC 1.8.2502.11, debug. Each used the same synthetic guest, isolated caches, and xcl run <fixture> -- --pr2600-vs-only with XCL_DIRECT_DXIL=all XCL_ADAPTER=4080 XCL_ASYNC_PSO=0 XCL_PSO_DISK_CACHE=0 XCL_HEAP_WINDOWS=0 XCL_UMA_WINDOWS=4.

  • All three launches with the supported VS created a native translated graphics PSO and exited 0. On main, startup wrote one HLSL cache entry and the guest translated the VS when it created the PSO. The integrated tree wrote the byte-identical 2,584-byte direct cache entry 24acc6835ffb0a75_Vertex_0_4_1.bin before the guest ran. A fresh integrated process with only that cache entry and no loose shaders created the same PSO, retained the entry byte for byte, and emitted no targeted direct compile dump or fallback.
  • In the other two launches, the loose 400-byte VS had one decoded v_cvt_off_f32_i4, and the guest still requested the separate supported VS. Main reported 0 errors, 1 skip, ran the guest to its PSO marker, and exited 0. The integrated build reported 1 error, 0 skips, logged incomplete translation, missing: ["v_cvt_off_f32_i4"], and exited 2 before guest entry.
  • The four launches that ran preparation added the same two empty NVIDIA driver-log directories in the synthetic folder on both builds. The outer folder-equality guard reported that difference. All original fixture files stayed byte-identical. The fresh cache-only replay passed the folder guard.

Could the hosted path preserve the old skip behavior for incomplete translations? Routing that case through the existing per-program handling would keep the successful cache warmup and let launch proceed past an unused unsupported shader.

@CryingLaughing

Copy link
Copy Markdown

I tested a follow-up for the hosted startup failure reported above. When the runtime path refuses a graphics shader during xcl run preparation, that stage now falls back to the existing per-program preparation, which handles incomplete translations as skips. Successful cache warming still uses the runtime path. Production patch · Verified review branch

The review branch retains current main 8b957bec6f82495aec940944c6bf47faa02db590 and PR head 2d229b9f76b605edffed09419328dc2245b97e8a as the integration parents. On RTX 4080 driver 621.01, Windows 11 25H2 build 26200.9974, Core i5-13600K, Rust 1.100.0 x64 MSVC, DXC 1.8.2502.11, debug, all five controls completed as expected. The formerly fatal loose VS now reports 0 errors and 1 skip, and its guest exits 0. The supported VS still warms the exact 2,584-byte cache entry and a fresh synthetic guest reuses it with no direct recompile. Both offline controls keep the original unsupported-shader diagnostic and count, and exit 0.

The automatic integration had a stale dxbc_container test call after main moved the helper. The review branch changes that call separately. At combined tip 7b3a0fc8176b905cd0ce52c51bba877f3332cc29, the two focused cold/warm tests and all ten shaders_e2e tests passed with zero capability skips. Test-helper patch

Route console VS (hw == 4) and PS (hw == 5) FSSM variants in `xcl shaders
--precompile` through `recomp::pso::console_to_dxil_in_outcome` instead of
only the manual HLSL translate + compile_cached loop:

- Warms the `translated/v2` cache used at runtime for both direct graphics
  (`XCL_DIRECT_DXIL=all`) and HLSL graphics (`XCL_DIRECT_DXIL=0`), warming
  at most one runtime VS and one runtime PS variant per container while
  keeping ES/GS skipped counting and Mode::Mesh handling unchanged.
- Adds `recomp::pso::console_to_dxil_in_status` returning `(Compiled, bool)`
  and typed `recomp::pso::CompileOutcome` / `console_to_dxil_in_outcome`
  (sharing `INCOMPLETE_TRANSLATION_PREFIX` across both cold translations
  and `.err`-cached lookups) so `--precompile` increments `already cached`
  on in-memory or `translated/v2` disk cache hits and `compiled` only when
  translation or compilation actually runs. On `CompileOutcome::Incomplete`,
  falls through to the existing per-program `recomp::translate` loop (keeping
  `Mode::Vertex` / `Mode::Pixel` arms intact) so both standalone
  `--precompile` and hosted `prepare_for_launch` (xcl-dev#2555) preserve exact
  skip semantics without failing startup on unsupported shaders.
- Reports explicit standalone PS `sampler_base=0` coverage alongside counts
  of PS and VS records carrying static samplers (which shift paired PS bases
  at pipeline creation).
- Updates `crates/xcl/tests/shaders_e2e.rs` for `xcl-dev#1942`'s shared `container`
  helper and adds fresh-process end-to-end tests covering direct VS/PS
  warming, HLSL static-sampler `sampler_base=0` hit vs `sampler_base=1`
  miss, and incomplete VS (`v_cvt_off_f32_i4`) skip + supported VS warming
  across cold and warm `.err`-cached runs.

Part of xcl-dev#2600
Part of xcl-dev#2508
Part of xcl-dev#1833

Assisted-by: Google Antigravity (Gemini 4 Neon)
@Decodere

Copy link
Copy Markdown
Contributor Author

Thanks for catching that #2555 interaction and confirming the fallback shape — fixed in d68c74e5 (rebased onto e120925e, cleanly mergeable onto main 8b957bec):

  • Added CompileOutcome::{Compiled, Incomplete, Failed} and console_to_dxil_in_outcome in pso.rs (sharing INCOMPLETE_TRANSLATION_PREFIX across both cold translations and .err-cached hits).
  • In shaders.rs::precompile, CompileOutcome::Incomplete(_) now falls through to the existing per-program recomp::translate loop (keeping Mode::Vertex / Mode::Pixel arms and graphics_split intact) so standalone --precompile and hosted prepare_for_launch (#2555) both skip unsupported shaders with 0 errors.
  • Updated shaders_e2e.rs for #1942's container helper and added precompile_skips_incomplete_vs_while_warming_supported_vs (supported VS + v_cvt_off_f32_i4 unsupported VS, cold + warm .err-cached + fresh-process zero-DXC cache hit). Also verified in a live 3-way merge against 8b957bec that both cold and warm .err-cached prepare_for_launch runs return Ok(()) with 0 errors, 1 skip, alongside full release workspace (1445/0/47) and paired 60 s RTX 4060 smokes (e120925e vs d68c74e5).

bmjask pushed a commit to bmjask/xcl that referenced this pull request Nov 27, 2026
Route standalone VS and PS variants through the exact runtime console_to_dxil_in path so precompile warms translated/v2 serialization and the selected HLSL/direct-DXIL backend instead of only manually warming HLSL output.

Selection matches the runtime's first hardware VS/PS FSSM and exact stage, split, windows, and base-zero keys. Paired PS variants with nonzero VS sampler bases remain cold because the shader archive has no pipeline pairing data.

GNU Windows-target cargo check passed. Fresh-cache Windows probes, GPU execution, and retail smoke were not available on this host.

Adapted from PR xcl-dev#2613.
Assisted-by: Codex (GPT-5.6-sol)
bmjask pushed a commit to bmjask/xcl that referenced this pull request Nov 27, 2026
Route standalone VS and PS variants through the exact runtime console_to_dxil_in path so precompile warms translated/v2 serialization and the selected HLSL/direct-DXIL backend instead of only manually warming HLSL output.

Selection matches the runtime's first hardware VS/PS FSSM and exact stage, split, windows, and base-zero keys. Paired PS variants with nonzero VS sampler bases remain cold because the shader archive has no pipeline pairing data.

GNU Windows-target cargo check passed. Fresh-cache Windows probes, GPU execution, and retail smoke were not available on this host.

Adapted from PR xcl-dev#2613.
Assisted-by: Codex (GPT-5.6-sol)

Assisted-by: Codex (GPT-5.6-sol)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants