Recompiler: XCL_COMPACT_NEST=auto nests programs of 512 cases or more #2008
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2018"
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 Pipodi on 2026-11-25T00:54:49Z.
Stacked on #1692 (
5d9d3209, on #144851f9a05aand #1316's commits rebased asb662d124..7c52d4f6, rebased onto maind52ff48c); only the top commit (f141b9d5) belongs here. The stack now carries rebased and edited versions of #1316's commits:b662d124(prepare() split),efc54bda(compact form),6a3c753a(A/B tests) and7c52d4f6(compact backend). The edits: the conflicts againstmain'sdispatch_remap/no_remapare resolved,efc54bdaadds the testthe_compact_form_keeps_the_dispatch_remap, andtranslate_asopens oneShaderTranslationspan for the compact attempt and the normal form. #1316 itself still sits on an oldermain.This revision: rebased onto main
d52ff48c. In #1316's rebased backend commit (7c52d4f6) the conflicts withmainare resolved:build.rs's translator sources (main'smod.rsin place ofdxc.rs, withcompact.rs), and inpso.rsthe compact refusal tag now wrapsmain'scompile_cached_in/compile_cachedchoice.main'ssemantic_pipeline_setting(shaders.rs) now listsXCL_COMPACT_CS(in7c52d4f6) andXCL_COMPACT_NEST(in #1692's421109bb), each with a test (warm_settings_keep_compact_cs_switch,warm_settings_keep_compact_nest_switch), so both change the warm-settings key. An earlier rebase (onto0fe06eb0) threadedmain'srt32_maskthrough #1316's rebased commits. In an earlier rebase, this PR's own commit had no conflicts. #1448's rebase (with #1316's commits) resolved conflicts ingpu/recomp/pso.rs(main'sXCL_DEBUG_CS_SUBand rodata changes kept together with the compact routing;XCL_DEBUG_CS_SUBforcesCompactCs::Never) and inshaders.rs, and fixed two places that no longer built after it: thesuper::translatepath and theconsole_translationcall intargets.rs.XCL_COMPACT_NEST=<P>nests every compact program or none. This addsXCL_COMPACT_NEST=auto: groups of 32 cases for a program of 512 cases (distinct block texts) or more, and the flat switch below. The case count is known only once the blocks are emitted, socompact_atresolves the setting there. Unset,0and a size behave as in #1692. Turningautoon by default is a separate PR. Part of #1269.The measurements behind the numbers (#1269 result), RTX 4090, release, cold driver (new exe path and fresh
XCL_DXIL_CACHEper run):512 is below the smallest program measured (698 cases); nothing under it was timed.
From testers, on the same three programs:
autothere.What is in it
crates/xcl/src/gpu/recomp/compact.rs:enum Nest { Flat, Groups(usize), Auto };parse_nestacceptsauto(trimmed, any case);NEST_MIN_CASES(512) andAUTO_GROUP(32);resolve_nest, called incompact_atonce the cases are counted;compact_withstill takes a group size, so its callers are unchanged.crates/xcl/src/gpu/recomp/pso.rs: the translated-shader cache names anautoentry_c_na(the group size follows from the program, which the hash identifies)._cand_c_n<P>are unchanged.compact::tests::auto_nest_starts_at_the_case_threshold:resolve_nestat 511/512, andcompact_atwith the threshold at the program's case count (nested in groups of 32) and one above it (byte-identical to the flat text);autoandAUTO;_c_na.Tested
RTX 4090, driver 621.40, i9-13900K, Windows 11 Pro 10.0.26300, stable MSVC Rust (
rustc 1.100.0 (0ef1bc386 2026-11-09)), debug build for the suite, release builds for the smoke runs.Rebased onto main
d52ff48c. The whole suite,cargo test --workspace --no-fail-fast -- --test-threads=4(debug, RTX 4090), run on #2025 (30aaa283, which contains this PR; not run on this head separately): 2916 passed, 1 failed, 51 ignored, 26 SKIPPED. 1 failed:gpu_direct_image_get_resinfo_d16, which fails on maind52ff48ctoo (broken by43c56dce; fixed by test-only #3513).At
825aa91/480143a(not rerun):cargo test -p xcl --lib compact -- --test-threads=4withXCL_COMPACT_NESTunset,=32and=auto: 34 passed, 0 failed each. The cache tests (shader_cache_tests): 16 passed. On480143a,compact::tests: 6 passed.SKIPPED lines of the workspace run at the stack top, deduplicated (29):
Fails without the change: with
Autoresolved to 0 and its tag set to_c,auto_nest_starts_at_the_case_thresholdandtranslated_compact_and_normal_forms_are_kept_apartfail.Regression run
The same retail title for 60 s on both sides,
scripts/smoke.ps1on clean trees, release builds,XCL_PREPARE=0andXCL_PRESS_AT=16:Aon both sides, RTX 4090 (driver 621.40).main (
6bfb5c51):This PR's head (
f141b9d5, rebased onto maind52ff48c):The PR's run got 99.9 % of
main's frames and 116.8 % of its peak commit, higher thanmain's but within 125 %.Not tested
autoin a title run: the smoke runs have it unset, so they check only that the change breaks nothing.autoitself on AMD or RADV: the testers' numbers above are with a fixed P.AI use
main, resolved the conflicts againstdispatch_remap/no_remap, added the testthe_compact_form_keeps_the_dispatch_remapand the span intranslate_as, and ran the suite and the smoke pair on that head.main, the conflict resolution, the test runs and that description update were done with Claude Code (Claude Opus 5.5 orchestrating, Claude Sonnet 5.5 subagents).mainand the conflict resolution, ran the suite and the smoke pair through subagents, and updated this description. A Claude Opus 5.5 reviewer agent checked the rebase (range-diff and the conflict resolutions).0fe06eb0: Claude Code, Claude Opus 5.5 (with subagents): the rebase, the suite and smoke runs, and this description update.d52ff48c, counts and description update: Claude Code, Claude Opus 5.55d9d3209(no change of its own) and updated this description; subagents ran the suite on #2025 and the smoke pair.Imported from ivall/xcl. Originally posted by nnonno91 on 2026-11-25T01:09:05Z.
Tested
Independent
XCL_COMPACT_NEST=autoGPU check on exact head480143a6583b2f4ca418898cd7ba224d62b83f51. Windows 11 25H2 (26200.9974), Ryzen 7 9800X3D, AMD Radeon(TM) Graphics (32.0.21042.62, native wave64), and GeForce RTX 5090 (32.0.16.1742, split wave64). Rust 1.100.0 x64 MSVC and DXC/DXIL 1.8.2502.11. Unoptimized dev/test profiles with debug info off.cargo build --workspace --lockedpassed.cargo test --locked -p xcl --lib <filter> -- --test-threads=1 --nocapture, on AMD with the setting unset:gpu::recomp::compact::tests6 passed,shader_cache_tests16 passed, andgpu::recomp::tests_compact::gpu_compact_nested_dispatch1 passed (also used--exactfor this last test). Zero failed, ignored, or skipped in each run.cargo test --locked -p xcl --test compact_auto_gpu_probe -- --exact auto_compact_at_actual_case_boundary --test-threads=1 --nocapturepassed on both GPUs withXCL_COMPACT_NEST=0,auto, and32in separate processes (1 passed, 0 failed, 0 ignored, 0 skipped per run). The temporary probe built two synthetic RDNA2 programs with exactly 511 and 512 distinct cases. Each nonterminal block adds a distinct literal to v0 and branches to the next block. It used the public compact translator, DXC, the DXIL validator, and D3D12 readback.At 511 cases,
autoproduced byte-identical HLSL to the flat0control. At 512, it produced 16 groups of 32 and byte-identical HLSL to the fixed32control. All 64 lanes matched an independent CPU sum for both programs in every mode on both GPUs. For each program and GPU, the full result buffer and memory were byte-identical across the three modes.For this particular 512-case program, grouped DXIL was larger than the flat control (36,392 to 41,284 bytes on AMD and 37,512 to 42,424 on NVIDIA).
Not tested
Controlled cold-driver compile times, GPU execution performance, real titles, RADV, and the full workspace test suite. The two programs are synthetic and exercise correctness at the cutoff.
AI use
OpenAI Codex (GPT-6 family, exact variant unavailable) prepared and ran the temporary probe, checked the outputs, and drafted this report.
Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T02:06:08Z.
Independent AMD RDNA2 + NVIDIA RTX 5090 checks on \
480143a\ look great. Currently \CONFLICTING\ and Draft — once the base stack (#1316\ / #1448\ / #1692) is rebased onto \main, please rebase #2018\ and mark Ready for review so \Build and test\ CI can run.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T04:01:35Z.
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.Imported from ivall/xcl. Originally posted by Pipodi on 2026-11-25T04:05:54Z.
@DavidM1911, thanks for checking. Yes, the conflict is expected. This PR is stacked on #1316 (
964f5ed), and #1316 conflicts with currentmain. #1448, #1692 and #2025 above it are drafts for the same reason. I'll rebase the whole stack as soon as #1316 is rebased, then post the new heads.If you'd like to test before then, build the branch as it is (on
main266b845). In that case please name the head commit you tested in the report.AI use: Claude Code with Claude Opus 5.5.
Imported from ivall/xcl. Originally posted by itsSio on 2026-11-25T09:51:06Z.
Tested
Independent check requested in #1269 at clean head
5040ea1ef4807af4732dcbfaed1789226c39c4e0. Windows 11 Pro 26200 on both systems; x64 MSVC, unoptimized dev/test with debug info disabled.cargo build --workspace --lockedpassed on both.cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --nocapture:32.0.16.108832.0.16.1088Both ran and passed
auto_nest_starts_at_the_case_thresholdandtranslated_compact_and_normal_forms_are_kept_apart. Runtime skips on both: 21 native-wave64 cases, three per-lane f16/f32 refusals, one unavailable driver-cache control, and one unavailable heap-windows case. The RTX 2080 SUPER also had two missing D3D12 debug-layer skips.cargo test -p xcl --lib --locked gpu::recomp::tests_compact -- --test-threads=1 --nocapture: 25 / 0 / 0, no runtime skips on the Radeon RDNA2 iGPU (32.0.21043.5001, Ryzen 7 system), and 25 / 0 / 0, one native-wave64 skip on the RTX 2080 SUPER. These runs leftXCL_COMPACT_NESTunset; the threshold unit test exercisesautoexplicitly.The RTX 2080 SUPER failed
placed_title_textures_share_vram_and_preserve_pixels(cubemap VA reuse assertion),transitions_apply_when_their_list_is_submittedandd32s8_targets_take_their_own_size_of_video_memory(bothPoisonError). The same three failures were visible before an earlier run timed out and also on the separate #1338 checkout. That is not a matched-parent comparison, so I am not classifying them as regressions or declaring this suite green. The RTX 5080 workspace and Radeon filter initially aborted with0xc0000005in DXC 1.6.2112.16; selecting DXC 1.9.2609.5 viaXCL_DXC_DIRresolved both aborts on the same checkout.Exact-parent follow-up: The original trio matches the symptoms tracked in #718. On each system above, I ran
cargo test -p xcl --lib --locked -- --test-threads=4 --nocapturein four separate processes ordered parent (95e8abcfd8eb2da975255e5ea2c85ed2d812f37f), head (5040ea1ef4807af4732dcbfaed1789226c39c4e0), head, parent. Same adapter, DXC and build settings per system; 25 runtime skips per library run.The three original D3D12 failures did not recur on either revision in this sample. The one distinct failure was
atomic_writes_preserve_xcltmp_blobs_and_skip_leftover_temps, on the second RTX 2080 SUPER head run. This is an observation, not an attribution to this PR. The original red workspace result is unchanged.Not tested
Retail smoke, full AMD workspace, opt-in
autoon a retail program, performance, or a repeated matched full-workspace comparison.AI use
Ran via Samaritan:
openai/gpt-6.2-sol): planned and ran these checks, diagnosed the toolchain issue, verified the saved test logs and wrote this report.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T00:49:46Z.
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.Imported from ivall/xcl. Originally posted by Pipodi on 2026-11-27T15:46:56Z.
@DavidM1911 Rebased onto current main (
623d02e4); the suite rerun and the smoke pair on the new head are updated in the description.Imported from ivall/xcl. Originally posted by Pipodi on 2026-11-27T19:11:34Z.
@DavidM1911 rebased onto current main (
6089122a); new head78f7e96c. The whole suite and a smoke pair were rerun, see the description. Ready for a retest when you have time.AI use: Claude Code (Claude Opus 5.5)
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T11:43:42Z.
Independent Windows/NVIDIA check of #2018 head
e2ab3ca2, including its stacked compact backend, on the RTX 3080 Ti.Tested: Windows 11 build 26300, RTX 3080 Ti 12 GB / driver 621.35, Ryzen 7 9800X3D, rustc 1.99.1 MSVC, DXC 1.8.2502.11.
cargo build --offline --locked -j 4 --workspacepassed.cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4completed with 2,162 passed, 10 failed, 48 ignored, and 26 explicitSKIPPEDnotices. The 10 failures are the same named tests in the clean-maine429936ccontrol run on this machine with the identical command: 2,125 passed, 10 failed, 48 ignored, 25 skip notices. The additional skip here isgpu_compact_native_wave64_formbecause this GPU has no native wave64.With
XCL_COMPACT_NEST=autoin a fresh process,cargo test --offline --locked -j 4 -p xcl --lib compact -- --test-threads=4passed 52/0/0 in 8.08 s, with one explicit skip (gpu_compact_native_wave64_form: no wave64). The newauto_nest_starts_at_the_case_thresholdand cache-identity tests passed.gpu_compact_nested_dispatchalso ran and passed with no skip. I reviewed the top commit's opt-in routing and cache-key separation and found no new correctness issue.Not tested: cold NVIDIA driver compile time for a 512–697-case program, GPU output specifically selected by
XCL_COMPACT_NEST=autoat that threshold, a title run, AMD/Intel. The existing nested GPU test uses an explicit group size, while the new test verifies theautodecision and generated HLSL.gpu_compact_sample_big_csdoes no sample run withoutXCL_SAMPLE_BIG_CS; I did not set that variable. These results establish current-head test parity on this card; they do not measure the performance threshold.AI use: Codex (GPT-6.2 Sol) built and ran the suite and compared it with the exact-main control; Codex (GPT-6.2 Astra) independently reviewed the top commit's routing and cache logic.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:12:11Z.
Triage (#1607) – head
5c14a4aStacked on #1692 (on #1448 and #1316's rebased commits); only
5c14a4abelongs here, and #2025 is stacked on it to make it the default. The lines shared with #1692, #1448, #1316, #1315, #1548 and #2025 are the stack's base commits; no other PR addsXCL_COMPACT_NEST=auto(Nest::Auto,resolve_nestincompact_at, the_c_nacache tag).No problems found in the diff.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-01T14:36:55Z.
Rerun on the new head (
f141b9d5): this PR's commit is unchanged; it was rebased onto #1692's new head5d9d3209. The earlier report, on5c14a4aa, is below.merge-check
base:
6bfb5c5153head:
f141b9d51dmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2943 passed, 0 failed, 51 ignored (#1692's new head merged alone: 2941 passed, 1 failed (xma2, the #3551 race), so 2942 tests; base: 2904); SKIPPED: 26 (23 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same set as #1692 merged alone; failing: none
review:
git range-diff:f141b9d5=5c14a4aa, and the stack below changed only #1692's warm-settings test (auto->32). The earlier review stands, except one line: no warm-settings test usesautoany more. That is fine, because the warm key compares raw values andautoentries have their own_c_naname.tests_compact::+compact::withXCL_COMPACT_NEST=auto: 34 passed, 3 of 3 runs.performance: as below (opt-in; the default path is unchanged).
verdict: safe to merge
hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)
Earlier report on
5c14a4aa(baseb2b1f109)Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T21:09:37Z.
Follow-up review (head
f141b9d5, since5c14a4a, diff read, not a merge-check):f141b9d5belongs here (88+/18- ingpu/recomp/compact.rsandpso.rs), unchanged since5c14a4a; the rest of the total is the #1448 / #1692 stack. The only edit below it is #1692's warm-settings test now using32instead ofauto.New: none.
Fine:
resolve_nestruns incompact_atafter the distinct texts are counted, soautobecomes a group size per program;compact_withkeeps its signature; the cache tags_c,_c_n<P>and_c_nastay apart, and the translator source hash coversNEST_MIN_CASESandAUTO_GROUP;auto_nest_starts_at_the_case_thresholdchecks the nested form at the threshold and that one case below gives text identical to the flat form.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Pipodi on 2026-12-02T15:59:18Z.
Closing: main's direct DXIL path now has its own compact dispatch and nesting (
dxil/kernel.rs, #2034, #2174), and with the defaults this stack'sgoes_direct(direct_on, compact_routed)(pso.rs) takes the programscompact_wantedpicks away from it and sends them back through HLSL and DXC, the form that never finished compiling on AMD (ActivateRays, @Nmopqr333). Foniass's #1316 triage reached the same conclusion. If the packing across words inpick_targetsstill pays off, it can come back as a small PR against the direct translator.AI use: Claude Code, Claude Opus 5.5 audited the stack; closed by the author.
Pull request closed