x + y
in LuminAIR, no computation happens immediately. Instead:
- The operation is recorded in a directed acyclic computation graph.
- Actual computation occurs only when
graph.gen_trace()
is executed.
Why AOT Compilation?
By fully representing ML models as static computation graphs, compilers have global knowledge of the entire model. This allows for:- Advanced Optimizations: Compilers can perform tasks like operator fusion, backend-specific optimizations, and linking operations to their AIR equivalents.
- Separation of Concerns: All complexity is pushed to compile time, leaving runtime execution lightweight and efficient.
How LuminAIR Compilers Work
Compilers in LuminAIR are modular and stackable, meaning multiple compilers can be applied sequentially to transform the computation graph. Each compiler focuses on a specific optimization task.
Default Compilers Provided by LuminAIR
- GenericCompiler
- StwoCompiler
- A specialized compiler designed for proving computational graphs using the Stwo prover.
- Replaces operations in the graph with their equivalent components in the AIR.
StwoCompiler
currently includes PrimitiveCompiler
. It maps primitive operators (e.g., Add
, Mul
) to their corresponding AIR components.
StwoCompiler
will include additional sub-compilers, such as FuseOpCompiler
, focuses on fusing multiple primitive operations into optimized composite operators.
Customizing Compilers for Specific Use Cases
LuminAIR supports custom compilers, designed by users, that can be stacked alongside default ones to address specific use cases.GenericCompiler
applies general optimizations.MyCustomCompiler
implements user-defined transformations for a specific task.StwoCompiler
prepares the graph for proof generation using the Stwo prover.