Demystifying Tensor Cores to Optimize Half-Precision Matrix Multiply
Authors:
- 1 May 2020
- conference paper
- Published by Institute of Electrical and Electronics Engineers (IEEE)
- p. 634-643
Abstract
Half-precision matrix multiply has played a key role in the training of deep learning models. The newly designed Nvidia Tensor Cores offer the native instructions for half-precision small matrix multiply, based on which Half-precision General Matrix Multiply (HGEMM) routines are developed and can be accessed through high-level APIs. In this paper, we, for the first time, demystify how Tensor Cores on NVIDIA Turing architecture work in great details, including the instructions used, the registers and data layout required, as well as the throughput and latency of Tensor Core operations. We further benchmark the memory system of Turing GPUs and conduct quantitative analysis of the performance. Our analysis shows that the bandwidth of DRAM, L2 cache and shared memory is the new bottleneck for HGEMM, whose performance is previously believed to be bound by computation. Based on our newly discovered features of Tensor Cores, we apply a series of optimization techniques on the Tensor Core-based HGEMM, including blocking size optimization, data layout redesign, data prefetching, and instruction scheduling. Extensive evaluation results show that our optimized HGEMM routine achieves an average of 1.73× and 1.46× speedup over the native implementation of cuBLAS 10.1 on NVIDIA Turing RTX2070 and T4 GPUs, respectively. The code of our implementation is written in native hardware assembly (SASS).Keywords
This publication has 6 references indexed in Scilit:
- A coordinated tiling and batching framework for efficient GEMM on GPUs2019
- NVIDIA Tensor Core Programmability, Performance & Precision2018
- Understanding the GPU Microarchitecture to Achieve Bare-Metal Performance Tuning2017
- Dissecting GPU Memory Hierarchy Through MicrobenchmarkingIEEE Transactions on Parallel and Distributed Systems, 2016
- Roofline: An Insightful Visual Performance Model for Floating-Point Programs and Multicore Architectures2009
- The cache performance and optimizations of blocked algorithms1991