Repository navigation
Description
Part of #2088 and #2508. Related to #2741, #2301 and #2080.
What happens on main
The direct translator selects a compact or ordinary lowering before it asks the dispatch splitter to plan pieces. The compact emitter keeps the current and next block indices in local alloca slots, and uses the same scheme for loop budget and guest register state. XCL's optimizer leaves the live dispatch locals in the module. Shader::split_compute rejects Alloca and ordinary local loads/stores before it reaches the CFG planner. As a result, choosing compact emission can turn a shader with a valid ordinary chain into a whole-only build. Native wave64, group shape, barriers and other split restrictions still apply. Form selection · Dispatch-local state · Optimize then split · Split restrictions
There is a second constraint even if the locals are promoted to SSA. Compact emission sends every class around the same dispatcher back edge. The resulting strongly connected component stays together in the partitioner, which refuses a component above four times its instruction target. In a standalone Linux probe using the extracted main optimizer and partitioner, the optimizer kept two live dispatch-index allocas. Separately, an artificial acyclic graph with 40 bodies produced 14 pieces at a test limit of 32, and the same body sizes behind a shared dispatcher back edge produced no plan at that limit. This checks the two mechanisms on synthetic IR. Retail eligibility and latency remain to be measured. Loop emission · Partitioner
Proposed work
- Test a synthetic guest compute program for which the ordinary form yields a valid chain and compact emission yields a valid whole PSO. Log the selected form and the actual split rejection condition. Respect forced compact, forced plain and split-disabled settings.
- On automatic selection, compare compact whole with the eligible ordinary chain on records observed before world entry. Keep the ordinary chain and optional whole fallback separately measurable. Reuse the existing descriptor and ABI checks, including Shaders: record and prewarm chain-ABI whole PSOs demanded before world entry #2741's proposed request identity for fallback capture. Measure native creation and peak commit, plus GPU time with the real dispatch slabs and barriers. Include the cost of a cold whole fallback wherever the caller can need one.
- If a combined representation is worth pursuing, try partitioning the ordinary CFG first and applying compact lowering only within selected legal regions. Promotion of compact scalar locals can be investigated independently. The work in itsSio/xcl#3 promotes static scratch arrays, which is adjacent to the local-memory check. A partitioning experiment also needs to preserve cross-piece liveness, barrier legality and dispatch semantics.
#2301's proposed size retry is a useful independent whole-form candidate. A comparison should track whether a smaller whole artifact replaces a useful chain, because the whole byte count alone omits the lost execution option. The end point is time to the first textured world frame with matching output and no increase in skipped work or device removals.
AI use was OpenAI Codex (GPT-6, exact serving variant unavailable) for static analysis, standalone Linux probes and drafting.
Activity
CryingLaughing commentedon Nov 26, 2026
I tested an opt-in implementation that keeps the compact whole fallback and retains compatible ordinary dispatch pieces. The branch is
fe87896d84ad581ac8a25b275d0889eaf938f2b0, based onb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7. It requires matching ordered static samplers and gives the option its own cache identity.cargo build --workspace --locked -j 4andcargo test --workspace --locked -j 4 -- --test-threads=4 --show-outputpassed. 1,437 passed, 0 failed, 47 ignored, including 29 capability skips in the pass count.RTX 4080 driver 621.01, i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 x64 MSVC and DXC 1.8.2502.11. The 24-piece case exercised CPU translation and DXIL validation. Retail smoke and native compile timings for large shaders remain untested.
Current-main integration
I merged main
8b957bec6f82495aec940944c6bf47faa02db590with preserved headfe87896d84ad581ac8a25b275d0889eaf938f2b0in an isolated worktree. The clean local test commitc386deae30a164ff293f732f180e5fbb29c5acc0and the published verification snapshot have the same source treefd300287639e99f033dcf5e31e908e185e2362c0. Verification snapshotThe locked offline build passed and compiled all 37 test harnesses. Three exact synthetic CPU fixtures passed with zero failures, ignored tests, or capability skips. The rerouted disk-cache test covered 12 subprocess settings. The automatic path kept the 7,280-byte compact whole and matched the ordinary five-piece chain with 256 scratch dwords per group. The sampler-order test rejected incompatible ordinary pieces.
The serial synthetic GPU workspace suite reported 1,448 passed, 0 failed, 47 ignored. It emitted 29 explicit
SKIPPEDnotices, comprising 21 for wave64, three for unsupported Direct DXIL instructions, three for the debug layer, one for driver-cache control, and one for heap windows. The runs used Windows 11 25H2 build 26200.9974, Core i5-13600K, RTX 4080 driver 621.01, Rust 1.100.0 x64 MSVC, and DXC 1.8.2502.11.The focused library test executable ran
gpu::recomp::pso::shader_cache_tests::rerouted_disk_entries_follow_compact_nesting_policy,gpu::dxil::kernel::chain_preservation_tests::automatic_compact_can_keep_an_ordinary_compute_chain, andgpu::dxil::kernel::chain_preservation_tests::compact_chain_rejects_ordinary_pieces_with_a_different_sampler_order, each with--exact --test-threads=1 --nocapture. All runs usedCARGO_INCREMENTAL=0 XCL_NETWORK=0. The workspace execution also usedXCL_ADAPTER=4080.The matched retail smoke covers the preserved head
fe87896d84ad581ac8a25b275d0889eaf938f2b0. The new integration runs used synthetic data. Independent retail smokeNative readback on the current-main integration
I ran the existing guarded readback fixture on the integration
90918802ee4078a8e28fd76a2b1409b9cc3c2fb5with the exact fixture treec46451a4c3560517f9a2260d206a0d426bd39bc7. The test exercised the five preserved ordinary dispatch pieces and forced the compact whole fallback by withholding the allocator. The split scratch requirement was 256 dwords per group. Exact native fixtureBoth routes matched all 784 UAV words after the fence. Each comparison included 736 written words, 32 untouched words in the skipped region, and 16 tail guard words. The pieces route created zero whole PSOs. The compact fallback created exactly one. The focused run reported 1 passed, 0 failed, 0 ignored, zero capability skips on an RTX 4080 with driver 621.01, Core i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 x64 MSVC, and DXC 1.8.2502.11.
The test executable used
XCL_ADAPTER=4080 XCL_TEST_COMPACT_CHAIN_NATIVE=1 XCL_ALLOC_SWAP=0 XCL_PSO_DISK_CACHE=0 XCL_NETWORK=0and private XCL data and DXIL cache paths. The native run used synthetic data. The existing matched retail smoke covers the preserved branch headfe87896d84ad581ac8a25b275d0889eaf938f2b0. Independent retail smokeSupplemental hosted Windows verification
The fork's
windows-2025job verified the clean checkout atfe87896d84ad581ac8a25b275d0889eaf938f2b0and passed./scripts/test.ps1 --skip test_title_runs_and_game_folder_is_untouchedwithCARGO_INCREMENTAL=0 XCL_NETWORK=0. The 37 harnesses reported 1,436 passed, 0 failed, 47 ignored and emitted 350SKIPPEDnotices in the raw log. The runner used Windows Server 2025, Microsoft Basic Render Driver, and Rust 1.100.0 MSVC. The required upstream CI result remains outstanding. Exact hosted jobNormal-entry correction and large native readback
The earlier 384-dword result measured test-only slot reuse. The PowerShell runner left
XCL_SAMPLE_SLOT_REUSEpresent with an empty value, and the splitter checks whether it exists. An isolated control reproduced the archived chain bytes with that flag present. TheXCL_SAMPLE_PHI_CSEflag alone left this fixture unchanged. I fixed the runner to remove absent variables and reran the five CPU cases on the preserved headfe87896d84ad581ac8a25b275d0889eaf938f2b0. All five passed with zero skips. Automatic lowering with preference on matched the ordinary 24-piece chain with 2,400 scratch dwords per group, and its whole matched the 4,524-byte forced compact output.The current-main integration also passed six fresh CPU controls with zero failures, ignores, or skips. Forced ordinary and automatic-with-preference were byte-identical for all 24 pieces and the scratch layout with both test-only flags unset. Forced compact and automatic were byte-identical for the whole shader. Exact current-main fixture
On the RTX 4080 with driver 621.01, the 142,092-byte guest shader then ran through its 24 pieces and through its forced compact fallback. Both routes matched 7,696 UAV words after the fence, including 7,648 writes, 32 skipped-region words, and 16 tail guards. The pieces route created zero whole PSOs. The fallback created one. The focused native result was 1 passed, 0 failed, 0 ignored, zero capability skips. The test used Windows 11 25H2 build 26200.9974, Core i5-13600K, Rust 1.100.0 MSVC, and DXC 1.8.2502.11.
The CPU recorder writes
ordinary/chain.binandcompact/whole.dxilin separate processes usingXCL_DIRECT_COMPACT=0and1respectively, withXCL_TEST_COMPACT_CHAIN_TRANSLATION_DIRset to the corresponding output folder and the split limit at 2,048. The serial native process setsXCL_TEST_COMPACT_CHAIN_REFERENCE_DIRto their parent directory and usesXCL_ADAPTER=4080 XCL_TEST_COMPACT_CHAIN_NORMAL_ENTRY_NATIVE=1 XCL_DIRECT_PREFER_SPLIT=1 XCL_DIRECT_SPLIT_INSTRUCTIONS=2048 XCL_ALLOC_SWAP=0 XCL_PSO_DISK_CACHE=0 XCL_NETWORK=0. It removesXCL_DIRECT_COMPACT,XCL_SAMPLE_SLOT_REUSE, andXCL_SAMPLE_PHI_CSEfrom its environment. The existing retail evidence remains attached to the preserved head.AI use
Upstream review status
The description draft for preserved head
fe87896d84ad581ac8a25b275d0889eaf938f2b0now passes the current description checker locally, including Anon64’s matched 60-second retail smoke. It also includes the corrected 2,400-dword default stride. The exact head has full local GPU results and a supplemental hosted Windows pass on the fork. The official upstream Windows CI run finished with zero jobs. Matched retail smoke · Upstream CI recordWould an upstream maintainer confirm whether a person should reopen #2810 at that exact head and whether a maintainer with write access can approve the upstream Windows workflow if it awaits approval? The description job also shows GitHub’s event-policy warning for December 2. For a reopening after that date, confirmation that the upstream description workflow can run would establish the path for that check. The PR remains closed pending confirmation. GitHub Actions event policy
Exact-head serial verification
On clean preserved
fe87896d84ad581ac8a25b275d0889eaf938f2b0, the locked offline workspace build passed. The serial workspace suite on an RTX 4080 with driver 621.01 reported 1,437 passed, 0 failed, 47 ignored across 37 harnesses. The two chain-preservation unit tests passed with zero capability skips. In the whole suite, the 29 explicit notices comprised 21 wave64 cases, three unsupported instructions, three debug-layer cases, one driver-cache control, and one heap-window case. This run used Windows 11 25H2 build 26200.9974, Core i5-13600K, Rust 1.100.0 x64 MSVC, and DXC 1.8.2502.11.OpenAI Codex (GPT-6, exact serving variant unavailable) ran and checked this serial comparison. The preserved head is the one used in Anon64’s matched retail smoke. Exact-head smoke