Tokamax is an OpenXLA library providing high-performance custom accelerator kernels for NVIDIA GPUs and Google TPUs. It offers state-of-the-art implementations built on top of JAX and Pallas, along with tooling for users to build and autotune their own custom kernels. As of version 0.0.12, it is still under heavy development, and users should anticipate API changes.
pip install -U tokamaxVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the application of `tokamax` custom kernels (e.g., `layer_norm`, `dot_product_attention`) within a JAX computation graph. It shows how to specify kernel implementations or allow `tokamax` to select the best one. It also highlights the pattern for integrating with JAX's `jit` and `grad` transformations.
Refer to the latest GitHub README and documentation for current API usage. Pin specific versions to avoid unexpected breakage in production environments.
To ensure consistent numerics across sessions, serialize and explicitly reuse autotuning results using `autotune_result.dumps()` and `tokamax.AutotuningResult.loads()`.
Add `disabled_checks=tokamax.DISABLE_JAX_EXPORT_CHECKS` to your `jax.export` call. Be aware that the exported function will be specific to the device it was serialized on.
If encountering `UnsupportedImplementationError` or similar, try `implementation=None` to let Tokamax select the best available implementation, which can fall back to XLA. Alternatively, consult the documentation for supported hardware and data types for the chosen implementation.