how to understand and evaluate deep learning processors14 hours ago · efficient dnn model design...

91
How to Understand and Evaluate Deep Learning Processors Vivienne Sze Massachusetts Institute of Technology February 16, 2020 Contact Info email: [email protected] website: http://sze.mit.edu https://twitter.com/eems_mit In collaboration with Yu-Hsin Chen, Joel Emer, Tien-Ju Yang Vivienne Sze ISSCC 2020 1 of 91

Upload: others

Post on 18-Feb-2020

11 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

How to Understand and Evaluate Deep Learning Processors

Vivienne SzeMassachusetts Institute of Technology

February 16, 2020Contact Infoemail: [email protected]: http://sze.mit.eduhttps://twitter.com/eems_mit

In collaboration with Yu-Hsin Chen, Joel Emer, Tien-Ju Yang

Vivienne Sze ISSCC 2020 1 of 91

Page 2: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Image Source: [Dean, ISSCC 2020]

Goals of this Tutorial

o Many existing Deep Learning Processors. Too many to cover!

Vivienne Sze ISSCC 2020

Number of DL processor papers atISSCC, VLSI, ISCA, MICRO

Artificial Intelligence

Machine Learning

Brain-Inspired

Spiking NeuralNetworks

DeepLearning

Image Source: [Sze, PIEEE 2017]

2 of 91

Page 3: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Goals of this Tutorial

o Many existing Deep Learning Processors. Too many to cover!

o In this tutorial, we focus on how to evaluate DL processorsn What are the key questions to ask?

o Specifically, we will discussn What are the key metrics that should be measured and compared? n What are the challenges towards achieving these metrics?n What are the design considerations and tradeoffs? n How do these challenges and design considerations differ across

platforms (e.g., CPU, GPU, ASIC, PIM, FPGA)?

o We will focus on inference, but many concepts covered also apply to training

Vivienne Sze ISSCC 2020 3 of 91

Page 4: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Tutorial Overview

o Deep Learning Overviewo Key Metrics and Design Objectiveso Design Considerations

n CPU and GPU Platformsn Specialized / Domain Specific Hardware (ASICs)

o Efficient Dataflowso Algorithm (DNN Model) and Hardware Co-Designo Flexibility and Scalability

n Other Platformso Processing In Memory / In Memory Computingo Field Programmable Gate Arrays (FPGAs)

o Tools for Systematic Evaluation of DL Processorso Should I Use Deep Learning for a Given Task?

Vivienne Sze ISSCC 2020 4 of 91

Page 5: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

What is Deep Learning (aka Deep Neural Networks)?

Input:Image

Output:“Volvo XC90”

Modified Image Source: [Lee, CACM 2011]

Low Level Features High Level Features

Vivienne Sze ISSCC 2020 5 of 91

Page 6: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Weighted Sums

Key operation is multiply and accumulate (MAC)Accounts for > 90% of computation

Yj = activation Wij × Xii=1

3

∑⎛

⎝⎜

⎠⎟

Input Layer

Output Layer

Hidden Layer

X1

X2

X3

Y1

Y2

Y3

Y4

W11

W34

Vivienne Sze ISSCC 2020

Nonlinear ActivationFunction

Sigmoid1

-1

0

0 1-1

Rectified Linear Unit (ReLU)1

-1

0

0 1-1

y=max(0,x)y=1/(1+e-x)

6 of 91

Page 7: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Popular Types of Layers in DNNso Fully Connected Layer

n Feed forward, fully connected

n Multilayer Perceptron (MLP)o Convolutional Layer

n Feed forward, sparsely-connected w/ weight sharingn Convolutional Neural Network (CNN)n Typically used for images

o Recurrent Layern Feedbackn Recurrent Neural Network (RNN)n Typically used for sequential data (e.g., speech, language)

o Attention Layer/Mechanismn Attention (matrix multiply) + feed forward, fully connected n Transformer [Vaswani, NeurIPS 2017]

FullyConnected

Vivienne Sze ISSCC 2020

SparselyConnected

FeedbackFeed Forward

Input Layer

Output Layer

Hidden Layer

Input LayerOutput Layer

Hidden Layer

7 of 91

Page 8: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

High-Dimensional Convolution in CNN

R

S

H

a plane of input activations a.k.a. input feature map (fmap)

filter (weights)

W

Vivienne Sze ISSCC 2020 8 of 91

Page 9: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

High-Dimensional Convolution in CNN

R

filter (weights)

input fmap

S

Element-wise Multiplication

H

W

Vivienne Sze ISSCC 2020 9 of 91

Page 10: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

High-Dimensional Convolution in CNN

R

filter (weights)

S

E

F Partial Sum (psum)

Accumulation

input fmap output fmap

Element-wise Multiplication

H

W

an output activation

Vivienne Sze ISSCC 2020 10 of 91

Page 11: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

High-Dimensional Convolution in CNN

H R

filter (weights)

S

E

Sliding Window Processing

input fmap an output activation

output fmap

W F

Vivienne Sze ISSCC 2020 11 of 91

Page 12: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

High-Dimensional Convolution in CNN

AlexNet: 3 – 192 Channels (C)

H R

S

C

input fmap

output fmap

… C …

filter

Many Input Channels (C)

E

W F

Vivienne Sze ISSCC 2020 12 of 91

Page 13: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

High-Dimensional Convolution in CNN

E

output fmap

many filters (M)

Many Output Channels (M)

M …

R

S 1

R

S

C …

M

H

input fmap

… C …

C …

W F

Vivienne Sze

AlexNet: 96 – 384 Filters (M) ISSCC 2020 13 of 91

Page 14: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

ISSCC 2020

High-Dimensional Convolution in CNN

Image batch size: 1 – 256 (N)

M

Many Input fmaps (N) Many

Output fmaps (N)

R

S

R

S

C …

C …

filters

E

F …

H

… C …

H

W

… C …

E …

1 1

N N

W F

Vivienne Sze 14 of 91

Page 15: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Define Shape for Each Layer

H – Height of input fmap (activations) W – Width of input fmap (activations)C – Number of 2-D input fmaps /filters(channels)R – Height of 2-D filter (weights)S – Width of 2-D filter (weights)M – Number of 2-D output fmaps (channels)E – Height of output fmap (activations)F – Width of output fmap (activations)N – Number of input fmaps/output fmaps(batch size)

Shape varies across layers

Vivienne Sze ISSCC 2020

Filters

R

S

…C

H

W

…C

…E

F

…M

…M

R

S

…C

H

W…

…C

1

N

1

M

1

Input fmapsOutput fmaps

E

FN

15 of 91

Page 16: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Large Sizes with Varying Shapes

Layer Filter Size (R) # Filters (M) # Channels (C) Stride1 11x11 96 3 42 5x5 256 48 13 3x3 384 256 14 3x3 384 192 15 3x3 256 192 1

AlexNet Convolutional Layer Configurations

[Krizhevsky, NeurIPS 2012]

34kParams 307kParams 885kParams

Layer1 Layer2 Layer3

105MMACs 224MMACs 150MMACsVivienne Sze ISSCC 2020 16 of 91

Page 17: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Popular DNNsMetrics LeNet-5 AlexNet VGG-16 GoogLeNet

