Writing Custom TPU Kernels: Can Pallas Beat XLA? (Bielik LLM on TPU v5e - RMSNorm)

Can custom Pallas kernels on Google Cloud TPUs beat XLA’s aggressive compiler fusion?

In this first episode of the Bielik on TPU kernel series, we transition the open-source Bielik-1.5B architecture from GPU Triton kernels over to Google Cloud TPU v5e hardware using JAX and Pallas.

We break down the TPU software stack, examine how Pallas maps memory references directly to TPU tiles via BlockSpec, and build a custom RMSNorm kernel from the ground up. Finally, we run end-to-end memory bandwidth benchmarks comparing custom Pallas against native JAX across varying batch sizes and hidden dimensions.

Key highlights covered:

Resources: