dxc: hash arguments into the DXIL cache key and honor XCL_DXC_ARGS (#559) #586
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/591"
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?
Imported from ivall/xcl. Originally posted by Ivankiosan on 2026-11-24T02:12:32Z.
Hash explicit and environment DXC arguments into the DXIL disk cache key, and honor
XCL_DXC_ARGSon the cached compilation path. Fixes #559.Previously,
cache_key_for_toolchainonly hashed the package version, toolchain identity, profile, entry, and source text, omitting any compiler arguments (extra: &[&str]). Furthermore,compile_cached_inhardcoded an empty argument list&[], ignoringXCL_DXC_ARGS. This caused different optimization levels or custom arguments to collide on the same cache key or be dropped entirely.This change:
cache_key_for_toolchainandcache_keyto append and hash the argument list into the FNV-1a digest. Empty argument lists keep the digest unchanged.compile_cached_argsto allow callers to pass explicit arguments through the cache.XCL_DXC_ARGSthroughcompile_cached_inso environment-specified arguments reach both the cache key and the compiler.What is in it
crates/xcl/src/gpu/recomp/dxc.rs: hash arguments intocache_key_for_toolchain, exposecompile_cached_args, consultXCL_DXC_ARGSincompile_cached_in, and add unit tests verifying key separation and environment variable handlingTested
cargo test --workspace -- --test-threads=4: 678 passed, 0 failed, 37 ignoredSKIPPEDGPU tests on adapter: nonegame_scarlett_master.exe)Regression run
Not tested
AI use
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-24T02:47:32Z.
NVIDIA run, since Not tested lists NVIDIA GPUs.
Tested
6c68cc703df3e2d75d5820ee594a4a155ce3ee9e, clean worktreestable-x86_64-pc-windows-msvc; DXC 1.9.2602.17 (Windows SDK 10.0.26100.0); debugcargo build --workspace, thencargo test --workspace -- --test-threads=4: 687 passed, 0 failed, 41 ignored (lib 647 / 0 / 21)cache_key_tracks_the_dxc_arguments,compile_cached_args_distinguishes_argument_lists,compile_cached_in_honors_xcl_dxc_args_envgpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwareXCL_SAMPLE_*andXCL_DXC_ARGSnot setNot tested
smoke.ps1run here.AI use
Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T02:55:09Z.
Test run of
6c68cc703df3e2d75d5820ee594a4a155ce3ee9eon AMD RDNA4; the PR was tested on NVIDIA only. I merged it onto currentmain18c105alocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 692 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 652 passed, 0 failed, 21 ignoredSKIPPED;cache_key_tracks_the_dxc_arguments,compile_cached_args_distinguishes_argument_listsandcompile_cached_in_honors_xcl_dxc_args_envpass.Review: An empty argument list keeps the old digest, so existing caches stay valid. One thing in the tests:
compile_cached_in_honors_xcl_dxc_args_envsetsXCL_DXC_ARGS="-O1"withstd::env::set_varin the middle of thexcllib test binary, which runs with several threads. While it is set, any GPU test compiling throughcompile_cached/compile_cached_inat the same time reads-O1fromenv_dxc_args(), compiles with it and caches under that key. It does not fail anything today, but it makes those runs depend on scheduling. Testingenv_dxc_args()'s parsing separately and callingcompile_cached_argswith an explicit list (ascompile_cached_args_distinguishes_argument_listsalready does) would keep the environment untouched. Smaller:XCL_DXC_ARGSis split on whitespace, so an argument containing a space cannot be passed.Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Imported from ivall/xcl. Originally posted by KainanP on 2026-11-24T19:35:29Z.
Thanks for wiring
XCL_DXC_ARGSinto the cache key. I read the diff at6c68cc7(not run).Two things about
compile_cached_in_honors_xcl_dxc_args_env:XCL_DXC_ARGSwhile other tests run in parallel.dxil_cache_round_tripcallscompile_cached_intwice and asserts the second is a hit. If theset_var("-O1")/remove_varwindow falls between those calls, the keys differ ([]vs["-O1"]) and that test fails intermittently.compile_cached_in_with(..., &env_dxc_args()...)directly, so thecompile_cached_in→env_dxc_argswiring is not actually tested.Suggestion: split parsing into a pure
dxc_args_from(Option<&str>) -> Vec<String>and test that, pluscompile_cached_argswith explicit lists (already covered), and drop the env mutation. Alternatively, guard every test that touches the variable orcompile_cached_inwith one shared mutex.AI use: Claude Code (Claude Opus 5.5) read the diff; not run. Checked by the user before posting.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T06:43:13Z.
Empirical test report (
6c68cc70)Hardware / environment
6c68cc703df3e2d75d5820ee594a4a155ce3ee9e, verified at detached HEAD.0ef1bc386), hostx86_64-pc-windows-msvc, unoptimized test profile. Loaded DXC compiler and DXIL signer 1.9.2609.5 (compiler revision01b62ad4).Commands and results
cargo test --workspace --no-runexited 0. It built the workspace test binaries and executed no tests.XCL_ADAPTER=NONE_CPU_ONLY,RUST_TEST_NOCAPTURE=1, andXCL_DXC_ARGSinitially unset,cargo test -p xcl --lib gpu::recomp::dxc:: -- --test-threads=1exited 0. The focused log recorded 17 passed, 0 failed, 0 ignored, 0 skipped and 651 filtered out. Skips were counted from case-sensitive lines beginning withSKIPPED.Observed behavior
XCL_DXC_ARGS=-O1caused a miss in the synthetic cache tests, and repeating the environment value hit the cache.Not tested
Full GPU workspace suite, game smoke runs, and real DXC compilation with overridden flags. The flag-specific tests used synthetic DXIL.
AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr591-focused.log and published.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T13:06:53Z.
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!
Imported from ivall/xcl. Originally posted by gut0to on 2026-11-26T16:43:09Z.
Review: COMMENTED
AI-assisted review (OpenAI GPT-6); I inspected the current diff and tests. I did not run tests or the game.
Imported from ivall/xcl. Originally posted by gut0to on 2026-11-26T16:43:09Z.
Code review location:
crates/xcl/src/gpu/recomp/dxc.rs; line 635Could
XCL_DXC_ARGSuse Windows command-line argument parsing, or document the supported quoting format and cover it with a test? With-I "C:\Program Files\DXC Includes",split_whitespace()returns tokens with the quotes attached, so DXC receives a truncated include path and extra arguments. This prevents passing a normal Windows include directory through the new setting. AI-assisted review (OpenAI GPT-6); I inspected the changed argument parsing and tests, and did not run tests or the game.Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:35:21Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:45:57Z.
Triage (#1607) – head
6c68cc7#613 is stacked on this PR (it contains this commit) and adds the pso.rs bypass of the warm translated-shader caches, without which
XCL_DXC_ARGSstill has no effect once a translation is cached. Main does not yet put the arguments into the DXIL cache key.In dxc.rs,
compile_cached_in_honors_xcl_dxc_args_envcallsstd::env::set_var("XCL_DXC_ARGS")while other tests that callcompile_cached_in(e.g.dxil_cache_round_trip) run in parallel, which can make them miss the cache. The test also callscompile_cached_in_withdirectly, so it never exercisescompile_cached_inreading the variable. #613 replaces this test.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.