Understanding Tensor Cores in NVIDIA GPUs

Tensor Core is a specialized hardware unit designed by NVIDIA to accelerate matrix multiplication and accumulation (MMA) operations—the fundamental building blocks of deep learning (DL) and tensor computations. As a key component of NVIDIA’s GPUs (starting with the Volta architecture in 2017), Tensor Cores implement mixed-precision computing and leverage the SIMT (Single Instruction, Multiple Threads) paradigm to deliver exceptional throughput for neural network training and inference, as well as high-performance computing (HPC) workloads involving tensor operations.

1. Core Function of Tensor Cores

At their heart, Tensor Cores execute the fused multiply-add (FMA) operation on matrices in a single clock cycle:

D=A×B+C

where:

  • A and B are input matrices (typically in lower precision, e.g., FP16, BF16, INT8).
  • C and D are accumulation matrices (typically in higher precision, e.g., FP32, FP64 for HPC).

This operation is the backbone of neural network computations—including convolutional layers, fully connected layers, and transformer attention mechanisms—where tensors (multi-dimensional arrays) are multiplied and accumulated repeatedly.

Key Matrix Sizes

Tensor Cores are optimized for small, fixed-size matrix operations (the “tensor tile” size), which align with the block-based computation patterns of neural networks:

  • Volta/Turing/Ampere: 4x4x4 matrix operations (multiply a 4×4 A matrix with a 4×4 B matrix, add to a 4×4 C matrix).
  • Hopper (H100): 8x8x8 matrix operations (doubled tile size for higher throughput) and support for FP8 precision (the smallest floating-point format for DL).
  • Blackwell (B100): 16x16x16 matrix operations, with enhanced support for sparse tensors (compressed data) to further boost efficiency.

2. Mixed-Precision Computing

A defining feature of Tensor Cores is mixed-precision computing, which combines lower-precision arithmetic (for faster computation) with higher-precision accumulation (to preserve accuracy):

  1. Input Precision: Matrices A and B are stored in low-precision formats like:
    • FP16 (Half Precision): 16-bit floating-point, common for DL training/inference.
    • BF16 (Brain Floating-Point): 16-bit format optimized for DL, with a larger exponent range than FP16 (better for numerical stability).
    • INT8/INT4 (Integer): 8/4-bit integer formats for low-latency inference (e.g., edge AI devices).
    • FP8 (Octo-Precision): 8-bit floating-point (Hopper/B100), enabling even faster computations with minimal accuracy loss.
  2. Accumulation Precision: The product A×B is accumulated into C in higher precision (FP32 for DL, FP64 for HPC), preventing precision degradation during repeated calculations.
  3. Output Precision: The final result D can be cast back to low precision (e.g., FP16) for storage or further computation, balancing speed and accuracy.

Mixed-precision computing with Tensor Cores delivers 2–8x higher throughput than pure FP32 computation, with negligible accuracy loss for most DL models (e.g., ResNet, BERT, GPT).

3. Tensor Core Architecture and Integration

Tensor Cores are integrated into NVIDIA’s GPU Streaming Multiprocessors (SMs), the basic compute units of a GPU:

  • Volta (V100): Each SM contains 8 Tensor Cores, totaling 640 Tensor Cores in a full V100 GPU.
  • Ampere (A100): Each SM has 4 third-generation Tensor Cores (with FP64 support), totaling 432 Tensor Cores in an A100 GPU.
  • Hopper (H100): Each SM has 8 fourth-generation Tensor Cores (FP8/BF16/FP16/FP32/FP64), totaling 1,328 Tensor Cores in an H100 GPU (PCIe version).
  • Blackwell (B100): Each SM features fifth-generation Tensor Cores with sparse tensor support, delivering up to 2x higher throughput than H100 for sparse DL workloads.

How Tensor Cores Work with GPU Threads

Tensor Cores operate in tandem with the GPU’s CUDA cores (scalar/vector processors):

  1. CUDA cores fetch and preprocess tensor data (e.g., loading matrices from memory, formatting for Tensor Core input).
  2. The GPU scheduler dispatches matrix multiplication tasks to Tensor Cores, which process the 4×4/8×8/16×16 matrix tiles in parallel.
  3. Results from Tensor Cores are passed back to CUDA cores for post-processing (e.g., activation functions like ReLU, normalization).