(v1)ResNet-50 EfficientNet-B4

Top-5 error (ImageNet) n/a 16.4 7.4 6.7 5.3 3.7*Input Size 28x28 227x227 224x224 224x224 224x224 380x380# of CONV Layers 2 5 16 21 (depth) 49 96# of Weights 2.6k 2.3M 14.7M 6.0M 23.5M 14M# of MACs 283k 666M 15.3G 1.43G 3.86G 4.4G# of FC layers 2 3 3 1 1 65**# of Weights 58k 58.6M 124M 1M 2M 4.9M# of MACs 58k 58.6M 124M 1M 2M 4.9MTotal Weights 60k 61M 138M 7M 25.5M 19MTotal MACs 341k 724M 15.5G 1.43G 3.9G 4.4GReference Lecun,

PIEEE 1998Krizhevsky, NeurIPS 2012

Simonyan, ICLR 2015

Szegedy, CVPR 2015

He, CVPR 2016

Tan, ICML 2019

Vivienne Sze ISSCC 2020 17 of 91* Does not include multi-crop and ensemble** Increase in FC layers due to squeeze-and-excitation layers (much smaller than FC layers for classification)

DNN models getting larger and deeper

Page 18: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Tutorial Overview

o Deep Learning Overviewo Key Metrics and Design Objectiveso Design Considerations

n CPU and GPU Platformsn Specialized / Domain Specific Hardware (ASICs)

o Efficient Dataflowso Algorithm (DNN Model) and Hardware Co-Designo Flexibility and Scalability

n Other Platformso Processing In Memory / In Memory Computingo Field Programmable Gate Arrays (FPGAs)

o Tools for Systematic Evaluation of DL Processorso Should I Use Deep Learning for a Given Task?

Vivienne Sze ISSCC 2020 18 of 91

Page 19: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Key Metrics: Much more than TOPS/W!o Accuracy

n Quality of resulto Throughput

n Analytics on high volume datan Real-time performance (e.g., video at 30 fps)

o Latencyn For interactive applications (e.g., autonomous navigation)

o Energy and Powern Embedded devices have limited battery capacityn Data centers have power ceiling due to cooling cost

o Hardware Costn $$$

o Flexibility n Range of DNN models and tasks

o Scalabilityn Scaling of performance with amount of resources

ImageNet

Computer Vision

Speech Recognition

[Sze, CICC 2017]

MNIST

Vivienne Sze ISSCC 2020

Data Center / High Throughput

Embedded Device / Low Latency

19 of 91

Page 20: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Key Design Objectives of DL Processors

o Increase Throughput and Reduce Latencyn Reduce time per MAC

o Reduce critical path à increase clock frequencyo Reduce instruction overhead

n Avoid unnecessary MACs (save cycles)n Increase number of processing elements (PE) à more MACs in parallel

o Increase area density of PE or area cost of systemn Increase PE utilization* à keep PEs busy

o Distribute workload to as many PEs as possibleo Balance the workload across PEso Sufficient memory BW to deliver workload to PEs (reduce idle cycles)

o Low latency has an additional constraint of small batch size

*(100% = peak performance)Vivienne Sze ISSCC 2020 20 of 91

Page 21: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Eyexam: Performance Evaluation Framework

Step 1: max workload parallelism (Depends on DNN Model)Step 2: max dataflow parallelismNumber of PEs (Theoretical Peak Performance)peak

performance

MAC/cycle

MAC/data

Vivienne Sze ISSCC 2020

