Skip to content

Recompiler: compact form also for branch-heavy programs of 2000+ blocks - #3263

Merged
Prime1997 merged 3 commits into
xcl-dev:mainfrom
Foniass:dxil-compact-branch-heavy
Nov 29, 2026
Merged

Prime1997 merged 3 commits into
xcl-dev:mainfrom
Foniass:dxil-compact-branch-heavy

Conversation

@Foniass

@Foniass Foniass commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Note: the suite and smoke results below replace an earlier set that, by a test-setup mistake (shared cargo target directory), came from another PR's build. These were run with a forced rebuild of this head.

Stacked on #3261 (which is stacked on #3250); only the top commit (e618b742) belongs here.

amd-dev's 9887b414 (Saksukella): compact::large() asked only for 20,000+ reachable non-terminator instructions, so branch-heavy unrolled compute programs just under that (e.g. 56c0cd3b82a00c6e, about 32k blocks) stayed in the plain form and produced 2.6 MiB of DXIL. The NVIDIA / AMD driver then committed tens of GB to compile it. The threshold becomes 10,000 instructions or 2,000 reachable blocks; automatic_plan still asks for the repetition and the table limit before it takes the form.

What is in it

  • crates/xcl/src/gpu/dxil/compact.rs: LARGE_INSTS = 10_000, LARGE_BLOCKS = 2_000 in large()
  • crates/xcl/src/gpu/dxil/compact_tests.rs: a_large_program_that_repeats_itself_takes_the_compact_form checks 2500 / 500 copies (compact) and 400 (plain)

Tested

  • RTX 5070 Ti (driver 32.0.16.2114), AMD Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), debug tests, release smoke
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on e618b74: 2609 passed, 4 failed, 49 ignored. The 4 failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3: E_OUTOFMEMORY from CreateComputePipelineState at seeds 70 / 545 / 1019 / 1507, the same as on main on this machine; they pass on Kalmarv's RTX 5070 Ti, so they come from this machine's driver / setup, not the code. SKIPPED GPU tests: 30, almost all no wave64.
  • Retail title: 60 s smoke run below. The PR's run used -StartupTimeoutSeconds 3600 for the cold pipeline rebuild new DXIL needs.

Regression run

main:

xcl-smoke v1
commit: b10cc4c6766adc947c2054ada4a2af98be15108d
gpu: NVIDIA GeForce RTX 5070 Ti
title: 3cb1d8e0
seconds: 60
exit: 0x0
frames shown: 1565 (PresentX 1565)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16026 MB

this PR:

xcl-smoke v1
commit: e618b7420706d8239c4462dba2cdbc0b49484731
gpu: NVIDIA GeForce RTX 5070 Ti
title: 3cb1d8e0
seconds: 60
exit: 0x0
frames shown: 1584 (PresentX 1584)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 15805 MB

Not tested

AI use

  • Claude Code with Claude Opus 5.5: ported the commit to main, resolved conflicts (noted in the commit message), ran the tests and the smoke run above and wrote this description.
  • Original commit: amd-dev 9887b414 (Saksukella, cherry-picked there from 53995420); the subject is reworded to the repo's style.

🤖 Generated with Claude Code

Foniass and others added 3 commits November 29, 2026 01:17
The direct DXIL writer emitted every record unabbreviated, so each
operand took a full 6-bit VBR chunk plus the record header. Define LLVM
DEFINE_ABBREV records for the hot function-block opcodes (binop without
flags, cast, cmp2, vselect, extractval, 4-byte-aligned load / store, br,
call, phi, gep) and for integer / f32 constants, and write the compact
form's lookup tables as one CST_CODE_DATA record instead of an aggregate
of interned integer constants. The records decode to the same operands,
so the module means the same; only its encoding is smaller.

Measured on the retail title with an RTX 5070 Ti (numbers in the PR).

Ported from the bitcode-encoding part of amd-dev's f089a9d (cherry
picked there from 46aecbf, raylitebull, Assisted-by: Antigravity
(Gemini 4 Neon High)). Left out here: its dead-constant pruning (main
already prunes, 09a65d6) and its IR / compact-form changes, which
follow separately.

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

The compact form lowers each class of identical blocks once, but a block
only joins a class when everything in it matches, and every class stores
all SGPRs and SCC it wrote back to their slots. In large console
programs the same buffer / SMEM / image access sits in many blocks with
different ALU around it, so its long lowering was emitted once per block.
On large programs (64 blocks or more):

- a memory instruction that occurs more than once becomes a micro-block
  of its own, lowered once for all its occurrences; pure no-ops
  (s_nop, s_waitcnt*, s_clause, ...) are left out, and the empty jump
  blocks that leaves are bypassed;
- blocks that differ only in one 32-bit literal, or only in where an
  s_getpc_b64 sits, share a class and read the literal / block PC from a
  packed table, when that saves at least 64 classes;
- the successor field can index a pool of distinct taken targets
  (fallthrough = 0) when that is smaller than inline block numbers or
  offset pairs; the table limit rises from 12288 to 32768 words;
- a backward liveness over s0..s105 and SCC gives each class the union
  of its blocks' live-out sets, and a class stores only what is live;
  the same liveness strips far-jump veneers (s_getpc_b64 + s_add_u32 +
  s_addc_u32 feeding a resolved s_setpc_b64) whose registers and SCC are
  dead at the target. Kernel-mode programs (the tests' ABI) keep every
  register live at the end.

The use / def sets are conservative: s_movrel* reads every SGPR,
conditional and read-modify-write SALU (s_cmov*, s_addk, s_mulk,
s_bitset*) read their destination and s_cmov* does not kill it, and a
wave32 VALU mask write defines only its low SGPR (from 33d1222, open as
xcl-dev#2604). New here: SDWA sources with their S0 / S1 bit set are SGPR uses,
as Lw::sources reads them; the ported code missed S1, so a v_add_nc_u32
sdwa reading s20 through VSRC1 left s20 dead and its store out.

The micro-blocks and the liveness are one commit: on an RTX 5070 Ti the
micro-blocks alone make the retail title's largest compute program
(95cc13288a27a96e) one the driver refuses (E_OUTOFMEMORY); with the
liveness it builds, and goes from 804 KB to 258 KB of DXIL.

Ported from the compact-form and liveness parts of amd-dev's f089a9d
(raylitebull, cherry-picked there from 46aecbf, Assisted-by:
Antigravity (Gemini 4 Neon High)) and 33d1222 (Alp Pesen,
Assisted-by: Antigravity (Gemini 4 Neon)).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
compact::large() previously only checked reachable non-terminator instruction count
(>= 20_000), ignoring both terminating branches and basic-block count. Branch-heavy
unrolled compute shaders just below 20k non-terminator instructions (for example,
cs 56c0cd3b82a00c6e) skipped compact lowering and emitted >2.6 MiB monolithic DXIL
(~588k IR lines, ~32k blocks, ~36k PHIs), causing the driver compiler to commit >36 GiB
of virtual memory and stall compilation. In compact form the same shader shrinks to
~160 KiB (~975 blocks, 108 PHIs).

Lower the non-terminator threshold to 10_000 and add a reachable basic-block threshold
(>= 2_000) in compact::large(); compact::wanted() still gates adoption on >70%
deduplication and bounded table size.

(cherry picked from commit 5399542)

Port onto nvidia-dev: `large` is asked by automatic_plan here (this
branch's form of `wanted`); its doc says so instead.

(cherry picked from commit 9887b41)

Ported to main (subject in the repo style).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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
@Foniass
Foniass marked this pull request as ready for review November 29, 2026 03:13
@Kalmarv

Kalmarv commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

merge-check
base: fa20459
head: e618b74
merge: clean onto main and with the 7-PR stack.
build: cargo build --workspace -> ok; cargo build --release -p xcl -> ok.
tests: tested in the clean 7-PR stack (#3250+#3261+#3263+#3264+#3265+#3266+#3268) on main fa204595: cargo test --workspace --no-fail-fast -- --test-threads=4 (DXC 1.9.2609.5; -p xcl --lib rerun skipping the 2 known main #3187 uma_driver mixed-window tests a_refused_gpu_upload_segment_becomes_custom and mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment) -> 2620 passed, 0 failed, 49 ignored (2481 lib + 139 integration, 25 SKIPPED notices; all 4 fuzz_validate_and_gpu_0..3 passed); failing: none. 150 s xcl-smoke (ea3b5e4d, XCL_PREPARE=0, RTX 5070 Ti) on the combined 8-PR stack: exit: 0x0, 2096 frames shown, 0 device removals, 0 crashes, 0 display System events, 32049 MB peak commit.
review: none (whole diff read: lowers LARGE_INSTS to 10_000 and adds LARGE_BLOCKS = 2_000 in compact::large(), still gated by automatic_plan deduplication; compact_tests.rs updated to check 2500/500/400 copies).
performance: positive: avoids multi-MiB plain-form DXIL and driver memory spikes on branch-heavy 2000+ block shaders; no regression in 150 s smoke.
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (wave32 only), Windows 11, DXC 1.9.2609.5 via XCL_DXC_DIR; Antigravity (Gemini 3.5 Pro) ran the merges, builds, workspace test suites, 150 s title smokes, diff reviews, and drafted this check.

@github-actions github-actions Bot added needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) needs:amd-test Needs a test report or merge-check on an AMD GPU labels Nov 29, 2026
@Foniass
Foniass marked this pull request as draft November 29, 2026 04:11
@github-actions github-actions Bot removed needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) needs:amd-test Needs a test report or merge-check on an AMD GPU labels Nov 29, 2026
@Foniass
Foniass marked this pull request as ready for review November 29, 2026 04:24
@KOLESNiii

KOLESNiii commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Test report: cold driver compile time with this stack on an RTX 2070 SUPER (Turing, 8 GB). One run per record, so read it as a direction.

I merged both of Foniass's stacks onto main 0fe06eb (this PR's #3250 → #3261 → #3263 and #3266 → #3268 → #3269; they merge without conflicts) and compared that build with main. The numbers are for both stacks together: I did not measure them separately.

Setup

  • RTX 2070 SUPER 8 GB (driver 621.40, 32-lane waves), Ryzen 5 3600XT, Windows 11 26300, release builds, Rust 1.100.1 (merged head 477e2b69).
  • xcl shaders <retail game's shaders.rpf> --measure-pso <record> --repeat 1: the driver's shader caches are turned off (ShaderCacheControl, Developer Mode), so every build is cold. One compile at a time, through a local exclusive queue.

Results (DXIL bytes, cold CreateComputePipelineState s)

record main both stacks both stacks + XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1
95cc13288a27a96e 1,221,312 B, 34.1 s 252,036 B, 6.6 s 228,824 B, 5.6 s
2e1d03fbed9d95eb 1,387,508 B, 33.9 s 948,960 B, 33.1 s 730,648 B, 21.1 s
958400d2caf07244 618,416 B, 14.5 s 260,476 B, 7.2 s 252,436 B, 7.9 s
56c0cd3b82a00c6e 682,480 B, 18.1 s 298,888 B, 10.0 s 286,604 B, 10.2 s
1d4ecf4cb407d4fe 506,032 B, 8.8 s 346,680 B, 8.6 s 278,744 B, 5.0 s
total 109.5 s 65.5 s (−40 %) 49.8 s (−55 %)
  • The biggest gain is on 95cc…, the program Recompiler: compact form splits out repeated memory ops and dead SGPR stores #3261 names: 4.8× less DXIL and 5.1× faster to build cold here. 958400d2… and 56c0cd3b…: about half. The plain-form programs (2e1d…, 1d4e…) shrink 27–32 % but build barely faster; heap windows help those instead, so the two are complementary.
  • Every build succeeded on this 8 GB card (no E_OUTOFMEMORY).

Not tested: the stacks separately; the suite and a title run of the merged build (only pipeline builds); whether the image is the same; AMD.

AI use: Claude Code (Claude Opus 5.5) merged and built the stacks, ran the queued job and wrote this report.

Context: why DXIL size matters for cold compilation. On this title, compute programs whose whole DXIL is 512 KiB or larger are 27 % of the 2,730 compute programs but about 95 % of a cold full preparation's compute driver work (driver time weighted as size^1.6, fitted to 1,340 cold compiles on this card). So size reductions count almost only on those programs. Breakdown by size band: #2088 (comment)

@KOLESNiii

Copy link
Copy Markdown
Contributor

merge-check claim
head: e618b74

@github-actions github-actions Bot added needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) needs:amd-test Needs a test report or merge-check on an AMD GPU labels Nov 29, 2026
@KOLESNiii

Copy link
Copy Markdown
Contributor

merge-check
base: 0fe06eb
head: e618b74
merge: clean. The merge carries the whole stack: e13ccd7 (#3250), 16f2f5c (#3261) and e618b74 (this PR's own commit); everything below is about that whole merge.
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2743 passed, 0 failed, 49 ignored, 28 SKIPPED: 22 no wave64, 3 per-lane f16/f32 forms refused (#1426 semantics), 2 no heap windows (one of them the opt-in XCL_HEAP_WINDOWS=1 test), 1 no GPU_UPLOAD heaps; failing: none. The base 0fe06eb, run alone on this PC with the same command and its own target dir: 2737 passed, 0 failed, 49 ignored, the same 28 SKIPPED. The PR's changed test a_large_program_that_repeats_itself_takes_the_compact_form passed. All 4 fuzz_validate_and_gpu_0..3 passed here (8 GB card). Each suite ran alone in the queue.
review: 4 minor findings, no major or critical one.

  • [minor] crates/xcl/src/gpu/dxil/compact.rs:227,265: MAX_TABLE_WORDS goes from 12,288 to 32,768 on every GPU, and with LARGE_INSTS 10,000 / LARGE_BLOCKS 2,000 more programs reach automatic_plan (kernel.rs:410) -> on AMD, programs that are plain on main become larger compact pipelines, untested there. Evidence: e964ad2 saw an RX 9070 XT reach 24 GB building the compact form of a 9,219-word program (neither form built); 3cde0cc since allows 12,288 words on every GPU; nothing gates the new limit by vendor, and no test covers a table above 12,288 words (compact_tests.rs:274 asserts p.words() <= 12288). Not a confirmed regression; the maintainer's RDNA4 run is what would show it.
  • [minor] compact.rs:241-249: Plan::words(), which the cap is checked against, leaves out the new xcl_pc, xcl_lit_idx and xcl_lit_pool tables (compact.rs:786, :810) -> a program can take the compact form with more table words than MAX_TABLE_WORDS.
  • [minor] compact_tests.rs: the S_GETPC_B64 block-PC parameterization, the far-jump veneer strip and dead SGPR / SCC store removal on a compute entry have no test (every compact GPU test uses Entry::Kernel, where all SGPRs are live at the end) -> new logic ships untested. Read the code; found no defect in them.
  • [minor] compact.rs:321, :343: the comments say repeated heavy memory ops are split out at >= 4 occurrences; the code does it at >= 2 (compact.rs:359).
    Checked without a finding: the DEFINE_ABBREV encoding and abbreviation ids (function block width 4, 12 abbreviations; constants block width 3, 3), field widths, and abbreviated record layouts against the unabbreviated ones; CST_CODE_DATA never empty; micro-block splitting keeps instruction order; literal parameterization only for a block with one literal-bearing instruction; SGPR / SCC use-def sets against the operand table, with VCC, EXEC and M0 never elided; veneer strip relies on resolve_far_jumps' exact register match.
    performance: measured on this PC in the earlier test report on this PR ( cold CreateComputePipelineState with the driver's caches off, one run per record): main 0fe06eb with this stack and the Recompiler: fix Direct DXIL live double-ext scan and movrel VGPR range #3266 -> Recompiler: direct DXIL optimizer runs to a fixed point with new passes #3269 stack merged together (not this stack alone) took 65.5 s against main's 109.5 s over 5 large compute programs, with 2.3-4.8x less DXIL on the three compact-form ones. Not measured here: frame time, and the extra per-iteration table loads in the compact loop head. Every direct-DXIL translation changes, so such programs are translated and built again once.
    verdict: safe to merge
    hardware / tool and model: Windows 11 build 26300.9974, NVIDIA GeForce RTX 2070 SUPER 8 GB (driver 621.40, wave32 only), AMD Ryzen 5 3600XT; rustc 1.100.1 (20ddd0171 2026-11-25) x86_64-pc-windows-msvc, debug test profile; trial merge 90e952bb98be58f5d9387dbd13789634dbf77d41 (local, not pushed). Not tested: AMD, native wave64. Claude Code: Claude Opus 5.5 (coordination, draft), Claude Opus 5.5 (full-diff review), Claude Opus 5.5 (recompiler review).

@github-actions github-actions Bot added ready-to-merge Has 2 independent safe merge-checks on current head (#3041) and removed needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) needs:amd-test Needs a test report or merge-check on an AMD GPU labels Nov 29, 2026
@KOLESNiii

Copy link
Copy Markdown
Contributor

Test report: full startup shader preparation, cold cache, with #3442 + the #3263 stack + the #3269 stack together

One run of a build that combines these three PRs. It shows what they do together; it does not say how much each one contributes.

Build: a96b183c, local merge of 4465c886 (main 3b6a91e + #3318 #3321 #3323 #3325 #3328 #3330 #3332 #3336 #3364 #3377 + #3241 + #3242) with:

cargo build --release -p xcl. Also set: XCL_HEAP_WINDOWS=1 XCL_HEAP_FLAT=1 (stands in for #2428, which does not merge onto this set).

This PR in the build: the whole stack, #3250 e13ccd7f, #3261 16f2f5c1, #3263 e618b742 (the current head).

Run: retail game, XCL_PREPARE_ALL=1 (all 26,503 records), XCL_RUN_SECONDS=180 (ends 180 s after the title starts), XCL_ACTIVITY=1. Cold XCL cache: XCL_DXIL_CACHE pointed at a new, empty folder, so no translation, DXC output or driver blob was reused.

Compared with: the same retail game and settings on 4465c886 alone (the base above, without the three PRs and without the heap switches), run earlier today with a warm cache: it started with 48,305 translations, 44,556 DXIL files and 13,051 driver blobs, and reused about half of its driver blobs.

base 4465c886, warm cache + #3442 + #3263 stack + #3269 stack, cold cache
translation + DXC (26,503 records) 1,353 s 1,619 s
driver compute pipelines 10,868 s 3,413 s
graphics pipelines 374 in ~80 s 391 in 100 s
title first presents 12,326 s (3 h 25 min) 5,141 s (1 h 26 min)
driver blobs made 12,304 new (25,355 in cache) 3,277
failed / fallback pipelines, crash 0 / 0 / none 0 / 0 / none
frames in the 180 s of play 5,104 3,818
  • Preparation finished 2.4× sooner even though the base was given the warm cache. Nearly all of the saving is in the driver's compute pipelines (3.2× shorter), the long tail where the very large compute programs are compiled.
  • The run made far fewer distinct driver pipelines (3,277 blobs against 25,355), which fits shorter, more compact programs reaching the driver.
  • Frames in play were 25 % lower (3,818 against 5,104). One 180 s run per side, with different builds, the heap switches on and the game possibly at a different point, so this is not a measured regression, but it needs a matched check (smoke on main and on this PR's head) before anyone reads the preparation result as free.

Not tested / limits

Hardware: NVIDIA GeForce RTX 2070 SUPER 8 GB (driver 621.40), AMD Ryzen 5 3600XT, 32 GB, Windows 11 Home build 26300, rustc 1.100.1.

Tool and model: Claude Code (Claude Opus 5.5): two sessions on this machine ran the queued runs; this one extracted the numbers from their logs and wrote this report.

@KOLESNiii KOLESNiii 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.

Static review of e618b742 for the stack in the #3041 comparison.

The threshold change itself looks consistent with the tested intent. It makes more wave32 shaders eligible for compaction and therefore exposes an inherited correctness issue I found in #3261. The compact liveness pass can drop a live high SGPR store across a SAVEEXEC_B64 instruction because wave32 lowering writes only the low destination. This is new review evidence for the stack carried by this PR.

Review assisted by Codex (GPT-6, exact variant unavailable). No new build or GPU run for this review.

@Prime1997
Prime1997 merged commit 8c9e83f into xcl-dev:main Nov 29, 2026
12 of 17 checks passed
@Foniass

Foniass commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. Your 4 points are now handled in follow-ups, since this was merged:

Separately, the AMD iGPU also showed that the literal table read 0 on AMD (moombathepilot's #3261 finding). That fix is #3473.

(Claude Code, Claude Opus 5.5, for Foniass)

dudenudem pushed a commit to dudenudem/xcl that referenced this pull request Nov 30, 2026
Takes the upstream sync after 5b0d5fa. Headline changes:
- 8c9e83f/e618b742/16f2f5c1 (xcl-dev#3263): compact DXIL form for branch-heavy
  programs of 2000+ blocks, splitting repeated memory ops and dead SGPR
  stores; compact block PC/literal plumbing in lower.rs and kernel.rs.
- 45dbd47 (xcl-dev#2341): per-lane compute size caps (MAX_INSTS 20,000,
  MAX_DXIL_BYTES 1 MiB) so giant compute programs fall back to compact.
- a7f059b (xcl-dev#2148): SSA trivial-phi/0-pred-phi fixes; 1933324 (xcl-dev#2060):
  reject image_gather4h/8h instead of a 2x2 Gather; 0738c30 (xcl-dev#2369):
  dedupe concurrent stand-in creation and harden shell COM; e9d7aef
  (xcl-dev#2398): saturate 16-bit integer valu16 with CLAMP=1; 6376287 (xcl-dev#1878)
  dxbc digest rounds.

Conflict resolutions:
| file | resolution |
| --- | --- |
| gpu/dxil/lower_wide.rs | took upstream's 32-bit exact CLAMP lowering for the 16-bit integer adds/subs/mads and deleted our T-021 64-bit signed duplicate; kept our v_mul_lo_u16 CLAMP arm (upstream does not cover it) and all our T-124 wave64/OMOD changes; removed the now-unused sat_i16 helper from prelude.rs |
| gpu/recomp/lower_dxil.rs | took upstream's MAX_INSTS/MAX_DXIL_BYTES cap and its size check; kept our marks thread-local propagation (marks::enabled / set_thread) in the per-lane thread |
| gpu/dxil/core_tests.rs | not a merge conflict, but the direct CLAMP test asserted the removed lowering: now expects 3x icmp sgt/slt i32 for valu16, no IMax/IMin, and 3x icmp sgt/slt i64 for the wide signed mads |
| hle/d3d12x/standin.rs | auto-merged upstream's concurrent dedupe and COM hardening; kept our mainline's immediate unref in Drop (our late_release exposes hold(), not hold_pipeline()) and upstream's new tests |
| compact.rs, compact_tests.rs, recomp/ssa.rs, lower_image.rs, kernel.rs, lower.rs | upstream's changes; lower_image keeps our watertight ray/triangle alongside upstream's gather4h/8h rejection |

Build (only possible target for this crate; native Linux fails on
testgame-mw's raw-dylib and retour's stdcall):
  cargo build --release --workspace --locked --target x86_64-pc-windows-gnu
  Finished in 55.12s; 47.01s incremental after the dead-helper removal.

Focused lib tests (Windows test binary under Wine, builtin DXGI, no GPU):
  gpu::dxil:   309 passed; 0 failed; 3 ignored; 80 SKIPPED
  gpu::recomp: 548 passed; 0 failed; 20 ignored; 320 SKIPPED
  hle::d3d12x::standin: 6 passed; 0 failed; 1 SKIPPED (no GPU or WARP)

Direct sweep (xcl.exe under Wine, --sample 0 --threads 8):
  CS 1636/1636  GS 195/390  MS 8724/8724  PS 9511/9511  VS 2184/2184
  total 22250/22445; the 195 unsupported are split-wave64 geometry (ES
  phase exchanges at group barriers). xcl-dev#2060 moved nothing here: the
  corpus has no image_gather4h/8h program in the direct set.
  coverage_gate.py --run-json --skip-recomp: "coverage gate: no
  regressions" (exit 0); baseline stays 22250/22445.

Upstream commits keep their authors; this merge commit only records the
resolutions.
Foniass added a commit to Foniass/xcl that referenced this pull request Nov 30, 2026
Follow-ups to the compact form's review on xcl-dev#3263 (KOLESNiii):
- Plan::words(), which the table limit is checked against, now counts
  the block-PC table and the literal index and pool tables, so a
  program can no longer take the form with more table words than
  MAX_TABLE_WORDS. A plan with a PC table and no block literal no
  longer emits empty literal tables.
- The block-PC table gets the literal index table's fix: entries of a
  power-of-two width, read from one word (entry_bits). The two-word
  read is what AMD's driver got wrong for the literal index; the PC
  values themselves read right on AMD in the new test, so this one is
  for consistency, not a seen failure.
- The comments said repeated memory ops split out at >= 4 occurrences;
  the code does it at >= 2.
- Tests for code that had none: a GPU run of blocks that share a class
  through the PC table, dead far-jump veneers left out (all of them in
  a compute program, all but the last in the kernel form) and a GPU
  run of that kernel form against the plain one, and words() against
  the table sizes in the DXIL.

On the retail title nothing changes: none of its 768 compute programs
that reach the compact plan has a literal or PC table. One of them has
a 16121-word plan (19840 blocks), over main's former 12288-word limit
and under the 32768 one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bobosneefdev pushed a commit to bobosneefdev/xcl that referenced this pull request Dec 1, 2026
Follow-ups to the compact form's review on xcl-dev#3263 (KOLESNiii):
- Plan::words(), which the table limit is checked against, now counts
  the block-PC table and the literal index and pool tables, so a
  program can no longer take the form with more table words than
  MAX_TABLE_WORDS. A plan with a PC table and no block literal no
  longer emits empty literal tables.
- The block-PC table gets the literal index table's fix: entries of a
  power-of-two width, read from one word (entry_bits). The two-word
  read is what AMD's driver got wrong for the literal index; the PC
  values themselves read right on AMD in the new test, so this one is
  for consistency, not a seen failure.
- The comments said repeated memory ops split out at >= 4 occurrences;
  the code does it at >= 2.
- Tests for code that had none: a GPU run of blocks that share a class
  through the PC table, dead far-jump veneers left out (all of them in
  a compute program, all but the last in the kernel form) and a GPU
  run of that kernel form against the plain one, and words() against
  the table sizes in the DXIL.

On the retail title nothing changes: none of its 768 compute programs
that reach the compact plan has a literal or PC table. One of them has
a 16121-word plan (19840 blocks), over main's former 12288-word limit
and under the 32768 one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 8d1bc67)
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) ready-to-merge Has 2 independent safe merge-checks on current head (#3041)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants