Inferensys

Glossary

Tensor Processing Unit (TPU)

A Tensor Processing Unit (TPU) is a Google-designed application-specific integrated circuit (ASIC) accelerator optimized specifically for high-volume, low-precision matrix operations fundamental to neural network inference and training.
Enterprise console with connected nodes and monitoring panels for orchestrated systems.
HARDWARE ACCELERATOR

What is a Tensor Processing Unit (TPU)?

A Tensor Processing Unit (TPU) is a Google-designed application-specific integrated circuit (ASIC) accelerator optimized specifically for high-volume, low-precision matrix operations fundamental to neural network inference and training.

A Tensor Processing Unit (TPU) is a Google-designed application-specific integrated circuit (ASIC) accelerator optimized for the high-volume, low-precision matrix multiplications and convolutions that form the computational core of neural networks. Unlike general-purpose GPUs, TPUs employ a systolic array architecture, a grid of fused multiply-accumulate (MAC) units that stream data directly between adjacent processing elements to maximize throughput and energy efficiency for these specific workloads. This design minimizes data movement, a primary bottleneck in deep learning computation.

TPUs are deployed in Google Cloud and internally for services like Search and Translate. They excel at inference and training of large models, particularly those using bfloat16 precision. Key to their performance is tight integration with Google's XLA compiler, which optimizes computational graphs for the TPU's architecture. As a cornerstone of hardware-aware model optimization, TPUs represent a shift towards domain-specific architectures that trade general programmability for extreme efficiency in targeted AI workloads.

TENSOR PROCESSING UNIT (TPU)

Key Architectural Features

A Tensor Processing Unit (TPU) is a Google-designed application-specific integrated circuit (ASIC) accelerator optimized for the high-volume, low-precision matrix operations fundamental to neural network inference and training. Its architecture diverges from general-purpose GPUs to achieve extreme efficiency for this specific workload.

01

Systolic Array Core

The TPU's defining feature is its large, two-dimensional systolic array of Matrix Multiply Units (MXUs). This is a fixed-function dataflow architecture where data flows through a stationary grid of processing elements (PEs) in a rhythmic, pipelined fashion.

  • Dataflow Efficiency: Weights are pre-loaded into the array. Input activations then flow horizontally, and partial sums flow vertically, with each PE performing a multiply-accumulate (MAC) operation. This minimizes data movement by reusing weights across many computations.
  • Massive Parallelism: A single TPU v3 core, for example, contains two 128x128 systolic arrays, capable of performing 32,768 16-bit floating-point (bfloat16) MAC operations per cycle.
  • Contrast with GPU: Unlike a GPU's SIMT (Single Instruction, Multiple Thread) architecture with programmable cores and caches, the systolic array is a hardwired, highly optimized pipeline for dense linear algebra, eliminating instruction fetch/decode overhead.
02

Unified Buffer & On-Chip Memory

The TPU employs a software-managed scratchpad memory called the Unified Buffer (UB), rather than a hardware-managed cache hierarchy.

  • Explicit Control: The compiler explicitly schedules all data movement between the UB (on-chip) and off-chip High-Bandwidth Memory (HBM). This allows for predictable, optimal data reuse patterns known at compile time.
  • High Bandwidth & Capacity: The UB provides orders of magnitude higher bandwidth and lower latency than accessing off-chip DRAM. For example, the TPU v4's UB offers ~1.2 TB/s of bandwidth.
  • Activation Storage: The UB primarily holds the input and output activations for the systolic array. Weights are streamed directly from off-chip HBM into the array via a dedicated Weight FIFO.
03

bfloat16 Numerical Format

TPUs are optimized for Google's bfloat16 (Brain Floating Point) numerical format, a critical choice for machine learning efficiency.

  • Design Rationale: bfloat16 truncates the mantissa bits of a standard IEEE FP32 number but keeps the same 8-bit exponent range. This preserves the dynamic range needed for training (to avoid overflow/underflow in gradients) while halving the memory footprint and bandwidth requirements.

  • Hardware Native Support: MXUs perform computations natively in bfloat16. Support for other precisions (like INT8 for inference) is handled through separate pipelines or conversion units.

  • Software Ecosystem: Frameworks like JAX and TensorFlow are built to leverage bfloat16, often using mixed-precision training where certain operations (like reductions) are kept in FP32 for stability.

