Top Banner
Brief Introduction of FPGA And Neural Network Deployment Zhang Bin
36

Brief Introduction of FPGA And Neural Network Deployment

Dec 19, 2021

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Brief Introduction of FPGA And Neural Network Deployment

Brief Introduction of FPGAAnd

Neural Network Deployment

Zhang Bin

Page 2: Brief Introduction of FPGA And Neural Network Deployment

FPGA---Field Programmable Gate Array

• Field:

• In the field

• Programmable:

• Re-Configurable - Change Logic Functions

• Gate Array:

• Reference to ASIC (Application specific integrated circuits) internal architecture

Page 3: Brief Introduction of FPGA And Neural Network Deployment

Why FPGA?

Parallelism!

Parallelism!

Parallelism!

Parallelism!

Page 4: Brief Introduction of FPGA And Neural Network Deployment

Programmable? How?

Logic elements FGPA Implementation

Page 5: Brief Introduction of FPGA And Neural Network Deployment

Programmable? How?

Page 6: Brief Introduction of FPGA And Neural Network Deployment

• CPU

• Complex internal structure

• GPU

• A large-scale data which is highly unified and mutually independent and normally operate in a pure computing environment with limited external interrupts.

FPGA vs. CPU vs. GPU --Architecture

Page 7: Brief Introduction of FPGA And Neural Network Deployment

• GPU

• Suitable for a real time image processing system requires high resolution and complex calculations.

• SIMD

• FPGA

• If the system only requires convolution based on low level algorithms, FPGA becomes more suitable.

Compare to FPGA, GPU has higher power consumption, but better calculation ability.

FPGA vs. GPU (Image processing)

Page 8: Brief Introduction of FPGA And Neural Network Deployment

• GPU

• Suitable for a real time image processing system requires high resolution and complex calculations.

• SIMD

• FPGA

• If the system only requires convolution based on low level algorithms, FPGA becomes more suitable.

Compare to FPGA, GPU has higher power consumption, but better calculation ability.

FPGA

Page 9: Brief Introduction of FPGA And Neural Network Deployment

Embeded system & FPGA SoC

Page 10: Brief Introduction of FPGA And Neural Network Deployment

FPGA Develop Workflow

Page 11: Brief Introduction of FPGA And Neural Network Deployment

Disadvantages

• Limited resources. Need to choose different FPGA models based on design needs.

• Compare to ASIC:

a. High power consumption

b. Only suitable for low quality production, because of the high expense

• Compare to GPU:

a. Relatively low calculation ability.

b. Low generality.

• HDL (Hardware Description Language). Long development period.

FPGA Pros & Cons

Page 12: Brief Introduction of FPGA And Neural Network Deployment

Advantages

• Flexibility

a. Programmable after manufacturing.

b. Customization

• Massively parallel

• Low latency

Mission-critical applications require very low-latency. (autonomous vehicles and manufacturing operations)

FPGA Pros & Cons

Page 13: Brief Introduction of FPGA And Neural Network Deployment

int foo (char x, char a, char b, char c) {

char y;

y = x*a+b+c;

return y

}

Example 1

Page 14: Brief Introduction of FPGA And Neural Network Deployment

void foo(int in[3], char a, char b, char c, int out[3])

{

int x,y;

for(int i = 0; i < 3; i++) {

x = in[i];

y = a*x + b + c;

out[i] = y;

}

}

Page 15: Brief Introduction of FPGA And Neural Network Deployment
Page 16: Brief Introduction of FPGA And Neural Network Deployment

Calculation of an addition of two 32-bits floating-point numbers

C = A + B

Example 2

Functions need to be designed.

• Same exponents -- compare unit, shift unit

• 2's complement -- adder

• add {1, fractions}-- adder

• carry? -- adder

• overflow or underflow

• Infinity, Zero or Nan -- IEEE 754

Page 17: Brief Introduction of FPGA And Neural Network Deployment

Example 2

Design flow

• Arrangement of operation functions

• Special numbers bypass

• Predict overflow/underflow

• Optimize

• Timing analysis

• Same exponents -- compare unit, shift unit

• 2's complement -- adder

• Add {1, fractions}-- adder

• Carry? -- adder

• Overflow/Underflow

• Infinity, Zero or Nan -- IEEE 754

Page 18: Brief Introduction of FPGA And Neural Network Deployment

Task pipeline --- Efficient Improvement

FPGA Deployment of Neural Network

Controller Task0 …… TaskN

Controller design?

Page 19: Brief Introduction of FPGA And Neural Network Deployment

FPGA + ARM

Page 20: Brief Introduction of FPGA And Neural Network Deployment

A typical FPGA-based neural network accelerator system

Page 21: Brief Introduction of FPGA And Neural Network Deployment

Computation and parameter of a typical NN model

Convolution and FC is the mainly computation.Matrix Multiplication

Page 22: Brief Introduction of FPGA And Neural Network Deployment

Resource consumption of mul-add operation

Floating-point number computation cost is much higher than fixed-point number

Page 23: Brief Introduction of FPGA And Neural Network Deployment

Build operations in the network

Neural Networks Implementation

Page 24: Brief Introduction of FPGA And Neural Network Deployment

Parallel operations (Operation channels)

Neural Networks Implementation

Page 25: Brief Introduction of FPGA And Neural Network Deployment

Data transactions, storage. (Calculation data, parameters)

Neural Networks Implementation

Page 26: Brief Introduction of FPGA And Neural Network Deployment

• Variety networks.

• SR: High data bandwidth. High calculation resources needed.

Challenges

Page 27: Brief Introduction of FPGA And Neural Network Deployment

Low-latency models. E.g. autonomous vehicles and manufacturing operations.

• Hight frequency.

• Low latency design.

Challenges

Page 28: Brief Introduction of FPGA And Neural Network Deployment

Performance and Resources balance

• Computation-limited

• Memory bandwidth-limited

Challenges

Page 29: Brief Introduction of FPGA And Neural Network Deployment

Building FPGA operation library.

Conv

FC

ReLu

Upsample

Resize

Pooling

...

Resolutions

Model of FPGA Implementation

Page 30: Brief Introduction of FPGA And Neural Network Deployment

Optimize operation implementation.• Better structure. (e.g. Mat-mul: systolic array)

Resolutions

Page 31: Brief Introduction of FPGA And Neural Network Deployment

Optimize storage strategy

Resolutions

Page 32: Brief Introduction of FPGA And Neural Network Deployment

Optimize based on network needs.

• Speed

• Resources usage

• Power consumption

• ...

Resolutions

Page 33: Brief Introduction of FPGA And Neural Network Deployment

Design automation (under exploration)• Model to Verilog (Zebra)

Resolutions

Page 34: Brief Introduction of FPGA And Neural Network Deployment

Model -> RTL design -> FPGA -> ASIC

Role in product development

The Goal Is ASIC

Page 35: Brief Introduction of FPGA And Neural Network Deployment

Q&A

Feel free to contact me if you have any further [email protected]

Page 36: Brief Introduction of FPGA And Neural Network Deployment

Thank you!