From CUDA and Jax to TorchTPU: Lessons from a Cayley Graph Solver
CayleyPy researcher conducted experiments to evaluate the performance of TorchTPU against A100 and JAX implementations in a shortest-path problem. TorchTPU, a native PyTorch backend for TPUs, showed ease of integration but required optimization for efficient performance. Initial training port on TorchTPU was 1.65 times slower than the A100 implementation, and the first TPU beam search was 5.7 times slower than JAX.
After optimizations including fused eager execution, rewriting attention, and fixing a deduplication bug, TorchTPU achieved comparable wall-clock performance to the A100 and 25% faster per level beam search than JAX on an eight-chip v6e machine. The investigation also led to valuable improvements in the solver itself and contributed to fixing attention-routing regression in TorchTPU. The code and experiments are available on Kaggle notebooks running on a free TPU v5e-8.
Rewritten by urgent.news; may contain errors — check the original.
Source: andlukyane.com