arXiv:2611.00624cs.AIOct 2026

Manuscript Offprint

arXiv:2611.00624

XLA from the Trenches: Correctness on TPU Workloads at Scale

Ignacio Cano, Amir Saadat, Rishipal Singh Bhatia, Samuel Ginzburg, Patrick C. Toulme, Ioannis Zarkadas, Praveen Narayanan, Pratik Bhatu, Nicolas Basile, Alexander Dietmüller, Ruishan Wang, Jacob Wahlgren, Victor Barros, Subhankar Shah, Michael Kuperstein, Farzin Houshmand, Emma Sevastian, Peter Gavin, Karthik Srinivasa Murthy, Berkin Ilbeyi, Amit Sabne, Eli Bendersky

Ignacio Cano Amir Saadat Rishipal Singh Bhatia Samuel Ginzburg Patrick C. Toulme Ioannis Zarkadas Praveen Narayanan Pratik Bhatu Nicolas Basile Alexander Dietmüller Ruishan Wang Jacob Wahlgren Victor Barros Subhankar Shah Michael Kuperstein Farzin Houshmand Emma Sevastian Peter Gavin Karthik Srinivasa Murthy Berkin Ilbeyi Amit Sabne Eli Bendersky

Google

ABSTRACT

Accelerating modern foundational models has pushed domain-specific compilers toward increasingly complex, multi-tiered optimization pipelines. However, this heavy optimization focus introduces delicate tradeoffs between peak execution performance and correctness. Subtle codegen defects can trigger numerical degradation and memory or buffer corruption, invalidating multi-million-dollar training runs and degrading live serving quality without raising obvious compiler errors. In this paper, we present a battle-tested methodology for verifying and triaging Google's XLA:TPU compiler at hyperscale. We leverage fuzzing techniques, combining synthetic program generation with real production traces, while orchestrating AI agent swarms to autonomously generate stress tests, reproduce failures, and draft fixes. To pinpoint root causes in full workloads, we pair this with a hierarchical differential pipeline that bisects large graphs down to individual failing operations inside fused kernels. Deployed in production, our framework has already driven the resolution of over 142 compiler bugs (with 103 additional findings under review), from which we distill pragmatic lessons learned.

1 INTRODUCTION

Optimizing machine learning (ML) workloads has become one of the defining computational challenges of our era. At the center of this revolution lie domain-specific ML compilers, such as XLA (Sabne, 2020), TVM (Chen et al., 2018a), Triton (Tillet et al., 2019), Glow (Rotem et al., 2018), which bridge the gap between high-level framework representations and custom accelerator architectures like Google's Tensor Processing Units (TPUs) (Jouppi et al., 2017) and modern GPUs. To unlock the physical compute limits of hardware, modern ML compilers rely heavily on aggressive, hardware-specific optimization passes. Crucial to this process are tiled fusions, where the compiler merges multiple operations into unified execution kernels and partitions them into smaller tiles, streaming intermediate data through fast on-chip caches or scratchpad memory rather than materializing it in off-chip High Bandwidth Memory (HBM).

While substantial literature and industrial efforts in ML compilation focus on performance—maximizing FLOP utilization, minimizing memory footprint, and automating tuning heuristics (Adams et al., 2019; Chen et al., 2018a;b; Cano et al., 2026)—an equally vital requirement is compiler correctness. In the era of frontier foundational models and safety-critical autonomous systems, a compiler defect can have severe, widespread repercussions. Beyond explicit failures like segmentation faults or fatal assertions, ML compiler bugs frequently manifest as silent numerical drift or subtle data corruption. A single miscompiled index offset, improper loop accumulator revisit, or packing error can silently alter tensor outputs, causing multi-million-dollar training runs to diverge after weeks of compute, or injecting subtle hallucinations into live inference services (McAllister et al., 2025; Roune, 2025).

Guaranteeing correctness in a production ML compiler faces several distinct challenges. First, code generation for accelerators involves a combinatorial explosion of interacting knobs (e.g., tensor shapes, tile sizes, buffering levels, layouts) creating an optimization space where standard regression suites barely scratch the surface. Second, modern production workloads compile into large computational graphs, making whole-model triage of numerical divergence a significant bottleneck that can take weeks of manual toil. Third, while differential testing against an unoptimized reference interpreter is theoretically sound, naive synthetic inputs trigger undefined floating-point math and hardware alignment violations, generating false-positive noise that undermines automated isolation. Finally, even after isolating an anomaly to a single fusion node, pipelined kernels execute intermediate values purely in hardware vector registers (without materializing them in HBM), turning fusions into opaque black boxes that blind standard debugging tools.

To address these challenges, we introduce a cohesive reli-

Correspondence to: Ignacio Cano nachocano@google.com.

ability framework for the XLA:TPU compiler that tackles correctness both proactively and reactively. Proactively, we improve bug detection via hybrid fuzzing. Rather than relying solely on (unrepresentative) synthetic graphs, we piggyback differential correctness checks onto our existing production autotuning pipeline (Cano et al., 2026), stress-testing boundary conditions across real fleet operations at near-zero marginal infrastructure cost. To further amplify this approach, we leverage AI to systematically expand test coverage across the fleet and scale both the findings and the generation of compiler fixes. Reactively, we establish a hierarchical differential isolation pipeline spanning from macro-graphs down to fused kernels. At the graph level, we recursively navigate large computational graphs to pinpoint failing operations while reducing false positives using reverse constraint propagation. At the kernel level, we inspect intermediate tensors directly inside fused kernels to pinpoint the exact sub-operation where hardware execution diverges from the reference semantics.

In summary, our main contributions are:

  • We design and deploy a hybrid fuzzer that evolved from purely synthetic XLA program generation, to leveraging real fleet-mined operations via production autotuning sweeps, and ultimately to orchestrating autonomous agent swarms that scale our reliability impact across the fleet.
  • We present a unified diagnostic framework spanning from macro-graph navigation to micro-kernel inspection, combining constraint-propagated input generation to isolate failing subgraphs with intra-fusion intermediate inspection to localize defects inside opaque fused kernels.
  • We evaluate our methodology on real-world production workloads—resolving over 142 compiler bugs to date, with 103 additional fixes under review—and distill pragmatic lessons learned from testing the XLA:TPU compiler at datacenter scale.

References (30)