pub fn optimize_kernel(ast: Arc<UOp>, renderer: &Renderer) -> Arc<UOp>Expand description
Apply optimizations to a kernel AST.
This is the main entry point for optimization in the tensor pipeline.
Uses environment variables for configuration (see OptimizerConfig::from_env).
§Pipeline
- Symbolic simplification - Constant folding, identities, DCE
- Loop→Global conversion - Enable GPU parallelization
- Hand-coded heuristics - Vectorization, unrolling, tiling
§Arguments
ast- The kernel AST (inner AST from KERNEL op)renderer- Backend capabilities descriptor
§Returns
Optimized AST with transformations applied.
§Environment Variables
MOROK_NOOPT=1- Disable all optimizations (for debugging)MOROK_BEAM=N- Use beam search with width N (future)