What problem does it solve?
Compiler contributors working on LuisaCompute need a clear map of how DSL code flows from AST through two intermediate representations (legacy Rust-based IR and the newer pure C++ XIR) into backend codegen, plus a catalog of available optimization passes.
Core Features & Use Cases
- Dual IR Pipeline Reference: Explains the legacy Rust IR path (ast2json → Rust FFI) and the preferred XIR path (ast2xir translator, xir2json serialization, xir2ast round-trip).
- XIR Architecture Guide: Documents the value hierarchy, instruction set (control flow, memory, SSA, arithmetic, resource, atomic, autodiff), structured control flow with merge blocks, and metadata system.
- Optimization Pass Catalog: Lists 40+ passes in src/xir/passes/ covering DCE, mem2reg, GVN, SCCP, LICM, SROA, inlining, and autodiff, with pipeline factory helpers.
- Use Case: When adding a new XIR optimization pass, follow the documented convention: create the pass in src/xir/passes/, register it in CMakeLists.txt, accept a Module or Function, and use XIRBuilder with replace_all_uses_with().
Quick Start
Explain how the LuisaCompute XIR pipeline lowers an AST for-loop into LoopInst blocks and which passes optimize it.