Recompiler: batch consecutive v_readfirstlane/v_readlane exchanges in… #938
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/944"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by zondy1i on 2026-11-24T09:11:48Z.
In split-wave64 mode (two hardware wave32 halves per console wave64), consecutive independent
v_readfirstlane_b32andv_readlane_b32instructions (for example, 4-dword V# or 8-dword T# descriptor waterfalls in wave64 mesh and compute shaders) previously each emitted a separatexcl_x_rla_uniformcall — inlining a full cross-halfxcl_x_meet()barrier/spin-wait exchange per instruction.PRELUDE_X64already supports multi-word exchanges (xcl_x_put(i, ...)/xcl_x_meet()/xcl_x_get(i), as used by coherents_load_dwordx4andds_bpermute). This batches consecutive dependency-freev_readfirstlane_b32/v_readlane_b32instructions inside each basic block into a single multi-wordxcl_x_meet()(sharing onefirst_lane(exec_lo, exec_hi)call across the batch), reducing DXIL size, DXC compile time, and NVIDIA driver (nvgpucomp64.dll) pipeline compile time. Native wave64 and wave32 HLSL are unchanged, and this is orthogonal to #917 (v_writelane_b32spill shadows).What is in it
crates/xcl/src/gpu/recomp/emit.rs:Em::emit_instsfor consecutive plainv_readfirstlane_b32/v_readlane_b32instructions within a basic block. Splits on any SGPR/EXEC read-after-write dependency, skips reads already resolved byupper_lanes, and caps batch width at(64 / waves).clamp(2, 8)so per-wave exchange storage stays<= 256dwords (1 KiB).Em::configure_round_modes(may_use_lds) for guest LDS use (Mode::Geometry(_)or anyENC_DSinstruction other thands_swizzle_b32/ds_bpermute_b32withGDS == 0), and keep lane-read batching at the existing 1-word slot (XCL_X_SLOT 1u) for those programs at every group size soXCL_X_LDS_TOPis never shrunk into guest LDS space.crates/xcl/src/gpu/recomp/tests.rs:split_wave64_readlane_batching_rules: covers 4-word batching, SGPR andEXECdependency splits, jump-target splits, 64- and 1024-thread slot caps, and native wave64 invariance.split_wave64_readlane_batch_preserves_guest_lds_top: 512-thread regression verifying that 8v_readfirstlane_b32beforeDS_WRITE_B32keepXCL_X_SLOT 1uandXCL_X_LDS_TOP 8142u, whileDS_SWIZZLE_B32still batches (XCL_X_SLOT 8u).gpu_split_wave64_batched_readlanes: GPU test verifying upper-half active lanes, mixed lower/upper lane batches, SGPR dependency split, andEXEC-modifying split.Across 10,447 wave64 CS/MS programs in a retail shader pack (measured pre-rebase), this removed 19,334
xcl_x_meet()exchanges (18,049 from consecutivev_readfirstlane_b32and 1,281 from consecutivev_readlane_b32).Measured on four retail wave64 shaders on
origin/main(09940bb) -> pre-rebase commit (e7199ca) (RTX 3060 Ti, DXC 1.9.2609.5):75 -> 25(-66.7%), DXIL345.6 -> 332.2 KB(-3.9%), DXC4549 -> 3853 ms(-15.3%), cold PSO7149 -> 6191 ms(-13.4%)258 -> 101(-60.9%), DXIL328.4 -> 279.7 KB(-14.8%), DXC7865 -> 5366 ms(-31.8%), PSO5551 -> 5409 ms(4481 ms first cold run)310 -> 131(-57.7%), DXIL426.7 -> 382.3 KB(-10.4%), DXC10468 -> 8867 ms(-15.3%), PSO9406 -> 8077 ms(-14.1%)505 -> 361(-28.5%), DXIL1028.9 -> 994.8 KB(-3.3%), DXC25564 -> 22523 ms(-11.9%), PSO24487 -> 21444 ms(-12.4%)Tested
x86_64-pc-windows-msvc), debug + release.origin/main(b49be183).cargo test --workspace -- --test-threads=4one22a0a6: 1438 passed, 0 failed, 47 ignored across 37 test binaries (29 runtimeSKIPPEDnotices from adapter-gated tests); all three tests (split_wave64_readlane_batching_rules,split_wave64_readlane_batch_preserves_guest_lds_top,gpu_split_wave64_batched_readlanes) ran and passed.Regression run
main:
PR:
Not tested
split_wave64is false there so emitted HLSL is unchanged).e7199ca; shaders without guest LDS are unaffected).AI use
Imported from ivall/xcl. Originally posted by Xeltax on 2026-11-24T09:32:51Z.
A first AMD run, on native Windows: the split form forced on 64-lane hardware, and the native path.
Tested
e7199camerged ontomain077ce40(clean merge).XCL_ADAPTER=radeon XCL_SPLIT_WAVE64=1 cargo test -p xcl --lib split_wave64 -- --test-threads=4.runner::split_wave64()is then true, so the HLSL batching asserts ofgpu_split_wave64_batched_readlanesrun as well:main077ce40: 6 passed, 0 failed, 1 ignored, in 5 of 5 runs.XCL_REQUIRE_GPU=wave64, noXCL_SPLIT_WAVE64):gpu::recompmodule: 190 passed, 0 failed, 18 ignored, no skips.maingives 188 / 0 / 18.Not tested
SlopTartsaw forced-split failures in #772.AI use
Imported from ivall/xcl. Originally posted by eizispark on 2026-11-24T09:37:05Z.
Hardware check of
e7199ca3f4fd985969b73bd17d5108866c93a679(verified clean merge withmain077ce40): pass.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profilecargo test --workspace --no-fail-fast -- --test-threads=4:715 passed, 3 failed, 41 ignored(GPU tests skipped on this adapter:none); the 3 failures are the pre-existing concurrenthle::d3d12xcontention (placed_title_textures_share_vram_and_preserve_pixelsplus 2 downstreamPoisonErrors), verified clean viacargo test -p xcl --lib hle::d3d12x -- --test-threads=1:115 passed, 0 failed, 1 ignoredsplit_wave64_readlane_batching_rules,gpu_split_wave64_batched_readlanes,gpu_wave32_program_in_wave64_hardware, andgpu_geometry_wave32_prefix_count_over_a_maskall passed on native wave64; also verified forced split-wave64 execution on discrete RDNA4 viaXCL_SPLIT_WAVE64=1 cargo test -p xcl --lib gpu_split_wave64_batched_readlanes -- --nocapture:1 passed, 0 failedRegression run
main(beaa245):PR (
e7199ca):Not tested
AI use
scripts/smoke.ps1harness on this machine and formatted this report.Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-24T09:43:14Z.
Update for head
e22a0a6: paired rerun onmainb49be18, same cards,cargo test -p xcl --lib -- gpu:: --test-threads=4. On both cards, the only result changes againstmainaregpu_split_wave64_batched_readlanes,split_wave64_readlane_batch_preserves_guest_lds_topandsplit_wave64_readlane_batching_rules, all ok, with no new skips. RX 9070 XT: 708 → 711 passed, 2 failed (#2115, the same onmain), 6 SKIPPED. RTX 3060: 710 → 713 passed, 0 failed, 24 SKIPPED.AMD run with native 64-lane waves, plus NVIDIA. Updated for head
e6a94f5(first run was one7199ca, same result).Tested: pass, head
e6a94f5applied onmainaaa0936, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17.cargo test -p xcl --lib -- gpu:: --test-threads=4:gpu_split_wave64_batched_readlanesok. The 2 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1and_3, which fail the same way onmainwithout this PR on this card.gpu_split_wave64_batched_readlanesok.Not tested: retail gameplay; performance.
Note: these runs check that the translated HLSL matches the test's reference model, in 64-lane and in 32-lane waves. They cannot show that the model matches the hardware.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-24T10:37:57Z.
Linux / AMD RDNA3 datapoint.
Merged state: head
e7199caonto main9aec53d, clean merge.Full suite,
cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 719 passed, 7 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows. batched readfirstlane/readlane green.Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.
Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross
x86_64-pc-windows-gnu,XCL_NETWORK=0, release profile,--test-threads=4. My Linux rows: #42 / #718.AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T12:38:45Z.
Independent verification, merged onto current
main384f7f7locally (clean merge).Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug; DXC 1.8.2502.11.
cargo test -p xcl --lib readlane: 2 passed, 0 failed —split_wave64_readlane_batching_rulesandgpu_split_wave64_batched_readlanes(GPU) both pass.AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Imported from ivall/xcl. Originally posted by pvfreis on 2026-11-24T14:36:39Z.
Review: COMMENTED
Review of
e7199ca(merge base09940bb), by reading the code; nothing was built or run here. I checked that each batched read sees what the unbatchedxcl_x_rla_uniformsequence would (lane indices,first_lane(exec)and the reads are all computed before the first SGPR write,emit.rs:972-990; dependent reads split the batch,:890-937), and that the GPU test compares against independent values. No defect found.Questions for the author
XCL_X_SLOTmovesXCL_X_LDS_TOPdown (emit.rs:4345): for a 1024-thread group from word 8094 to 7902 (arithmetic), and LDS accesses above the top are clamped onto it. Did the shader-pack scan check that no LDS-using program reaches between the old and new top?Review by Claude Code (written by Claude Opus 5.5, second read by Claude Fable 5.2); each point checked by a person before posting.
Imported from ivall/xcl. Originally posted by zondy1i on 2026-11-24T14:48:18Z.
Thanks for the code review! Answering both questions:
XCL_X_LDS_TOPfor 1024-thread groups: We cappedXCL_X_SLOTat 4 for 1024-thread groups (768 Bextra, movingXCL_X_LDS_TOPfrom word 8094 to 7902, leaving 31,608 B of LDS) rather than 8 specifically to keep the footprint small. The corpus scan verified static exchange reductions and clean translation/compilation across all 10,490 wave64 CS/MS shaders, rather than proving dynamic runtime LDS offsets on every 1024-thread LDS-using shader. If a tighter guarantee is preferred, cappingx64_batch_capwhenself.uses_ldsis true for 1024-thread groups is straightforward — happy to add that if desired.recomp::translate(split-wave64) across all 10,490 wave64 CS/MS shaders in a retail shader corpus, and the DXC/PSO times come from a one-off local Rust harness callingrecomp::translate->dxc::compile->CreateComputePipelineStateon a cold cache (single cold build per shader on Windows 11 + RTX 3060 Ti).18,049 + 1,281 = 19,330in compute shaders plus4in mesh shaders =19,334total exchanges removed.AI use: Antigravity (Gemini 4 Neon) helped draft this reply from the code and measurement logs.
Imported from ivall/xcl. Originally posted by pvfreis on 2026-11-24T14:57:49Z.
Thanks, that answers both (and the 4 are the mesh shaders, understood).
On the LDS top: since the scan checked translation and compilation rather than the LDS offsets programs reach at run time, the cap you describe (no batching beyond today's slot size when
uses_ldsis set for 1024-thread groups) would remove the one risk at little cost, so I'd add it.On the numbers: the harness could live in the tree as an
#[ignore]test that reads the shader pack from anXCL_SAMPLE_*variable, as the other game-data tests do (CONTRIBUTING, "Tests on game data"). Then anyone who owns the title can rerun the counts and timings on their own GPU.Reply by Claude Code (Claude Opus 5.5); checked by a person before posting.
Imported from ivall/xcl. Originally posted by Mykolas009 on 2026-11-24T15:02:27Z.
Tested on NVIDIA Blackwell: this PR's head
e7199camerged ontomain6efdabc(clean merge, not pushed).Ryzen 5 7500F; Windows 11 Pro 26300; Rust 1.100.0 MSVC; DXC 1.9.2602.17; debug.
cargo build --workspace+cargo test --workspace --no-fail-fast -- --test-threads=4:729 passed, 0 failed, 41 ignored (
main6efdabcalone: 727 / 0 / 41, 3 of 3 runs).SKIPPED:
gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64).split_wave64_readlane_batching_rulesandgpu_split_wave64_batched_readlanes: pass.emit.rsandmod.rsfrommainand this PR's tests kept, both tests fail(
tests.rs:5808andtests.rs:5897).main077ce40+ this PR: same result for its own tests and the negative control.Since #798 the exchange this PR removes is also the bounded-spin one in one-wave groups, which costs about
8.3x of wave32 per exchange on this card (
bench_split_wave64). I did not measure this PR's effect onframe times.
Not tested
smoke.ps1(no game files); frame times of real shaders. AMD.AI use
Imported from ivall/xcl. Originally posted by Mykolas009 on 2026-11-24T15:49:55Z.
How much the batching saves on NVIDIA, since nobody has timed it yet. A local benchmark (not for a PR,
built like
bench_split_wave64: a 2^18-thread compute dispatch, 32,768 loop iterations, GPU timestamps,median of 9, release) on
main930e8b4with and without this PR (e7199ca), 2 runs each:mainv_readfirstlaneof lane valuesv_readfirstlane(nothing to batch)So four reads in a row run about 3x faster, and a lone read is unchanged. The wave64 output of every case
is identical with and without the PR (same hash of all stored values).
Tested
Rust 1.100.0 MSVC; DXC 1.9.2602.17.
930e8b4+ this PR (debug): full suite 753 passed, 0 failed, 41 ignored; both new tests pass andboth fail with
emit.rsandmod.rsfrommain(tests.rs:5808, 5897).Not tested
AI use
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-25T23:21:39Z.
Follow-up on the LDS cap at head
e6a94f5: the largest extra reservation is at 512 threads, not 1024. Eight independentv_readfirstlane_b32instructions before aDS_WRITE_B32selectXCL_X_SLOT 8and moveXCL_X_LDS_TOPfrom word 8142 to 7918 (896 more bytes reserved). Guest LDS words 8000 and 8001, distinct on the previous single-word exchange, would both clamp to 7918. This address alias is a source-level prediction; I have not run a GPU readback of those two words.I added a synthetic 512-thread translation regression locally. It fails on the PR head (
0 passed, 1 failed) because the slot expands, then passes with a small guard (1 passed, 0 failed). The existingsplit_wave64_readlane_batching_rulesunit test andgpu_split_wave64_batched_readlanestest also pass with that guard (1/0each, the GPU test ran on an RTX 3080 Ti with no skip). The test reads no game data.Suggested bound: classify possible guest LDS use over the decoded program before emitting instructions, then keep lane-read batching at the existing one-word slot for that class at every group size. Exclude
DS_SWIZZLE_B32,DS_BPERMUTE_B32, and GDS accesses from that classification; geometry also has implicit LDS. Checkinguses_ldsinside the batching loop is insufficient when lane reads precede the first DS instruction. This leaves the no-LDS batching benefit intact. I have an uncommitted 27-line local diff (including the regression) if useful.AI use: Codex (GPT-6.2 Sol) reviewed the source, wrote and ran the synthetic regression and local guard, and drafted this comment.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T03:11:27Z.
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
Imported from ivall/xcl. Originally posted by zondy1i on 2026-11-26T08:24:15Z.
Rebased onto current
main(b49be183) and addressed @thehollowedone's 512-thread guest-LDS headroom finding ine22a0a6:Em::configure_round_modes(may_use_lds) for guest LDS usage (Mode::Geometry(_)or anyENC_DSinstruction other thands_swizzle_b32/ds_bpermute_b32withGDS == 0), and keep readlane batching at the existing 1-word slot (XCL_X_SLOT 1u) for those programs at every group size soXCL_X_LDS_TOPis never shrunk.split_wave64_readlane_batch_preserves_guest_lds_top(512-thread regression confirming 8v_readfirstlane_b32beforeDS_WRITE_B32keepXCL_X_SLOT 1uandXCL_X_LDS_TOP 8142u, whileDS_SWIZZLE_B32still batches).Full workspace suite on
e22a0a6: 1438 passed, 0 failed, 47 ignored; 60 s smoke is updated in the description. Thanks @thehollowedone for catching this!Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-26T09:57:57Z.
Independent Windows/NVIDIA check of #944 head
e22a0a6, rebased onb49be183and including the guest-LDS guard:cargo build --offline --locked --workspace: passed.cargo test --offline --locked -p xcl --lib gpu_split_wave64_batched_readlanes -- --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored, no GPU skip.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --quiet: 1,438 passed, 0 failed, 47 ignored across 37 test executables. The output also printed 25SKIPPEDnotices; I do not count those paths as GPU coverage.This verifies the current head's test behavior on this adapter. I did not repeat the earlier shader-corpus timing or run a retail title, so I cannot confirm the current head's compile-time gain or retail behavior.
AI use: Codex (GPT-6.2 Sol) inspected the revision, ran the tests, and drafted this report.
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T02:45:34Z.
merge-check claim
head:
e22a0a6e78Imported from ivall/xcl. Originally posted by throny on 2026-11-28T03:01:06Z.
merge-check
base:
753e8b1ahead:
e22a0a6e78merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1515 passed, 0 failed, 47 ignored; its split-wave64 tests ran on this wave32-only card and passed (26 SKIPPED lines); base alone: 1512 passed, 0 failed, 47 ignored
review: no blocking finding. A batch is consecutive plain readfirstlane / readlane instructions inside one block; it ends at any read of a register written inside it and at any write to EXEC, VCC or M0, so an EXEC change is never straddled. Which half provides the value is the same rule as the existing uniform exchange. Programs with guest LDS are excluded. Minor: inside a batch the pc markers and comments are emitted in a different order.
performance: fewer exchange meetings per shader on wave32-only GPUs; each group's shared memory grows by at most about 1 KB. It changes a translator source: every tester re-translates all shaders once. The gain was not measured here; I can add a world run on this card.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T11:38:25Z.
merge-check claim
head:
e22a0a6e78Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T12:04:53Z.
merge-check
base:
e429936c10head:
e22a0a6e78merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2129 passed, 9 failed, 48 ignored, 25 SKIPPED: 21 no wave64, 3 per-lane f16/f32 forms refused (#1426 semantics), 1 no heap windows; failing: gpu::dxil::module::split::tests::dispatch_chain_oversized_loop_matches_whole, gpu::dxil::module::split::tests::dispatch_chain_wave32_live_loops, gpu::dxil::module::split::tests::dispatch_chain_wave64_live_loops_and_exchange, gpu::recomp::heap_window_tests::gpu_heap_flat_reads_match_guarded_and_root_output, gpu::recomp::tests::gpu_compute_mode_dispatch_abi, gpu::recomp::tests::gpu_float_cas_uses_ieee_equality, test_title_draws_with_a_root_signature_under_the_debug_layer, test_title_runs_and_game_folder_is_untouched, test_title_runs_under_the_debug_layer_with_dred: these 9 fail on the base too (the base e429936c's suite, run alone on this PC with the same command: 2126 passed, 9 failed, 48 ignored, 25 SKIPPED, these same 9 failing), and each also failed when rerun alone on this merge (the two debug-layer e2e tests stop on the D3D12 debug layer rejecting a pixel shader as corrupt or unsigned, and test_title_runs_and_game_folder_is_untouched on the test title's console command list memory-methods check, "post-Wait32/64 write failed"); not caused by this PR. The suite ran on this PC at the same time as 3 other PRs' suites, in one queued job.
review: [major] crates/xcl/src/gpu/recomp/emit.rs:1066 and :1075 (emit_insts): a batched run of split-wave64 v_readfirstlane_b32 / v_readlane_b32 is emitted through emit_x64_readlane_batch and the loop continues without calling x64_fail_closed_since(emitted_from), which every other exchange (the reduction tail at :1072, and each inst() at :1086) is followed by -> in a group of more than 64 threads (x64_spin), a half whose partner timed out at the batch's xcl_x_meet() keeps running with the 0 placeholders instead of returning, which the comment at :1082-1085 says it exists to prevent ("later stores would turn a synchronization failure into plausible but undefined game output"). Evidence: emit.rs:1063-1086, x64_fail_closed_since at emit.rs:5031 matches "xcl_x_meet(" (confirmed by reading; not triggered in a test). Fix: call self.x64_fail_closed_since(emitted_from) before both
continues. Rest of the diff read (may_use_lds pre-scan; dependency tracking on SGPRs, EXEC and VCCZ/EXECZ; slot cap (64 / waves).clamp(2, 8); batching off with guest LDS and in geometry; 3 tests); x64() excludes vertex and pixel shaders, so the batch's first_lane (not first_lane_live) and the skipped graphics-reduction reads do not apply.performance: reasoned, not measured: fewer exchanges (one xcl_x_meet per batch of 2-8 lane reads instead of one each) in split-wave64 compute / mesh / kernel programs without LDS; translator output changes, so those shaders are translated again once.
verdict: not yet: one major finding (a batched lane-read exchange skips the fail-closed exit after a partner timeout); add the x64_fail_closed_since call
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 0edd4686341a561a1a8ed609b5b72d3e401836d6 (local, not pushed). Claude Code: Claude Opus 5.5 (coordination, full-diff review, draft).
correction (2026-11-28): the base counts above were first given as 2128 passed: that base run reused this PC's merge test binary (one cargo target dir for both sides). The base was rerun with its own target dir; the same 9 tests fail on it, so the classification and the verdict stand.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:32:46Z.
Triage (#1607) – head
e22a0a6No open or merged PR makes the same change for the HLSL path. #2343 (same author) is the direct-DXIL counterpart (
gpu/dxil/lower_valu.rs,lanes.rs), so the two do not overlap. #981 (merged) only folded reduction tails, which this keeps (batch of more than 2 first, then the tail fold, then a batch of 2).Dependency tracking looks right. Sources are read before the single meet and results are written after it, so a write-after-read inside a batch is safe. A read-after-write on an SGPR, EXEC (readfirstlane) or VCCZ/EXECZ ends the batch. Batching is off when the program may use guest LDS or runs in geometry mode. No problems found in the diff.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-12-01T05:54:33Z.
merge-check
base:
d0832e614fhead:
e22a0a6e78merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> NVIDIA: 2893 passed, 0 failed, 51 ignored, 24 SKIPPED lines (base alone: 2890 passed, 0 failed, 51 ignored, 24 SKIPPED). The 3 new tests (
split_wave64_readlane_batching_rules,split_wave64_readlane_batch_preserves_guest_lds_top,gpu_split_wave64_batched_readlanes) passed. AMD Radeon iGPU (XCL_ADAPTER=radeon): the 3 new tests passed, then the lib test binary stopped with exit 0x80004005, as it does on the base alone (#3488). The other failures are identical with and without this PR:gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form,f32_programs_on_the_gpu,gpu_f32_compares_with_nan,gpu_float_compares_random,two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs. Radeon,cargo test -p xcl --lib gpu::recomp::tests -- --test-threads=4(the module this PR adds to, run alone so the lib binary does not stop): 225 passed, 2 failed, 18 ignored, against 222 passed, 2 failed, 18 ignored on the base alone; the same 2 fail on both (gpu_f32_compares_with_nan,gpu_float_compares_random), and the 3 new tests pass.review: KOLESNiii's major finding holds on the current merge, and it is a semantic conflict with
main, not a slip in the PR.maingainedx64_fail_closed_sincein86a90eeb("Shaders: fail closed on wave64 rendezvous timeout", 2026-11-26), one day after this head (2026-11-25), so the PR never saw it. In the mergedemit_insts(emit.rs~1043-1070), the reduction-tail path and everyinst()are followed byself.x64_fail_closed_since(emitted_from), but both batch branchescontinuewithout it.emit_x64_readlane_batchemitsbool ok = xcl_x_meet();and thenok ? xcl_x_get(i) : 0u, so after a timed-out partner a half keeps going with zeros.x64_fail_closed_sinceemitsif (xcl_x_dead) return;only whenx64_spin()holds, i.e. groups of more than 64 threads (x64_spin_for). Batching is allowed there (cap64 / waves, clamped to 2-8), so the case is reachable. The fix is one line before each of the twocontinues:self.x64_fail_closed_since(emitted_from);. The rest of the batching agrees with throny's review: it ends at a read of a register written in the batch, and it is off when the program may use guest LDS (may_use_lds, a pre-scan) or in geometry mode.performance: fewer
xcl_x_meet()calls in split-wave64 programs with runs of lane reads; nothing measured in a title here.verdict: not yet: add
x64_fail_closed_since(emitted_from)after both batched exchanges inemit_insts, so a batch fails closed like every other exchange on currentmainhardware / tool and model: RTX 5070 Ti 16 GB (wave32) + AMD Radeon iGPU, Ryzen 7 9800X3D, Windows 11 26300, debug test profile. Claude Code, Claude Opus 5.5: merge, build, both suites, full-diff review of the merge result.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.