dxil: collapse forward s_cbranch_execz regions and make read-only loads branchless #1834
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!1834
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1834"
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?
@raylitebull on GitHub · 2026-11-24 21:37 UTC · original
raylitebull:fix/dxil-block-collapse→main· +1348 −69 · 8 files · 3 commits · openEliminates pathological basic-block and CFG blowup in the direct RDNA2 -> DXIL translator on large compute shaders by lowering read-only memory loads branchlessly and collapsing side-effect-free forward
S_CBRANCH_EXECZregions, cuttingActivateProbes(56c0cd3b82a00c6e) from 21,302 blocks to 396 (53.8x fewer) andamdxc64.dllcompile RAM from a +25.7 GB OOM spike to 2,737 MB (unblocking #1809 on AMD).Part of #1269 and #1673; unblocks #1809.
Why this exceeds ~800 lines: the production change combines two closely coupled CFG-reduction passes (
with_mem_load_i32sbranchless read-only loads inlower_mem.rsso load diamonds don't block region merging, pluscollapse_execz_regions+ backward scalar liveness incfg.rs),#2034/#2076compactcompatibility (compact.rs+plan_withbefore collapse inkernel.rs), and#2207reload.rsCfgOpsupport (killing cached scalar loads onRestoreIfExecZ), while the remainder consists of CFG unit tests, the GS-entry geometry regression test ingeometry_tests.rs, and the GPU differential test incore_tests.rs.What is in it
crates/xcl/src/gpu/dxil/lower_mem.rs: addwith_mem_load_i32sandsafe_load_addrfor read-only loads (mem_ld,mem_ld_n,ld_raw_guarded,ld_raw_u32_guarded, single-componentFormatLoad,smem), clamping out-of-range windows/inactive lanes to window 0 (MEM_HEAP_BASE + 0, which remains readable via root-heap clamping regardless of#1992descriptor offsets) / byte offset 0 and selecting 0 on inactive lanes while keeping stores and atomics guarded.crates/xcl/src/gpu/dxil/cfg.rs,compact.rs,compact_tests.rs,reload.rs,kernel.rs, &geometry_tests.rs: runcompact::plan_withbeforecollapse_execz_regionsinkernel.rs(preserving#2034/#2076compact forms viacompact::wanted(cfg, p, tables),sampler.is_some()inplan_with'sCfgOp::Instarm,CfgBlock::ops,SaveExecZ/RestoreIfExecZin class key &emit_with_nest, andcfg.orig_leadersincompact_tests.rs); updatereload.rsforCfgOp(including killing cached scalar loads onRestoreIfExecZ { regs }); on non-compact CFGs with >= 128 blocks (EXECZ_COLLAPSE_MIN_BLOCKS), collapse acyclic forwardS_CBRANCH_EXECZregions (<= 2048 ops) in reverse RPO when all instructions pass a strict side-effect-free allowlist and abstract interpretation provesEXEC == 0, preserving the GS entry block boundary (gs_block) and only live-out modified scalar registers viaSaveExecZ/RestoreIfExecZ(u128backward scalar+SCC liveness); add 4 CFG unit tests plusgeometry_execz_collapse_preserves_gs_entry_boundaryandgpu_geometry_collapsed_execz_preserves_gs_entry.crates/xcl/src/gpu/dxil/core_tests.rs: keep#2180'swindow_at_lowers_to_32bit_carry_without_int64and#2173'sdot8test alongside GPU differential testcollapsed_execz_kernel_matches_hlsl_on_gpuverifying bit-exact equivalence against HLSL acrossEXEC=0, partialEXEC, and fullEXEC.Tested
rustc 1.99.1 (58cf8f9c3 2026-10-13), DXCdxcompiler 1.8.2502.11/dxil 1.8.2502.11, rebased cleanly onto569f0fc5(b0b2d8a0).cargo test -p xcl --lib(gpu::dxil::cfg::4/4,gpu::dxil::reload::6/6, non-GPUgpu::dxil::compact_tests::6/6): 16 passed, 0 failed (2.30s,dxil 1.8.2502.11validated).86f526ccpassedcargo check --workspace --tests,d899eb5passedgpu::dxil::geometry_tests(2/2), and pre-GS headb1cae38passed RX 9070 XT (976pass,@eizispark) + RTX 3090 (@WebIdentity1).Regression run
scripts/smoke.ps1pair and GPU tests onb0b2d8a0vs569f0fc5have not been run locally yet. AMD and NVIDIA reviewers are invited to verifyb0b2d8a0vs569f0fc5(geometry_tests,core_tests,compact_tests,reload,scripts/smoke.ps1, and56c0cd3b82a00c6ecompact output) and post results in the comments.Not tested
geometry_tests,core_tests) and 60 sscripts/smoke.ps1pair onb0b2d8a0, fullcargo test --workspacesuite onb0b2d8a0, wave32-only AMD adapters, and Linux/Wine/vkd3d-proton.AI use
569f0fc5, CFG/liveness design, and test verification; the author reviewed the diff and test output.@HKEY-Funk-Machine on GitHub · 2026-11-24 21:56 UTC · original
@raylitebull the long
XCL_DIRECT_DXIL=1title run you asked for, on AMD RDNA4 (RX 9070). #1834 nearly halvescs 56c0cd3b82a00c6e's driver time in the title (151.5 s, against 282 s onc4d37be's parent4178e88with the same settings).cs 95cc13288a27a96estill doesn't build: about 6 min into its driver compile, process memory rose from ~47 GB to 104 GB in ~70 s, the next builds returned0x8007000E, and XCL aborted on a failed 1.5 MB allocation (0xc0000409).Tested
4ed0c2d+ #751, plus two local-only changes: skipInitializeApiImplEx2inxgameruntime/api.rs(hangs here), and a log line before and after each computeCreateComputePipelineState. Release.XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_TRANSLATED_CACHE=0 XCL_PSO_DISK_CACHE=0 XCL_NETWORK=0, A pressed withXCL_PRESS_A_AT(every 2 s from 8 to 90 s), 30 min limit,xcl.execopied to a new name so the AMD driver's cache was cold. Process memory sampled every 2 s.4178e88(#1748), same settings4ed0c2d(#1834)cs 56c0cd3b82a00c6ecs 95cc13288a27a96e0x8007000Eafter 996 s0x8007000E0xc0000409, at 8.4 min (memory allocation of 1572864 bytes failed)cs 56c0cd3b82a00c6efinished it fell to ~43 GB. Then, withcs 95cc13288a27a96ethe only large build in the driver, it climbed 47 → 72 → 95 → 104 GB between 16:48:04 and 16:49:16. So on this driver, the late phase of that one compile seems to need ~55 GB or more on its own. I did not separate it from the title's other activity, though (no isolated build).Not tested
cs 95cc13288a27a96ebuilt alone outside the title;scripts/smoke.ps1pairs (my tree needs the localapi.rschange to start, so it isn't the clean head the script requires); the full suite on4ed0c2d; switch windows with #1834; more than one run.AI use: Claude Code (Claude Opus 5.5) built the tree, ran the title unattended with the memory sampling, read the logs and wrote this comment.
@eizispark on GitHub · 2026-11-24 22:41 UTC · original
Hardware test report — commit
b1cae38Verified
b1cae384a163b97db59a80c57fd3182c2517a5d5(rebased ontomain689f2db477c3c062cf162649781640ef8a977c18, clean merge): pass (0new failures vsmain689f2db).Tested
32.0.32015.16001), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 x64,rustc 1.100.0 (0ef1bc386 2026-11-09), debug tests + release smokecargo test --workspace --no-fail-fast -- --test-threads=4 --skip gpu::dxil::msaa_tests::gpu_direct_msaa_image_loads:976 passed, 2 failed, 45 ignored(8 skipped), vsmain689f2db972 passed, 2 failed, 45 ignored(8 skipped) on this adapter:--skip gpu::dxil::msaa_tests::gpu_direct_msaa_image_loads) and the 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1,gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_3) are pre-existing onmain689f2db(#1679) on RDNA4;0new failures8 skipped: 6gpu::recomp::lower_dxil::testsf16/f32 direct-DXIL per-lane cases refused where#1426semantics differ from the console's;shaders::tests::pso_measurement_compiles_an_exact_synthetic_record(Windows Developer Mode required,0x887A002D);heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowsgpu::dxil::cfg::tests(4/4passed:loop_entered_in_the_middle_is_split,live_out_scalar_reg_is_saved_and_restored,nested_execz_collapses_to_single_block,unsafe_execz_regions_are_not_collapsed),gpu::dxil::core_tests::collapsed_execz_kernel_matches_hlsl_on_gpu, and native RDNA4 wave64 GPU tests (gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,console_wave64_compute_through_the_pso_hook_dispatch_and_read_back) all passedRegression run (
scripts/smoke.ps1, 60 s, warm shader/driver cache)main(689f2db477c3c062cf162649781640ef8a977c18):PR (
b1cae384a163b97db59a80c57fd3182c2517a5d5):Not tested
XCL_SAMPLE_*pack benchmarks, gameplay past the menusAI use
@minimalhipster990 on GitHub · 2026-11-24 22:19 UTC · original · edited 2026-11-24 23:01 UTC
XCL #1834 on a GeForce RTX 4090 — ActivateProbes
24 November 2026 · Direct DXIL · Four heap-backed memory windows
The PR reduced the retail compute entry point from 21,303 to 397 basic blocks on this wave32 adapter running a split-wave64 program. Median first pipeline creation changed from 117.46 s to 79.55 s (-32.3%). PR #1834 · Shader optimization tracker #1269
Results
Times and memory figures are medians with the observed minimum and maximum in parentheses. Memory is process-private Windows commit. The driver peak includes the device, root signature, bytecode and driver allocations in the process.
c4d37be4ed0c2dFor context, the RX 9070 title run on this same record reported 282.4 s and 151.5 s. That run used a different baseline, local changes and a live title. The RTX 4090 comparison here isolates the PR from its immediate parent. RX 9070 title measurements
BASE: six timed translations and 2/2 completed first PSO attempts. Median private memory immediately before the two calls was 99.0 MiB and 100.9 MiB respectively.
PR: six timed translations and 4/4 completed first PSO attempts. Median private memory immediately before the two calls was 98.5 MiB and 101.7 MiB respectively.
The PR had the shorter first PSO time in 2/2 matched rounds. The immediate repeat is a separate warm measurement.
Using only the 2 shared rounds, with order reversed in the second round, the first PSO medians are 117.46 s on base and 80.81 s on the PR (-31.2%). The table also includes the extra samples collected for the faster arm.
Validation and scope
indirect_diffuse_lighting:CS_ScreenProbes_ActivateProbes_9083c094_Wrapped. Its inflated Xbox blob was 21,140 bytes, FNV-1a56c0cd3b82a00c6e; the selected compute program contained 488,744 bytes of ISA with an 8×8×1 thread group. The runtime adapter query selected split wave64 on the RTX 4090.mainagrees with one entry plus the explicit labels (21,302 on base, 396 on the PR). This convention and the split-wave configuration matter when comparing counts and container sizes with the PR author's native-wave results.Reproduction
c4d37bec1bb4286eb373aea963404a23f13401fa, head4ed0c2d1f1e18915607b92e01da3f8bba367feae. Both used locked release builds and the same measuring code. Commit comparisonkernel::translate_computeentry point withXCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=1,mem_windows=0x104and sampler base zero. The direct translator emitted and signed DXIL. DXC compilation was used only for the synthetic HLSL reference.CreateComputePipelineStateonly, using XCL's compute ABI root signature and the actual retail static sampler. Both revisions used fresh serial processes, unique executable paths, identical driver settings and no application-provided PSO blob. Within each round the revision order alternated. The plan allowed four driver rounds per arm, reduced to two if the first process took over 90 s. Each attempt had a 12-minute ceiling, a 24 GiB private-commit guard and a 5 GiB system commit reserve.PROCESS_MEMORY_COUNTERS_EX.PeakPagefileUsage) was captured immediately after each timed stage. A fresh process for each stage isolates translation from driver memory. The driver peak is the process lifetime high-water mark through the first PSO call. It excludes GPU VRAM and kernel allocations outside the measuring process.0x887A002D. First calls are fresh-process observations. Persistent driver caching could influence the timing; immediate repeats were recorded separately. A full title run and frame time were outside this benchmark.The per-trial table and machine-readable results include every timed observation. The files
trials.csvandresults.jsonare retained locally.The retained harness can be rerun from the local benchmark directory with the pinned checkouts and local dump. Run the commands sequentially.
OpenAI Codex prepared the harness, ran the benchmark and drafted this report.
XCL #1834 on RTX 4090 — smoke and world-entry tests
The PR compiled ActivateProbes 39.581 seconds faster in the running game (30.4%). Both builds reached the loading spinner after first-run setup. Neither produced a verified frame of the playable world during observation. The last two-second interval with any presents ended at 172.1 seconds on both builds. Compilation continued after that point. XCL PR #1834 · Shader tracker #1269
60-second smoke test
689f2dbb1cae380x00x0The PR produced seven more frames with 16 MiB higher peak commit. One run per build covered startup without menu input. This test does not measure gameplay FPS.
World loading
The same scripted gamepad input selected Confirm setup and start the game at 123 seconds on each fresh profile. I checked the presented images saved by XCL and the live game window. Both showed the loading indicator and later a black window reporting 0.0 FPS. The DirectStorage and driver logs continued after the visible transition.
689f2dbb1cae380x0(903.1 s wall clock)What the driver completed. Durations below come from paired XCL driver-compile start/finish sequence numbers in the retail process. XCL recorded no supplied driver blob for either shader at the start of these calls.
56c0cd3b82a00c6e(ActivateProbes)95cc13288a27a96eThe base reached the monitor's low-system-commit threshold with the second compile outstanding. That stop leaves its eventual compile time unknown. The PR completed both shaders and moved on to other pipelines. The last presents on both builds preceded these two driver calls, so the logs do not establish that either shader caused presentation to stop. Both builds also logged DirectStorage request errors including
0x89240009. Neither run logged an unhandled exception or device removal. The PR’s final report counted 3,612 frames shown and 3,612 PresentX calls, all accounted for by the activity intervals through 172.061 s.Reproduction and scope
7850d621. NVIDIA GeForce RTX 4090, driver 621.24, AMD Ryzen 7 5800X3D, 32 GB installed RAM, Windows 11 build 26300. Rust 1.99.1 MSVC, DXC/DXIL 1.9.2602.17.689f2db477c3c062cf162649781640ef8a977c18and its direct childb1cae384a163b97db59a80c57fd3182c2517a5d5, built withcargo build --release --locked -p xcl --bin xcl. The executable used for each smoke test and long run matched its build's SHA-256.scripts/smoke.ps1 -Game <folder> -Seconds 60 -Xcl <release-exe>. Long runs usedxcl run <folder>, XCL activity logging, frame readback every 60 frames and a 900-second in-game limit. Process private bytes and available system commit were sampled about once per second. The monitor stopped a run after three samples below 1 GiB available system commit, or any sample below 256 MiB. XCL's activity intervals are two seconds. Timings in the table use the game log's clock unless marked as a monitor measurement.Original smoke output
Base
PR
@grahamster2 on GitHub · 2026-11-24 23:03 UTC · original
Test report for 4ed0c2d on NVIDIA.
Tested
1d027e5(one CI-only commit after your basec4d37be), built the same way.cargo build --workspacethencargo test --workspace --no-fail-fast -- --test-threads=4: 963 passed, 0 failed, 43 ignored. main: 959 passed, 0 failed, 43 ignored. Same 22 SKIPPED lines on both (21no wave64/refusedlower_dxil and lower tests, 1no heap windows).scripts/smoke.ps1, 60 s, same title:main:
PR:
XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_PSO_WAIT_MS=50, each build with its own empty driver-blob cache and the NVIDIA DXCache cleared first:56c0cd3b82a00c6e(ActivateProbes): direct DXIL 3,885 KB on main, 3,328 KB here (-14 %).95cc13288a27a96e: 3,246 KB to 3,106 KB. Neither driver compile finished on either build: the title crashed 10-20 s after they started (the same0xc0000005null write inside the title on both, about 60 s after the world loads). So I have no NVIDIA compile time or compile RAM for those two.Not tested
AI use
@raylitebull on GitHub · 2026-11-24 23:10 UTC · original
@thehollowedone Thank you for the sharp split-wave64 geometry retest on
b1cae38— that's a great catch on preserving the GS entry block boundary when crossing the EXECZ collapse threshold afterS_SETPC_B64handoff.We'll preserve the GS entry boundary during block merging in
cfg.rsand add that extended 70-branchbranchy_programscenario togeometry_tests.rsas our next update to#1834.@raylitebull on GitHub · 2026-11-24 23:45 UTC · original
@thehollowedone Pushed
c1acabc(fix/dxil-block-collapse, rebased onto62265d3):gs_block) during block merging incrates/xcl/src/gpu/dxil/cfg.rs.S_CBRANCH_EXECZ +1afterS_SETPC_B64geometry scenario (geometry_execz_collapse_preserves_gs_entry_boundary+gpu_geometry_collapsed_execz_preserves_gs_entry) tocrates/xcl/src/gpu/dxil/geometry_tests.rs.If anyone on AMD or NVIDIA can verify
gpu::dxil::geometry_testsand post a fresh 60 sscripts/smoke.ps1pair onc1acabcvs62265d3, that would be greatly appreciated.@WebIdentity1 on GitHub · 2026-11-24 22:34 UTC · original · edited 2026-11-25 00:00 UTC
Update: geometry-boundary repair verified on exact head
c1acabc095db07352e86220edf6e57504b538b79.Native Windows 10 19045, Ryzen 7 7800X3D, RTX 3090 driver 591.74, Rust 1.98.1 MSVC, DXC 1.8.2502.11, debug;
XCL_ADAPTER=3090,XCL_SPLIT_WAVE64=1.cfg.rsrestored fromb1cae38: 3 passed / 2 failed / 0 ignored, zero skips. The new static check reports the GS entry merged into ES; the GPU record test produces zeros, including counts0,0instead of72,5. The other three tests pass. This isolates the new boundary repair.c1acabc; no competing patch.Not tested on this head: retail smoke, the full workspace suite, AMD/native wave64, or new timing/memory measurements. The older timings below belong to
b1cae38only. This answers the requested Ampere geometry check; exact-head retail smoke remains outstanding.AI use: Codex with GPT-6 Astra inspected the repair, prepared the negative control, ran the Windows checks and drafted this update.
Earlier b1cae38 comparison and its limits
RTX 3090 validation of exact rebased head
b1cae384a163b97db59a80c57fd3182c2517a5d5againstmain689f2db477c3c062cf162649781640ef8a977c18. Native Windows 10 19045, driver 591.74, Rust 1.98.1 MSVC,XCL_ADAPTER=3090; synthetic fixtures only.Tested
cargo build --locked --workspace: exit 0 on both revisions.cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --show-output: main 973 passed / 2 failed / 45 ignored, PR 978 passed / 1 failed / 45 ignored, across 20 targets, with 25 explicitSKIPPEDlines each.gpu_clamp_and_omod_per_instructionfailed on both.d32s8_targets_take_their_own_size_of_video_memoryfailed only on main; this PR does not change that path. No PR-only failure.collapsed_execz_kernel_matches_hlsl_on_gpupassed 1/0/0 with a test-only prerequisite guard that asserted and printedNVIDIA GeForce RTX 3090, split-wave64 support and DXC, preventing its normal silent early return.I also measured the same public, test-only nested-EXECZ kernel on both exact revisions, with two fresh shader sizes and reversed run order. Every GPU run passed and the checked outputs matched:
The timed interval includes pipeline creation and dispatch/readback; it is not a pure driver compile measurement. These two synthetic first-use observations are directional, not a retail workload or a stable latency distribution. Six 310-file source snapshots were SHA-256 checked before and after the remote runs. The author’s new head already includes the geometry merge and cache version 8, so I have no competing patch to propose.
Not tested: retail smoke/gameplay, memory peak, AMD/Intel, and long world-loading behavior. The exact-head retail smoke gate is still pending; the common CLAMP failure prevents a clean full-suite claim on this machine.
AI use: Codex desktop (GPT-6) prepared the synthetic test overlays, ran the Windows checks and drafted this report; all figures above come from the retained raw logs.
@thehollowedone on GitHub · 2026-11-24 22:05 UTC · original · edited 2026-11-25 00:05 UTC
Tested
On
4ed0c2d1, I ran the stock EXECZ-collapse fixture on the RTX 3080 Ti and then extended it with four asymmetric masks. These included upper-half-only activity, lower-half-only activity, an inner mask in the opposite half that leaves no active lanes, and full launch EXEC narrowed to the upper half.The 70 nested regions collapsed to one block as expected. For all seven cases, direct DXIL and HLSL agreed on both output VGPRs across all 64 emulated lanes, restored EXEC, SCC and the live scalar register. The two VGPRs and the scalar register also matched a separate CPU calculation.
Windows 11 build 26300, RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Rust 1.99.1 MSVC debug, DXC 1.8.2502.11.
cargo test --offline --locked -p xcl --lib collapsed_execz_kernel_matches_hlsl_on_gpu -- --nocapture --test-threads=1passed 1/1 as shipped and 1/1 with the added masks. Zero skips. The extended fixture required this adapter and forced split wave64.Not tested
This covers synthetic branch collapse and scalar liveness. Retail driver compile time and the changed memory-load path were outside this check.
AI-assisted. Codex (GPT-6 family, exact variant unavailable) extended and ran the fixture and drafted this report.
Formatted-load retest on the same revision
I ran
BUFFER_LOAD_FORMAT_Xon the RTX 3080 Ti in split wave64, with two configured memory windows. The 16-bit signed normalized input started at byte 3 of a dword, so the load crossed a dword boundary. Both HLSL and direct DXIL passed with root-UAV switching and with descriptor-heap windows.Across all four dispatches, the 32 active lanes decoded the expected values from window 1 and got zero for a view outside the configured windows. The other 32 lanes kept both destination registers at their initial values. Window 0 held different data at the same low offsets. All 64 lanes per dispatch matched the CPU expectations.
cargo test --offline --locked -p xcl --lib scratch_formatted_load_preserves_split_wave_masks_and_windows -- --nocapture --test-threads=1passed 1/1. The stockgpu_heap_windows_reject_out_of_uma_aliasingalso passed withXCL_DIRECT_DXIL=1. Zero skips. These are synthetic readbacks on the same hardware and toolchain listed above.Geometry retest on b1cae38
The stock geometry readback passed. A scratch extension exposed a split-wave64 regression when geometry crosses the EXECZ collapse threshold. In
branchy_programfromgeometry_tests.rs, immediately after the GS initializes EXEC, add 70 forwardS_CBRANCH_EXECZ +1branches, each skipping a singleV_MOV_B32 v52, 1.0, and omit the original unconditional move tov52. Keep the existing ESS_SETPC_B64handoff and the 25-primitive draw.The PR reduced the CFG from 147 to 6 blocks. HLSL matched the CPU model. Direct DXIL returned zero vertices and triangles in the first group, where the model expected 72 vertices and 5 triangles. A local control that preserved the GS entry during block merging reduced the CFG from 147 to 7 blocks and restored exact record readback on both paths.
On the same RTX 3080 Ti and toolchain,
cargo test --offline --locked -p xcl --lib gpu::dxil::geometry_tests:: -- --nocapture --test-threads=1passed 3/3 with that local control, including the extended fixture. The four CFG unit tests and the stock collapsed-EXECZ compute GPU test also passed. Zero skips. This retest used synthetic shaders and did not measure retail world load.AI-assisted. Codex (GPT-6 family, exact variant unavailable) extended the fixture, ran the tests, and drafted this update.
Geometry fix retest on
c1acabcFollowing up on the retest request. On an RTX 3080 Ti (621.35), Windows 11 build 26300, Rust 1.99.1 MSVC and DXC 1.8.2502.11,
cargo test --offline --locked --release -p xcl --lib gpu::dxil::geometry_tests -- --nocapture --test-threads=1passed all four tests with zero failures, ignored tests or runtime skips.The new 70-branch fixture preserved the GS entry and matched the expected live geometry records on the GPU in split wave64, including 72 vertices and 5 triangles in the first group. Retail world loading and AMD remain unverified in this check.
AI-assisted. Codex (GPT-6 family, exact variant unavailable) ran the tests and drafted this update.
Rendered-output check on
d899eb5On the RTX 3080 Ti (621.35), Windows 11 build 26300, Rust 1.99.1 MSVC and DXC 1.8.2502.11, I extended only the test fixture. The 70-branch console shader was unchanged. The test mesh shader mapped the recorded primitive ID and vertex ordinal to six separate triangles, including one from the partial last group.
Direct DXIL and HLSL matched all 1,024 RGBA pixels in split wave64, with 54 marked pixels and a verified interior pixel for each expected triangle. Both matched the same 702 live geometry record words against the CPU expectations.
cargo test --offline --locked --release -p xcl --lib gpu::dxil::geometry_tests -- --nocapture --test-threads=1passed 4/4. The same test binary passed 4/4 withgpu::dxil::cfg::testsand 1/1 withcollapsed_execz_kernel_matches_hlsl_on_gpu, with zero skips. This covers synthetic rendering through the test mesh shader. Retail world load and native wave64 were outside this check.AI-assisted. Codex (GPT-6 family, exact variant unavailable) extended the fixture, ran the tests, and drafted this update.
@DavidM1911 on GitHub · 2026-11-25 01:03 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@raylitebull on GitHub · 2026-11-25 01:54 UTC · original
Rebased
#1834cleanly onto3da2abbin commit2a19e89, resolving thecrates/xcl/src/gpu/dxil/core_tests.rsEOF append conflict cleanly alongside#1922.Pushed
2a19e89for GitHub ActionsBuild and testand fresh AMD / NVIDIA verification (gpu::dxil::cfg::tests,gpu::dxil::geometry_tests,gpu::dxil::core_tests, andscripts/smoke.ps1).@Royalflamejlh on GitHub · 2026-11-25 02:43 UTC · original
My #2034 merged after
2a19e89was pushed, and the two now conflict. With the conflict resolved collapse-first onmaincbc296a, the compact form no longer triggers: the program your description measures (56c0cd3b82a00c6e) is 3,782,928 B of direct DXIL, wheremainhas 484,508 B (4,329,420 B with neither). Planning the compact form before the collapse (14 added lines) keeps 484,508 B, but that program and its twin then skip your collapse; the other four of the six largest keep it.Setup: Linux through Wine, no card, release.
XCL_DIRECT_DXIL=1 xcl shaders <folder> --precompile --only cs --split 1, four memory windows in the switch form (noXCL_HEAP_WINDOWS), the six largest compute programs of a retail pack, 1 translation each. Most of the blocks below are those windows' switches; your collapse took that program's conditional branches from 10,025 to 208. To build, the merge needs one hunk inkernel.rs(both sides kept) andcompact.rstakingCfgBlock::ops: 38 lines, withSaveExecZandRestoreIfExecZin a class's key and inemitas the block walk has them, and one line incompact_tests.rs.maincbc296amain, compact form off (XCL_DIRECT_COMPACT=0)2a19e89, collapse firstmain'sRead:
collapse_execz_regionsruns beforecompact::plansees the blocks (on your earlier headd899eb5it left that program as 195 blocks of 149 kinds), and the compact form is then not chosen. The lines that plan first:plan_withiscompact::plantaking the two maps it reads fromLwas arguments. Here they are empty, so a program this check takes and the full plan then refuses would get neither form; none of the six did. On the other four programs the collapse still saves 1.1 % on three and 0.01 % on the fourth.Not tested: anything on a card, the suite, your tests with these lines, and AMD, where you measured the driver's memory: which of the two forms its compiler takes better I cannot say.
AI use: Claude Code (Claude Fable 5.2) made the merges, ran the translations and wrote this comment.
Posted without review by a person: the account owner was away and reads replies later.
@JJAutoCompare on GitHub · 2026-11-25 04:26 UTC · original
Tested
Independent Arc A770 run of open PR #1834 at
2a19e89ae60f1801b8f85577896f0bff5f45592eon STOR-WINLAB. The reused checkout was clean and detached at that SHA before and after testing.Windows 11 Enterprise Evaluation x64 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust/Cargo 1.100.0 x86_64-pc-windows-msvc, DXC/DXIL 1.9.2609.5. Unoptimized tests with debug info and incremental compilation disabled. Used two Cargo jobs and prebuilt outside the Arc mutex (exit 0, 2m 43s).
1 passed, 0 failed, 0 ignored, 0 explicit skips, 1,093 filtered out, 0.36 s. The fixture and mutex wrapper each exited 0. The fixture asserted that 70 nested EXECZ regions collapsed to one CFG block. In split wave64, direct DXIL and HLSL/DXC matched all 396 checked 32-bit values across zero, partial, and full launch EXEC. The checks covered EXEC low/high, SCC, s10, v1 and v2. The final capture confirmed the Intel D3D12 driver loaded and HLSL compile workers started after the fixture's silent GPU guard. Two earlier runs passed with incomplete process evidence.
Not tested
Other fixtures, source mutations, separate memory and failure checks, native wave64 or standalone wave32, other adapters, retail titles and smoke runs, and the workspace suite.
AI use
T3 Code / Codex (gpt-6.2-sol) ran the checked-in fixture and wrote the test report.
@raylitebull on GitHub · 2026-11-25 10:38 UTC · original
Thanks for the careful
lower_mem.rsnotes,@gsucristo!Rebased
#1834cleanly onto56ec08d(d660ab6+ee55ddd):kernel.rsconflict with#2034: cleanly preservedcompact::emit+plan.is_none().MEM_HEAP_BASE + 0invariant documented (lower_mem.rs): explicitly documented the window-0 raw-UAV readability invariant inwith_mem_load_i32s(unaffected by#1992's null-view descriptor shift sincewith_mem_load_i32salways bases reads atMEM_HEAP_BASE).safe_load_addrcalls (lower_mem.rs): removed both redundantlet base_aligned = lw.safe_load_addr(base_aligned, cond);lines before multi-dwordsmem/ buffer-load loops sinceatis already clamped per iteration.Pushed
ee55dddfor GitHub ActionsBuild and testand fresh AMD / NVIDIA verification (gpu::dxil::cfg::tests,gpu::dxil::geometry_tests,gpu::dxil::core_tests, andscripts/smoke.ps1).@raylitebull on GitHub · 2026-11-25 10:52 UTC · original
Thanks again
@Royalflamejlhand@gsucristo!Updated
#1834cleanly onto629a30b2inf5bfb10e:#2207(482cb126reload::analyze) ߲(compact):crates/xcl/src/gpu/dxil/reload.rsforCfgOp(including killing cached scalar loads onRestoreIfExecZ { regs }so repeated-load caching remains sound across collapseds_cbranch_execzregions), alongsidekernel.rsresolution.compact.rs(CfgBlock::ops,SaveExecZ/RestoreIfExecZin class key &emit_with_nest) andcompact_tests.rs(cfg.orig_leaders), and rancompact::plan_withbeforecollapse_execz_regionsinkernel.rs(#issuecomment-7151108939).lower_mem.rsupdates: documented theMEM_HEAP_BASE + 0window-0 raw-UAV readability invariant inwith_mem_load_i32sand removed both redundant pre-loopsafe_load_addrcalls.cargo check --workspace --tests+ unit tests):gpu::dxil::cfg::(4 passed, 0 failed),gpu::dxil::reload::(6 passed, 0 failed,dxil 1.8.2502.11validated), andcompact_tests::a_mask_read_whole_after_one_copy_only_splits_the_class(1 passed, 0 failed).@Toons29 on GitHub · 2026-11-25 13:40 UTC · original
Regression run of
f5bfb10eon the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon1a0bbe3a, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 100 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; a script posted this right after the run, with both blocks exactly as printed.@raylitebull on GitHub · 2026-11-25 18:22 UTC · original
Rebased
#1834cleanly onto569f0fc5in commitb0b2d8a0, keeping both#2173'sdot8test andcollapsed_execz_kernel_matches_hlsl_on_gpuincrates/xcl/src/gpu/dxil/core_tests.rs(alongside#2076compact-thirdand#2180).Verified locally (
16 passed, 0 failedin2.30s:gpu::dxil::cfg::4/4,gpu::dxil::reload::6/6, non-GPUgpu::dxil::compact_tests::6/6) and pushedb0b2d8a0.@DavidM1911 on GitHub · 2026-11-26 06:28 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.@gsucristo on GitHub · 2026-11-25 02:10 UTC · original · reviewed
Reviewed the diff — strong CFG-reduction win (
21,302 -> 396blocks onActivateProbes) that complements #2034 nicely on large shaders whose blocks aren't exact duplicates. Theu128backward scalar liveness +SaveExecZ/RestoreIfExecZhandling and GS-entry boundary pinning look well structured.A few points from reading the diff:
crates/xcl/src/gpu/dxil/lower_mem.rs,with_mem_load_i32s): Inactive/OOB lanes clamp the heap window toMEM_HEAP_BASE + 0(window 0, byte offset 0) and executeraw_loadunconditionally. Worth explicitly documenting/verifying the invariant that window 0 is always bound and readable at offset 0 (especially alongside PRs like #1992 that shift heap window slots).crates/xcl/src/gpu/dxil/lower_mem.rs): In the multi-dwordsmem/buffer_loadloops,let base_aligned = lw.safe_load_addr(base_aligned, cond);before the loop is redundant sinceatis already clamped withlw.safe_load_addr(at, cond)on every iteration.cargo test+scripts/smoke.ps1regression runs on the rebased head2a19e89before merge.(AI disclosure: review drafted with Antigravity — exact model name not provided to the agent — and checked by the reviewer before posting.)
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.