Skip to content

Recompiler: preserve compute prologue dominance in direct DXIL - #3154

Merged
Prime1997 merged 2 commits into
xcl-dev:mainfrom
KaniaKrzysztof:fix/compact-compute-prologue
Nov 30, 2026
Merged

Prime1997 merged 2 commits into
xcl-dev:mainfrom
KaniaKrzysztof:fix/compact-compute-prologue

Conversation

@KaniaKrzysztof

@KaniaKrzysztof KaniaKrzysztof commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1269 and #2088. A branched DispatchX prologue could reject direct DXIL twice on the same compute program. The first failure appended createHandleFromBinding after the entry terminator. With that repaired, compact lowering stored an EXEC value in entry before its phi was defined at the prologue join.

What is in it

  • ee1efda inserts lazy static sampler creation and annotation before the terminator and restores the caller's insertion state (dxil/lower_image.rs). The two-sampler fixture checks exact point/linear outputs and inactive sentinels (recomp/tests.rs).
  • 43902aa keeps each register alloca in entry and places its first store after the initializer's definition (dxil/lower.rs). Both DispatchX paths reach the join before the compact loop. The entry allocation dominates the store, the phi dominates its value, and the memoized slot is initialized once. Constants and entry loads retain their entry initialization. A forced-compact EXEC fixture covers full and partial groups (dxil/kernel.rs).

Tested

Edited after rerunning the full suite without the XCL_* overrides used in the earlier local setup. That setup overrode both the Agility SDK and DXC directories. The rerun passed on the same driver. We did not isolate which override caused the earlier failures.

Both clean checkouts ran scripts/test.ps1 with its default four test threads on an RTX 4090, driver 621.40. Both loaded the system D3D12Core 10.0.26100.9818 and Windows SDK DXC/DXIL 1.9.2602.17.

Revision Passed Failed Ignored Exit code
main 10d27297 2,152 0 48 0
PR head 43902aa2 2,153 0 48 0

All five previously failing texture tests and the D32S8 VRAM test passed on both revisions. The static-sampler and compact EXEC regression tests passed on the PR head. Each run reported 25 GPU skips. The nine optional XCL_SAMPLE_* inputs were unset.

Compilation and GPU timing. On the 2070, one affected program produced 1,214,520 bytes of compact DXIL, versus 9,370,880 bytes through the archived fallback. Translation wall time was 7.08 s versus 95.0 s. One repaired native PSO call took 38.91 s with 836 MiB process peak commit. The driver reported one creation, zero confirmed misses and one unknown. A cold native speedup is unmeasured.

During full-pack pre-menu shader preparation for a newer retail game on RTX 4090, PR head 43902aa2 rebuilt the affected compute shader from a private cache copy with its three prior translations set aside. The new compact DXIL was 1,214,520 bytes, down from 9,370,880 bytes for the archived HLSL fallback (87.0% smaller). Its SHA-256 matched the compact DXIL independently produced on RTX 2070.

On a synthetic 128-iteration wave32 loop, initial medians were 8.976 µs HLSL and 22.096 µs repaired compact (2.46×; 54 timestamps each). Three fresh-process comparisons of byte-identical guest inputs against a CPU oracle gave 8.992–9.008 µs HLSL, 21.920–21.968 µs historical compact (7f0eea29) and 21.856–21.952 µs repaired compact (120 timestamps per form per process). The overhead already existed on this loop.

Regression run

RTX 4090, newer retail game, 60 seconds per revision, networking off, startup preparation disabled, separate fresh XCL caches. Publisher provenance is unverified.

Main

xcl-smoke v1
commit: 10d272970f25b02b72ebe3c883d02d74d4d4763b
gpu: NVIDIA GeForce RTX 4090
title: newer retail game
seconds: 60
exit: 0x0
frames shown: 980 (PresentX 980)
presents per 2 s (last 3): 57 54 60
device removals: 0
crashes: 0
peak commit: 15515 MB

PR head

xcl-smoke v1
commit: 43902aa2a05f56f870f6db60fb9b46e47833c0e8
gpu: NVIDIA GeForce RTX 4090
title: newer retail game
seconds: 60
exit: 0x0
frames shown: 1042 (PresentX 1042)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15511 MB

The operator observed the menu on both revisions. Each log records the affected guest compute shader during startup. Neither log confirms that the repaired compact lowering ran or that the GPU dispatched that shader.

Minecraft Preview 4× MSAA. The startup crash has a verified fix in #1087. On November 24, 2026, Minecraft Preview 1.18.3064.0 reached the menu and completed 60 seconds on that PR’s head with 3,421 frames on RTX 4090 and 3,412 on RTX 2070, both with zero crashes and zero device removals. On November 27, an independent Intel Arc probe reproduced the default multisampled depth-view failure on the parent and verified the fix. #1087 remains open. Retail verification · Independent probe

Not tested

Execution and timing of the affected compute shader with representative in-game resources, and AMD hardware.

AI use

We used OpenAI Codex with GPT-6.2 Astra to investigate the two defects, write the fixes and synthetic tests, run validation on both hosts and prepare this report.

@Aniseto

Aniseto commented Nov 28, 2026

Copy link
Copy Markdown

Ran the static-sampler-from-code test at bacb6f04 on an NVIDIA Blackwell desktop part:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

XCL_ADAPTER=NVIDIA cargo test -p xcl --lib gpu_static_samplers_from_constants_in_code -- --test-threads=1
1 passed; 0 failed; 0 ignored; 0 measured; 2029 filtered out      (exit 0)

The test passes, covering the lazy static-sampler handle inserted before the entry terminator when a compute prologue branches. The PR description lists a full release workspace run that did not finish and twelve failures, six of them the known main failures from #3093; I ran only this targeted test, so I am not reporting a suite result. The PR has no comments yet.

Not tested: the full workspace suite, the forced-compact slot fixture, a paired smoke run, a retail title, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

@Royalflamejlh

Copy link
Copy Markdown
Contributor

At bacb6f04 (on main e429936c), a direct-only survey of a retail title's 1,636 compute programs translated 1,275 of them directly in the split wave64 form and 1,437 in the native wave64 form, against 708 and 1,000 on main; 0 validator failures, 0 panics, and no "instruction after a terminator" left in either form.

Setup: Linux, Wine 11.21 Staging, CPU only (no GPU), Rust 1.98.0, release, x86_64-pc-windows-gnu; xcl shaders <pack> --direct --sample 0 --split 1 and --split 0, 8 threads.

scratch_ptr (lower_mem.rs:2373) has the same pattern as the static sampler: it switches to init.entry to allocate xcl_scratch and appends after the guard's terminator. No compute program of this title reaches it (the survey is the same with it fixed), but this test fails at bacb6f04 with "direct DXIL builder error: instruction after a terminator in block Block(0)":

#[test]
fn compute_scratch_is_allocated_before_the_dispatch_limit_guard() {
    use crate::gpu::recomp::CsInterface;
    let code = prog(&[
        ("V_MOV_B32", "ENC_VOP1", &[("VDST", 1), ("SRC0", 133)], None),
        ("SCRATCH_STORE_DWORD", "ENC_FLAT_SCRATCH", &[("ADDR", 0), ("DATA", 1), ("SADDR", 0x7F)], None),
        ("SCRATCH_LOAD_DWORD", "ENC_FLAT_SCRATCH", &[("ADDR", 0), ("VDST", 2), ("SADDR", 0x7F)], None),
        ("S_ENDPGM", "ENC_SOPP", &[], None),
    ]);
    let cs = CsInterface { threads: [64, 1, 1], ..Default::default() };
    let ko = KernelOptions { wave64: true, split: false, mem_windows: 1, sampler_base: 0 };
    super::kernel::translate_compute(&code, ko, &cs).unwrap_or_else(|e| panic!("{}", &e[..e.len().min(800)]));
}

It passes with the same two lines your sampler change uses, in scratch_ptr:

                let cur = self.cur();
                let before = self.s.m.set_insert_before_term(true);
                self.s.m.set_block(self.init.entry);
                // … the alloca as it is …
                self.s.m.set_block(cur);
                self.s.m.set_insert_before_term(before);

Not tested: a GPU, Windows, the whole suite, a title run.

AI use: Claude Code (Claude Opus 5.5) ran the surveys and the test and wrote this comment.

Royalflamejlh added a commit to Royalflamejlh/xcl that referenced this pull request Nov 28, 2026
Royalflamejlh added a commit to Royalflamejlh/xcl that referenced this pull request Nov 28, 2026
…t guard

