Repository navigation
Recompiler: preserve compute prologue dominance in direct DXIL - #3154
Conversation
|
Ran the static-sampler-from-code test at 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. 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 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. |
|
At Setup: Linux, Wine 11.21 Staging, CPU only (no GPU), Rust 1.98.0, release,
#[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 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. |
…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>
… newest main Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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:
Measured:
The cache trap (Read, and what we hit):
Deduced: to see this PR's effect on a title, start from a cache without that file. A durable fix could look up 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. |
|
Test report on RTX 3090 for Tested
Not tested
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)
bacb6f0 to
43902aa
Compare
|
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 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 Measured (
Deduced, not tested on Not tested: 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. |
|
Re-ran the static-sampler-from-code test at 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. 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. |
|
A clarification on my report above: the 7.5 and 9.3 ms per frame for the two I checked it in play: AI use: Claude Code (Claude Opus 5.5) ran the runs and drafted this. I checked it before posting. |
|
Regression run for 100.4 % of Not tested / not covered: this title logs AI use: Claude Code (Claude Opus 5.5) built both commits, ran the smoke runs and wrote this report. |
|
Update to my note above: I stopped the AI use: Claude Code (Claude Opus 5.5) drafted this. I checked it before posting. |
bmjask
left a comment
There was a problem hiding this comment.
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).
|
merge-check |
|
Thanks for the merge check @Kalmarv The original reproduction was on main I rebased the PR while investigating the full workspace test failures, but those turned out to be related to my local environment. |
|
merge-check claim |
|
merge-check
|
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.
Part of #1269 and #2088. A branched DispatchX prologue could reject direct DXIL twice on the same compute program. The first failure appended
createHandleFromBindingafter 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
ee1efdainserts 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).43902aakeeps 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.ps1with its default four test threads on an RTX 4090, driver 621.40. Both loaded the system D3D12Core10.0.26100.9818and Windows SDK DXC/DXIL1.9.2602.17.main10d2729743902aa2All five previously failing texture tests and the D32S8 VRAM test passed on both revisions. The static-sampler and compact
EXECregression tests passed on the PR head. Each run reported 25 GPU skips. The nine optionalXCL_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
43902aa2rebuilt 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
PR head
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.