Recompiler: direct DXIL PS IR cuts (shared float decode, direct quad shuffles, predicate-derived lane masks) #3501
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3501"
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 Kalmarv on 2026-11-30T03:25:47Z.
Three direct-DXIL pixel-shader IR cuts that reduce DXIL size and cold driver compile times on heavy pixel shaders.
What is in it
Tested
cargo check -p xcl --tests: passed on this exact head againstorigin/main(91244db94)scripts/smoke.ps1running now and will be pasted below.Regression run
main:PR head:
Not tested
AI use
Imported from ivall/xcl. Originally posted by CharlyRien on 2026-12-01T12:32:56Z.
Same report as on #2571 (https://github.com/xcl-dev/xcl/pull/2571#issuecomment-7311064649), posted here because it points at this PR's
ballot_ps_quadlowering: on an RTX 3090, with #2571's forms switched off, this lowering hangs the GPU in one draw, and #2571 hides the hang at a large frame-rate cost (the drop minimalhipster990 bisected to #2571 on the 4090).Stack: main
493dbd3d(has #3535) + #3528 (ba8592a4) + #3517 (0b4283d1) + 42 local commits of ours (memory-window, alias-copy and diagnostic switches; none touchesrecomp/ps_masks.rs,dxil/kernel.rs,lower.rs,lower_valu.rsorlanes.rs). Run settings as in our earlier reports (16 heap windows,XCL_SPARSE_WINDOWS=4,XCL_GPU_WAIT_TIMEOUT_MS=45000). Fresh shader preparation for each build, warm driver cache. Presents/s from world +20 s to +180 s, one setting per run.lw.ps_masksleft empty indxil/kernel.rs)ballot_ps_quadas before #3501 (4WaveActiveBallot, local switch indxil/lanes.rs)53e85fb1(before #3499, #3501 and #2571)What we read (not measured):
02202839) produces: the code #2571 added elsewhere (lower_valu.rs,lanes.rs,compact.rs) is skipped whenps_masksis empty. That parent already has #3501 (a50fa7ab), which turnedballot_ps_quadintoWaveActiveBit(Or)+QuadReadLaneAt.QuadReadLaneAtand from 6 to 44WaveActiveBit(Or), inside a loop capped at 65536 iterations; the loop exit takes one of those masks. The bodies are otherwise the same (same CFG, resource handles, discard).real.rsprints "DRED page fault at GPU VA 0x0" whenever the page-fault output is readable, even for a hang, so that line is misleading.What we deduce: on NVIDIA (wave64 split into two wave32 halves) the #3501
ballot_ps_quadlowering can hang this draw. #2571 replaces most of those compares with its forms, so the hang disappears, but the frame rate drops (0.23 here, against 0.66-1.41 with the #3501 lowering reverted instead). That would also match the 82-87 s DRED-3 hangs reported on the 4090 before #2571. We have not found which instruction hangs, nor checked AMD.The image in the two no-hang runs is not clean either (bald character and half-dark window, as on our earlier trees, see #505 / #3517), so this is a pace and hang result, not a rendering one.
Hardware: RTX 3090 24 GB (driver 616.56, Resizable BAR off), Ryzen 9 5950X, 32 GB, Windows 11 22631. Not tested: AMD, main without our local commits.
AI use: Claude Code (Claude Opus 5.5) ran the builds, preparations and runs, read the logs and wrote this; Antigravity CLI (Gemini 4 Neon) compared the two DXIL dumps (read-only); checked and posted by me.
Imported from ivall/xcl. Originally posted by minimalhipster990 on 2026-12-01T17:27:44Z.
On an RTX 4090 (driver 621.40, Windows), the in-world slowdown for one pixel shader first appears at
a50fa7a. Restoring only the pre-PR body ofballot_ps_quadon top of the complete PR brought this draw back below 0.12 ms in all 12 active pairs tested. This directly tests the function identified in the RTX 3090 report for GPU time on the 4090. The preceding commit,e18e7b2, produces byte-for-byte identical DXIL to the pre-PR baseline for this shader.e18e7b2vsa50fa7aballot_ps_quadvs unchanged complete PRThe host was fixed at
a07ad1b1with #3318. Guest dump hashes werebf5a7665d0c6631a(mesh) andaf68da74e05dbb3c(pixel, guest wave64 on wave32 hardware). Each pair reused the same real indirect command, geometry, descriptors and depth/stencil tests, with depth/stencil writes disabled in both passes. Each pass started from a private copy of the same six color targets at 2560×1440. GPU timestamps cover the mesh/raster command. The table selects two compute groups and eight mesh groups with PS invocations. B was slower in every pair, in both execution orders. Mesh primitives, clipped primitives and PS invocations matched within every pair in the table.Color changes too. In the adjacent-commit test, the two active readbacks differed at 360 and 450 texels on target 1 only. In the function-only test, the two active readbacks had 103 and 104 PS invocations respectively. Restoring the old function changed 60/63/40 texels on targets 0/1/2 in the first draw and 56/60/35 in the second. Targets 3–5 matched. A console reference would be needed to decide which output is correct.
The function-only control kept the PR's quad shuffle and predicate changes intact. Both replay processes exited cleanly. The measurements cover this shader's draw time in one save. Whole-game frame rate and the cause of the pre-world hang remain open.
AI use: OpenAI Codex (GPT-6) reconstructed the intermediate trees, ran the builds and GPU replays, checked the logs and readbacks, and drafted this comment.