scratch_ptr allocated xcl_scratch in the entry block after d940354's
dispatch-limit guard had terminated it ("instruction after a terminator
in block Block(0)"); it now inserts before the terminator, as xcl-dev#3154 does
for static samplers. Offered on xcl-dev#3154.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Royalflamejlh added a commit to Royalflamejlh/xcl that referenced this pull request Nov 28, 2026
… newest main

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CharlyRien

Copy link
Copy Markdown
Contributor

A test of this PR on one retail compute program, on NVIDIA. It also shows a cache trap for anyone testing it on an existing cache.

Setup:

  • RTX 3090 24 GB (Resizable BAR off), driver 616.56, Ryzen 9 5950X, 32 GB RAM, Windows 11 22631.
  • Builds: main e429936c, and this PR's head bacb6f04 on it, release.
  • One compute program of the retail title, the one our main run stalled on while loading. Fresh, empty DXIL cache, xcl shaders <folder> --precompile, then the same with --pipelines --threads 1. No title.

Measured:

main e429936c this PR bacb6f04
direct DXIL fails: "instruction after a terminator in block Block(0)" 1,214,602 B, validated
what the runtime uses the HLSL fallback, 9,370,880 B of DXIL the direct DXIL
translation – 7.1 s
driver pipeline build not finished after 575 s (our title run, stuck on the loading art) about 54 s

The cache trap (Read, and what we hit):

  • translated::cached_rerouted in gpu/recomp/pso.rs looks a program up under the HLSL path's identity first, then under rerouted_identity.
  • When the direct translator fails on an enormous program, the HLSL fallback is stored under the HLSL path's identity. That identity does not follow the direct translator's version or sources: direct_output_identity only goes into rerouted_identity.
  • So once main has stored this program's fallback, a build with this PR finds it first and never translates the program again.
  • We hit that: our first run of this PR used a copy of the cache from a main run, and it served main's 9,370,880 B fallback for this program, unchanged.

Deduced: to see this PR's effect on a title, start from a cache without that file. A durable fix could look up rerouted_identity first, or key an enormous program's fallback by rerouted_identity as well, so that a fixed direct translator retries it.

Not tested: a title run with this PR on a clean cache; other programs (with this PR's build, 4 other programs of the title still fell back, with "multidimensional groups need the HLSL console-linear thread reorder", a different reason); other cards and drivers; AMD.

AI use: Claude Code with Claude Opus 5.5 built both commits, ran the test on this machine, read the cache code and wrote this. The person running these tests asked for this post.

@afpruivo

Copy link
Copy Markdown

Test report on RTX 3090 for bacb6f04: no new test failures, and on a retail title's shader pack the sampler fix lets 567 more compute programs translate through direct DXIL (43.3 % → 77.9 %).

Tested

  • NVIDIA GeForce RTX 3090 24 GB, driver 621.40, i5-13600K, Windows 11 Pro 26300, Rust 1.99.1; tests in debug, the pack run in release.

  • cargo test --workspace --no-fail-fast -- --test-threads=4 on bacb6f04: 2127 passed, 10 failed, 48 ignored (9 distinct tests).

  • SKIPPED: 21 "no wave64", 2 debug-layer cases (no d3d12SDKLayers.dll), 3 f16 / conversion cases the per-lane form refuses, 1 heap windows.

  • xcl shaders <shaders.rpf> --direct --validate --only cs --sample 100000, on the newer retail title (TitleID 7952987A), every compute program validated:

    main e429936c this PR bacb6f04
    CS translated 708 / 1636 (43.3 %) 1275 / 1636 (77.9 %)
    "instruction after a terminator in block Block(0)" 567 0
    validator failures / panics 0 / 0 0 / 0

    Among them are the two most expensive compute programs on this title's direct queue in play, scattering_transmittance_system:CS_Gather_Classified_9 and _11 (dump hashes 2504944a10775aeb, 95bc3980ec624295). Each runs once per frame through ExecuteIndirect, for 7.5 and 9.3 ms per frame on nvidia-dev (XCL_GPU_TIMES). On main the direct form refuses both, at the first static sampler used outside the entry block, so they take the HLSL path.

Not tested

  • AMD and wave64 hardware.
  • Play: I haven't run the title on this PR, so I don't know whether the direct forms of these programs are faster than the HLSL ones, or whether they draw the same picture.
  • The second commit (bacb6f04, compact register slots) only through the suite and the pack run above. I didn't isolate which programs need it.

AI use: Claude Code (Claude Opus 5.5) ran the tests and the pack comparison and drafted this. I checked it before posting.

DispatchX can branch before the first image instruction requests a sampler. Insert both handle operations before the terminator and restore the caller insertion state. Exercise two static samplers with full and partial groups.

Assisted-by: OpenAI Codex (GPT-6)
Keep lazy allocas in entry. Initialize an instruction-valued slot in its defining block so the DispatchX EXEC phi dominates its store. Exercise full and partial groups in forced compact lowering.

Assisted-by: OpenAI Codex (GPT-6)
@KaniaKrzysztof
KaniaKrzysztof force-pushed the fix/compact-compute-prologue branch from bacb6f0 to 43902aa Compare November 28, 2026 17:21
@KaniaKrzysztof
KaniaKrzysztof marked this pull request as ready for review November 28, 2026 17:55
@Eterst

Eterst commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

A side effect to plan for when this lands: with the entry block fixed, more of a retail title's huge compute programs translate directly and come in under the 8 MiB XCL_PIPELINE_MAX_KB cap, so a precompile with --pipelines now has the driver build them. Each such build takes far more memory than a worker is budgeted.

Setup: RTX 4070 SUPER 12 GB (driver 621.40), Ryzen 7 5700X, 32 GB RAM, Windows 10 19045, Rust 1.100.0, release. Not a clean main: a local test tree (main of 11-27 with d9403543 ported by hand) with this PR's two commits applied by hand, and ad19a1c1. So the numbers are about the driver's cost, not about main's precompile code.

Measured (xcl shaders <pack> --precompile --only cs --pipelines, a RAM guard ending the process below 0.4 GB free):

pipelines built at once result
12 ended by the guard at 523 s: 18.1 GB private, 0.39 GB free (1,100 of 2,689 pipelines made)
4 ended by the guard after about 70 s: 15.7 GB private
1 finished: 18.8 min, 2,687 made, 0 refused, 2 still over the cap
  • During the first run the cache gained three compute DXIL files of 4,518,940, 4,360,108 and 4,224,036 bytes, the largest of that run. Private memory climbed about 1 GB every 2 s in the last 20 s before each end.
  • On this tree the precompile creates its pipelines with CreateComputePipelineState directly (shaders.rs) and doesn't take the runtime's huge-build gate (big_compile_turn, XCL_HUGE_PSO_CONCURRENCY, default 1).

Deduced, not tested on main: main's preparation workers count 3 GB of commit for each (prepare_workers, shaders.rs:2750). One driver build of a 4 MB+ compute program held well over that here, and #3067 saw single workers at 10–17 GB. With this PR more such programs pass the cap, so a 32 GB machine may need one huge build at a time, or a per-worker budget that scales with the DXIL size.

Not tested: main's worker processes, other drivers, AMD.

Results with the PR, for the record: the 1,068 compute programs of this pack that failed with "instruction after a terminator in block Block(0)" all translate directly now: 0 such failures. The remaining HLSL routes are the 471 multidimensional-group ones, by design. The scratch line from the earlier comment is in our tree as well; its test fails without it and passes with it.

AI use: Claude Code (Claude Opus 5.5) ran the precompiles, read the logs and wrote this comment.

@Aniseto

Aniseto commented Nov 28, 2026

Copy link
Copy Markdown

Re-ran the static-sampler-from-code test at 43902aa2 after the head moved from bacb6f04 and after a NVIDIA driver update; this is a new response in the same thread, not an edit of my earlier report at bacb6f04: #3154 (comment)

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

XCL_ADAPTER=NVIDIA cargo test -p xcl --lib gpu_static_samplers_from_constants_in_code -- --test-threads=1
1 passed; 0 failed; 0 ignored; 0 measured; 2045 filtered out      (exit 0)

The test still passes at the new head on the new driver. The PR description reports a full debug workspace run at this head on an RTX 4090 with six failures; I ran only this focused test, so I am not reporting a suite result. The new dimension here is the Blackwell card on driver 32.0.16.2140.

Not tested: the full workspace suite, a paired smoke run, a retail title, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

@afpruivo

Copy link
Copy Markdown

A clarification on my report above: the 7.5 and 9.3 ms per frame for the two CS_Gather_Classified programs were measured on nvidia-dev, and there both programs already translate through direct DXIL without this PR. The refusal ("instruction after a terminator") happens on main. So the report doesn't show a frame-time gain from this PR, and I didn't mean to suggest one.

I checked it in play: nvidia-dev 54225f58 with and without this PR's two commits, three interleaved runs each, 16 frames from 420 s. Both arms built the same DXIL for these programs (274,848 B for 95bc3980ec624295), and the direct-queue busy time per frame was the same within noise (control 144.7 / 140.3 / 141.2 ms, with the PR 141.2 / 149.8 / 139.3 ms). The coverage numbers for main stand. I'm running the same comparison on main now and will add the result here.

AI use: Claude Code (Claude Opus 5.5) ran the runs and drafted this. I checked it before posting.

@Anon64

Anon64 commented Nov 28, 2026

Copy link
Copy Markdown

Regression run for 43902aa2 (this head) against main b937fbab on an RTX 3060 12 GB (driver 581.80), i9-14900KF, 64 GB RAM, Windows 11 26200, release builds. A newer retail game, 300 s, XCL_PREPARE=0, XCL_ADAPTER=3060, XCL_PIPELINE_THREADS=8, same cache state.

xcl-smoke v1
commit: b937fbab2964b2c142f5d13662b91b00f99b9848
gpu: NVIDIA GeForce RTX 3060
title: retail-1
seconds: 300
exit: 0x0
frames shown: 8786 (PresentX 8786)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 37615 MB
xcl-smoke v1
commit: 43902aa2a05f56f870f6db60fb9b46e47833c0e8
gpu: NVIDIA GeForce RTX 3060
title: retail-1
seconds: 300
exit: 0x0
frames shown: 8822 (PresentX 8822)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 37535 MB

100.4 % of main's frames, 99.8 % of its peak commit, no device removal or crash.

Not tested / not covered: this title logs huge-program direct DXIL unavailable: direct DXIL builder error: instruction after a terminator in block Block(0) on this machine, but only while its shaders are translated cold during preparation; with a warm cache and XCL_PREPARE=0 neither run hit that path (0 such lines in both logs), so this run does not show the fix working, only that nothing regressed. Not run: the whole suite, AMD, a cold-cache preparation.

AI use: Claude Code (Claude Opus 5.5) built both commits, ran the smoke runs and wrote this report.

@afpruivo

Copy link
Copy Markdown

Update to my note above: I stopped the main comparison before it finished, so I have no frame-time result for this PR on main. With ±3–6 ms of run-to-run noise per frame on this title, three runs a side wouldn't separate a difference of this size. The test and coverage results in my report stand.

AI use: Claude Code (Claude Opus 5.5) drafted this. I checked it before posting.

@bmjask bmjask left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critical-review result: I found no concrete defect. Initializing the allocation slot in its defining block preserves dominance, and inserting sampler handles before the entry terminator while restoring builder state matches the surrounding IR construction pattern. The DispatchX regression exercises the motivating path.

Please retain the change as a focused correctness repair and keep the exact-head PR validation attached to this commit.

Reviewed at 43902aa with Codex (GPT-5).

@Kalmarv

Kalmarv commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

merge-check
base: fa20459
head: 43902aa
merge: clean (trial merge bfac2ad8, local)
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 (XCL_DXC_DIR = DXC 1.9.2609) -> 2609 passed, 0 failed, 49 ignored; SKIPPED: 26, the usual set (21 no wave64 on this 32-lane GPU, 3 per-lane forms refused, 2 no heap windows). Both of the PR's tests ran (not skipped) and passed: gpu::dxil::kernel::gpu_compact_slots_use_the_dispatch_prologues_exec_mask and the new DispatchX part of gpu::recomp::tests::gpu_static_samplers_from_constants_in_code.
review: none blocking; whole diff read (kernel.rs, lower.rs, lower_image.rs, recomp/tests.rs, +75). (1) Init now stores a slot's initial value in the block that defines it (def_block(v), else entry): the DispatchX EXEC mask is defined at the prologue join, so the store sees the selected mask, not a stale full one. (2) A static sampler handle created on first use now goes in front of entry's terminator (set_insert_before_term(true), restored after): entry can already end in the prologue's branch, and the handle must dominate both paths. Both changes are local and keep the old placement when the value comes from entry. (3) The tests do not catch the fix on this tree and GPU. With lower.rs and lower_image.rs set back to main's (rebuilt, PR tests kept), both tests still pass, so on this base neither test program reaches the bad placement. They guard the behaviour but would not have failed before. Worth a word from the author on which main commit or program shape reproduced it.
performance: no cost by default (only where values are placed in the prologue). Title run (release build of the merge, scratch/fast-world.py fast profile, against main fa20459): exit 0, 0 crashes, 0 device removals; world entry 92.5 s against 76.8 s and 99.7 s in two main runs; peak commit 33,512 MB against 33,027 and 31,295 MB (101.5 % of the higher); 86 WARN lines against 86. This run presented world frames (1.5 fps, 3 frame dumps) while both main runs showed 0 fps in their window.
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74, wave32 only), AMD Ryzen 9 9950X, Windows 11 build 26200; rustc 1.99.0, debug test profile, release build for the title run, DXC 1.9.2609 via XCL_DXC_DIR. Claude Code, Claude Opus 5.5: build, suite, revert probe, title run and full-diff review; this report.

@github-actions github-actions Bot added area:recompiler RDNA2 decoder, HLSL/direct-DXIL recompiler, wave64/wave32 area:tests Unit, integration, e2e tests, or testtitle gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) labels Nov 29, 2026
@KaniaKrzysztof

