mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:10:51 +01:00
[PR #2093] spirv_opt: scalar-replace surviving static Function arrays (SHADER-SPIRV-OPT-SROA) #2099
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2099
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2093
Author: @jarvixaiassistant-glitch
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:perf/spirv-opt-sroa📝 Commits (1)
b782be7spirv_opt: scalar-replace surviving static Function arrays (SROA)📊 Changes
3 files changed (+388 additions, -11 deletions)
View changed files
📝
docs/design.md(+5 -3)📝
tests/test_spirv_opt.py(+185 -0)📝
tools/spirv_opt.py(+198 -8)📄 Description
Claimed in the coordination issue as: SHADER-SPIRV-OPT-SROA (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7173149042)
What and why
Adds Scalar Replacement of Aggregates (SROA) to
tools/spirv_opt.py(--opt, off by default) for surviving non-escaped, statically indexed 1DFunction-scope array variables (such as%vgpr[256]and%sgpr[128]when no dynamicv_movrel*/s_movrel*indexing is present):FunctionarrayOpVariableinto individual per-slot scalarFunctionOpVariables for only the live slots actually referenced after dominator-tree store-to-load forwarding and DCE, eliminating monolithic array allocas and their staticOpAccessChaininstructions (enabling further downstream forwarding/DSE/DCE across CFG merges and loops).OpDecorate/OpDecorateId/OpMemberDecorate), non-null initializers, or negative/out-of-bounds static indices.OpAccessChaininstructions cleanly, and generates collision-free SSA IDs across the whole module.docs/design.mdand adds comprehensive unit +spirv-val+ interpreter execution tests intests/test_spirv_opt.py.Tested
tests/test_spirv_opt.py(LEONIDA_REQUIRE_SPIRV_TOOLS=1, Khronosspirv-val): 14/14 PASS (1.013 s), includingtest_sroa_splits_surviving_register_arrays_across_control_flow,test_sroa_preserves_dynamic_array_and_handles_edge_cases, andtest_wave64_emulated_compute_validates_and_shrinks.scripts/check_no_game_data.py: PASStests/test_ci_registration.py: 16/16 PASStests/test_docs_*.pysuites: 50/50 PASSGPUs tested: n/a (pure-Python
tools/spirv_opt.py+ Khronosspirv-val+ SPIR-V interpreter tests on Windows 11)AI-assisted: yes (JARVIX)
Checklist
main(db1a22d29) and merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.