Skip to content

Quadrants — high-performance multi-platform compiler for physics simulation

Quadrants is a Python-to-multi-GPU compiler under the Genesis robotics stack, forked from Taichi in June 2025 and rebuilt as a fully independent project with its own roadmap. It compiles plain Python kernels to CUDA, AMD ROCm, Apple Metal, Vulkan, and x86/ARM64 CPU backends via LLVM, with first-class GPU graphs, register-resident 16×16 matrix tiles, source-level fastcache (cuts kernel load from 7.2s → 0.3s on Genesis benchmarks), and reverse-mode autodiff with dynamic loops as a first-class citizen on every backend. The name comes from the Chinese saying 太极生两仪,两仪生四象 (Supreme Polarity gives rise to Two Modes, which give rise to Four Forms / Quadrants) — acknowledging the Taichi roots while signalling the new identity. Open-sourced via pip install quadrants and bundled inside Genesis World — Simulation platform for general-purpose robotics & embodied AI learning with no extra install.

  • Multi-backend SIMT primitives map to native equivalents at the subgroup and block level — warps of 32 on NVIDIA, waves of 64 on AMD, subgroups on Metal — so a hand-tuned contact solver runs without per-platform branches [README §SIMT primitives, §Subgroup ops].
  • Reduced launch latency: ndarray CPU performance improved 4.5×, and ndarray GPU performance went from 11× slower than fields to ~30% slower (RTX 5090, Genesis benchmark) [README §Performance].
  • Fastcache: opt-in source-level cache (@qd.kernel(fastcache=True)) that bypasses front-end AST parsing — cuts warm-cache kernel load from 7.2s → 0.3s on Genesis benchmarks (~24× speedup) [README §Fastcache].
  • GPU Graphs: @qd.kernel(graph=True) captures kernel sequences into a graph; qd.graph_do_while runs GPU-side iteration loops using hardware conditional nodes on CUDA SM 9.0+ (Hopper) — removes launch latency from top-level for-loops [README §Performance / GPU Graphs].
  • perf_dispatch: auto-benchmarks multiple kernel implementations at first call for a given argument geometry and caches the fastest per signature, so the same frontend code adapts to hardware automatically [README §Performance / perf_dispatch].
  • Tile16x16: register-resident 16×16 matrix tiles with Cholesky factorization, triangular solve, and rank-1 updates — claimed 5× faster than shared-memory baselines on blocked linear algebra [README §SIMT primitives].
  • Autodiff with dynamic loops: reverse-mode AD computes gradients of any kernel transparently using runtime-based memory allocation; forward-mode AD, custom gradients via @qd.ad.grad_replaced, and qd.ad.Tape are also supported as first-class citizens across all backends [README §Autodiff].
  • Zero-copy interop with PyTorch / NumPy via DLPack on CUDA, CPU, AMDGPU, and Metal; direct torch tensor pass-through into kernels — supports the ML-stack handoff that hand-rolled CUDA kernels typically require [README §Performance / Zero-copy interop].
  • Removed components vs upstream Taichi: GUI/GGUI, C-API, AOT, DX11/DX12, iOS/Android, OpenGL/GLES, argpack, CLI — focused on the compiler core for simulation workloads, dropping mobile and visualization paths [README §Removed components].
  • Python backend: qd.init(qd.python) interprets kernels as plain Python so they can be stepped through in a standard Python debugger — debuggability that JIT-compiled kernel languages usually lack [README §Debugging & development].
  • LLVM 22 + ARM aarch64 support; kernel-level device-side branch coverage integrated with pytest-cov and AI-driven CI checks for line wrapping, deleted comments, and feature factorization [README §Platform support, §CI].
  • Backward compatibility with upstream Taichi is not maintained — Quadrants is now a fully independent project [README §The origin].

Quadrants is delivered as a single pip-installable Python package targeting Python 3.10–3.13 on macOS 14/15, Windows, or Ubuntu 22.04–24.04 (and ROCm 5.2+ for AMD). Plain Python kernels are JIT-compiled to native code via LLVM, with per-backend code generators for CUDA, ROCm, Metal, Vulkan, and CPU. The three-layer cache (compiled kernels on disk + PTX + fast-cache process startup) caches compiled artifacts for reuse — scene switches reuse cached kernels rather than triggering recompilation. Inside kernels, dense linear algebra (Cholesky, triangular solve) is expressed in intuitive Python syntax that lowers to 16×16 tile-blocked code paths, and whole-kernel common-subexpression elimination catches redundant work that block-local optimizers miss. A lightweight perf-dispatch layer benchmarks kernel variants on first call per argument geometry and caches the fastest choice per signature.

Tensors come in two interchangeable types: field for peak runtime throughput and ndarray for fast startup and compile time. A unified qd.Tensor wrapper switches between them, or between physical layouts, at runtime without changes to calling code. dataclasses.dataclass structs work with ndarrays and fields, are nestable, and can be passed to qd.func with zero kernel-runtime overhead. BufferView provides safe sub-range ndarray access with bounds checking in debug mode.

The CI infrastructure is notable for the kernel-level branch coverage (device-side coverage in standard coverage.py format integrated with pytest-cov) and AI-driven code review checks — uncommon discipline for a GPU compiler project.

This is a tooling release, not a paper. The README’s quantitative claims are all relative to either upstream Taichi or to internal Genesis benchmarks: ndarray CPU 4.5× faster, ndarray GPU gap closed from 11× to ~1.3× vs fields (RTX 5090), fastcache 24× warm-load speedup (7.2s → 0.3s), Tile16x16 5× over shared-memory baselines, and (from the parent The Role of Simulation in Scalable Robotics, Genesis World 1.0, and the Path Forward) up to 4.6× runtime speedup on manipulation/locomotion benchmarks vs the upstream Taichi fork. No published benchmarks against hand-tuned CUDA libraries (cuBLAS, cuSPARSE, etc.) or against other Python-GPU compilers (Triton, JAX/Pallas, Mojo). Documentation is online at the project docs site with an autoapi reference.

Quadrants is a concrete datapoint for what a Taichi successor actually looks like in 2026 — upstream Taichi has not been actively maintained, and Genesis’s response was to fork, focus the surface area (drop mobile/GUI/AOT), and double down on the simulation-workload performance path. The trio of GPU graphs (CUDA SM 9.0+ hardware conditional nodes), perf-dispatch, and fastcache is a sharper statement of “kernel launch overhead is the bottleneck at simulation scale” than most ML-systems blog posts make. The cross-platform discipline (CUDA + ROCm + Metal + Vulkan + CPU from a single Python frontend) makes it relevant beyond robotics — any project currently routing through hand-written CUDA for one platform and giving up on others is the addressable audience.

Within IO-Aware Kernel Design, Quadrants sits adjacent to but distinct from the kernel-author-facing line (Loads and Loads of Fluffy Kittens: Compute-Communication Kernels with Multi-GPU ThunderKittens for ThunderKittens, BackendBench: Ship Correct and Fast LLM Kernels to PyTorch for BackendBench): instead of a DSL for ML kernels specifically, it’s a general Python-to-GPU compiler whose performance discipline (graph capture, tile algebra, three-layer cache) is shaped by physics-simulation needs. The “kernel-level branch coverage in standard coverage.py format” is an unusual rigor signal worth borrowing for any team that wants to actually verify CUDA correctness in CI.