Shader compile time: DXC compiles without lifetime markers #1529
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!1529
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1529"
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?
@Retried on GitHub · 2026-11-24 17:18 UTC · original
Retried:shader-compile-time→main· +106 −16 · 2 files · 2 commits · openDXC now gets
-disable-lifetime-markersfor every recompiled program. With HLSL 2021 and SM 6.6 it wraps every local in alifetime.start/lifetime.endpair. The pair only tells the optimiser that the local is undefined where its scope starts. Without it, the local keeps its last value there, which is one of the values "undefined" already allowed, so no program changes meaning. Programs compile about 6 % faster and their DXIL is 0.6 % smaller. A caller that passes-enable-lifetime-markers(or its own-O) still wins.Refs #1269
What is in it
Tests: retail_pipeline_cost times DXC and the driver per program(crates/xcl/src/gpu/recomp/tests.rs): an ignored test that translates retail records (picked by offset) the way a title gets them, including the split wave64 form, and creates them as compute pipelines. It prints the translation + DXC time, the DXIL size and the driver time.xcl shaders --compilecannot measure the driver: its HLSL is not the split form, and NVIDIA refuses[WaveSize(64)].Recompiler: DXC compiles without lifetime markers(crates/xcl/src/gpu/recomp/dxc.rs): the arguments are now built inarguments(), which adds the flag. Two tests: the exact arguments per size and caller overrides, and a compile with real DXC.Tested
NVIDIA GeForce RTX 2070 SUPER (driver 621.35), Ryzen 7 5800X3D, 32 GB, Windows 10.0.26300.9974, rustc 1.100.0, DXC 1.9.2602.17 (Windows SDK 10.0.26100.0)
cargo build --workspace && cargo test --workspace -- --test-threads=4(debug,XCL_SAMPLE_RPFset): 772 passed, 0 failed, 42 ignoredSKIPPED:
gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64)Compile time on a retail
shaders.rpf, before → after:retail_translation_survey, seed 1269, 63 programs, DXC in process (release),b7aa9f3and this PR run alternately, two rounds; totaldxc.exeretail_pipeline_cost), DXCCreateComputePipelineState, DXIL the driver had not seen)The first version of this description gave 71 s → 64 / 65 s for the sample. The 71 s was measured on an older
main, so it was replaced by the alternating runs above.Regression run
Both runs used an empty
XCL_DXIL_CACHEandXCL_TRANSLATED_CACHE=0. Order: main, this PR, main again, and this PR again after the commit message was corrected (same tree). The blocks are the second main run and the last run. The first main run, made while the game files were not yet in the OS file cache, showed 454 frames (same exit, no removals or crashes, peak commit 15737 MB).Not tested
AI use
🤖 Generated with Claude Code
@MatyEjsr on GitHub · 2026-11-24 17:45 UTC · original
Verified PR #1529 at head commit
e06ffce08bdca11410bcba022ec4dbd58f5fbd42on NVIDIA RTX 3090 (wave32 / split wave64).Environment
Tested
origin/main(9e3831e):git merge-tree --write-tree 9e3831e e06ffceexited 0 (no conflicts).cargo build --workspace -j 8: succeeded (10.82s).cargo test --workspace -j 8 -- --test-threads=4: 772 passed, 0 failed, 42 ignored.SKIPPED(4):gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask(no wave64)gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)test_title_draws_with_a_root_signature_under_the_debug_layer(no d3d12SDKLayers.dll)uploads_start_from_each_subresources_state(no D3D12 debug layer (0x887A002D))arguments_pick_the_level_by_size_and_leave_out_lifetime_markers,dxc_accepts_the_arguments): 2 passed, 0 failed, 0 ignored.cargo test -p xcl --lib gpu::recomp::tests::gpu_ -j 8 -- --test-threads=1, 85 passed, 0 failed, 1 ignored, 2 SKIPPED):main(b7aa9f3):4.69s,4.64s,4.66s(median4.66s)e06ffce):4.57s,4.56s,4.51s(median4.56s, -2.1% end-to-end across the synthetic GPU suite including PSO creation and execution)--test-threads=8,gpu_sparse_vram_descriptors_buffers_and_xmemintermittently fails (submit 1 lane 0 mismatch, left0vs right1077) when another test opens UMA concurrently; confirmed pre-existing onmain(b7aa9f3, 2/3 runs) and unrelated to PR #1529 (passes 3/3 solo and passes under--test-threads=4).Code review
arguments()cleanly isolates DXC argument construction, preserves caller-O*and*lifetime-markersoverrides by placingextralast, and leaves the DXIL cache key unchanged so existing cached entries remain valid.retail_pipeline_costproperly dropsManuallyDrop::into_inner(desc.pRootSignature)and stays#[ignore]d behindXCL_SAMPLE_RPFandXCL_RECORDS.Not tested
retail_pipeline_cost,retail_translation_survey) and retail smoke run (XCL_SAMPLE_*unset)AI use
@nnonno91 on GitHub · 2026-11-24 17:46 UTC · original
Independent AMD run and lifetime-marker comparison on
e06ffce08bdca11410bcba022ec4dbd58f5fbd42.Tested
XCL_ADAPTER.cargo build --workspace --lockedpassed.cargo test --locked -p xcl --lib gpu::recomp::dxc::cache_tests -- --test-threads=4 --nocapturepassed all 12.cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-outputreported 772 passed, 0 failed, 42 ignored, and zero GPU skips. The bundled title passed.cargo test --locked -p xcl --test lifetime_marker_probe -- --exact lifetime_marker_outputs_match_cpu --nocapture --test-threads=1using a temporary synthetic compute shader with initialized arrays scoped inside two branches of a loop. In four fresh test processes (DXC 1.8.2502.11 and 1.9.2609.5 on each adapter), XCL compiled tocs_6_6at-O1once with the PR default and once with-enable-lifetime-markers. Both versions matched a CPU calculation across all 64 lanes on AMD and 32 on NVIDIA. All unwritten buffer words kept their initial values.dxc.exe -dumpbinshowed twollvm.lifetime.startand twollvm.lifetime.endcalls when explicitly enabled and zero with the PR default in all four comparisons. The default DXIL was 184 bytes smaller in each pair.Not tested
Retail shaders, retail title runs, and compile or driver timings. The GPU comparison checks one synthetic shader.
AI use
OpenAI Codex (GPT-6 family, exact variant unavailable) wrote the temporary probe, ran the checks, and drafted this report.
@karthik765 on GitHub · 2026-11-24 18:21 UTC · original
Tested on AMD Radeon RX 7800 XT with driver
32.0.32029.2010, Windows 11 build26300.9974, Rust1.100.0(MSVC), and DXC1.9.2602.17.Both revisions built successfully with
cargo build --workspace --locked. Results fromcargo test --workspace --locked --no-fail-fast -- --test-threads=4:b7aa9f3bd212088e0d927439284dc5ed325ce3c7e06ffce08bdca11410bcba022ec4dbd58f5fbd42The native wave64 compute and mesh shader cases and XCL’s synthetic end-to-end title test passed on both revisions. The separate
gpu_wave64_ps_whole_wave_reductionsrun also passed on both withXCL_REQUIRE_GPU=wave64,mesh. The PR’s DXC argument-handling and compiler acceptance tests both passed.Not tested: Retail game files or shader packs, compile-time speedup, driver pipeline build times, or in-game loading. All
XCL_SAMPLE_*variables were unset.AI use: Codex (GPT-6) ran the tests on the hardware above and drafted this report.
@DavidM1911 on GitHub · 2026-11-24 18:58 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored.Thanks!
@kais7654 on GitHub · 2026-11-24 19:36 UTC · original
Ran on the PR's head (
3386385): RTX 5070 Laptop (Blackwell, driver 616.87),Windows 11 26H2, rustc 1.100.0.
cargo build --workspace: ok
cargo test -p xcl --lib gpu::recomp: 191 passed, 0 failed, 19 ignored
(includes the new arguments_pick_the_level_by_size_and_leave_out_lifetime_markers)
One sequencing question: this keeps the >8 MB -O0 band while #1526 removes it —
both touch the same threshold block in dxc.rs, so whichever merges second needs
a rebase of
arguments(). Is the intent that #1529 lands first on main and#1526 rebases on it, or the other way?
Not tested: the 5.7 % compile-time claim itself (no retail pack here), and no
GPU-side check that dropping lifetime markers changes no program's result.
AI use: my local Mistral Vibe agent fetched the branch, ran the build/tests
above and drafted this comment; I checked the diff.
@kleborgn on GitHub · 2026-11-24 19:48 UTC · original
Hardware: AMD Radeon RX 7900 XTX (driver 32.0.32029.2010), Ryzen 9 7950X3D, 32 GB, Windows 11 Pro 10.0.26300, rustc 1.100.0; tests in debug, timings in release. DXC 1.8.2505.32 (Windows SDK 10.0.28000.0).
Tested (AMD)
Commit
3386385, on its own base:cargo test --workspace -- --test-threads=4: 772 passed, 0 failed, 42 ignored. No SKIPPED lines.The same diff applied to
mainc160d86(applies cleanly): 860 passed, 0 failed, 43 ignored (main alone: 858 / 0 / 42). SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).retail_translation_survey, seed 1269, 1 in 420 (63 programs, 98,123 instructions), DXC in process, release, parentb7aa9f3and3386385run alternately, two rounds each, 0 DXC errors:retail_pipeline_cost, threeCS_RaytracingResolve_c5cb017eprograms (about 72 KB of console code), freshXCL_DXIL_CACHE,XCL_TRANSLATED_CACHE=0; translation + DXC, parent -> PR (the test file from this PR was copied onto the parent):Not tested
AI use
@Retried on GitHub · 2026-11-24 22:28 UTC · original
I am not going to follow this PR up any further. Maintainers can edit the branch, take it over or close it.
On the open question about #1526: the two PRs change the same threshold block in
dxc.rsarguments()independently. Whichever lands second needs a small rebase there and keeps both changes:-disable-lifetime-markersfrom this PR, and the >8 MB band at-O1from #1526. I have no preference on the order.@jennydeth on GitHub · 2026-11-25 23:02 UTC · original
RTX 3060 12 GB / 32 GB RAM, exact head
3386385against its baseb7aa9f3, both with an emptyXCL_DXIL_CACHEandXCL_TRANSLATED_CACHE=0as in the description: the suite passes. On the retail title both arms crash the same way, with #846'sgame_scarlett_master.exe+0x23cf683, so this PR does not cause it, but neither run gets far enough to compare compile times. Currentmain06c9f55ran the same route for 600 s without that crash in an earlier run here (warm caches, and no frame after ~100 s either), so a useful regression run on this title probably needs the branch rebased.Tested
stable-x86_64-pc-windows-msvc); release build; DXC 1.9.2609.5 (XCL_DXC_DIR)cargo test --workspace --release --no-fail-fast -- --test-threads=4on3386385: 772 passed, 0 failed, 42 ignored (20 test targets incl. doc-tests), includingarguments_pick_the_level_by_size_and_leave_out_lifetime_markersanddxc_accepts_the_arguments. SKIPPED (2):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64)scripts/smoke.ps1 -Game <folder> -Seconds 600(main's copy of the script;b7aa9f3's has no-OutDir),XCL_NETWORK=0, scripted pad presses from the start screens into the story load (XCL_PRESS_AT), a fresh emptyXCL_DXIL_CACHEper arm,XCL_TRANSLATED_CACHE=0. Head run first, then the base.Regression run
mainb7aa9f3:This PR,
3386385:unhandled exception 0xc0000005 in game_scarlett_master.exe+0x23cf683 (write at address 0x0),rcx=0x70024c348: at 132 s on the base and 141 s with this PR, after the last present at 102 s / 112 s.On the cache key (the description's Not tested already says the key has no flags): one detail it does not say. The translated cache is rebuilt by this change, since
dxc.rsis one ofbuild.rs'sTRANSLATOR_SOURCES, but its misses go back to the DXIL cache, whose key (crate version, DXC dlls, profile, entry, HLSL) is unchanged, so existing users keep the old DXIL even after the translated cache is rebuilt. If the flag should reach them, the arguments (or a version for them) would need to go into the DXIL key.Not tested
main; a warm-cache run; AMD / wave64AI use: Claude Code (Claude Opus 5.5) built both commits, ran the suite and the two runs on my machine, read the logs and the cache-key code, and wrote this.
@DavidM1911 on GitHub · 2026-11-26 05:40 UTC · original
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.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.