Copy link
Copy Markdown
Contributor Author

Thanks for the merge check @Kalmarv

The original reproduction was on main e429936c10a5b8aa09470ff99dfc8c8d3d8c56fd, using the (95cc13288a27a96e) compute shader.

I rebased the PR while investigating the full workspace test failures, but those turned out to be related to my local environment.

@no-juiice

Copy link
Copy Markdown

merge-check claim
head: 43902aa

@no-juiice

Copy link
Copy Markdown

merge-check
base: bc2cbb7
head: 43902aa
merge: clean (4 files, +75; git diff --check clean)
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 (XCL_DXC_DIR = DXC 1.9.2609.5) -> 2725 passed, 0 failed, 49 ignored (41 binaries; the lib binary runs 2615 tests, base 2614); SKIPPED: 28 notices (22 "no wave64", 3 per-lane form refused for wave32 f16/f32 cases, 2 "no heap windows", 1 "no D3D12 debug layer"); failing: none in that run, but see review 1
review:

  1. Intermittent crash of the lib test binary: in 2 of 4 full-workspace runs of the merge result, xcl lib tests exited with 0xc0000005 (STATUS_ACCESS_VIOLATION), both times after exactly 82 finished tests and with the same four tests in flight: gpu::agility::tests::create_device_sets_dred_first, gpu::bvh::tests::scene_trace_matches_brute_force, gpu::bvh::tests::trace_matches_brute_force, gpu::dxil::compact_tests::a_large_program_that_repeats_itself_takes_the_compact_form. Not seen in 3 full-workspace runs of the base (one of them had two unrelated e2e failures, test_title_runs_and_game_folder_is_untouched and incomplete_discovered_corpus_blocks_headless_title_entry, which did not repeat), nor in 2 -p xcl --lib runs of the merge result (2586 passed, 0 failed, 29 ignored). Each of the four tests passes alone (--exact --test-threads=1) with and without this PR, and a full-workspace run with --skip gpu::agility::tests::create_device_sets_dred_first passed. This PR's new test sorts into that part of the run, so it may only change which tests run together and expose an existing race; I could not show which. Unconfirmed as this PR's; a full-workspace run on another machine would settle it.
  2. The diff itself: Init::slot now stores a slot's first value in that value's defining block, before its terminator, while the alloca stays in entry; slot runs before load emits its read, so the store precedes the first load. This relies on every first value being defined in a block that dominates the compact loop (true for entry values and for the DispatchX prologue join). lower_image.rs creates the static sampler handle before the entry terminator and restores the insertion setting, which removes the "instruction after a terminator in block Block(0)" refusal. Both new tests ran (wave32) and passed: gpu::dxil::kernel::gpu_compact_slots_use_the_dispatch_prologues_exec_mask, gpu::recomp::tests::gpu_static_samplers_from_constants_in_code. No other findings.
  3. Not covered here: wave64 hardware (this GPU is wave32 only, 22 wave64 cases skipped), AMD, and a game run of this exact merge result.
    performance: translation-time only; no per-frame cost expected. Related to the precompile-memory note above: on this 16 GB RAM machine a main db3921dc compute precompile with --pipelines and the size cap off died with "LLVM ERROR: out of memory" at 42 GB process private, building the HLSL-path DXIL (9-19 MB) of the large compute programs; main 10d27297 + Recompiler: 2-D and 3-D compute groups take the direct DXIL route again #3189 + this PR (4 driver compiles at once, default 8 MiB cap) finished: 10,002 pipelines, 0 refused, 8.5 GB peak private, 66 min. Not an A/B of this PR alone. Later builds with this PR (on 765b2c5b, d8bd9a38, 24d21a41) reached the retail title's world; launch preparation had 0 failed workers.
    verdict: safe to merge
    The merge is clean, the build and the full suite pass (2725 passed, 0 failed), the diff reads correct and both new tests pass on the GPU. The intermittent lib-binary crash in review 1 is unconfirmed as this PR's: it doesn't reproduce with any of the four tests alone, and it may be an existing race this PR's added test exposes.
    hardware / tool and model: NVIDIA GeForce RTX 4060 Laptop GPU 8 GB (driver 617.42), AMD Ryzen 7 7435HS, 16 GB RAM, Windows 11 Home 26300, rustc 1.100.0, debug / Claude Code, Claude Opus 5.5 (ran the builds and tests and wrote this; checked before posting)

