What problem does it solve?
Writing custom SPIR-V optimizer passes requires deep knowledge of SPIRV-Tools internals like IRContext, InstructionBuilder, def-use management, and pass registration plumbing, which is poorly documented and error-prone.
Core Features & Use Cases
- Pass Skeletons: Provides ready templates for deriving from
Pass or MemPass, implementing Process(), and declaring preserved analyses.
- IR Manipulation Reference: Covers Instruction, BasicBlock, Function, and InstructionBuilder APIs for building, replacing, and killing instructions safely.
- Testing & Registration: Documents the PassTest fixture helpers (
SinglePassRunAndCheck, SinglePassRunAndMatch) and the full pass registration flow in optimizer.cpp and CMake.
- Use Case: You need to add a new optimization pass to the SPIRV-Tools fork in LuisaCompute; use this Skill to scaffold the pass, write Effcee-based match tests, and wire up the CLI flag.
Quick Start
Write a new SPIRV-Tools optimizer pass that removes redundant stores and register it with a CLI flag.