Repository navigation
Recompiler: specialize constant-selector v_perm_b32 in direct DXIL - #2267
ramon-victor wants to merge 1 commit into
Conversation
|
Tested Independent Windows verification at clean
Not tested Native or split wave64 for this fixture, full AMD workspace, Intel, title samples, and performance. AI use Ran via Samaritan:
|
|
Independent RX 6800M check of PR head Environment: Windows 11 build 26200; Ryzen 9 5980HX; Radeon RX 6800M driver
The fixture checks 10 selector patterns across 8 input pairs and validates/disassembles the generated DXIL. I did not run the full workspace suite, a retail-title smoke, split-wave64, or a performance benchmark on this head. The local wave64 result is not an exact-head test-binary result; it uses the exact-head production code with the fixture mode changed as described. AI use: OpenAI Codex (GPT-6; exact variant not exposed in this session) ran the native Windows tests, made and restored the local fixture-only change, checked the logs, and drafted this report. No game data was used. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Diff review, CI, and both AMD and NVIDIA checks passed on |
…ecialize const v_perm_b32 Rebases xcl-dev#2212 and xcl-dev#2267 onto main and adds constant reversebits folding. Co-authored-by: tibzejoker <tibzejoker@users.noreply.github.com> Co-authored-by: ramon-victor <ramon-victor@users.noreply.github.com>
|
#3503 (main commit 6ff86e3, "specialize const v_perm_b32 (#2267)") merged the same AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
|
Closing as superseded: this change is already on Two independent checks found this: Foniass's close list on #1607 and ours against current AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents. |
Specializes
Lw::perm_b32(v_perm_b32) in the direct DXIL translator when the byte selector operandselis a compile-time constant, avoiding the ~125-instruction dynamic per-byte select tree emitted for arbitrary runtime selectors.For constant selectors (the standard RDNA2 idiom for packing, unpacking, byte-swapping, and sign-extending),
perm_b32_const:s0ors1) and byte-shift delta into a single shift (and omits the byte mask whenever the shift already zeroes the excluded lanes, reducing identity selectors like0x03020100/0x07060504to 0 ops and half-packs like0x05040100to 3 ops).8..=11) into a singleashr(orshl 16+ashr 31for bit-15 signs).12) and0xFF(>= 13) bytes directly into a single constant operand.Part of #1269.
What is in it
crates/xcl/src/gpu/dxil/prelude.rs: addLw::perm_b32_const, dispatched fromLw::perm_b32whenself.s.m.const_u64(sel)isSome(k)(dynamic selectors stay on the existing loop), plusperm_b32_const_tests::gpu_direct_perm_b32_const_selector_matches_isachecking DXIL validation, disassembly (select-tree elimination), and GPU execution across 10 selector patterns covering all selector classes (0..=3,4..=7,8..=11,12,13,255).On a seeded 600-program sample (
xcl shaders <archive> --direct --sample 600 --seed 3 --max-bytes 40000 --validate --threads 8, 573 programs within the cap, measured before rebasing onto1a0bbe3), all 573/573 validate cleanly (0validator failures):42,232,344 B -> 42,221,860 B(-10,484 B)302.63 ms -> 284.48 msTested
621.24, wave32), AMD Ryzen 7 5700X, Windows 11 Pro26300,rustc 1.99.0(x86_64-pc-windows-msvc), DXC/DXIL1.8.2502.11(Windows SDK10.0.26100.0).cargo test -p xcl --lib perm_b32_const_tests(debug):1 passed; 0 failed(validates DXIL, verifies select-tree elimination, and verifies 10 selector patterns × 8 inputs on the RTX 3070)..\scripts\test.ps1(debug, full workspace on headc665154):1251 passed; 0 failed; 46 ignored(25 GPU sub-checks skipped on this wave32 adapter: 21no wave64, 1no heap windows, 3 per-lane#1426refusals).cargo build --release -p xcl+ direct DXIL validation sweep on 573 sampled retail shader programs:573/573translated anddxil.dll-validated (0failures).Regression run
Not tested
XCL_SAMPLE_*env vars unset).AI use
perm_b32_constinprelude.rs, added DXIL disassembly and GPU ISA parity tests, and ran the full workspace test suite, 573-shader validation benchmark, and 60 s smoke regression run.