Recompiler: direct DXIL cache entries change when its sources do #1947
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!1947
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1947/head"
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?
@pvfreis on GitHub · 2026-11-24 23:47 UTC · original
pvfreis:dxil-cache-hash→main· +54 −4 · 3 files · 1 commits · merged 2026-11-25 01:05 UTCThe on-disk translated cache is keyed by the HLSL path's sources (
XCL_TRANSLATOR_SOURCE_ID), but ofgpu/dxilonly byTRANSLATOR_VERSION, which is bumped by hand. Unless something merged with it changes the HLSL path's sources, agpu/dxilchange that doesn't bump the number, or bumps it to one already used, leaves the old translator's containers in use underXCL_DIRECT_DXIL.mainhas such a case now: #1900 (20cf130) puts the MSAAtextureLoadbeforegetDimensions, because AMD's driver compiler crashes on the other order, and doesn't bump it. For a program with an MSAA image load, a direct cache written at689f2dbstill gives the old order at20cf130(see Tested).This does for the direct path what
bfb8133d(#1745) did for the per-lane sources, by listing the directory. MatyEjsr noted the gap on #1714 and IgorAntunes66 on #1741.Related to #1269: it asks for shaders compiled directly into DXIL, and a direct-translator change tested over an existing cache can run and measure the old containers. If
goal:world-loadfits, please set it.What is in it
build.rs: hashes every.rsfile ofgpu/dxilbut the test files (*tests.rs) intoXCL_DIRECT_DXIL_SOURCE_ID. Tests inside the other files are hashed with them. A new file (#1793 adds one) is not left out.recomp/pso.rs: that hash is part of the direct entries' identity only (and the per-lane entries', which extend it). HLSL-path entries keep theirs. A unit test.dxil/kernel.rs: the comment ofTRANSLATOR_VERSION. The constant stays, for changes inpso.rs.Cost
gpu/dxiledit, even a comment, makes the next run withXCL_DIRECT_DXILtranslate again (programs that fall back to HLSL still hit the DXC cache).gpu/dxiledit would re-key those entries too. imnicho raised that on #1809 for the hand bumps, and it now tags compute entries only. This PR makes it happen on every edit rather than on every bump.Tested
cargo test --workspace --locked --no-fail-fast -- --test-threads=4at1831ec4a: 977 passed, 0 failed, 45 ignored (22 SKIPPED lines: 18 no wave64, 3 wave32 per-lane forms refused, 1 no heap windows)direct_dxil_identity_tracks_its_sourcesfails with the source left out ofdirect_versionand passes with it (cargo test -p xcl --lib shader_cache_tests: 13 passed, 1 failed / 14 passed; this diff on689f2db)IMAGE_LOADprogram, throughtranslated::cachedwithXCL_DIRECT_DXIL=1, builds run one after the other over one cache directory:main: written at689f2db; at20cf130the689f2dbcontainer is served (getDimensionsbeforetextureLoad), while a fresh translation there hastextureLoadfirst689f2db+ this diff; at1831ec4ait is translated again (textureLoadfirst), and a rerun is a hit689f2db): editingdxil/module/opt.rsor adding a file changes onlyXCL_DIRECT_DXIL_SOURCE_ID; editingdxil/ops_tests.rschanges noneRegression run
main:
PR:
(the second of two pairs, run main, PR, main, PR; the first: main 1477 frames, peak 21803 MB; PR 1478 frames, 22433 MB; no removal or crash in either. Release builds.)
Not tested
identity()passes the hash on is covered only by the scratch test, not by the unit testdirect_compute/direct_graphicsinpso.rsstay outside the hash, as before: bumpTRANSLATOR_VERSIONfor those (#1913 changesdirect_graphicswithout one; it also edits hashed sources, which changes the identity anyway)Overlaps (open PRs, merged in a scratch tree with this PR and with
main62265d3, 2026-11-24 23:45Z):TRANSLATOR_VERSION: #1707 and #1739 bump 6 to 7, whichmainalready has; #1720, #1742, #1793, #1800, #1801, #1818, #1834, #1906, #1908, #1919, #1923, #1938, #1939 and #1940 all bump 7 to 8 (#1720 and #1919 also changeemit.rs, which is hashed). All sixteen merge cleanly with this PR; for theirgpu/dxilchanges the bump becomes optional. #1544, #1546, #1699, #1737 and #1850 bump it too and conflict withmainalready.gpu/dxil.pso.rs: #1809 conflicts (its direct entries needdirect_version(..)too). #1472 callsidentity_within its tests and merges cleanly.build.rs: #1082, #1316, #1413, #1448, #1548 and #1692 merge cleanly; #1630 conflicts withmainalready.XCL_DXIL_NO_OPT).AI use
🤖 Generated with Claude Code
github-bot referenced this pull request2026-11-26 05:16:03 +00:00
@upipibi on GitHub · 2026-11-25 00:26 UTC · original
RTX 3070 (Ampere, driver 616.56, Windows 11, debug) at
1831ec4:cargo test -p xcl --lib -- --skip gpu_gives 817 passed, 0 failed, and thegpu_tests withXCL_DIRECT_DXIL=1give 110 passed, the same asmain.A live example of the "bumps it to one already used" case: three open PRs each bump
TRANSLATOR_VERSIONfrom 7 to 8 right now (#1946, #1950, #1952). Whichever two merge later would each need to renumber by hand. With this PR in, none of them needs a bump, since all three only changegpu/dxilfiles.AI-assisted (Claude Code).
@futurepro62 on GitHub · 2026-11-25 00:22 UTC · original · edited 2026-11-25 00:40 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
1831ec4(on its base20cf130).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 967 passed, 0 failed, 43 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.direct_dxil_identity_tracks_its_sources.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 976 passed, 0 failed, 45 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on main80f4819too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests andconst_and_null_mask_operands_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
@anes66 on GitHub · 2026-11-25 00:49 UTC · original
CPU-only build-script validation on exact head
1831ec4a5abb1c3ae0ca4ab3803776f7fafe30cbpassed. Optional regression companion d8dc190, directly on that head, adds one integration test; no runtime/build-script changes remain in the patch.Tested
build.rsagainst that tree, and checks all three emitted identity strings across 17 script invocations. It does not reimplement the hash.dxil/cfg.rsordxil/module/opt.rschanges only the direct identity; editingrecomp/lower.rschanges only per-lane; editingrecomp/emit.rschanges only the common source identity. Restoring the bytes restores all identities.ops_tests.rsor adding a non-Rust file changes none of the three.cargo test --locked -p xcl --test direct_source_identity -- --nocapture --test-threads=1: 1 passed / 0 failed / 0 ignored, no skips.cargo test --locked -p xcl --lib gpu::recomp::pso::shader_cache_tests:: -- --nocapture --test-threads=1: 14 passed / 0 failed / 0 ignored, no skips.Not tested
Cargo's filesystem-change scheduling (the test invokes the compiled script itself), full workspace/GPU suite, release, retail cache reuse, or integration onto newer main. Compiling the script requires
rustcand the normal MSVC build environment. No competing upstream PR.AI use
Codex (GPT-6; exact variant unavailable) wrote the regression and temporary control, ran CPU validation and prepared this report.
@JJAutoCompare on GitHub · 2026-11-25 01:03 UTC · original
Tested
Clean PR head
1831ec4a5abb1c3ae0ca4ab3803776f7fafe30cbon an AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation 26200.9974, Rust 1.100.0x86_64-pc-windows-msvc(debug). The host has an Intel Arc A770 (driver 32.0.101.9175). These checks were CPU-only. Cargo target, temporary files and the DXIL cache used private directories onL:withCARGO_INCREMENTAL=0.7 passed, 0 failed, 0 ignored, 0 skipped (946 filtered out). This exercised source and backend identities, cache hits and misses across namespaces and rejection of truncated entries.
I also ran
cargo run --offline -j 2 -vv --bin xclin five states of a scratch Cargo package that used the PR's unchangedbuild.rsand copied source inputs. All five runs exited 0 and matched their assertions. An unchanged rerun reused the build output. Editingsrc/gpu/dxil/module/opt.rsreran the build script and changed only the direct identity (8f217b15dfe94ce9to80f5ea9901858109). Restoring the bytes reran the script and restored the original value. Editingsrc/gpu/dxil/ops_tests.rsreran the script and preserved all three identities.Not tested
Full workspace suite, release build, DXC or shader execution on the GPU, retail-title cache reuse or smoke runs.
AI use
Codex (
gpt-6.2-sol) ran the tests, wrote the scratch probe and prepared this report.@DavidM1911 on GitHub · 2026-11-25 02:50 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!