Docsity

Hardware Specialization, Exercises of Computer Networks

Partial preview of the text

Download Hardware Specialization and more Exercises Computer Networks in PDF only on Docsity!

Hardware Specialization

ECE 5775

High-Level Digital Design Automation

Fall 2022

▸First reading assignment

  • A. Boutros and V. Betz, “FPGA Architecture: Principles and Progression”, IEEE CAS-M 2021.
  • Complete reading before Thursday 9/

▸Hands-on HLS tutorial next Tuesday

  • Bring your laptop

Announcements

1

3 ▸ Higher demand on efficient compute acceleration, esp. for machine learning (ML) workloads ▸ Lower barrier with cloud FPGAs & open-source hardware coming of age

A Golden Age of Hardware Specialization

Modern ML Models are Computationally

Demanding

▸ Deep neural networks (DNNs) require enormous amount of compute

  • For example, ResNet50 (70 layers) performs 7.7 billion operations to classify one image 4 X. Xu, et al. Scaling for Edge Inference of Neural Networks. Nature Electronics , 2018.

PERSPECTIVE NATURE^ ELECTRONICS

Number of operations ( × 10 9 ) 10 20 5 1 50 20% 10% 4% Top-five error AlexNet ( 2012 ) OverFeat ( 2013 ) GoogLeNet ( 2014 ) VGG-1 6 VGG-1 9 ( 2014 ) Inception-v Inception-v 2 Inception-v Inception-v 4 ( 2016 ) MobileNet ShuffleNet Xception ResNeXt-101 DPN- PolyNet NASNet-A( N =7) ResNet ResNet ( 2015 ) ResNet5 0 NASNet-A( N =5) NASNet-A( N =4) NASNet-A( N =7) DaDianNao 500 1,00 0 PD of GPUs PD of ASICs PD of FPGAs Moore’s law trend for performance according to ref. 35 Moore’s law end DNNs in academia without structural optimization DNNs in academia with structural optimization a b Compute Density

▸ Classical Dennard scaling

  • Frequency increases at constant power profiles
  • Performance improves “for free"! ▸ Leakage limited scaling
  • Vth virtually stopped scaling due to exponentially increasing leakage power
  • VDD scaling nearly stopped as well to maintain performance ▸ Dark silicon
  • Power constraints limit how much of the chip can be activated at any one time (not 100% anymore) 6

End of Dennard Scaling and Dark Silicon

Classical Dennard scaling Transistor (trans.) # S 2 Capacitance / trans. 1/S Voltage (Vdd) 1/S Frequency S Total power 1 Leakage limited scaling Transistor (trans.) # S 2 Capacitance / trans. 1/S Voltage (Vdd) ~ Frequency ~ Total power S

7

Ending of Moore’s Law? A Reality Check of

Density Scaling

[Figure credit: David Brooks, Harvard]

9

Rough Energy Breakdown for an Instruction

Figure 1.1.7: Power breakdown of an 8 core server chip. Figure 1.1.8: Figure 1.1.9: Rough energy costs for various operations in 45nm 0.9V. ͬͬ ,QWHJHU $GG ) )$GG *0HPRU* $GG &DFKH ELW ELW S- ELW S- )$GG ELW S- ELW S- &DFKH ELW .% S- .% S- 0XOW ELW S- ELW S- )0XOW ELW S- ELW S- 0% S- '5$0 Q- Instruction Energy Breakdown 25pJ 6pJ^ Control 70 pJ I-Cache Access Register File Access Add M. Horowitz, Computing's energy problem (and what we can do about it), ISSCC’2014. Estimated energy costs for various integer, floating-point (FP), and memory operations on CPU (target node: 45nm at 0.9V) 25pJ 6pJ Control Control overheads (clocking, decoding, pipeline control, ….) I-Cache access Register file access 32 - bit ALU

10

Reducing Compute Energy Overhead

I-Cache RF Control I-Cache RF Control I-Cache RF Control hundreds or more …^ … … Further specialization (what we achieve using accelerators) Single instruction multiple Data (SIMD): tens of operations per instruction I-Cache RF Control … [Figure credit] W. Qadder, et al., Convolution Engine: Balancing Efficiency & Flexibility in Specialized Computing, ISCA’2013. I-Cache RF Control A sequence of energy-inefficient instructions Arithmetic

12

Customized Data Types

▸ Using custom numeric types tailored for a given application/domain improves performance & efficiency Sign (^) Exponent Mantissa Half float (fp16) bfloat int uint uint block-fp

fixed<9,4> Covered in lectures & labs

▸ MSB weight = - 2 n- 1 13

Binary Representation – Positional Encoding

3 2 2 2 1 2 0 unsigned 1 0 1 1 = 11

3 2 2 2 1 2 (^0) 2’c 1 0 1 1 = - 5 Two’s complement ▸ MSB has a place value (weight) of 2 n- 1 Unsigned number Binary Point (implicit) Most significant bit (MSB)

▸ Overflow occurs when a number is larger than the largest number that can be represented using a given number of bits ▸ Underflow occurs when a number is smaller than the smallest number that can be represented 15

Overflow and Underflow

3 2 2 2 1 2 0 2

  • 1 2 - 2 unsigned 1 0 1 1 0 1 = 11. 0 1 1 0 1 = 3. Overflow with 3 integer bits

16

Handling Overflow

▸ One common & efficient way of handling overflow is to drop the MSB(s) of the original number

  • This is commonly called wrapping
    • 2 3 2 2 2 1 2 0 2 - 1 2 - 2 2’c 1 0 1 1 0 1 = - 4. 2’c 0 1 1 0 1 = ?? Wrapping can cause a negative number to become positive, or a positive to negative Dropping MSB when integer width is reduced

Example Application: Edge Detection

▸ Identifies discontinuities in an image where brightness (or image intensity) changes sharply

  • Very useful for feature extractions in computer vision Figures: Pilho Kim, GaTech Sobel operator G = ( GX ,GY ) 18

CPU Implementation of a 3x3 Convolution

CPU Main Memory Cache for (r = 1; r < H; r++) for (c = 1; c < W; c++) for (i = 0; i < K; i++) for (j = 0; j < K; j++) out[r][c] += img[r+i-1][c+j-1] * f[i][j]; 19 W H