@Prime1997
Prime1997 merged commit f0e7b79 into xcl-dev:main Nov 30, 2026
4 of 9 checks passed
dudenudem pushed a commit to dudenudem/xcl that referenced this pull request Nov 30, 2026
Keeps upstream's DXIL IR cuts (xcl-dev#3500-xcl-dev#3503/xcl-dev#3495-xcl-dev#3499: sampler waterfall,
descriptor windows, split-wave64 mask exchange, per-lane exec, direct PS
masks, quad shuffles, packed/normalized buffer decode, commit-aware
compiles), xcl-dev#3269 fixed-point optimizer, xcl-dev#3154 compact compute prologue,
xcl-dev#2123 split atomic add, xcl-dev#2070 offline 64 MB stacks, xcl-dev#3442 split-whole,
xcl-dev#1319 root-constant bounds, xcl-dev#3356 late Reset releases, xcl-dev#1322 empty-BVH/NaN
rays, xcl-dev#2753 3-D texture sizing, XMA/VFS/TLS/loader fixes.

Resolutions:
- real.rs: union of T-156 res_release pinning with upstream's InListReset
  and abi_rs_for_stages; dropped upstream's warm_graphics (T-095 removed
  that path); kept ComputeBuild::IndirectChain for our split-chain variant.
- dispatch_chain.rs: kept our IndirectBuild split-chain architecture (the
  T-095 port removed the preload/whole-worker machinery upstream builds
  on); ported upstream's huge-PSO refusal log.