04

CISC-Style Vector Processing Unit

Alongside the systolic array, each TPU core contains a Vector Processing Unit (VPU).

  • Role: The VPU handles all non-matrix-multiplication operations required in a neural network. This includes:

    • Activations (ReLU, sigmoid, GELU)
    • Normalizations (BatchNorm, LayerNorm)
    • Pooling operations (max, average)
    • Element-wise operations (add, multiply)
  • CISC Design: The VPU is a Complex Instruction Set Computer unit. A single VPU instruction can trigger a long sequence of internal micro-operations, reducing instruction fetch overhead and improving efficiency for these common, fixed patterns.

  • Workflow: The systolic array and VPU work in tandem. The MXU outputs results to the UB, which are then processed by the VPU before being fed back into the MXU or written to memory.

05

Inter-Core Interconnect (ICI)

For scaling beyond a single chip, TPUs use a dedicated, high-performance Inter-Core Interconnect (ICI).

  • Direct Chip-to-Chip Links: ICI provides direct, low-latency links between TPU cores, forming a multi-dimensional toroidal mesh topology (e.g., a 2D or 3D torus). This avoids the bottleneck of routing through a host CPU or a separate NIC.

  • Performance Characteristics: The ICI is designed for the all-to-all communication patterns common in distributed model training (e.g., for gradient synchronization in data parallelism). TPU v4 pods use an optical ICI capable of hundreds of gigabits per second per link.

  • System Scaling: This architecture enables the creation of TPU pods—supercomputers composed of thousands of interconnected TPU cores that behave as a single, massive accelerator for training giant models like PaLM or Gemini.

06

Software-Controlled Dataflow

TPU execution is orchestrated by a host CPU (e.g., an x86 server) that acts as a controller, but the core computation is driven by a compiler-determined dataflow.

  • XLA Compiler: The Accelerated Linear Algebra (XLA) compiler for TensorFlow/JAX is central. It takes a high-level model graph and performs graph compilation, fusing operations, scheduling memory transfers, and generating a highly optimized TPU program.

  • Minimal Runtime Overhead: The host sends this compiled program and initial data to the TPU. The TPU then executes the entire computational graph with minimal further interaction from the host, decoupling the control plane (CPU) from the data plane (TPU).

  • Contrast with GPU Launch: This differs from the GPU model where the CPU frequently launches individual kernels. On TPU, a single "program" may represent an entire training step or a large inference batch.

HARDWARE-AWARE MODEL OPTIMIZATION

How a Tensor Processing Unit Works

A Tensor Processing Unit (TPU) is a Google-designed application-specific integrated circuit (ASIC) accelerator optimized specifically for high-volume, low-precision matrix operations fundamental to neural network inference and training.

A TPU's core is a systolic array, a grid of thousands of Multiply-Accumulate (MAC) units connected to form a dataflow architecture. This design is optimized for the General Matrix Multiply (GEMM) operations that dominate neural network workloads. Data flows through the array in a coordinated wave, minimizing expensive data movement by reusing inputs across many computations without accessing external memory. This massively parallel, fixed-function approach provides extreme throughput and energy efficiency for dense linear algebra compared to general-purpose processors.

The TPU architecture is tightly coupled with a software stack designed for graph compilation. A neural network model is compiled into a TPU program, a sequence of low-level instructions that configure the systolic array and on-chip memory. The compiler performs critical hardware-aware optimizations like operator fusion and optimal memory layout transformations. This compilation step is essential for mapping diverse neural network graphs onto the TPU's specialized datapaths, enabling high utilization of its computational resources for both training and high-throughput batch inference.

GENERATIONAL COMPARISON

TPU Generations and Evolution

A technical comparison of Google's Tensor Processing Unit (TPU) generations, highlighting architectural advancements, performance metrics, and key deployment models.

Feature / MetricTPU v2/v3 (2nd/3rd Gen)TPU v4 (4th Gen)TPU v5e/v5p (5th Gen)

Announcement Year

2017 (v2), 2018 (v3)

2021

2023 (v5e), 2024 (v5p)

Core Architecture