This division of labor lets the GPU optimize for both the large-scale parallelism of tensor operations (Tensor Cores) and the irregular logic of neural network pipelines (CUDA cores).

4. Performance Metrics of Tensor Cores

Tensor Core performance is measured in teraFLOPS (TFLOPS) or petaFLOPS (PFLOPS) (1 PFLOPS = 1,000 TFLOPS) for mixed-precision operations:

GPU GenerationPrecisionTensor Core Throughput (TFLOPS)Key Improvement
Volta (V100)FP16125First Tensor Core design (4x4x4 tiles)
Turing (RTX 2080)FP16/INT865 (FP16), 130 (INT8)INT8 inference support
Ampere (A100)BF16/FP16312 (BF16/FP16), 19.5 (FP64)FP64 HPC support, 3rd-gen Tensor Cores
Hopper (H100)FP84,096 (FP8)FP8 precision, 8x8x8 tiles, 4th-gen Tensor Cores
Blackwell (B100)FP8 (Sparse)8,192 (FP8 sparse)Sparse tensor acceleration, 5th-gen Tensor Cores

For context, an H100 GPU’s Tensor Cores deliver 4,096 TFLOPS of FP8 performance—over 30x more than the V100’s FP16 throughput.

5. Key Advantages of Tensor Cores

  • Unmatched DL Throughput: Tensor Cores are purpose-built for the MMA operations that dominate DL workloads, delivering far higher performance than general-purpose CPUs or traditional GPU CUDA cores.
  • Mixed-Precision Efficiency: By using low-precision input and high-precision accumulation, Tensor Cores balance speed and accuracy, reducing memory bandwidth usage (lower-precision data = smaller memory footprints) and power consumption.
  • Sparse Tensor Support: Modern Tensor Cores (Hopper/B100) accelerate sparse tensors (tensors with many zero values, common in DL models like transformers) by skipping zero-value operations, doubling throughput for sparse workloads.
  • HPC Compatibility: With FP64 support (Ampere+), Tensor Cores also accelerate HPC workloads involving dense matrix operations (e.g., computational fluid dynamics, quantum chemistry).

6. Limitations of Tensor Cores

  • Workload Specialization: Tensor Cores only accelerate matrix multiplication/accumulation—they provide no benefit for non-tensor workloads (e.g., general-purpose computing, random memory accesses).
  • Precision Constraints: While mixed precision works for most DL models, some HPC workloads require strict FP64 precision, limiting Tensor Core speedups (though Ampere+ improves FP64 support).
  • Programming Requirements: To utilize Tensor Cores, developers must use NVIDIA’s specialized libraries and APIs:
    • CUDA Deep Neural Network (cuDNN): Optimized DL library for neural network layers (convolution, attention).
    • Cutlass: A template library for custom Tensor Core operations.
    • PyTorch/TensorFlow: Frameworks that integrate cuDNN to automatically use Tensor Cores for DL models (with minimal code changes).
  • NVIDIA Exclusivity: Tensor Cores are proprietary to NVIDIA GPUs; competing accelerators (e.g., AMD MI300X, Google TPU) use different tensor acceleration hardware (e.g., Matrix Cores, systolic arrays).

7. Applications of Tensor Cores

Tensor Cores are the workhorse of modern AI and HPC, powering key applications:

Scientific AI: Combining DL and HPC (AI-driven scientific computing) for tasks like drug discovery (molecular docking) and astrophysics simulations (dark matter modeling).

Deep Learning Training: Training large language models (LLMs like GPT-4, Gemini), computer vision models (ResNet, Stable Diffusion), and recommendation systems (Netflix/Amazon recommendation engines).

DL Inference: Low-latency inference for edge AI (autonomous vehicles, smart cameras) and cloud AI (chatbots, image generation) using INT8/FP8 precision.

High-Performance Computing (HPC): Accelerating dense matrix operations for climate modeling, nuclear fusion simulations, and molecular dynamics (using FP64 precision in Ampere+/Hopper GPUs).

Generative AI: Powering diffusion models (Stable Diffusion), large language models, and multi-modal AI (text-to-image, text-to-video) via transformer attention mechanism acceleration.


了解 Ruigu Electronic 的更多信息

订阅后即可通过电子邮件收到最新文章。

Posted in

Leave a comment