Brandon Schneider
|
c01ecc469d
|
feat: SPIR-V copy-if optimizer — skip zero deltas in GPU shaders
Transforms branch-based patterns to OpSelect:
Before: 3 blocks, OpBranchConditional, OpPhi
After: 1 block, OpSelect (single-cycle on most GPUs)
Pattern detection:
- OpSelectionMerge + OpBranchConditional
- True block: single compute + OpBranch
- False block: empty (just OpBranch)
- Merge block: OpPhi merging true/false values
Transformation:
- Remove SelectionMerge + BranchConditional
- Inline compute instruction
- Replace OpPhi with OpSelect
- Collapse 3 blocks to 1
Same pattern as:
- VCN delta+RLE (3.3x): skip zero bytes
- QR spatial hash (2.18x): skip non-neighbors
- Lean compilation (2.7x): skip trivial theorems
- Spatial hash (86.5% cache hit): skip empty cells
Driver-agnostic: works at SPIR-V level before Mesa.
No Mesa fork required. No NIR pass needed.
|
2026-05-30 15:57:08 -05:00 |
|