Find your next open-source project

Search by name, purpose, or keyword — or paste a GitHub repository URL

Qingyang-Lucas-Fang/OpenAssembler

Developer Tools

A reverse-engineered PTX-to-SASS compiler for sm_80 that replaces ptxas code generation and optimizes kernels.

107
4
Python
Apache-2.0
2 days old

What it is

OpenAssembler is a second implementation of NVIDIA's closed-source ptxas, built by treating ptxas, nvdisasm and the GPU as black boxes. It decodes and encodes SASS for sm_80 (Ampere), reuses a ptxas-built cubin as the ELF container, and replaces only the instruction words, declared register count and exit-offset table with its own code generator (source:7).

The compiler pipeline covers PTX to IR, DCE and copy coalescing, linear-scan register allocation, lowering, optional 4x loop unrolling and list scheduling using hardware-measured latencies, then bit-level encoding with its own encoder (source:10). Frontends accept PTX, a Python subset and CUDA C/C++; CUDA C is lowered to PTX by nvcc first (source:16).

The repository also includes a SASS emulator fitted to A100 behaviour, a z3-proven constant-division lowering, a 541-probe test corpus, and Strassen/AlphaTensor fast-matrix-multiplication plans.

Quick start

Requirements: Python 3.12+, a Linux or macOS machine (Windows is unsupported), and NVIDIA's ptxas, nvdisasm and optionally nvcc from CUDA 12.8. A GPU is only needed to run results, not to compile.

git clone https://github.com/Qingyang-Lucas-Fang/OpenAssembler.git && cd OpenAssembler
python3 -m venv .venv && source .venv/bin/activate
pip install -e .
env/fetch_cuda.sh
env/cuda.sh ptxas --version   # should report release 12.8

On Debian/Ubuntu, install python3-venv and xz-utils first; compiling CUDA C also needs a host g++ (source:20). On macOS, start a Linux VM with colima first (source:25). If CUDA 12.8 is already installed, point OPENASSEMBLER_CUDA_HOME at it or put the tools on PATH (source:27).

Compile a kernel to a loadable cubin and readable SASS listing, verifying against the reference interpreter:

openassembler compile examples/div_by_const.ptx -o out.cubin --verify

The same command accepts the Python and CUDA C examples (examples/vector_add.py, examples/vector_add.cu). Running openassembler with no arguments opens an interactive shell where the openassembler prefix is omitted (source:31).

To run the probe corpus on hardware, build the corpus, compile it with the project's backend, then run on a local NVIDIA GPU, an SSH host or Modal:

openassembler corpus
openassembler check
openassembler gpu run --backend local --which ours

Constraints

  • The encoder and latency model target sm_80 only; other architectures such as sm_86/89/90/100/120 are not yet covered (source:18).
  • The compiler does not replace ptxas end to end: it still needs a ptxas-built cubin as the ELF template and does not cover all of PTX. Missing features include f16/f64 arithmetic, warp shuffles/votes, register spilling, float division/sqrt, ld.global.v2, and more than 7 live predicates (source:13).
  • The measured speedups are limited to the listed kernel shapes on an A100; tight dependent chains are 5–8% slower than ptxas, and the direct GEMM remains behind cuBLAS at n = 8192 (source:46).
  • Licensing is Apache-2.0; the AlphaTensor factorizations under third_party/ carry separate attribution in NOTICE (source:55).

HotRepo's take

The project reached 104 stars and 3 forks in its first recorded snapshot on the Python new list on 2026-11-02, with 3 stars and 1 fork added in a roughly one-hour window. That is a very short observation period, so the numbers establish an early signal rather than a trend. The technical value is concentrated in the reverse-engineered sm_80 encoding and measured A100 results, which are documented with reproduction commands rather than presented as general claims.

Written by AI from the project's README, updated . The project's own docs are the source of truth.