Repository navigation
rdna2spirv: hoist constant-index %vgpr/%sgpr OpAccessChain to %entry (SHADER-789) - #4440
SweatierKey wants to merge 1 commit into
Conversation
Kam471
left a comment
There was a problem hiding this comment.
Ran this at 7c4a1679 on Windows 11: tests/semantic/test_reg_ptr_hoist.py -> 5 tests, OK; compileall and git diff --check clean.
Constant-index %vgpr/%sgpr OpAccessChains are hoisted to %entry, and the new tests cover the hoisted form plus the cases that must stay in place. No blocking issue.
|
Automated test:
Same machine and setup as my earlier manual reports. AI-assisted (Claude Code). |
|
Tested
No GPU, no game data. AI-assisted. |
|
Verified GPU verification (
|
|
NVIDIA Ada before/after on Windows 11 28000.3501, RTX 4070 Ti SUPER / 617.14. Exact
All 38 selected modules passed Follow-up with #4345 applied as well. Both merge orders produced the same tree on
The size savings compose. The extra size reduction from #4440 did not yield a consistent timing improvement over #4345 alone across all three sizes. All 19 four-way groups produced bit-identical RGBA32F readbacks at all 4,096 pixels. The combined tree passed the 11 focused semantic tests and all 80 modules validated. Synthetic benchmark only. |
|
Tested 7c4a167 on Arch Linux (in a VM), CPython 3.14, LLVM 23.1.5, SPIRV-Tools v2026.4, Mesa llvmpipe: pass, no regression against
|
|
Tested GPU suite (RTX 3080, driver 615.71.09, Vulkan 1.4.351) — identical to
Semantic side, which is what your change touches:
Five extra tests (yours) and the same failing set with the same names — Translator pytest side: the 28 pytest-marked files as CI runs them: 1592 passed, 1 failed on your branch The RTX 5080 was not run in this pass: 186 MiB free on that card (another job holds it here). It matched the 3080 Machine: Linux Mint 22 (Ubuntu 24.04 base), |
|
Tested Corpus (CPU, counts only):
GPU ( Code read (independent, CPU, synthetic programs only): no problems found.
AI-assisted (Claude Code). |
Claim: #4257 (comment) (tracked as
SHADER-789in #4421).What changes
Gen.reg_ptr(kind, r)intools/rdna2spirv.pyand enableshoist_reg_ptrs=Trueintranslate().OpAccessChain %_ptr_Function_uint %vgpr/%sgpr %cNon everyload_reg,store_reg,dst, andv_writelane_b32, emits one%reg_v<r>/%reg_s<r>pointer per accessed register in%entry(after allOpVariabledeclarations and prologue stores, dominating every block in%main).s_movrel*/v_movrel*) remain inline; directGen()callers (unit tests inspectingg.bodywithoutassemble()) default tohoist_reg_ptrs=Falsefor full backwards compatibility.OpAccessChaininto aFunction-scopeOpVariableyields an immutable pointer), default-on for all translated shaders, and completely orthogonal to spirv_opt: sound dominator-tree SPIR-V optimizer (#884) #2298 (--opt), rdna2spirv: the legacy multiply tests |x|, |y| < FLT_MIN instead of flushing both operands, 11% smaller modules (SHADER-771) #4345 (SHADER-771), rdna2spirv: f32 constants are module-scope OpConstants, not a bitcast at each use (-2.4% SPIR-V) #4391 (Gen.fconst), andSHADER-774(%fmt_decode_fn).Measured impact (synthetic shaders,
spirv-as+spirv-val --target-env vulkan1.2)03b09a08)s_cbranch_execzblocks).spv/ 7,846 regOpAccessChain.spv/ 51 regOpAccessChain.spvbytes,spirv-val34→26 msv_fma_f32).spv/ 4,040 regOpAccessChain.spv/ 48 regOpAccessChain.spvbytes,spirv-val14→10 msVerification (Linux CPU, Python 3.13.5, SPIRV-Tools, no game files)
tests/semantic/test_reg_ptr_hoist.py: 5/5 OK (spirv-val --target-env vulkan1.2,%entryordering afterOpVariables, zero non-entry constant-index chains, 32-lane divergentrun_wavewithv_writelane_b32,v_movrels_b32dynamic coexistence,--wave64-emulateCS validation, directGen()compatibility).tests/test_semantic_translator_use.py: 3/3 OK.tests/semanticsuite (unittest discover -s tests/semantic, 7,456 tests): zero new failures (identical to untouchedmain03b09a08: same 7 pre-existing failures + 2 errors intest_loop_ballot_barrier,test_cmp_class_f64,test_mutations).tests/test_*.py: 74/74 passed.git diff --checkclean.AI-assisted.