Hasty Briefsbeta

Bilingual

We accidentally built an LLVM compiler for Jax

2 days ago
  • The Catalyst quantum compiler for PennyLane accidentally supports pure classical JAX code, compiling it to MLIR and LLVM without quantum instructions.
  • The team chose JAX because it can trace Python functions, supports NumPy and SciPy APIs, and lowers to MLIR, while adding native Python control flow and dynamic shapes.
  • The goal was to compile entire hybrid quantum-classical workflows into standalone executables, not just quantum instructions.
  • Catalyst bypasses XLA, lowering JAX representations directly to standard MLIR dialects and then to LLVM, enabling use of LLVM tools like Enzyme for backpropagation.
  • Benefits include standalone AOT binaries without ML runtime dependencies, support for dynamically-shaped arrays, native Python control flow, and ease of custom MLIR passes.
  • This approach may be useful for edge ML, custom hardware, and compiler infrastructure, though it won't beat XLA for standard deep learning workloads.

Related

Loading…