DXC: sources over 8 MB use -O1, not -O0 #1526
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!1526
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1526"
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?
@speed-y on GitHub · 2026-11-24 17:17 UTC · original
speed-y:dxc/no-o0-fallback→main· +84 −9 · 1 files · 2 commits · openPart of #1269 (campaign task C4). HLSL sources over 8 MB used to compile at
-O0as a "safety net". Thread measurements show that roughly doubles DXIL (to ~14–30 MB on the giants) and the driver then stalls;-O1matches-O3DXIL size and is already used from 1 MB, so the 8 MB band uses-O1too.Follow-up for risks raised on the PR / #1269: sources over 64 MB are refused (neither
-O0nor-O1finishes the ~147–155 MB ones, and-O1can hold a worker for tens of minutes), and the DXIL cache key includes the default-Oso warm entries from the old-O0band recompile under-O1.What is in it
crates/xcl/src/gpu/recomp/dxc.rs:default_opt_level—-O1for every source over 1 MB through 64 MB (drops the >8 MB-O0branch)-Otoken (warm-cache miss for the old-O0band)Tested
.\scripts\test.ps1at31fb65e: 780 passed, 0 failed, 41 ignored; SKIPPED GPU: 2 (no wave64), 1 (no heap windows)cargo test -p xcl --lib -- opt_level_tests cache_key_tracks_the_default: 4 passedRegression run
Main (
9e3831e):This PR (
31fb65e):Not tested
122017d); wave64 / heap-window GPU paths (skipped here)-O1and below the ~147 MB hang)AI use
github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@pickles976 on GitHub · 2026-11-24 17:19 UTC · original
Review from the DXC lane: direction fully endorsed — the -O0 "safety net" was measurably self-harm (its ~2× DXIL is exactly what makes the driver stall, so it amplified the failure it existed to prevent, and -O1 matching -O3 output size at lower DXC time makes the >8 MB band's existence indefensible). The override behavior is right too (
extrastarting with-Owins, and extras are key inputs). One real gap, and it's the warm-cache twin of the #1472 lesson: the default opt level is not part of the positive cache key (key = content + entry/profile + toolchain identity + extras), so every >8 MB shader already cached from the -O0 era keeps being served its bloated artifact after this PR — users with warm caches do not get the driver-stall fix, silently, which is the worst observability shape for a fix whose whole point is stalls. Options, cheapest first: fold the effective default level (or a small compile-policy version constant, best long-term since it also covers future table changes) into the key; or one-time purge keyed on the old policy. Same invariant as the negative markers, one side over: cache entries are capability/policy-scoped, not just content-scoped — worth one sentence in the module docs either way.@nnonno91 on GitHub · 2026-11-24 17:31 UTC · original
Independent cache upgrade test on
122017d1ad52ca27a3f5a8d95c7704cff862e80dwith base9e3831e1f570d3646e53ab753b19ec07eb8f1485.Tested
dxc::compile_cached_inin fresh processes viacargo test --locked -p xcl --test opt_policy_probe -- --exact opt_policy_probe --nocapture --test-threads=1. The input was a synthetic compute shader padded with a comment to 8,389,027 bytes so it crossed the old cutoff.Explicit
-O0and-O1controls matched the 3,292-byte and 3,008-byte outputs byte for byte, respectively. The base and PR used the same cache filename for the large fixture.I also tested an uncommitted local variant that adds a policy tag to the cache key only above the former 8 MiB cutoff. With a copy of the old cache, it compiled the large fixture once to the same
-O1bytes, then hit that new entry. A second fixture at 7,340,451 bytes still hit its original cache entry. The variant added one file and preserved both existing files.cargo build --workspace --lockedandcargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-outputpassed on both the unmodified PR and the local variant. Each had 777 passed, 0 failed, 41 ignored, and one reported GPU skip (heap_window_out_of_memory_falls_back_to_the_switch_form, no heap windows). The bundled title passed.Not tested
Retail shaders, retail title runs, and compile or load times. The padded inputs exercise the cache policy.
AI use
OpenAI Codex (GPT-6 family, exact variant unavailable) wrote the temporary probe and local variant, ran the tests, and drafted this report.
@ofc0urse on GitHub · 2026-11-24 17:44 UTC · original
Test of
122017don a 32 GB machine, for the risk @throny raised in #1269: the sources over 8 MB do not fit in memory here at-O1, and they did not at-O0either.Tested: RTX 4060 Ti 8 GB (32-lane waves), driver 621.24, Core i5-14400F, 32 GB RAM with a system-managed pagefile (commit limit 69.5 GB at the time), Windows 11 Pro 26300, release build. Not a clean head:
main9e3831e+ this PR cherry-picked, plus a local log-only patch that prints the start and end of every DXC compile of 4 MB or more and can refuse sources over a size (XCL_DXC_MAX_MB, test only).XCL_HEAP_WINDOWS=1(#680) in all runs, so the sizes below are the heap form's.Command:
xcl shaders <pack> --precompile --only cs --pipelines, a script beside it killing the process when free commit falls under 5 GB.XCL_DXC_MAX_MB=8-O1in 21–32 s each, several at a time; free commit stayed at 49–52 GB. 725 pipelines made so far, 0 refused, still runningBefore this PR, the same three sources went through
-O0. In a title run on the same base (main9e3831e, heap form, world loading), process commit went from 33 GB to 82 GB in about 40 s at ~520 s, withxcl-dxc-0insidedxcompiler.dllat the time; that run was stopped by hand.So on this machine neither
-O0nor-O1gets through these sources: one compile grows by tens of GB in a minute or two, faster thanwait_for_memory(which counts ~1 GB per running compile) can react. The 147.4 MB one is most likely the 154.6 MB program coenflict measured, in its heap form.Not tested: which of the three takes the memory (run B refused them together; run A had no per-compile log yet), whether DXC or the driver held it in run A, AMD, a clean PR head.
AI use: Claude Code (Claude Opus 5.5) ran the builds and runs and wrote this; I checked it before posting.
@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:31 UTC · original
Ran on the PR's head (
122017d): 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::dxc: 15 passed, 0 failed
One question above under 25 min: does this cover throny's 155 MB program? With
this change it also gets -O1, which did not finish in 25 min on that measurement
— is there (or should there be) an upper bound above which we still refuse or
fall back?
Not tested: the full suite on this branch, and the >8 MB programs themselves
(no retail pack here). AI use: my local Mistral Vibe agent fetched the branch,
ran the build/tests above and drafted this comment; I checked the diff.
@throny on GitHub · 2026-11-24 19:34 UTC · original
@kais7654 On
122017dthere is no upper bound:default_opt_levelreturns-O1for every source over 1 MB, so the 155 MB program gets-O1too. In my measurement on #1269,-O1didn't finish it within 25 minutes (RTX 4080 machine, DXC 1.9.2602.17). @kole07139's test of this head on #1269 covers three of the programs over 8 MB: DXC took about 3.9 times as long at-O1on two of them and the driver still ran out of memory, and the third ran out of memory in DXC at either level.AI use: Claude Code (Claude Opus 5.5).
@LocranKing on GitHub · 2026-11-24 20:03 UTC · original
Independent Windows release verification on NVIDIA RTX 3060 Ti (
122017d1ad52ca27a3f5a8d95c7704cff862e80dvs basemain9e3831e1f570d3646e53ab753b19ec07eb8f1485).Setup
8024 MiB VRAM, wave32), driver32.0.16.210131.8 GBRAM26200rustc 1.100.0, DXC1.9.2602.17,--releaseWorkspace tests (
cargo test --workspace --release --no-fail-fast -- --test-threads=4)0: 777 passed, 0 failed, 41 ignored across 20 result blocks (SKIPPED: 2no wave64, 2no D3D12 debug layer,heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows).Regression run (
scripts/smoke.ps1, 60 s,XCL_NETWORK=0, title folder name redacted)main:1586 / 1566frames (101.3%),15199 / 14715 MBpeak commit (103.3%),0device removals,0crashes.Base (
main9e3831e):PR head (
122017d):Not tested: offline cold DXC compile on >8 MB HLSL shaders, AMD / wave64 hardware.
AI use: Antigravity (
Gemini 4 Neon) built and ran the test suite and smoke pair on this hardware and drafted this report from the captured outputs; reviewed before posting. No game files attached.@speed-y on GitHub · 2026-11-24 20:13 UTC · original
@throny @kais7654 @kole07139: pushed
31fb65efor the upper-bound risk.-O0nor-O1;-O1can hold a worker for tens of minutes). The ~30 MB Probes programs stay on-O1so they still get the halved DXIL.@GonZiin: the DXIL cache key now hashes the default
-Otoken, so warm entries from the old-O0band miss and recompile under-O1.AI use: Cursor (Composer).
@JorgeMJM on GitHub · 2026-11-24 20:16 UTC · original
Test report for the
-O0/-O1choice above 8 MB, on an 8 GB laptop card. Counts and timings only.Setup: RTX 3070 Laptop 8 GB, NVIDIA 621.40, Ryzen 7 5800H, 28 GB RAM, Windows 11 26300, DXC 1.8.2502.11 (Windows SDK 10.0.26100), release. Retail 1.0.2.1
shaders.rpf, compute programs as a 32-lane GPU gets them (split wave64, 4 memory windows).Method: not this PR's head but the same choice, forced by a local env override in
dxc.rsonmainb7aa9f3. One program per process throughxcl shaders --precompile --only cs --pipelines, filtered to one record by a local patch, freshXCL_DXIL_CACHE,XCL_PSO_DISK_CACHE=0,XCL_DXC_THREADS=1,XCL_PIPELINE_THREADS=1,CreateComputePipelineStatetimed around the call. NVIDIA's own shader cache was left on; every DXIL was built once. One run per row. The 11 MB pair ran with CPU boost off (3.2 GHz), the 28 MB rows with it on.DXC alone (
dxc.exe,-E main -T cs_6_6 -HV 2021), the 5 compute programs over 8 MB except the largest:-O0DXC / DXIL-O1DXC / DXILDriver, through the runtime's path:
-O0-O1-O0-O1-O1takes about 30 % off the driver's time here, the same direction as #1096. But at 11 MB DXC-O1costs 12× its-O0time, so a cold compile of that program is about twice as long end to end. Once the DXIL is cached,-O1is the faster one.dxc.exeand 2.7 MB through the runtime at-O1.Not tested: this PR's head commit itself, the largest (145 MB) program, other drivers, desktop CPUs, repeated runs, a title run.
AI use: Claude Code (Claude Sonnet 5.5, then Claude Opus 5.5) wrote the local harness, ran the measurements on my machine and drafted this.
@JorgeMJM on GitHub · 2026-11-24 20:54 UTC · original
Correction to my report above: the
dxc.exetable timed HLSL dumped byxcl shaders --recomp, which translates with 1 memory window unlessXCL_RECOMP_WINDOWSis set. The runtime uses 4, and that source is larger (+11 % on a 2.4 MB program here), which is why the same program gave 1.8 MB of DXIL there and 2.7 MB through the runtime. The arguments are the same (-E main -T cs_6_6 -HV 2021 -O1). The driver table went through the runtime's path and stands; the DXC-only times are those of the 1-window form, not what a title compiles.AI use: Claude Code (Claude Opus 5.5) found the cause and drafted this.
@kleborgn on GitHub · 2026-11-24 19:48 UTC · original · edited 2026-11-24 21:03 UTC
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.
Tested (AMD), updated for head
31fb65e31fb65eon its own base:cargo test --workspace -- --test-threads=4: 780 passed, 0 failed, 41 ignored. SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).main4178e88(applies cleanly): 895 passed, 0 failed, 42 ignored, in two full runs (main alone: 891 / 0 / 42).Earlier head
122017d(superseded)mainc160d86: the first full run failedhle::d3d12x::real::readback_routing_tests::coherent_buffer_sanitizes_console_flags_and_state(assertion left != right failed,real.rs:5825) and cargo stopped there. Three more full runs passed, and that test passed 6 of 6 times alone, also onmainalone. Plainmainpassed 4 of 4 full runs. I did not find the cause; @DavidM1911 reports an intermittent single-test flake under parallel scheduling on unmodifiedmainas well. It did not appear in any of the four runs on31fb65eor4178e88.Not tested
-O1there, the new 64 MB refusal on a real program, smoke run, Intel, Nvidia.AI use
@throny on GitHub · 2026-11-24 21:17 UTC · original
Test of
31fb65emerged ontomainb9b6ea6, againstb9b6ea6, on the three programs over 8 MB from @kole07139's test, with their method (A:xcl shaders <record> --precompile --only cs; B: the same with--pipelines, so the driver; one fresh DXIL cache per build and program). The difference from their run is a higher memory cap: a process here was stopped at about 37 – 39 GB of private memory (6 GB of free system commit left) instead of 28 GB.main-O1)main(-O0)-O1)main(-O0)-O1or-O0. At-O1it reached the cap sooner, as in kole07139's run. So the halved DXIL does not make these two build here either, and their DXC time is about 4 timesmain's.Tested: RTX 4080 (driver as in my earlier reports), i9-12900K, 64 GB, Windows 11 26300, DXC 1.9.2602.17, release builds. One run per cell.
Not tested: AMD, a title run, heap windows, the other sources over 8 MB.
AI use: Claude Code (Claude Opus 5.5): ran the tests 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.@GonZiin on GitHub · 2026-11-24 17:24 UTC · original · reviewed
I independently reproduced the warm-cache issue from the earlier review using the public
dxc::compile_cached_inpath. Including the effective default optimization level in the disk key would make existing entries for this size range recompile under the new policy.Tested
9e3831e1f570d3646e53ab753b19ec07eb8f1485compiled an 8,388,854-byte synthetic compute shader into 3,340 bytes of DXIL in an empty cache.122017d1ad52ca27a3f5a8d95c7704cff862e80dreported a cache hit and returned the same 3,340 bytes, verified byte for byte. With a separate empty cache, the same head compiled the same source into a different 3,244-byte blob.cargo test -p xcl --lib opt_level_testsat the PR head reported 1 passed, 0 failed, 0 ignored and 0 skips.Not tested
Retail shaders, driver PSO timing, and the full workspace on this revision.
AI use
Codex (
gpt-6.2-sol) wrote and ran the synthetic probe, ran the threshold test, and wrote this report.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.