Decorator JITs: Python as a DSL

Looking at Python programs for machine learning, the “JIT decorator” pattern is quite common. Tools like JAX and Triton allow for executing functions without going through the Python interpreter in the traditional way. Instead, the code inside the JIT decorator resembles a Domain Specific Language processed by a special compiler in libraries like JAX and Triton. Python acts as a meta-language to describe computations. This post explores implementation strategies used by libraries through simplified educational examples, covering AST-based JIT, bytecode-based JIT, and tracing-based JIT. Each strategy has its unique approach to converting Python functions into an intermediate representation for execution. The post delves into case studies like Triton and Numba, showcasing real-world applications of these strategies.

https://eli.thegreenplace.net/2025/decorator-jits-python-as-a-dsl/

To top