- pso_async.rs: took upstream's commit-aware build_pieces/build_scoped and
  WORKER_STACK, removed the preload/backlog subsystem our port does not
  have (and its tests), kept our profile_is_series_s.
- late_release.rs: took upstream's Dead enum, Busy/InListReset and
  hold_pipeline/hold_heap/hold_unmap, with our vram release path (no
  recycle pool).
- emit.rs: upstream's additions moved into emit/memory.rs (ADD_TID_ENABLE),
  emit/exp.rs (misc-vector layer/viewport), emit/mimg.rs (SampleCmp with
  bias gradients), emit/valu.rs (abs/neg on shift/align), emit.rs out_struct.
- bind.rs: root-constant bounds clamp + its test; kept our bool
  execute_indirect API.
- bvh.rs: our grow/tri_ret/watertight model plus upstream's empty-root
  bounds and NaN-ray refusal.
- kernel.rs: upstream's mask/waterfall/rodata cuts plus our lanes_upper.
- shaders.rs: upstream's worker stack helpers and mesh/GS precompile paths,
  with our PipelineJob record identity.
- eh.rs: upstream's CLWB TF guard + test, our termination test.
- lower.rs test: 574bda4 makes wave32 SALU words compute S_WQM without
  quad lanes; assert that and keep the wave64 refusal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:recompiler RDNA2 decoder, HLSL/direct-DXIL recompiler, wave64/wave32 area:tests Unit, integration, e2e tests, or testtitle gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks)

Projects

None yet

Development

Successfully merging this pull request may close these issues.