Matrix Multiply Unit (MXU) + Vector Processing Unit (VPU)

Enhanced MXU + VPU, improved interconnect

Scalable MXU cores, next-gen SparseCore for embeddings

Peak Compute (BF16/FP16)

45 TFLOPS (v2), 123 TFLOPS (v3) per chip

275 TFLOPS per chip

197 TFLOPS (v5e), 459 TFLOPS (v5p) per chip

On-Chip Memory (HBM)

16 GB HBM (v2), 32 GB HBM (v3)

32 GB HBM

16 GB (v5e), 95 GB (v5p) HBM

Interconnect (Chip-to-Chip)

Dedicated toroidal 2D mesh network

ICI (Inter-Core Interconnect) optical circuit switching

v5e: Slice; v5p: Improved ICI for larger-scale pods

Deployment Model

Cloud TPU Pods (v2/v3 Pods)

Cloud TPU v4 Pods

v5e: Cost-optimized for inference/training; v5p: Highest-performance pods

SparseCore Accelerator

Primary Use Case Focus

Large-scale model training (e.g., BERT, ResNet)

Very large-scale training & inference (e.g., PaLM, GPT-class models)

v5e: Efficient inference & mid-scale training; v5p: Frontier-scale training

Software Stack

TensorFlow (primary), JAX (emerging)

TensorFlow, JAX, PyTorch (via torch_xla)

TensorFlow, JAX, PyTorch with mature torch_xla integration

TPU APPLICATION DOMAINS

Primary Use Cases and Workloads

Google's Tensor Processing Units are designed for specific computational profiles. Their architecture excels in workloads dominated by large-scale, low-precision matrix multiplications and convolutions, which are the core of modern deep learning.

03

Computer Vision & Convolutions

The TPU's matrix unit is highly efficient for convolutional neural network (CNN) operations, which can be mapped to matrix multiplications via the Im2col transformation. This makes TPUs exceptionally well-suited for image classification, object detection, and semantic segmentation tasks at data-center scale.

  • Architectural Fit: Native acceleration for 2D and 3D convolution kernels common in ResNet, EfficientNet, and similar architectures.
  • Use Case: Training and serving vision models for Google Photos, YouTube, and autonomous vehicle research.
04

Recommendation Systems

The massive embedding lookups and dense multi-layer perceptron (MLP) components of modern recommendation and ranking models are a core TPU workload. TPUs can efficiently handle the sparse-to-dense computation pattern and the large, memory-intensive embedding tables that characterize these systems.

  • Challenge Addressed: Accelerating the combination of sparse features (user IDs, item IDs) with dense neural network layers.
  • Scale: Powers real-time recommendations for YouTube, Play Store, and Ads.
06

Transformer Model Optimization

TPU architecture is particularly aligned with the computational graph of Transformer models. The attention mechanism, which is dominated by matrix multiplies, and the feed-forward networks are core TPU strengths. Compiler-level optimizations like kernel fusion for layer normalization and GELU activations are heavily utilized.

  • Specialized Software: The XLA compiler fuses operations and optimizes memory layout specifically for TPU execution.
  • Efficiency: Enables training of models with extremely long context windows by optimizing memory bandwidth usage for attention.
TENSOR PROCESSING UNIT (TPU)

Frequently Asked Questions

A Tensor Processing Unit (TPU) is a Google-designed application-specific integrated circuit (ASIC) accelerator optimized specifically for high-volume, low-precision matrix operations fundamental to neural network inference and training. This FAQ addresses common technical questions about its architecture, use cases, and performance characteristics.

A Tensor Processing Unit (TPU) is a Google-designed Application-Specific Integrated Circuit (ASIC) built to accelerate machine learning workloads, specifically the large-scale matrix multiplications (tensor operations) that dominate neural network training and inference. It works by employing a Systolic Array architecture—a grid of thousands of multiply-accumulate (MAC) units—that streams data through the array in a coordinated rhythm, minimizing data movement and maximizing computational throughput for low-precision operations like bfloat16 and int8. Unlike a GPU's more general-purpose cores, the TPU's design is heavily optimized for the predictable, high-volume linear algebra of neural networks, with a large on-chip Unified Buffer (high-bandwidth memory) to feed the systolic array and minimize off-chip memory access.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.