lucialuka/OpenAssembler
حول
Open source compiler for your whole ML repo (support python, CUDA C/C++) into sass and cuda binary (which are closed sourced by Nvidia); 3-40% faster than Openai Triton for Neural Network (primarily LLM) based training/inferencing
لغات البرمجة وبيئات التشغيلالنمو المقاس للنجوم
- خلال 24 ساعة
- +١
- خلال 7 أيام
- +١
- خلال 15 يومًا
- +١٣
- خلال شهر
- التحديث متأخر
تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.
README.md
الأصل
OpenAssembler
Compile customized GPU kernels and Python model graphs to native NVIDIA SASS and cubins.
OpenAssembler targets A100 / SM80. Its native backend selects instructions, allocates registers, schedules dependencies and encodes GPU machine code. Production execution loads OpenAssembler-owned cubins through the CUDA driver.
Python 3.12+ · Linux and macOS · Apache 2.0
Quick start
Install with Homebrew and authenticate Modal once:
brew tap lucialuka/openassembler https://github.com/lucialuka/OpenAssembler
brew install lucialuka/openassembler/openassembler
If you are using Modal
If you do not have access to real NVIDIA hardware, you can use Modal for A100 and other Nvidia hardware. Just enter:modal setup
Start OpenAssembler from your terminal:
openassembler
The logo appears each time you open the interactive shell. At its prompt, enter
commands directly. In your own ML repository, omit the path to use the current
directory: inspect, compile --backend modal --verify, then
run --backend modal. Your ML environment can stay active; OpenAssembler uses
its installed compiler runtime. See getting started.
From a source checkout, try the vector-add example on Modal:
compile examples/vector_add.py --backend modal --out-dir output/first-kernel --verify
run output/first-kernel --spec examples/run_spec.json --backend modal
exit
Choose one backend: modal, local, or an SSH destination such as user@host.
Local Linux supports compilation and execution with the required CUDA toolkit,
driver and A100. macOS supports local compilation through Colima; use Modal or
SSH for GPU execution. Type help, help compile, or press Tab for completion.
Type exit or press Ctrl-D to return to your terminal.
If an old Python environment shadows the Homebrew executable, run deactivate
in your terminal, then launch openassembler again. The
getting-started guide covers local Linux, macOS/Colima
and SSH setup, the first kernel and model, and troubleshooting.
[!NOTE] For more detailed installation guide and some of the experimental runs, plz visit Getting Started
Supported inputs
| Input | Compilation route |
|---|---|
| PTX | OpenAssembler parses admitted PTX and compiles it with the native backend. Best for customized MMA (Matrix Multiplication and Addition) operation |
| Typed Python kernels | Customized Kernel MUST use @kernel at the start. The supported @kernel subset lowers to PTX, then uses the native backend. |
| CUDA C/C++ device sources | nvcc emits PTX; OpenAssembler compiles the admitted PTX. Better for routine ML tasks. |
| Python model repositories | Static discovery or an explicit model contract captures supported CPU PyTorch graphs and generates native kernels. |
| Generated GEMM and rowwise kernels | Dedicated generators compile bounded shape and policy contracts. |
These are bounded compiler contracts. Arbitrary Python programs, unsupported operations, host launch rewriting and architectures beyond SM80 are not supported. Unsupported GPU operations fail explicitly. The production route does not use Triton, Inductor or vendor GPU fallback. See MODELS.md for supported PyTorch operations and KERNELS.md for the kernel-language subsets.
Build, inspect and run
[!NOTE] Make sure that all of the customized kernel (python) should start with:
@kernel
After starting openassembler, use the same repository path across the workflow:
inspect /path/to/repo --json
compile /path/to/repo --backend modal --verify
run /path/to/repo --backend modal
Use cnr to compile and run in one command. The compile step writes a manifest, cubins, and readable SASS listings by default. Model bundles also save their graph plan, weights and launch metadata. Run loads saved artifacts and does not recompile. See the command reference for flags, defaults, outputs and launch specifications.
For Python models, MODELS.md covers discovery, configuration, supported operations, training and the Python API.
Architecture and results
PTX, typed Python and CUDA source converge on PTX before OpenAssembler's SM80 backend. PyTorch models are captured on the CPU with torch FX, differentiated, and lowered to OA-generated kernels. NVIDIA tools parse CUDA C/C++ and supply the cubin container; every executed instruction is OpenAssembler's. See ARCHITECTURE.md.
On an A100, compiled PyTorch models train and run inference faster than TorchInductor/Triton in 19 of 20 measured cases (1.3–5.0×; one case is 0.95×). At the single-kernel level, same-source ptxas still produces faster tensor GEMMs. See STATUS.md and the whole-model results.
Documentation
Start at the documentation home.
| Reference | Use it for |
|---|---|
| Getting started | Install, backends, first kernel and model, troubleshooting |
| Models | PyTorch model compilation, training and runtime |
| Kernels | PTX, CUDA C/C++ and typed Python kernel support |
| Commands | CLI syntax, options and outputs |
| Status | Current results and known gaps |
| Development | Contributor setup, tests and rules |
The compiler and runtime live in openassembler/. Examples are in examples/, regressions in tests/, and experiments with their raw results in exp/ and compiler_exp/.
Licensed under Apache 2.0. See NOTICE for attribution.
Star History
استكشف مشاريع مشابهة ومرتبطة
جارٍ التحميل…