Stock jax.lax.approx_max_k beats hand-written Pallas top-k kernels by ~11x on TPU v5e
petrusenko_max · x · 2026-11-23
The author released tpu-retrieval-bench, an open-source benchmark for exact top-k embedding retrieval on TPU comparing XLA, blockwise, and hand-written Pallas kernels (plus a float64 NumPy oracle). The counterintuitive result: stock jax.lax.approxmaxk beat his hand-written Pallas top-k kernels by 11x on a TPU v5e, and his exact fused kernel only beat XLA at batch 1024.
Benchmarks throughput and p99 tail latency across 8 variants (numpyref, jittopk, blockwisetopk, pallasfusedbucket, pallasfusedtopk, pallasscoretopk, scoreonly, selectonly) at N=1M, D=128, k=10, bf16. The core question: when does a hand-written Pallas kernel beat stock XLA, and when is XLA already fast enough? Includes spec, methodology docs, fuzz tests, and results, Apache-2.0 licensed.
More from Infra
- engy launches accountless inference grid Gamma where agents pay on-chain with no human in the loop — markjeffrey · 2026-11-23
- MIT's SLIC trains a small local LLM to design analog chips, matching frontier models at a fraction of the compute — MIT News AI · 2026-11-23
- Panic-buying at Costco as Outlook, FAA, JPMorgan, iCloud and PlayStation outages spook Americans — nikola_mr64990 · 2026-11-23
- NVIDIA GR00T N1.7 latency on robot boards: 312.2ms on Jetson Orin vs 22.9ms on H100 — AIFlow_ML · 2026-11-23
- OpenRouter drops 3 inference providers after canary-token sting exposes months of prompt theft — winer666 · 2026-11-23
- China Telecom open-sources Xing4.1-Preview: 285B MoE trained end-to-end on Ascend 910C — teortaxesTex · 2026-11-23