Skip to content

Recompiler: direct DXIL optimizer runs to a fixed point with new passes - #3269

Merged
Prime1997 merged 1 commit into
xcl-dev:mainfrom
Foniass:dxil-ir-opts
Nov 30, 2026
Merged

Prime1997 merged 1 commit into
xcl-dev:mainfrom
Foniass:dxil-ir-opts

Conversation

@Foniass

@Foniass Foniass commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

#3266 and #3268 are merged; this PR is now one commit (a899ec90) on main 5b0d5fa3. It includes #3268's review fixes (the fold's phi edges, the 64-bit cmpxchg flag), which are on main.

Rebased for a test on newer main: main's lanes::ps_ballot_tests::direct_ps_mask_and_scc_counts_live_lanes_only (de915b5) split a block with a dead s_add, so that block-local CSE kept two identical waveActiveBallot(true) calls apart. This PR's fixed-point loop runs CSE again after simplify_cfg has merged that block away, and folds them. That fold is correct (one block, no discard between), but the test then counts 1 ballot instead of 2 (the CI failure on 568e9380). The test now exports the skipped s14, so its split stays; that is the only change to it.

The IR part of amd-dev's direct DXIL size work (f089a9df, "shrink emitted shaders 4.5x-5.4x"); the bitcode part is #3250 and the compact-form part is #3261. optimize() now repeats its passes, up to 4 times, while one of them still changes the function. It gains:

  • scalar-alloca store-to-load forwarding and dead-store elimination (mostly the compact form's register slots)
  • entry-block hoisting of repeated constant-argument ReadNone intrinsics (createHandleFromHeap unshared, annotateHandle / getDimensions block-local)
  • branch facts in the dominator-tree CSE
  • chained-select collapse and removal of redundant adjacent barriers
  • in the lowering: constant EXEC lane-bit folds, single-instruction IEEE f32 compares, and constant fast paths for XCL_RDNA_FLOAT's FRC and legacy mul / fma

XCL_DXIL_NO_OPT gains alloca, facts, hoist and barrier.

What is in it

  • crates/xcl/src/gpu/dxil/module/opt.rs: the passes, optimize() rebuilt as the fixed-point loop, layout_positions, three new tests (local_alloca_store_load_forwarding_and_dse, hoist_entry_readnone_and_keep_heap_handles_unshared, redundant_barriers_eliminated_within_block)
  • crates/xcl/src/gpu/dxil/lanes.rs, prelude.rs, lower_valu.rs, module.rs (const_f32); lanes.rs also has the test change above
  • port to main: the loop keeps main's fold_guarded_selects, the trivial-phi pass after simplify_cfg, and main's back-edge check in every trivial-phi pass. The original commit's XCL_HEAP_WINDOWS default flip is left out (two NVIDIA setups failed with heap windows on, per the amd-dev port).

NVIDIA fix in this port: with XCL_RDNA_FLOAT (on by default) the original commit lowers v_fract_f32 to a bare native Frc. On NVIDIA Frc of a tiny negative input returns 1.0, which RDNA never does (it clamps to 0x3F7FFFFF): gpu_fract_f32_edges and f32_programs_on_the_gpu failed every run. The port keeps the native Frc and its result keeps the old clamp. The original was only run on AMD.

Why it needs #3266, and size
Without #3266's live double-ext scan, the new passes remove f64 ops but DoubleExtensions stays declared, and the validator rejects the module (fuzz_validate_and_gpu_0, seed 33). With it, the fuzz tests pass. The change is 886 + 245 lines: the new passes share the rewritten optimize() loop. It could be split into the loop plus one PR per pass if a reviewer prefers.

#3265 (merged): amd-dev's f089a9df also changed #3265's test raw_buffer_oob_check_guards_32bit_wraparound (the atomic's OFFSET from 16 to 20). On main, which has #3265, the test passes unchanged with this PR.

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 a899ec9 (rebased onto main 5b0d5fa): 2779 passed, 0 failed, 49 ignored. SKIPPED GPU tests: 45 distinct notices, 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: 3b6a91ed096d6d6e0fee52cfb86dc0a7d7c8c1b0
gpu: NVIDIA GeForce RTX 5070 Ti
title: 3cb1d8e0
seconds: 60
exit: 0x0
frames shown: 1193 (PresentX 1193)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15684 MB

this PR:

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

Not tested

  • the DXIL size / driver compile time effect on main (not measured), AMD GPUs, whether the image looks the same, other titles

AI use

  • Claude Code with Claude Opus 5.5: ported the IR part of f089a9df, merged its optimize() with main's, found the dependency on Recompiler: fix Direct DXIL live double-ext scan and movrel VGPR range #3266 (seed 33), adapted main's ballot test, ran the tests and the smoke run above, wrote this description.
  • Original code: amd-dev f089a9df (raylitebull, from 46aecbf7, written with Antigravity (Gemini 4 Neon High)).

🤖 Generated with Claude Code

@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:amd Code is specific to AMD / RDNA / wave64 GPUs (scope tag; see needs:amd-test) labels Nov 29, 2026
@github-actions github-actions Bot added needs-pr-check Failing the PR description check (CONTRIBUTING.md) and removed needs-pr-check Failing the PR description check (CONTRIBUTING.md) labels Nov 29, 2026
@Foniass
Foniass marked this pull request as ready for review November 29, 2026 02:59
@github-actions github-actions Bot added needs-1st-check Passes gates; needs first independent merge-check (#3041) needs:amd-test Needs a test report or merge-check on an AMD GPU and removed needs-1st-check Passes gates; needs first independent merge-check (#3041) needs:amd-test Needs a test report or merge-check on an AMD GPU labels Nov 29, 2026
@Kalmarv

Kalmarv commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

merge-check
base: fa20459
head: b97cdff
merge: clean onto main (stacked on #3266 + #3268) and with the full 8-PR stack.
build: cargo build --workspace -> ok; cargo build --release -p xcl -> ok.
tests: In the clean 8-PR stack on main fa204595 with DXC 1.9.2609.5 and default env: cargo test -p xcl --lib --no-fail-fast -- --test-threads=4 -> 2483 passed, 3 failed, 29 ignored; failing: gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu (f32 rounding, wave32: lane 0 v9: 0x3f800000 against 0x3f7fffff), gpu::recomp::tests::gpu_fract_f32_edges (lane 6: fract(-0.000000029802322) below 1.0: left 1065353216 right 1065353215), and hle::kernelx::tests::a_page_whose_move_fails_stays_mapped_where_it_was (parallel flake). Re-running all 3 with XCL_RDNA_FLOAT=0 passed (3 passed; 0 failed in 0.90 s), and the 7-PR stack without #3269 passed all 2620 workspace tests with default env. 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: finding in crates/xcl/src/gpu/dxil/prelude.rs: rdna_float_enabled() (XCL_RDNA_FLOAT) defaults to true, which lowers fract_f to a single dx.op.unary(Frc). On NVIDIA RTX 5070 Ti, dx.op.unary(Frc) returns 1.0f (0x3f800000) instead of 0x3f7fffff for fract(-2^-25), failing both f32_programs_on_the_gpu and gpu_fract_f32_edges. Either keep fract_f's < 1.0 clamp (defaulting XCL_RDNA_FLOAT off on non-RDNA / by default) or drop the Frc shortcut from default lowering.
performance: positive IR shrink from the optimizer passes when XCL_RDNA_FLOAT=0 (8-PR smoke 2096 frames, 32049 MB peak commit), but default-on Frc breaks f32 v_fract_f32 precision on NVIDIA.
verdict: not yet: XCL_RDNA_FLOAT defaults to on in prelude.rs, breaking fract_f on NVIDIA RTX 5070 Ti (f32_programs_on_the_gpu and gpu_fract_f32_edges fail with 0x3f800000 vs 0x3f7fffff; both pass with XCL_RDNA_FLOAT=0).
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.

@Foniass
Foniass marked this pull request as draft November 29, 2026 04:11
@Foniass
Foniass marked this pull request as ready for review November 29, 2026 05:36
@github-actions github-actions Bot added gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) and removed gpu:amd Code is specific to AMD / RDNA / wave64 GPUs (scope tag; see needs:amd-test) labels Nov 29, 2026
@Kalmarv

Kalmarv commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

merge-check
base: fa20459
head: 4a8217a
verdict: safe to merge

Re-verified updated head 4a8217a7 (fast-forward onto origin/main fa204595, NVIDIA GeForce RTX 5070 Ti, DXC 1.9.2609.5, default XCL_RDNA_FLOAT enabled):

  • gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: 1 passed, 0 failed (0.69 s) — the 0x3F7FFFFF clamp on native Frc fixes the previous NVIDIA failure.
  • gpu::recomp::tests::gpu_fract_f32_edges: 1 passed, 0 failed (0.36 s).
  • gpu::dxil::: 241 passed, 0 failed, 3 ignored (8.10 s, including fuzz_validate_and_gpu_0..3).
  • xcl --lib: 2477 passed, 0 failed, 29 ignored (5 parallel-contention tests re-verified 5/5 with --test-threads=1; 2 known main #3187 uma_driver mixed-window tests skipped).

@github-actions github-actions Bot added gpu:amd Code is specific to AMD / RDNA / wave64 GPUs (scope tag; see needs:amd-test) and removed gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) labels Nov 29, 2026
@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 (#3250 → #3261 → #3263 and this PR's #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

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, #3266 a343eafc, #3268 527a8b26, #3269 4a8217a7 (the head is now e01151a2, which differs).

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.

The IR part of amd-dev's DXIL size work. optimize() now repeats its
passes (up to 4 times) while one of them still changes the function,
and gains:

- intra-block store-to-load forwarding and dead-store elimination for
  non-escaping scalar allocas (mostly the compact form's register
  slots), and removal of stores to allocas nothing loads;
- hoisting of repeated constant-argument ReadNone intrinsics (e.g.
  dx.op.groupId) to the entry block; createHandleFromHeap stays
  unshared and annotateHandle / getDimensions stay block-local;
- branch facts in the dominator-tree CSE: below a branch on c, c is
  known (and a switch case's value), so dominated compares fold;
- in-place collapse of chained selects on the same condition;
- removal of adjacent barriers the first one already covers;
- in lanes.rs / prelude.rs / lower_valu.rs: constant EXEC lane-bit
  folds, single-instruction IEEE f32 compares, and constant fast
  paths for XCL_RDNA_FLOAT's FRC and legacy mul / fma.

New XCL_DXIL_NO_OPT names: alloca, facts, hoist, barrier.

Ported to main: the loop keeps main's passes (fold_guarded_selects,
the trivial-phi pass after simplify_cfg) and main's back-edge check in
every trivial-phi pass (positions recomputed after hoisting, CFG
folding and merging; layout_positions). The XCL_HEAP_WINDOWS default
flip of the original commit is left out. Needs the live double-ext
scan of the commit below (xcl-dev#3266): without it, f64 ops the new passes
remove leave DoubleExtensions declared and the validator rejects the
module (fuzz seed 33).

Ported from the IR part of amd-dev's f089a9d (raylitebull,
cherry-picked there from 46aecbf, Assisted-by: Antigravity (Gemini 4
Neon High)).

The native Frc of the XCL_RDNA_FLOAT fast path keeps the 0x3F7FFFFF clamp of the old lowering: on NVIDIA Frc rounds a tiny negative input to 1.0, which RDNA never returns (gpu_fract_f32_edges and f32_programs_on_the_gpu failed without it; the original commit was only run on AMD).

main's lanes::ps_ballot_tests::direct_ps_mask_and_scc_counts_live_lanes_only
split a block with a dead s_add so block-local CSE kept two identical
waveActiveBallot(true) calls apart; the fixed-point loop runs CSE again
after simplify_cfg merged that block away and folds them (correct: one
block, no discard between). The test now exports the skipped s14, so its
split stays.

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

@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 e01151a2 for the stack in the #3041 comparison.

Legacy floating-point fast paths can change signed-zero results. One known finite nonzero operand removes both zero checks. For instance, multiplying literal -1.0 by runtime +0.0 can yield -0.0, where the prior legacy lowering returned +0.0. The FMA fast path can similarly bypass returning the exact addend when the runtime operand is zero. Keep the check for any operand that can still be zero. Float fast paths

The scalar alloca pass can also delete an initializing store if its only load uses a trivial pointer PHI. The load is still keyed by the PHI when liveness is counted. Later operand rewriting exposes a load from the now-uninitialized alloca. I found no current shader-lowering caller that constructs this IR pattern. Store elimination

Both findings apply to 4a8217a7 in the measured stack and were checked in e01151a2.

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

@jsalzy

jsalzy commented Nov 30, 2026

Copy link
Copy Markdown

merge-check claim
head: a899ec9

@github-actions github-actions Bot added needs-1st-check Passes gates; needs first independent merge-check (#3041) needs:amd-test Needs a test report or merge-check on an AMD GPU labels Nov 30, 2026
@jsalzy

jsalzy commented Nov 30, 2026

Copy link
Copy Markdown

merge-check
base: f97120d
head: a899ec9
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2843 passed, 1 failed, 51 ignored; SKIPPED: 25 (22 no wave64 on this GPU; 2 no heap windows (opt-in XCL_HEAP_WINDOWS=1); 1 driver cache cannot be disabled without Windows Developer Mode); failing: two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (gpu_two_pass_cache_e2e.rs:584 "releasing the title PSOs releases their two-pass state", left 1, right 0, in its warm child run; cargo also prints the child's result, so its total reads 2 failed), passes on base this time but is unstable on this machine: the same assertion failed in 4 of 17 suite runs tonight, twice on main alone. Main alone at f97120d: 2841 passed, 0 failed, 51 ignored. The PR's three new tests pass, and so do f32_programs_on_the_gpu (wave32 parts; wave64 skipped) and gpu_fract_f32_edges on this NVIDIA card, the two the first check saw fail on an RTX 5070 Ti at b97cdff.
review: one finding, then the rest reads right. (1) XCL_RDNA_FLOAT (default on) gives mul_legacy and fma_legacy a fast path that returns a plain fmul / fmad as soon as ONE operand is a finite non-zero constant, dropping the == 0 test of the other operand. That test is not redundant: mul_legacy(-2.0, x) with x = +0.0 gives +0.0 on main and -0.0 with the fast path; fma_legacy(2.0, x, -0.0) with x = 0 gives -0.0 on main and +0.0; and a subnormal constant (x != 0.0 in Rust) is taken as non-zero although the GPU flushes it to zero. No test covers a one-constant legacy multiply with a zero operand. #2262 (older, open) changes the same functions but keeps the compare for the unknown operand and excludes subnormals; the two conflict in prelude.rs. (2) The rest, whole diff read: the passes repeat up to 4 times while one still changes the function; scalar-alloca forwarding and dead-store removal only touch non-escaping single-element allocas and stay inside a block; branch facts go only into a block whose single predecessor branches on the condition and stay within its dominator subtree; the entry hoist takes only groupId / threadId / flattenedThreadIdInGroup / createHandleFromBinding with entry-available arguments and leaves heap handles, annotateHandle and getDimensions in their blocks (minor: the doc comments of hoist_entry_readnone still say it hoists createHandleFromHeap / annotateHandle); a barrier is dropped only when an equal or stronger one precedes it in the block with no store, atomic, non-constant load or non-ReadNone call between; CSE's block-local table is cleared after dx.op.discard. f32 compares become single ordered / unordered fcmp (mapping checked: nlt -> UGE, nge -> ULT, nlg -> UEQ, lg -> ONE). #1860 (open) also edits opt.rs's CFG clean-up; not a duplicate.
performance: every pass removes or merges instructions, so the DXIL gets smaller; translation time can rise (up to 4 optimizer rounds per program), not measured here.
verdict: not yet: in the XCL_RDNA_FLOAT fast path of mul_legacy / fma_legacy, take plain fmul / fmad only when both operands are known non-zero normals (or keep the == 0 test of the unknown operand, as #2262 does), and settle the overlap with #2262.
hardware / tool and model: RTX 4070 SUPER 12 GB (621.24 / 32.0.16.2124), Ryzen 7 7800X3D, 32 GB, Windows 11 Pro 25H2 26200.9974, Rust 1.100.0, debug / Claude app (Claude Opus 5.5): merge, build and suite run on this PC with git and cargo only; diff review by Claude Opus 5.5.

@github-actions github-actions Bot removed needs-1st-check Passes gates; needs first independent merge-check (#3041) needs:amd-test Needs a test report or merge-check on an AMD GPU labels Nov 30, 2026
@Prime1997
Prime1997 merged commit c7fbeb4 into xcl-dev:main Nov 30, 2026
4 of 5 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.
Prime1997 added a commit to Prime1997/xcl that referenced this pull request Nov 30, 2026
…faults

own10 skips the alloca/facts/hoist/barrier passes and runs one round by
default, so the three tests of those passes saw them skipped and failed
on the RTX 3060 Ti suite. A test-only thread-local (WITH_3269) gives
those tests xcl-dev#3269's defaults without touching the process environment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DaZV7vMq866ni7pGnJC2Ew
ArtuArtaza added a commit to ArtuArtaza/xcl that referenced this pull request Dec 1, 2026
a899ec9 (xcl-dev#3269) lowered the direct translator's f32 compares (f16 ones go
through f32) to one `fcmp` each, without the explicit NaN tests of xcl-dev#46. Three
GPU tests fail on an RX 6700 XT (32.0.21045.29003) since then:
gpu_f32_compares_with_nan, gpu_float_compares_random and
f32_programs_on_the_gpu. They pass on its parent 5b0d5fa.

The DXIL is right, the driver is not. It takes `fcmp one` (v_cmp_lg) for `une`,
so a NaN operand gives true, and it gives the second of two compares of the
same operands that differ only in ordered / unordered (`olt` and `ult`) the
first one's result, in either order. Two plain fcmps in a kernel without any
wave operation show it: 36 of the 182 ordered pairs of predicates are wrong on
that card and 0 on WARP, the same with XCL_DXIL_NO_OPT=all, so no optimizer
pass takes part. xcl-dev#46 had found the second form on RDNA3 and an RDNA2 iGPU.

Splitting only `lg` into `olt | ogt` leaves 16 pairs wrong and the three tests
failing. The explicit tests do not depend on what the driver makes of an fcmp
of a NaN. They cost 1.65 % more DXIL over 567 sampled programs of a retail
title.

The new test reads the predicates from the disassembly, so it fails without an
AMD card too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 gpu:amd Code is specific to AMD / RDNA / wave64 GPUs (scope tag; see needs:amd-test)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants