Repository navigation
Conversation
…n timer - crates/xcl/src/shaders.rs — add in-memory program/HLSL deduplication, persistent precompile-index-v1 warm-cache record fast-skip with atomic flushing, XCL_DIRECT_DXIL=all VS/PS support in precompile(), and RAII 2 GB memory reserve - crates/xcl/src/gpu/recomp/dxc.rs — add existing_cache_keys single-read_dir scan, cache_key_for, thread-local IDxcUtils reuse, canonicalized cache path caching, zero-syscall cache dir write, and swap-returning set_memory_reserve - crates/xcl/src/hle/d3d12x/present/preparation.rs — show real Elapsed time, throughput (records/s) and ETA on the preparation screen, and only show 'No shader progress for N s' when quiet >= 5s Tests: Windows 11 RTX 5080 cargo test -p xcl --lib dxc (45 pass), preparation (5 pass), shaders (17 pass); 300-record cold XCL_DIRECT_DXIL=all 18.57s -> 12.68s (-31.7%)
|
Reproduced a false warm-cache hit on exact clean head
Every run exited 0 with zero reported shader errors. |
|
Follow-up with a tested fix on top of Warm-cache timing added: on the same Windows machine, offline I added an end-to-end test using the existing synthetic pixel shader fixture. It checks a cold compile, a valid warm hit, then overwrites the cached DXIL with zeros without changing its length. The test fails on the original head ( |
|
I reproduced a valid-file warm-index mismatch on Including the existing A local candidate scopes the index by translator source identity and the effective safe-barrier setting, and reuses the existing conservative cache policy for other diagnostic overrides. It leaves runtime shader-cache eligibility unchanged. A standalone synthetic regression passed 19 CLI invocations across two independently built emitter revisions, including unset versus explicit AI use: OpenAI Codex with GPT-6.2 Astra constructed the probes, tested the candidate and independently reviewed it; Codex coordinated and prepared this report. |
|
@ettehn Thanks for catching and reproducing this! Pushed
|
|
I retested the valid-file index cases from my earlier comment on updated head
All 11 fresh-process checks exited successfully. This shows preparation can skip the newly selected cache key; it does not establish a rendered-pixel error or GTA VI loading impact. AI use: OpenAI Codex with GPT-6.2 Astra ran the checks; Codex coordinated and prepared this follow-up. |
|
@andrewDoing Thank you for catching that! That cross-build and option-scoping bug is fixed in
|
|
A separate synthetic concurrency check on current head Both DXIL files from every concurrent pair were byte-identical to the sequential controls. A serial revisit restored the two index entries with one cached shader and zero compiles per run. The demonstrated effect is a lost index shortcut, not lost DXIL or demonstrated extra DXC compilation. Retail timing remains unmeasured. The experiment used two repository-derived synthetic pixel shaders and separate temporary caches per trial. In the current implementation each process loads an index snapshot and later saves its full updated snapshot to the shared path. AI use: OpenAI Codex with GPT-6.2 Astra built and ran the synthetic checks; Codex coordinated and prepared this follow-up. |
|
Retested the valid-file cases from my earlier reports on updated head The concurrent-writer case in my other comment is separate. On this head 3/3 concurrent pairs still retained only one of two index records; both DXIL files remained intact, and serial recovery recompiled neither shader. AI use: OpenAI Codex with GPT-6.2 Astra ran the checks; Codex coordinated and prepared this follow-up. |
|
Follow-up to my concurrent-index report: I tested a local Windows candidate on All three concurrent two-process trials retained both index entries and produced DXIL byte-identical to the sequential control. A focused Rust serialization/merge regression passed. In separate controls, a held lock, a handle denying replacement, and an inaccessible sidecar each left the previous index intact; preparation still completed and a later run recovered both entries. The lock attempt is best-effort and timed out after about 250 ms in the held-lock test. A separate process-death test confirmed the OS releases the lock when its owner exits. This addresses the index shortcut only. It does not establish a retail timing benefit, and power-loss durability was not tested. AI use: OpenAI Codex with GPT-6.2 Astra implemented and independently reviewed the candidate and ran the synthetic tests; Codex coordinated and prepared this follow-up. |
|
@andrewDoing Thank you again for isolating the concurrent-writer race and testing that approach! Pushed
|
|
Retested the concurrent-writer case from my earlier comment on updated head One test-oracle suggestion: checking only that subsequent serial runs report In a separate Windows sharing-violation control, the prior index remained intact and both DXIL outputs were retained. This is synthetic cache evidence, not a retail timing measurement. AI use: OpenAI Codex with GPT-6.2 Astra ran the controls and independently reviewed the test oracle; Codex coordinated and prepared this follow-up. |
|
One Windows path regression in Replacing only the raw Win32 call with Concurrent long-path check. I tested ten fresh pairs of independent writer processes per variant. One process used an ordinary absolute path (314–315 characters) and the other used the canonical extended-length spelling of the same index. Both spellings contended on the same mutex. On OpenAI Codex (6.2sol) assisted with verification. Originally posted by @ettehn in #2928 (comment) |
|
I reproduced @ettehn’s Windows long-path finding through
All three processes exited successfully and reported zero shader errors. The long-path run preserved the compiled shader but silently missed the index write. The extended-path revisit shows why the CLI summary alone cannot verify index persistence. This test covered the existing PR head. @ettehn’s proposed replacement was tested separately in the index harness. AI use: OpenAI Codex with GPT-6.2 Astra ran the CLI checks; Codex coordinated and prepared this follow-up. |
… index directly in E2E
|
@ettehn @andrewDoing Thank you both for the follow-up verification and catching these! Pushed 1. Long-path index replacement (
|
|
On head I used the unmodified In 3/3 trials, B's preparation succeeded with zero reported errors. A's record hash The save path currently treats every index read error as an empty map. For publication, treating only AI use: OpenAI Codex with GPT-6.2 Astra adapted and ran the Windows probes, checked the independent reference, and drafted this report. |
|
Retested the long-path and concurrent-writer cases on updated head This confirms the tested long-path and normal concurrent-writer fixes; the forced read-failure case in my separate follow-up remains distinct. No retail title or timing was tested. AI use: OpenAI Codex with GPT-6.2 Astra ran the synthetic CLI checks; Codex coordinated and prepared this follow-up. |
|
Follow-up to the forced index-read failure on In 3/3 Windows byte-range-denial trials, shader B still compiled while the existing A index remained byte-identical. After the lock was released, a B revisit produced both exact reference records. In 3/3 normal concurrent-writer pairs, both records were present immediately and both DXIL files matched the sequential controls. This is synthetic cache testing; retail performance and power-loss durability remain unmeasured. AI use: OpenAI Codex with GPT-6.2 Astra implemented and tested the local candidate; Codex coordinated and prepared this follow-up. |
|
I measured one remaining warm-index cost on
All runs reported OpenAI Codex assisted with the local patch and verification. |
Speeds up offline/startup shader precompilation, eliminates warm-cache re-work, fixes the preparation progress timer, and validates warm-index DXIL containers before skipping.
What is in it
crates/xcl/src/shaders.rs:recomp::translatecalls (seen_programs) and repeated HLSL compiles/disk checks (seen_hlsl_jobs, e.g. shared mesh passthrough shaders) insideprecompile().precompile-index-v1-<scope>.bin) that validates only its referenced.dxilentries viarecomp::dxc::validated_cache_keys, skippingxbox::parse+ translation on valid hits while automatically recompiling corrupt/missing entries.XCL_DIRECT_DXIL=allfor standaloneVertex/Pixelshaders inprecompile()viapso::console_to_dxil_in, matching runtime behavior.dxc::set_memory_reserve(2)duringprecompile()so both CLI and pre-entry launch preparation benefit cleanly and restore the prior reserve on exit.crates/xcl/src/gpu/recomp/dxc.rs:validated_cache_keys(reusingcached_file/valid_dxil_containerwithout scanning unrelated files),cache_key_for,pub fn toolchain_identity(), thread-localIDxcUtilsreuse incompile_linked(), bounded canonical-path caching innormalized_cache_dir, and zero-syscall directory creation on hot write paths.crates/xcl/src/hle/d3d12x/present/preparation.rs:"No shader progress for 0 s"text with realElapsed, throughput (records/s), andETA, surfacing"No shader progress for N s"only whenquiet >= 5.crates/xcl/tests/shaders_e2e.rs:shaders_precompile_recovers_corrupt_same_length_cached_dxilverifying recovery when a cached.dxilis overwritten with same-length zero bytes while a warm index is present.Tested
32.0.16.2124/621.24), AMD Ryzen 7 5700X (8C/16T),rustc 1.91.1 (ed61e7d7e 2025-11-07), DXC/DXIL1.8.2502.11, debug tests & release build (--locked).cargo test -p xcl --lib dxc -- --test-threads=4: 45 passed, 0 failed, 3 ignored (dump_dxc_lowering,blob_dxc_cost,dxc_time_levels)cargo test -p xcl --lib preparation -- --test-threads=4: 5 passed, 0 failed, 0 ignoredcargo test -p xcl --lib shaders -- --test-threads=4: 17 passed, 0 failed, 0 ignoredcargo test -p xcl --test shaders_e2e -- --test-threads=4: 9 passed, 0 failed, 0 ignored (includesshaders_precompile_recovers_corrupt_same_length_cached_dxil)--precompile --limit 300, NVMe SSD):18.33 s(main) ->15.40 s(6c1a9ffwarm-index + container validation).dxil/ 9.3 MB):15.24 s(main) ->0.63 smedian (0.677 / 0.631 / 0.632 s)XCL_DIRECT_DXIL=all:18.57 s -> 12.68 s(-31.7%)--precompile --limit 1500, 2,711 hits across 2,988.dxil/ 242.5 MB on HDD):110.79 s(main) ->4.01 scold OS page cache /0.72 s(0.722 / 0.714 s) warm OS page cache (compiled 0, already cached 2711, errors 0).Regression run
main (
af2cecc408) and pre-cache runs timed out at 120s startup timeout while compiling the 26,503-shader pack on cold cache (XCL printed no log pathbefore entering the guest). Fullscripts/smoke.ps1run pending cold shader cache completion (ortest-onlylabel).Not tested
cargo test --workspace -- --test-threads=4(only targeteddxc,preparation,shaders, andshaders_e2esuites were run).AI use