[Chen, arXiv 2019: https://arxiv.org/abs/1807.07928 ]

A systematic way of understanding the performance limits for DL processors as a function of specific characteristics of

the DNN model and processor design

21 of 91

Page 22: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Eyexam: Performance Evaluation Framework

Number of PEs (Theoretical Peak Performance)peakperformance

Slope = BW to PEs

MAC/cycle

MAC/data

BWBounded

ComputeBounded [Williams, CACM 2009]

Based on Roofline Model

Vivienne Sze ISSCC 2020 22 of 91

Page 23: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Eyexam: Performance Evaluation Framework

Step 1: max workload parallelismStep 2: max dataflow parallelism

Step 3: # of active PEs under a finite PE array sizeNumber of PEs (Theoretical Peak Performance)

Step 4: # of active PEs under fixed PE array dimension

peakperformance

Step 5: # of active PEs under fixed storage capacity

Slope = BW to only active PE

MAC/cycle

MAC/data

https://arxiv.org/abs/1807.07928

Vivienne Sze ISSCC 2020 23 of 91

PE

C

M

Page 24: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Eyexam: Performance Evaluation Framework

Step 1: max workload parallelismStep 2: max dataflow parallelism

Step 3: # of active PEs under a finite PE array sizeNumber of PEs (Theoretical Peak Performance)

Step 4: # of active PEs under fixed PE array dimension

peakperformance

Step 5: # of active PEs under fixed storage capacity

workload operational intensity

Step 6: lower act. PE util. due to insufficient average BWStep 7: lower act. PE util. due to insufficient instantaneous BW

MAC/cycle

MAC/data

https://arxiv.org/abs/1807.07928

Vivienne Sze ISSCC 2020 24 of 91

Page 25: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Key Design Objectives of DL Processorso Reduce Energy and Power

Consumptionn Reduce data movement as it

dominates energy consumptiono Exploit data reuse

n Reduce energy per MAC o Reduce switching activity and/or

capacitanceo Reduce instruction overhead

n Avoid unnecessary MACs

o Power consumption is limited by heat dissipation, which limits the maximum # of MACs in parallel (i.e., throughput)

Operation: Energy (pJ)

8b Add 0.0316b Add 0.0532b Add 0.116b FP Add 0.432b FP Add 0.98b Multiply 0.232b Multiply 3.116b FP Multiply 1.132b FP Multiply 3.732b SRAM Read (8KB) 532b DRAM Read 640

Relative Energy Cost

1 10 102 103 104[Horowitz, ISSCC 2014]

Vivienne Sze ISSCC 2020 25 of 91

Page 26: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Key Design Objectives of DL Processors

o Flexibilityn Reduce overhead of supporting flexibility n Maintain efficiency across wide range of DNN workloads

o Different layer shapes impact the amount ofn Required storage and computen Available data reuse that can be exploited

o Different precision across layers & data types (weight, activation, partial sum)o Different degrees of sparsity (number of zeros in weights or activations)o Types of DNN layers and compute beyond MACs (e.g., activation functions)

o Scalabilityn Increase how performance (i.e., throughput, latency, energy, power)

scales with increase in amount of resources (e.g., number of PEs, amount of memory, etc.)

Vivienne Sze ISSCC 2020 26 of 91

Page 27: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Specifications to Evaluate Metricso Accuracy

n Difficulty of dataset and/or task should be consideredn Difficult tasks typically require more complex DNN models

o Throughputn Number of PEs with utilization (not just peak performance)n Runtime for running specific DNN models

o Latencyn Batch size used in evaluation

o Energy and Powern Power consumption for running specific DNN modelsn Off-chip memory access (e.g., DRAM)

o Hardware Cost n On-chip storage, # of PEs, chip area + process technology

o Flexibility n Report performance across a wide range of DNN modelsn Define range of DNN models that are efficiently supported

Vivienne Sze ISSCC 2020

DRAM

Chip

[Sze, CICC 2017]

27 of 91

ImageNetMNIST

Computer Vision

Speech Recognition

Off-chip memory access

Page 28: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Comprehensive Coverage for Evaluation

o All metrics should be reported for fair evaluation of design tradeoffs

o Examples of what can happen if a certain metric is omitted:n Without the accuracy given for a specific dataset and task, one could

run a simple DNN and claim low power, high throughput, and low cost –however, the processor might not be usable for a meaningful task

n Without reporting the off-chip memory access, one could build a processor with only MACs and claim low cost, high throughput, high accuracy, and low chip power – however, when evaluating system power, the off-chip memory access would be substantial

o Are results measured or simulated? On what test data?Vivienne Sze ISSCC 2020 28 of 91

Page 29: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Example Evaluation Process

The evaluation process for whether a DL processor is a viable solution for a given application might go as follows:

1. Accuracy determines if it can perform the given task 2. Latency and throughput determine if it can run fast enough

and in real-time3. Energy and power consumption will primarily dictate the

form factor of the device where the processing can operate 4. Cost, which is primarily dictated by the chip area, determines

how much one would pay for this solution5. Flexibility determines the range of tasks it can support

Vivienne Sze ISSCC 2020 29 of 91

Page 30: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Interim Q&A SessionPlease ask questions that you feel are

essential to follow the rest of this tutorial

Vivienne Sze ISSCC 2020 30 of 91

Page 31: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Tutorial Overview

o Deep Learning Overviewo Key Metrics and Design Objectiveso Design Considerations

n CPU and GPU Platformsn Specialized / Domain Specific Hardware (ASICs)

o Efficient Dataflowso Algorithm (DNN Model) and Hardware Co-Design o Flexibility and Scalability

n Other Platformso Processing In Memory / In Memory Computingo Field Programmable Gate Arrays (FPGAs)

o Tools for Systematic Evaluation of DL Processorso Should I Use Deep Learning for a Given Task?

Vivienne Sze ISSCC 2020 31 of 91

Page 32: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

CPUs and GPUs Targeting Deep Learning

Use matrix multiplication libraries on CPUs and GPUs

Vivienne Sze ISSCC 2020 32 of 91

Intel Xeon (Cascade Lake) Nvidia Tesla (Volta) AMD Radeon (Instinct)

Page 33: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Map DNN to a Matrix Multiplication

Fully connected layer can be directly represented as matrix multiplication

M

CHW

CHW

N

Filters Input fmaps

×

N

Output fmaps

M=

Vivienne Sze ISSCC 2020

Note: Matrix multiplication also heavily used by recurrent and attention layersIn fully connected layer, filter size (R, S) same as input size (H, W)

H

W

…C…

1

M

input fmaps output fmaps

filters

H

…C… …

1…

N N

11

W 1

H

…C…

MW

H

W

…C…

11

M

33 of 91

Page 34: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Map DNN to a Matrix Multiplication

Convolutional layer can be converted to Toeplitz Matrix

Vivienne Sze ISSCC 2020 34 of 91

Convolution

1 2 34 5 67 8 9

1 23 4

Filter Input Fmap Output Fmap

* = 1 23 4

1 2 3 41 2 4 52 3 5 64 5 7 85 6 8 9

1 2 3 4 × =Filter Input Fmap Output Fmap

Matrix Multiply (by Toeplitz Matrix)

Data is repeated

Page 35: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

CPU, GPU Libraries for Matrix Multiplication

o Implementation: Matrix Multiplication (GEMM)

n CPU: OpenBLAS, Intel MKL, etc

n GPU: cuBLAS, cuDNN, etc

o Library will note shape of the matrix multiply and select implementation optimized for that shape

o Optimization usually involves proper tiling to memory hierarchy

Vivienne Sze ISSCC 2020 35 of 91

Page 36: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Analogy: Gauss’s Multiplication Algorithm

4 multiplications + 3 additions

3 multiplications + 5 additions

Reduce number of multiplications to increase throughput

Vivienne Sze ISSCC 2020 36 of 91

Page 37: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Reduce Operations in Matrix Multiplication

o Fast Fourier Transform [Mathieu, ICLR 2014]

n Pro: Direct convolution O(No2Nf

2) to O(No2log2No)

n Con: Increase storage requirementso Strassen [Cong, ICANN 2014]

n Pro: O(N3) to (N2.807)n Con: Numerical stability

o Winograd [Lavin, CVPR 2016]

n Pro: 2.25x speed up for 3x3 filtern Con: Specialized processing depending on filter size

Compiler selects transform based on filter size

Vivienne Sze ISSCC 2020 37 of 91

Page 38: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Reduce Instruction Overheado Perform more operations per instruction

n CPU: SIMD / Vector Instructions o e.g., Specialized Vector Neural Network Instructions (VNNI) fuses separate multiply and add

instructions into single MAC instruction and avoids storing intermediate values in memoryn GPU: SIMT / Tensor Instructions

o e.g., New opcode Matrix Multiply Accumulate (HMMA) performs 64 MACs with Tensor Core

o Perform more MACs per cycle without increasing memory bandwidth by adding support for reduced precisionn e.g., If access 512 bits per cycle, can perform 64 8-bit MACs vs. 16 32-bit MACs

Tensor CoreImage Source: Nvidia

Vivienne Sze ISSCC 2020 38 of 91

Page 39: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Design Considerations for CPU and GPU o Software (compiler)

n Reduce unnecessary MACs: Apply transforms n Increase PE utilization: Schedule loop order and tile data to increase data reuse

in memory hierarchy o Hardware

n Reduce time per MAC o Increase speed of PEso Increase MACs per instructions using large aggregate instructions (e.g., SIMD, tensor core)

à requires additional hardwaren Increase number of parallel MACs

o Increase number of PEs on chip à area costo Support reduced precision in PEs

n Increase PE utilization o Increase on-chip storage à area costo External memory BW à system cost

Vivienne Sze ISSCC 2020 39 of 91

Page 40: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Tutorial Overview

o Deep Learning Overviewo Key Metrics and Design Objectiveso Design Considerations

n CPU and GPU Platformsn Specialized / Domain Specific Hardware (ASICs)

o Efficient Dataflowso Algorithm (DNN Model) and Hardware Co-Design o Flexibility and Scalability

n Other Platformso Processing In Memory / In Memory Computingo Field Programmable Gate Arrays (FPGAs)

o Tools for Systematic Evaluation of DL Processorso Should I Use Deep Learning for a Given Task?

Vivienne Sze ISSCC 2020 40 of 91

Page 41: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

ISSCC 2020

Properties We Can Leverage• Operations exhibit high parallelism

à high throughput possible

• Memory Access is the Bottleneck

Example: AlexNet has 724M MACs à 2896M DRAM accesses required

Vivienne Sze

ALU

Memory Read Memory WriteMAC*

* multiply-and-accumulate

filter weightfmap act

partial sum updated partial sum

Worst Case: all memory R/W are DRAM accesses

200x 1x

DRAM DRAM

41 of 91

Page 42: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Properties We Can Leverage• Operations exhibit high parallelism

à high throughput possible

• Input data reuse opportunities (e.g., up to 500x for AlexNet)à exploit low-cost memory

Vivienne Sze ISSCC 2020

Filter Input Fmap

Convolutional Reuse (Activations, Weights)

CONV layers only(sliding window)

Filters

2

1

Input Fmap

Fmap Reuse(Activations)

CONV and FC layers 42 of 91

Filter

2

1

Input Fmaps

Filter Reuse(Weights)

CONV and FC layers(batch size > 1)

Page 43: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Highly-Parallel Compute ParadigmsTemporal Architecture

(SIMD/SIMT) Spatial Architecture

(Dataflow Processing)

Register File

Memory Hierarchy

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

Control

Memory Hierarchy

ALU ALU ALU ALU

ALU ALU ALU ALU

ALU ALU ALU ALU

ALU ALU ALU ALU

Vivienne Sze ISSCC 2020 43 of 91

Page 44: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Temporal Architecture (SIMD/SIMT)

Register File

Memory Hierarchy

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

ALU

Control

Spatial Architecture (Dataflow Processing)

Memory Hierarchy

ALU ALU ALU ALU

ALU ALU ALU ALU

ALU ALU ALU ALU

ALU ALU ALU ALU

EfficientDataReuseDistributedlocalstorage(RF)

Inter-PECommunica5onSharingamongregionsofPEs

ProcessingElement(PE)

Control

Reg File 0.5 – 1.0 kB

Advantages of Spatial Architecture

Vivienne Sze ISSCC 2020 44 of 91

Page 45: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

How to Map the Dataflow?

Vivienne Sze ISSCC 2020

Spatial Architecture(Dataflow Processing)Memory Hierarchy

ALU ALU ALU ALU

ALU ALU ALU ALU

ALU ALU ALU ALU

ALU ALU ALU ALU

CNN Convolution

?activations

weights

partialsums

Goal: Increase reuse of input data (weights and activations) and local

partial sums accumulation45 of 91

Page 46: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Tutorial Overview

o Deep Learning Overviewo Key Metrics and Design Objectiveso Design Considerations

n CPU and GPU Platformsn Specialized / Domain Specific Hardware (ASICs)

o Efficient Dataflowso Algorithm (DNN Model) and Hardware Co-Designo Flexibility and Scalability

n Other Platformso Processing In Memory / In Memory Computingo Field Programmable Gate Arrays (FPGAs)

o Tools for Systematic Evaluation of DL Processorso Should I Use Deep Learning for a Given Task?

Vivienne Sze ISSCC 2020

Y.-H. Chen, J. Emer, V. Sze, “Eyeriss: A Spatial Architecture for Energy-Efficient Dataflow

for Convolutional Neural Networks,”

International Symposium on Computer Architecture (ISCA),

June 2016.

46 of 91

Page 47: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Data Movement is Expensive

Maximize data reuse at low cost levels of memory hierarchy

Vivienne Sze ISSCC 2020

DRAM Global Buffer

PE

PE PE

ALU fetch data to run a MAC here

ALU

Buffer ALU

RF ALU

Normalized Energy Cost*

200×

PE ALU 2×

1× 1× (Reference)

DRAM ALU

0.5 – 1.0 kB

100 – 500 kB

NoC: 200 – 1000 PEs

* measured from a commercial 65nm process

Specialized hardware with small (< 1kB) low cost memory near compute

Farther and larger memories consume more power

47 of 91

Page 48: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Weight Stationary (WS)

• Minimize weight read energy consumption− maximize convolutional and filter reuse of weights

• Broadcast activations and accumulate partial sums spatiallyacross the PE array

• Examples: [TPU, ISCA 2017], NVDLA

Global Buffer

W0 W1 W2 W3 W4 W5 W6 W7

Psum Activation

PE Weight

Vivienne Sze ISSCC 2020 48 of 91

[Chen, ISCA 2016]

Page 49: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

• Minimize partial sum R/W energy consumption− maximize local accumulation

• Broadcast/Multicast filter weights and reuse activations spatiallyacross the PE array

• Examples: [Moons, VLSI 2016], [Thinker, VLSI 2017]

Output Stationary (OS)

Global Buffer

P0 P1 P2 P3 P4 P5 P6 P7

Activation Weight

PE Psum

Vivienne Sze ISSCC 2020

[Chen, ISCA 2016]

49 of 91

Page 50: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

• Minimize activation read energy consumption− maximize convolutional and fmap reuse of activations

• Unicast weights and accumulate partial sums spatiallyacross the PE array

• Example: [SCNN, ISCA 2017]

Input Stationary (IS)

Global Buffer

I0 I1 I2 I3 I4 I5 I6 I7

Psum

ActPE

Weight

Vivienne Sze ISSCC 2020 50 of 91

[Chen, ISCA 2016]

Page 51: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

ISSCC 2020

Row Stationary Dataflow

• Maximize row convolutional reuse in RF− Keep a filter row and fmap sliding window in RF

• Maximize row psum accumulation in RF

PE b a c

Reg File

d c e

c

b a

[Chen, ISCA 2016]Vivienne Sze

1D convolution within PE

51 of 91

Page 52: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Row Stationary Dataflow

Optimize for overall energy efficiency instead for only a certain

data type

[Chen, ISCA 2016]Vivienne Sze ISSCC 2020

PE 1

Row 1 Row 1

PE 2

Row 2 Row 2

PE 3

Row 3 Row 3

Row 1

= *

PE 4

Row 1 Row 2

PE 5

Row 2 Row 3

PE 6

Row 3 Row 4

Row 2

= *

PE 7

Row 1 Row 3

PE 8

Row 2 Row 4

PE 9

Row 3 Row 5

Row 3

= *

* * *

* * *

* * *

52 of 91

Page 53: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Tutorial Overview

o Deep Learning Overviewo Key Metrics and Design Objectiveso Design Considerations

n CPU and GPU Platformsn Specialized / Domain Specific Hardware (ASICs)

o Efficient Dataflowso Algorithm (DNN Model) and Hardware Co-Designo Flexibility and Scalability

n Other Platformso Processing In Memory / In Memory Computingo Field Programmable Gate Arrays (FPGAs)

o Tools for Systematic Evaluation of DL Processorso Should I Use Deep Learning for a Given Task?

Vivienne Sze ISSCC 2020 53 of 91

Page 54: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Commercial Products Support Reduced Precision

Nvidia’s Pascal (2016) Google’s TPU (2016)TPU v2 & v3 (2019)

Intel’s NNP-L (2019)

Vivienne Sze ISSCC 2020 54 of 91

8-bit fixed for Inference & 16-bit float for Training

Page 55: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Reduced Precision in Research

o Reduce number of bits n Binary Nets [Courbariaux, NeurIPS 2015]

o Reduce number of unique weightsn Ternary Weight Nets [Li, NeurIPS Workshop 2016]n XNOR-Net [Rategari, ECCV 2016]

o Non-Linear Quantizationn LogNet [Lee, ICASSP 2017]

o Trainingn 8-bit with stochastic rounding [Wang, NeurIPS 2018]

Binary Filters

Log Domain Quantization

Vivienne Sze ISSCC 2020 55 of 91

Page 56: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Precision Scalable MACs for Varying Precision

Vivienne Sze ISSCC 2020

Conventional data-gated MACGate unused logic (e.g., full adders)

to reduce energy consumption

[Camus, JETCAS 2019]

Full precision 8bx8b 4bx4b 2bx8b

Many approaches increase utilization of logic to increase throughput/area; however, area and energy overhead can reduce benefits

1.3x

1.6x

Evaluation of 19 precision scalable MAC designs5% of values 8bx8b

47.5% of values at 2bx2b and 4bx4b4bx4b

Conventional data-gated

56 of 91

Page 57: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Sparsity in Activation Data

9 -1 -31 -5 5-2 6 -1

Many zeros in output fmaps after ReLUReLU

9 0 01 0 50 6 0

00.20.40.60.8

1

1 2 3 4 5CONV Layer

# of activations # of non-zero activations

(Normalized)

Vivienne Sze ISSCC 2020

[Chen, ISSCC 2016]57 of 91

Page 58: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Data Gating / Zero Skipping

[Chen, Eyeriss, ISSCC 2016]

Filter Scratch Pad

(225x16b SRAM)

Partial Sum Scratch Pad

(24x16b REG)

Filt

Img

Input Psum

2-stage pipelined multiplier

Output Psum

0

Accumulate Input Psum

1

0

== 0 Zero Buffer

Enable

Image Scratch Pad

(12x16b REG)

0 1

Skip MAC and mem reads when image data is zero.

Reduce PE power by 45%

Reset

[Albericio, Cnvlutin, ISCA 2016]

Gate operations (reduce power consumption)

Skip operations(increase throughput)

Vivienne Sze ISSCC 2020 58 of 91

Page 59: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Apply Compression to Reduce Data Movement

[Chen, ISSCC 2016]

0

1

2

3

4

5

6

1 2 3 4 5

DRAM

Access(MB)

AlexNetConvLayer

Uncompressed Compressed

1 2 3 4 5AlexNet Conv Layer

DRAM Access (MB)

0

2

4

61.2�

1.4�1.7�

1.8�1.9�

UncompressedFmaps + Weights

RLE CompressedFmaps + Weights

Simple RLC within 5% - 10% of theoretical entropy limit

Example: Eyeriss compresses activations to reduce DRAM BW

Vivienne Sze ISSCC 2020

ReLU

Input Image

Output Image

Filter Filt

Img

Psum

Psum

Buffer SRAM

108KB

14×12 PE Array

Link Clock Core Clock

Run-Length Compression (RLC)

Example:

Output (64b):

Input: 0, 0, 12, 0, 0, 0, 0, 53, 0, 0, 22, …

5b 16b 1b 5b 16b 5b 16b 2 12 4 53 2 22 0

Run Level Run Level Run Level Term

Off-Chip DRAM 64 bits

Decomp

Comp

DCNN Accelerator DNN Accelerator

59 of 91

Page 60: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Pruning – Make Weights SparseOptimal Brain Damage

[Lecun, NeurIPS 1990]

pruning neurons

pruning synapses

after pruningbefore pruning

Prune DNN based on magnitude of weights

[Han, NeurIPS 2015]

Example: AlexNetWeight Reduction: CONV layers 2.7x,

FC layers 9.9xOverall Reduction: Weights 9x, MACs 3x

retraining

Vivienne Sze ISSCC 2020 60 of 91

Page 61: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

How to Evaluate Complexity of DNN Model?

Vivienne Sze ISSCC 2020 61 of 91

Number of MACs and weights are not good proxies for latency and energy

# of operations (MACs) does not approximate latency well

Source: Google (https://ai.googleblog.com/2018/04/introducing-cvpr-2018-on-device-visual.html)

OutputFeatureMap43%

InputFeatureMap25%

Weights22%

Computa:on10%

EnergyConsump:onofGoogLeNet

[Yang, CVPR 2017]

# of weights alone is not a good metric for energy (All data types should be considered)

Energy breakdown of GoogLeNet

https://energyestimation.mit.edu/

Page 62: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Energy-Aware Pruning

Directly target energy and incorporate it into the

optimization of DNNs to provide greater energy savings

• Sort layers based on energy and prune layers that consume the most energy first

• Energy-aware pruning reduces AlexNetenergy by 3.7x and outperforms the previous work that uses magnitude-based pruning by 1.7x

0 0.5

1 1.5

2 2.5

3 3.5

4 4.5

Ori. DC EAP

Normalized Energy (AlexNet)

2.1x 3.7x

x109

Magnitude Based Pruning

Energy Aware Pruning

Pruned models available at http://eyeriss.mit.edu/energy.html[Yang, CVPR 2017]

Vivienne Sze ISSCC 2020 62 of 91

Page 63: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Compact DNN Modelso Design compact DNN Models

n Tends to increase range of layer shapes (e.g., R, S, C) that need to be supportedn Can be handcrafted or learned using Network/Neural Architecture Search (NAS)

Vivienne Sze ISSCC 2020

Year Accuracy* # Layers # Weights # MACsAlexNet 2012 80.4% 8 61M 724M

MobileNet[1] 2017 89.5% 28 4M 569M[1]

* ImageNet Classification Top-5

Filter Decomposition

R

S

C …

R

S

……

C

11

*

Bottleneck Layer

Reduce number of channels before large filter convolution

Decompose large filters into smaller filters

63 of 91

1x1 convolutionsFilter Decomposition

Page 64: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

NetAdapt: Platform-Aware DNN Adaptation

• Automatically adapt DNN to a mobile platform to reach a target latency or energy budget

• Use empirical measurements to guide optimization (avoid modeling of tool chain or platform architecture)

• Requires very few hyperparameters to tune

In collaboration with Google’s Mobile Vision Team

NetAdapt Measure

Network Proposals

Empirical MeasurementsMetric Proposal A … Proposal Z

Latency 15.6 … 14.3

Energy 41 … 46

…… …

PretrainedNetwork Metric Budget

Latency 3.8

Energy 10.5

Budget

AdaptedNetwork

… …

Platform

A B C D Z

[Yang, ECCV 2018]

Code available at http://netadapt.mit.edu

Vivienne Sze ISSCC 2020 64 of 91

Page 65: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Improved Latency vs. Accuracy Tradeoffo NetAdapt boosts the real inference speed of MobileNet by up to 1.7x with

higher accuracy

Reference:MobileNet: Howard et al, “Mobilenets: Efficient convolutional neural networks for mobile vision applications”, arXiv 2017MorphNet: Gordon et al., “Morphnet: Fast & simple resource-constrained structure learning of deep networks”, CVPR 2018

+0.3% accuracy1.7x faster

+0.3% accuracy1.6x faster *Tested on the ImageNet dataset

and a Google Pixel 1 CPU

Vivienne Sze ISSCC 2020 65 of 91

Page 66: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Design Considerations for Co-Designo Impact on accuracy

n Must consider difficulty of dataset, task, and DNN modelo e.g., Easy to reduce precision for an easy task (e.g., digit classification) à does method work

for a more difficult task?o e.g., Easy to prune weights from over parameterized DNN models (e.g., AlexNet, VGG) à

does method work on compact DNN models?

o Does hardware cost exceed benefits?n Need extra hardware to support variable precision and shapes or identify sparsity

o e.g., Additional shift-and-add logic and registers for varying precisionn Granularity impacts hardware overhead as well as accuracy

o e.g., Fine-grained or coarse-grained (structured) sparsity

o Evaluation n Avoid evaluating impact based on number of weights or MACs as they may not be

sufficient for evaluating energy consumption and latency n Baseline for precision: 8-bit for inference and 16-bit float for training

o 32-bit float is a weak baseline

Vivienne Sze ISSCC 2020 66 of 91

Page 67: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Tutorial Overview

o Deep Learning Overviewo Key Metrics and Design Objectiveso Design Considerations

n CPU and GPU Platformsn Specialized / Domain Specific Hardware (ASICs)

o Efficient Dataflowso Algorithm (DNN Model) and Hardware Co-Design o Flexibility and Scalability

n Other Platformso Processing In Memory / In Memory Computingo Field Programmable Gate Arrays (FPGAs)

o Tools for Systematic Evaluation of DL Processorso Should I Use Deep Learning for a Given Task?

Vivienne Sze ISSCC 2020 67 of 91

Page 68: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Many Efficient DNN Design Approaches

pruning neurons

pruning synapses

after pruningbefore pruning

Network Pruning

C1

1S

R

1

R

SC

Compact Network Architectures

10100101000000000101000000000100

01100110

Reduce Precision

32-bit float

8-bit fixed

Binary 0

No guarantee that DNN algorithm designer will use a given approach.

Need flexible hardware!

Vivienne Sze ISSCC 2020

[Chen, SysML 2018]68 of 91

Page 69: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Limitations of Existing DNN Architectures

o Specialized DNN hardware often rely on certain properties of the DNN model in order to achieve high energy-efficiency

o Example: Reduce memory access by amortizing across PE array

Vivienne Sze ISSCC 2020 69 of 91

PE arrayWeightMemory

ActivationMemory

Weight reuse

Activation reuse

Page 70: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Limitations of Existing DNN Architectures

o Reuse depends on # of channels, feature map/batch size n Not efficient across all DNN models (e.g., compact DNNs)

Vivienne Sze ISSCC 2020 70 of 91

PE array(spatial

accumulation)

Number of filters(output channels)

Number ofinput channels

PE array(temporal

accumulation)

Number of filters(output channels)

feature mapor batch size1

C1

1R

Example mapping for depth wise layer

S

Page 71: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Need Flexible Dataflow

Use flexible dataflow (Row Stationary) to exploit reuse in any dimension of DNN to increase energy efficiency and array utilization

Vivienne Sze ISSCC 2020

Example: Depth-wise layer71 of 91

Page 72: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Need Flexible On-Chip Network for Varying Reuse

o When reuse available, need multicast to exploit spatial data reuse for energy efficiency and high array utilization

o When reuse not available, need unicast for high BW for weights for FC and weights & activations for high PE utilization

o An all-to-all on-chip network satisfies above but too expensive and not scalable

Glo

bal B

uffe

r

PE PE PEPE

PE PE PEPE

PE PE PEPE

PEPE PE PEG

loba

l Buf

fer

PE PE PEPE

PE PE PEPE

PE PE PEPE

PE PE PEPE

Glo

bal B

uffe

r

PE PE PEPE

PE PE PEPE

PE PE PEPE

PE PE PEPE

Glo

bal B

uffe

r

PE PE PEPE

PE PE PEPE

PE PE PEPE

PE PE PEPE

High Bandwidth, Low Spatial Reuse Low Bandwidth, High Spatial Reuse

Unicast Networks Broadcast Network1D Multicast Networks1D Systolic Networks

[Chen, JETCAS 2019]

Vivienne Sze ISSCC 2020 72 of 91

Page 73: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Hierarchical MeshGLBCluster

RouterCluster

PECluster

…… …

MeshNetwork

All-to-allNetwork

(a) (b) (c) (d) (e)

GLBCluster

RouterCluster

PECluster

…… …

MeshNetwork

All-to-allNetwork

(a) (b) (c) (d) (e)

High Bandwidth High Reuse Grouped Multicast Interleaved Multicast

Vivienne Sze ISSCC 2020

[Chen, JETCAS 2019]

73 of 91

Page 74: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Eyeriss v2: Balancing Flexibility and Efficiency

Efficiently supportso Wide range of filter shapes

n Large and Compact

o Different Layers n CONV, FC, depth wise, etc.

o Wide range of sparsity n Dense and Sparse

o Scalable architecture

Over an order of magnitude faster and more energy efficient than

Eyeriss v1

Speed up over Eyeriss v1 scales with number of PEs

# of PEs 256 1024 16384

AlexNet 17.9x 71.5x 1086.7x

GoogLeNet 10.4x 37.8x 448.8x

MobileNet 15.7x 57.9x 873.0x

5.610.912.6

Vivienne Sze ISSCC 2020

[Chen, JETCAS 2019]

74 of 91

Page 75: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Design Considerations for Flexibility and Scalability

o Many of the existing DL processors rely on certain properties of the DNN Modeln Properties cannot be guaranteed as the wide range techniques used for

efficient DNN model design has resulted in a more diverse set of DNNsn DL processors should be sufficiently flexible to efficiently support a wide

range of techniques

o Evaluate DL processors on a comprehensive set of benchmarksn MLPerf benchmark is a start, but may need more (e.g., sparsity, reduced

precision, compact network architectures)

o Evaluate improvement in performance as resources scales up!n Multiple chips modules [Zimmer, VLSI 2019] and Wafer Scale [Lie, HotChips 2019]

Vivienne Sze ISSCC 2020 75 of 91

Page 76: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Design Considerations for ASICo Increase PE utilization

n Flexible mapping and on-chip network for different DNN workloads àrequires additional hardware

o Reduce data movementn Custom memory hierarchy and dataflows that exploit data reusen Apply compression to exploit redundancy in data à requires additional

hardwareo Reduce time and energy per MAC

n Reduce precision à if precision varies requires additional hardware; impact on accuracy

o Reduce unnecessary MACsn Exploit sparsity à requires additional hardware; impact on accuracy n Exploit redundant operations à requires additional hardware

Vivienne Sze ISSCC 2020 76 of 91

Page 77: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Tutorial Overview

o Deep Learning Overviewo Key Metrics and Design Objectiveso Design Considerations

n CPU and GPU Platformsn Specialized / Domain Specific Hardware (ASICs)

o Efficient Dataflowso Algorithm (DNN Model) and Hardware Co-Designo Flexibility and Scalability

n Other Platformso Processing In Memory / In Memory Computingo Field Programmable Gate Arrays (FPGAs)

o Tools for Systematic Evaluation of DL Processorso Should I Use Deep Learning for a Given Task?

Vivienne Sze ISSCC 2020 77 of 91

Page 78: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Performing MAC with Memory Storage Element o Analog Compute

n Activations, weights and/or partial sums are encoded with analog voltage, current, or resistance

n Increased sensitivity to circuit non-idealities: non-linearities, process, voltage, and temperature variations

n Require A/D and D/A peripheral circuits to interface with digital domain

o Multiplicationn eNVM (RRAM, STT-RAM, PCM) use resistive device n Flash and SRAM use transistor (I-V curve) or local cap

o Accumulationn Current summing n Charge sharing

V1G1

I1 = V1�G1V2

G2

I2 = V2�G2

I = I1 + I2= V1�G1 + V2�G2

Image Source: [Shafiee, ISCA 2016]

Activation is input voltage (Vi)Weight is resistor conductance (Gi)

Vivienne Sze ISSCC 2020

Psumis output current

78 of 91

Page 79: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Processing In Memory (PIM*)o Implement as matrix-vector multiply

n Typically, matrix composed of stored weights and vector composed of input activations

o Reduce weight data movement by moving compute into the memoryn Perform MAC with storage element or in

peripheral circuitsn Read out partial sums rather than weights à

fewer accesses through peripheral circuitso Increase weight bandwidth

n Multiple weights accessed in parallel to keep MACs busy (high utilization)

o Increase amount of parallel MACs n Storage element can be higher area density

than digital MACn Reduce routing capacitance

weight stationary dataflow

inputactivations

DACAD

C

psum/output activations

Analog logic (mult/add/shift)

Columns in Array (A)

Rows in Array (B)

Vivienne Sze ISSCC 2020

* a.k.a. In-Memory Computing (IMC)

eNVM:[Yu, PIEEE 2018], SRAM:[Verma, SSCS 2019]

79 of 91

Storage Element

Page 80: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Design Considerations for PIMo Reduced precision due to non-idealities of analog compute

n For higher precision use o multiple storage elements per MAC à reduce area density and number of MACso bit serial processing à increase cycles per MAC

n Note: Per chip training may address variability but expensive in practiceo A/D and D/A conversion increase energy consumption and reduce area density

n Large array size can amortize conversion cost à increase area density and data reusen Array size limited by capacitance and resistance of bitline and wordline

o PE Utilizationn Number of rows or columns read in parallel from array limited by peripheral circuits

o Flexibilityn Limited mapping of weights due to sensitivity of analog compute and density

requirements à affects utilization of arrayn Can be challenging to support sparsityn If expensive to write (e.g., eNVM), need to store entire DNN model on-chip

Vivienne Sze ISSCC 2020 80 of 91

Page 81: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Design Considerations for DNNs on PIM

o Designing DNNs for PIM may differ from DNNs for digital processors

o Highest accuracy DNN on digital processor may be different on PIMn Accuracy drops based on robustness to non-

idealitieso Reducing number of weights is less desirable

n Since PIM is weight stationary, may be better to reduce number of activations

n PIM tend to have larger arrays à fewer weights may lead to low utilization on PIM

o Current trend is deeper and smaller filtersn For PIM, may be preferable to do shallower

and larger filters

Vivienne Sze ISSCC 2020

[Yang, IEDM 2019]

81 of 91

Imag

eNet

Storage Element

R x

S x

C

M

Page 82: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Field Programmable Gate Array (FPGA)o Often implemented as matrix-vector multiply

n e.g., Microsoft Brainwave NPU [Fowers, ISCA 2018]

o A popular approach uses weight stationary dataflow and stores all weights on FPGA for low latency (batch size of 1)n Referred to as pinning/persistent weightsn Scale to larger DNNs with multiple FPGAs due to

high external bandwidth capabilities

o Reduced precision to fit more weights and MACs on FPGAn e.g., custom ms-fp: 5-bit exponent (shared across

vector), 2-3 bit mantissa à 96,000 MACs on Stratix

Vivienne Sze ISSCC 2020 82 of 91

Page 83: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Design Considerations for FPGAs

o Increase number of PEs n Use custom reduced precision à check impact on accuracyn Use Look up tables (LUTs) for MACs, but slower and more area than DSPs

o Tradeoff between storage and compute à number of PEs versus PE utilization

o Increase PE utilizationn Design memory hierarchy using on-chip memory resources

o Store all weights on-chip when feasible (good for batch size 1)n Customized architecture and mapping for each layer

o Tailor architecture (e.g., PE array dimension) at synthesis time to DNN model and increase efficiency (e.g., PE utilization) of underlying FPGA hardware

o Specialized PE array added as co-processor to FPGA n Example: Xilinx Alveo platform has a xDNN systolic array accelerator

Vivienne Sze ISSCC 2020 83 of 91

Page 84: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

DL Processor Evaluation Toolso Require systematic way to

n Evaluate and compare wide range of DL processor designs

n Rapidly explore design spaceo Accelergy [Wu, ICCAD 2019]

n Early stage energy estimation tool at the architecture levelo Estimate energy consumption based on

architecture level components (e.g., # of PEs, memory size, on-chip network)

n Evaluate architecture level energy impact of emerging deviceso Plug-ins for different technologies

o Timeloop [Parashar, ISPASS 2019]

n DNN mapping tool n Performance Simulator à Action countsVivienne Sze ISSCC 2020

Open-source code available at: http://accelergy.mit.edu

Accelergy(Energy Estimator Tool)

Architecturedescription

Action countsAction counts

Compound componentdescription

… Energy estimation

Energyestimation plug-in 0

Energy estimation plug-in 1

Timeloop(DNN Mapping Tool &

Performance Simulator)

84 of 91

Page 85: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Summary

o DNNs are a critical component in the AI revolution, delivering record breaking accuracy on many important AI tasks for a wide range of applications; however, it comes at the cost of high computational complexity

o Efficient processing of DNNs is an important area of research with many promising opportunities for innovation at various levels of hardware design, including algorithm co-design

o When considering different DNN solutions it is important to evaluate with the appropriate workload in term of both input and model, and recognize that they are evolving rapidly

o It is important to consider a comprehensive set of metrics when evaluating different DNN solutions: accuracy, throughput, latency, power, energy, flexibility, scalability and cost

Vivienne Sze ISSCC 2020 85 of 91

Page 86: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Should I Use Deep Learning for a Given Task?o While deep learning gives state-of-the-art accuracy on many tasks, it may not be

the best approach for all tasks. Some factors to consider includeo How much training data is available?

n Deep learning requires a significant amount of data à in particular, labelled data (current state-of-the-art results rely on supervised learning)

o How much computing resource is available?n Despite the progress in the area of efficient deep learning, it can still require orders of

magnitude more complexity than other machine learning based approacheso How critical is interpretability?

n Understanding why the DNN makes a certain decision is still an open area of researchn DNN models can be fooled – increasing robustness is still an open area of researchn In general, debugging what happens within a DNN can be challenging

o Does a known model already exist? n Many things in the world are based on known models or laws (e.g., Ohm’s Law V=IR);

it may be unnecessary to re-learn this from the data

Vivienne Sze ISSCC 2020 86 of 91

Page 87: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Papers at this year’s ISSCCo 7.1 A 3.4-to-13.3TOPS/W 3.6TOPS Dual-Core Deep-Learning Accelerator for Versatile AI Applications in 7nm

5G Smartphone SoCo 7.2 A 12nm Programmable Convolution-Efficient Neural-Processing-Unit Chip Achieving 825TOPSo 7.4 GANPU: A 135TFLOPS/W Multi-DNN Training Processor for GANs with Speculative Dual-Sparsity

Exploitation

o 14.1 A 510nW 0.41V Low-Memory Low-Computation Keyword-Spotting Chip Using Serial FFT-Based MFCC and Binarized Depthwise Separable Convolutional Neural Network in 28nm CMOS

o 14.2 A 65nm 24.7µJ/Frame 12.3mW Activation-Similarity-Aware Convolutional Neural Network Video Processor Using Hybrid Precision, Inter-Frame Data Reuse and Mixed-Bit-Width Difference-Frame Data Codec

o 14.3 A 65nm Computing-in-Memory-Based CNN Processor with 2.9-to-35.8TOPS/W System Energy Efficiency Using Dynamic-Sparsity Performance-Scaling Architecture and Energy-Efficient Inter/Intra-Macro Data Reuse

o 15.2 A 28nm 64Kb Inference-Training Two-Way Transpose Multibit 6T SRAM Compute-in-Memory Macro for AI Edge Chips

o 15.3 A 351TOPS/W and 372.4GOPS Compute-in-Memory SRAM Macro in 7nm FinFET CMOS for Machine-Learning Applications

o 15.4 A 22nm 2Mb ReRAM Compute-in-Memory Macro with 121-28TOPS/W for Multibit MAC Computing for Tiny AI Edge Devices

o 15.5 A 28nm 64Kb 6T SRAM Computing-in-Memory Macro with 8b MAC Operation for AI Edge Chips

Vivienne Sze ISSCC 2020 87 of 91

Page 88: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

Additional Resources

V. Sze, Y.-H. Chen, T-J. Yang, J. Emer,

“Efficient Processing of Deep Neural Networks: A Tutorial and Survey,”

Proceedings of the IEEE, Dec. 2017

For updates

http://mailman.mit.edu/mailman/listinfo/eems-news

Book Coming Soon!

MIT Professional Education Course on “Designing Efficient Deep Learning Systems” http://professional-education.mit.edu/deeplearning

DNN Tutorial website http://eyeriss.mit.edu/tutorial.html

Vivienne Sze ISSCC 2020 88 of 91

Page 89: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

References (1 of 3)Deep Learning Overviewo Transformer: Vaswani et al, “Attention is all you need,” NeurIPS 2017o LeNet: LeCun, Yann, et al. “Gradient-based learning applied to document recognition,” Proc. IEEE 1998o AlexNet: Krizhevsky et al. “Imagenet classification with deep convolutional neural networks,” NeurIPS 2012o VGGNet: Simonyan et al.. “Very deep convolutional networks for large-scale image recognition,” ICLR 2015o GoogleNet: Szegedy et al. “Going deeper with convolutions,” CVPR 2015o ResNet: He et al. “Deep residual learning for image recognition,” CVPR 2016o EfficientNet: Tan et al., “EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks,” ICML 2019

Key Metrics and Design Objectiveso Sze et al., “Hardware for machine learning: Challenges and opportunities,” CICC 2017,

https://www.youtube.com/watch?v=8Qa0E1jdkrE&feature=youtu.beo Sze et al., “Efficient processing of deep neural networks: A tutorial and survey,” Proc. IEEE 2017o Williams et al., “Roofline: An insightful visual performance model for floating-point programs and multicore

architectures,” CACM 2009o Chen et al., Eyexam, https://arxiv.org/abs/1807.07928

CPU and GPU Platformso Mathieu et al., “Fast training of convolutional networks through FFTs,” ICLR 2014o Cong et al., “Minimizing computation in convolutional neural networks,” ICANN 2014o Lavin et al., “Fast algorithms for convolutional neural networks,” CVPR 2016

Vivienne Sze ISSCC 2020 89 of 91

Page 90: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

References (2 of 3)Specialized Hardware (ASICs): Dataflow, Reduced Precision, Sparsity and Compact Modelo Chen et al., “Eyeriss: A Spatial Architecture for Energy-Efficient Dataflow for Convolutional Neural Networks,” ISCA

2016, http://eyeriss.mit.eduo Courbariaux et al., “Binaryconnect: Training deep neural networks with binary weights during propagations,”

NeurIPS 2015 o Li et al., “Ternary weight networks,” NeurIPS Workshop 2016o Rategari et al., “XNOR-Net: ImageNet Classification Using Binary Convolutional Neural Networks,” ECCV 2016o Lee et al., “LogNet: Energy-efficient neural networks using logarithmic computation,” ICASSP 2017o Lecun et al., Optimal Brain Damage,” NeurIPS 1990o Han et al., “Learning both weights and connections for efficient neural networks,” NeurIPS 2015o Chen et al., “Eyeriss: An energy-efficient reconfigurable accelerator for deep convolutional neural networks,” ISSCC

2016, http://eyeriss.mit.eduo Albericio et al., “Cnvlutin: Ineffectual-neuron-free deep neural network computing”, ISCA 2016o Yang et al., “Designing Energy-Efficient Convolutional Neural Networks using Energy-Aware Pruning,” CVPR 2017,

http://eyeriss.mit.edu/energy.htmlo Yang et al., “NetAdapt: Platform-Aware Neural Network Adaptation for Mobile Applications,” ECCV 2018,

http://netadapt.mit.eduo Howard et al., “Mobilenets: Efficient convolutional neural networks for mobile vision applications”, arXiv 2017o Camus et al., “Review and Benchmarking of Precision-Scalable Multiply-Accumulate Unit Architectures for Embedded

Neural-Network Processing,” JETCAS 2019

Vivienne Sze ISSCC 2020 90 of 91

Page 91: How to Understand and Evaluate Deep Learning Processors14 hours ago · efficient DNN model design has resulted in a more diverse set of DNNs n DL processors should be sufficiently

References (3 of 3)Specialized Hardware (ASICs): Flexibility and Scalability o Chen et al., “Understanding the Limitations of Existing Energy-Efficient Design Approaches for Deep Neural

Networks,” SysML 2018, https://www.youtube.com/watch?v=XCdy5egmvaUo Chen et al., “Eyeriss v2: A Flexible Accelerator for Emerging Deep Neural Networks on Mobile Devices,” JETCAS 2019o Zimmer et al., “A 0.11pJ/Op, 0.32-128 TOPS, Scalable Multi-Chip-Module-based Deep Neural Network Accelerator

with Ground-Reference Signaling in 16nm,” VLSI 2019o Lie (Cerebras), “Wafer Scale Deep Learning,” Hot Chips 2019

Other Platforms: Processing In Memory / In-Memory Computing and FPGAso Verma et al., “In-Memory Computing: Advances and prospects,” ISSCC Tutorial 2018 / SSCS Magazine 2019o Yu, “Neuro-Inspired Computing with Emerging Nonvolatile Memorys,” Proc. IEEE 2018o Yang et al., “Design Considerations for Efficient Deep Neural Networks on Processing-in-Memory Accelerators,” IEDM

2019o Fowers et al., “A configurable cloud-scale DNN processor for real-time AI,” ISCA 2018

DL Processor Evaluation Toolso Wu et al., “Accelergy: An Architecture-Level Energy Estimation Methodology for Accelerator Designs,” ICCAD 2019,

http://accelergy.mit.eduo Parashar et al., “Timeloop: A Systematic Approach to DNN Accelerator Evaluation,” ISPASS 2019

Vivienne Sze ISSCC 2020 91 of 91