MagiCompiler  by SandAI-org

Accelerating large AI models with plug-and-play compilation

Created 4 months ago
287 stars

Top 91.3% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

MagiCompiler is an advanced compiler and runtime augmentation framework built on PyTorch, designed to break through memory and operator overhead bottlenecks in large-scale Transformer-like architectures. It offers a "plug-and-play" solution for accelerating both training and multi-modality inference workloads with minimal code intrusion, providing significant performance gains out-of-the-box for researchers and power users.

How It Works

Adopting a "Compiler as Manager" philosophy, MagiCompiler orchestrates the entire execution dataflow, moving beyond traditional kernel fusion. It employs system-level optimizations, including whole-graph capture for inference and FSDP-aware layer-wise compilation for training, ensuring distributed sharding remains transparent. Key features include smart asynchronous offloading to overlap computation with memory transfers and heuristic activation recomputation to slash peak memory usage by intelligently recomputing memory-bound operations.

Quick Start & Requirements

Installation is recommended via a prebuilt Docker image (sandai/magi-compiler:latest). Alternatively, local installation involves cloning the repository and running pip install -r requirements.txt followed by pip install . or pip install -e .. Prerequisites include Python >= 3.12 and PyTorch >= 2.9; a CUDA Toolkit is recommended. Optional dependencies like graphviz are noted for specific visualization tasks.

Highlighted Details

MagiCompiler demonstrates substantial performance improvements, achieving up to 26% acceleration on NVIDIA H100s for video generation models and near real-time inference speeds on RTX 5090s. Its @magi_compile decorator enables easy integration, delivering up to 20%+ speedups. The magi_depyf toolkit provides native introspection for debugging compilation artifacts, while heuristic activation recomputation effectively reduces peak memory demands.

Maintenance & Community

Officially open-sourced in March 2026, MagiCompiler is under rapid development with a roadmap including ecosystem integrations, an official hub, a hardware-aware auto-scheduler, and a next-gen custom backend. The project actively encourages community contributions through issues, discussions, and pull requests.

Licensing & Compatibility

The project is licensed under the Apache License 2.0, which is permissive for commercial use and integration into closed-source projects.

Limitations & Caveats

As a rapidly developing project, comprehensive integration guides for popular frameworks are still forthcoming. While demonstrating significant performance gains, users should be aware that certain advanced features and ecosystem integrations are planned for future releases.

Health Check
Last Commit

4 days ago

Responsiveness

Inactive

Pull Requests (30d)
17
Issues (30d)
2
Star History
288 stars in the last 30 days

Explore Similar Projects

Starred by Yaowei Zheng Yaowei Zheng(Author of LLaMA-Factory), Yineng Zhang Yineng Zhang(Inference Lead at SGLang; Research Scientist at Together AI), and
1 more.

VeOmni by ByteDance-Seed

1.2%
2k
Framework for scaling multimodal model training across accelerators
Created 1 year ago
Updated 2 days ago
Feedback? Help us improve.