FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs?...

34
Craig Abramson Senior Technical Marketing Engineer Longmont, Colorado FPGAs for Highest Performance Inference

Transcript of FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs?...

Page 1: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Craig Abramson

Senior Technical Marketing Engineer

Longmont, Colorado

FPGAs for Highest

Performance Inference

Page 2: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Why FPGAs?

The rate of AI innovation

Performance at low latency

Whole app acceleration

Conclusion

Agenda: Machine Learning Challenges

Page 3: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Why FPGAs?

Page 4: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Quiz: FPGAs are . . .

A. Flexible Parallel GPU Accelerators

B. Functional Pervasive Gigaspeed ALU

C. Field Programmable Gate Array

D. Fast Processor for GNU Assemblers

Quiz: GPUs are . . .

A. Graphics Processing Units

For hyperscaler machine learning INFERENCE, the battle is really between FPGAs and GPUs

Page 5: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Why FPGAs?

˃ Custom chip alternative

˃ lower cost/power solution

˃ Lower risk

˃ Higher functionality

Feature Benefit

˃ Faster time to market

˃ Lower cost/power solution

˃ Lower risk

˃ Higher functionality

Page 6: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Training vs. Inference

Inference

Few dogs

at a time

“Dog”

InputInference

Training

Many

Dog

Pictures

“Dog”

InputTraining

Learning

MATH MATH

Page 7: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Training: Process for machine to

“learn” and optimize model from data

Inference: Using trained models to

predict/estimate outcomes from new

observations in efficient deployments

INFERENCE

Fewer

“dog”✓

“dog”

Input

”cat”

TRAINING

= ?

Many

labels

Error

Input

Training vs. Inference

https://arxiv.org/pdf/1510.00149v5.pdf

Focus

Page 8: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Why ML Inference? It’s Where the Market is going to be. . .

Training Data Center Inference Edge InferenceTAM $B

Barclays Research, Company Reports May 2018

2016 2017 2018 2019 2020 2021 2022 2023

30

20

10

Page 9: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Rate of Innovation

Page 10: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Gen1

Gen2

Gen3

Gen4

Gen5

Companies want to design with PCIe before spec is finalized

FPGAs enable that

Page 11: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

AlexNet

GoogLeNet

DenseNet

Silicon lifecycle

Rate of Innovation Outpaces Silicon Cycles

2012 2018

Machine Learning Innovation Outpaces Silicon Cycles

Page 12: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

2012 2013 2014 2015 2016 2017 2018 2019 2020

FP32 FP/INT16 INT8 INT6 INT4 INT2 INT1INT32

The Rate of AI Innovation

Source: Bill Dally (Stanford), Cadence Embedded Neural Network Summit, February 1, 2017

Inferenceis Moving to Lower Precision

8b Add 0.03

16b Add 0.05

32b Add 0.1

16b FP Add 0.4

32b FP Add 0.9

RELATIVE ENERGY COST

Operation: Energy (pJ)

Inference is Moving to Lower Precision

Page 13: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Summary: Things in ML Are Changing Fast

Page 14: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Performance at Low Latency

Page 15: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

SW Programmable

HW Adaptable

Workload Flexibility

Throughput vs. Latency

Device / Power Efficiency

Custom ASIC

Delivering Adaptable ML Compute Acceleration

CPU(Sequential)

GPU(Parallel)

FPGA / SoC

Page 16: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

A Brief History of (GPU) Time

1990 1995 2000 2005 2010 2015 2020

CPU

lacks graphics

horsepower

Fixed Silicon

3DVertex

2DPixel

Programmable

3DVertex

2DPixel

2007

CUDA Introduction

Programmable

Unified

3D & 2D

Machine Learning

High

Performance

ComputingAlexNet

• HW Architecture

• Programming Model

Graphics

Acceleration

GPUGraphics

GPGPUCompute

Kepler Maxwell Pascal Volta Turing

Same Silicon

+ Tools

+ ECC

+ Perf Adj.

+ Power Adj.

Page 17: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

CPU + GPU Work Together to Feed the Beast

DRAM

ALU ALU

ALU ALU

Control

L2

Cache

CPU

DRAM

L2

GPU

PCIe / AXI / etc

100s of ALUs

Latency Optimized• Serial Processing

• Large Data Cache

Throughput Optimized• Data Parallel

Processing

• Compute favored over

on-chip Memory

Cache AccessMemory Access

“Latency Hiding”

100’s of Threads

GPUs “BATCH”

data to get

around this.

Kernels

Page 18: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Data Flow and Data Precision Matters

DRAM

L2

Load Store

ALU

Op

Executed

Fixed

Memory

Hierarchy32-bit

PC Instruction

CacheStack

˃ Software Defined Data FlowMajor overhead (memory, comms, power)

Non-deterministic Behavior (latency)

˃ Fixed Data Precision SupportFloating point / Integer units

Native precisions defined at T/O

BRAM

DRAM

32-bit

………….0n

………….0n

………….0n

………….0n

Adaptable HW Kernel

Adaptable HW Kernel

Custom

Memory

Hierarchy

Variable

Precision

˃ Hardware Defined Data FlowMinimum overhead, custom compute / memory

Deterministic Behavior (latency)

Reconfigurable to current / future workloads

˃ Variable Data Precision SupportOptimize for memory, power, cost

Future proof, adapts to future precision trends

GPU (Basically a SW Engine) FPGA

Page 19: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Memory Hierarchy: Very Fundamental FPGA Advantage

˃ Rigid memory hierarchy & data duplication

˃ High “data locality” required for workload efficiency

GPU

co

rere

g

co

rere

g

co

rere

g

co

rere

g

Block 0

co

rere

g

co

rere

g

co

rere

g

co

rere

g

Block 1

co

rere

g

co

rere

g

co

rere

g

co

rere

g

Block N

Global Mem

(Off-chip HBM / GDDR)

Shared Mem/ L1 Cache

1X

Latency : Power

10X

100X

Shared Mem/ L1 Cache

Shared Mem/ L1 Cache

L2 Cache

1X

2X

80X

Memory

Compute

Memory

Hierarchy

(Interconnect)

Memory

Compute

Memory

Hierarchy

Fixed

FPGA

Global Mem (if needed)

UltraRAM UltraRAM

BRAM BRAM BRAM BRAM

LUTRAM LUTRAM LUTRAM LUTRAM LUTRAM LUTRAM LUTRAM

Kernel

A

Kernel

B

Kernel

C

Adaptable

BRAM

˃ Adaptable memory hierarchy & datapath

˃ ~5X more on-chip memory / less off-chip required

Match Memory Hierarchy & Bandwidth

to Compute Requirements

Fixed Memory Hierarchy & Shared Interconnect:

Robs Bandwidth / Capacity & Stalls Compute

D0

D0

D0

Page 20: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

What About Batching?

Input 1

Input 2

Input 3

Input 4

Result 1

Result 2

Result 3

Result 4

GPU

High Throughput OR Low Latency

Batching: Loading up lots of similar Data Sets

• Keep compute cores busy

• Hide some memory latency

• Create better SIMT efficiency

Fundamental to GPU Architecture

(Software Defined Data Flow)

Independent of Data Set count

• Custom HW kernels

• Custom Memory Hierarchy

• HW pipeline data flow

Not Required for FPGA / ACAP

(Hardware Defined Data Flow)

High Throughput AND Low Latency

FPGA

Input 1

Input 2

Input 3

Input 4

Result 1

Result 2

Result 3

Result 4

Batching doesn’t even really apply in an FPGA

Page 21: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

A Batching Example: Image Classification

DRAM

L2

Batch = 1

Time

“Dog”

Memory Compute Low Throughput

Low Latency

GPU

Page 22: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

DR

AM

UR

AM

BR

AM

xDNN Kernels

UR

AM

BR

AM

UR

AM

BR

AM

UR

AM

BR

AM

A Batching Example: Image Classification

DRAM

L2

Batch = 1

Time

“Dog” “Cat” “Truck” “Duck” “Cat” “Dog” “Duck” “Truck”

Memory Compute Low Throughput

Low Latency

Batch = 64

Memory ComputeHigh Throughput

High Latency

“Cat”

“Duck”

“Truck”

“Dog”

High Throughput

AND

Low Latency

GPU FPGA

Page 23: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

The Benefits of Pruning & Compression

a0

a3

Before Pruning

weights

(w00 . .)

x =

a0

a1

a2

a3

?

After Pruning

w00

w10

w20

w30

w01

w11

w21

w31

w02

w12

w22

w32

w03

w13

w23

w33

a0

a3

weights

(w00 . .)pruning synapse

pruning neuron

-

-

-

-

-

-

-

-

Pruning Benefits:

• Smaller, “lighter” networks

• Less mem capacity & b/w req’d

• Reduced compute requirement

• Higher performance

• Lower powerG

PU

FP

GA

Applies

to Both

. . BUT . .

• Issues w/ sparse & small matrices

• Compute efficiency degrades

• Still more off-chip mem req’d

• Better w/ sparse matrices

• Single-chip solutions possible

• Device scales w/ compute/resources

Up to 30+%

Better

Compression

Page 24: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Adaptable Hardware Addresses Inference Challenges

Custom data flow

(Address new architectures)

Custom memory hierarchy

(Address power/performance challenges

Custom precision

(Address power/cost)

Domain Specific

Architectures (DSAs)

on Adaptable Platforms

Page 25: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Putting Metrics & Benchmarks in Focus

0

1000

2000

3000

4000

5000

P4 P40 T4 (est) AlveoU200

AlveoU250

Imag

es /

sec

GoogleNetv1 Batch=1 Throughput

Int8 TOPS

P4 = 22

U200 = 18.6

U250 = 33.3

P40 = 47

T4 = 130

ML Benchmark

Focus on Application Level Performance Where Xilinx Solutions Shine

Adaptable Hardware Delivers

AND Application Reqs:• Request (“Batch”) Size

• Latency Spec

• Power Envelope

• Accuracy Requirements

Usable TOPS limited by:• Memory bottlenecks

• Code / data structure

• Stalls & branches

• Freq. throttling

• Custom compute / memory • Higher device utilization

• HW performance / power

Page 26: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

26Page

Bi-directional LSTM Performance: Speech to Text

LSTM

CNN

Fully connected

Softmax

Result

Audio

Feature extraction

Decoder

ASR system

model

2 layers

with BN and

Hardtanh

5 layers

Bi-

directional

1 layer

1 layer

only used

in training

0

20

40

60

80

100

120

140

Tim

e (

ms)

End-2-End Time: AWS Instance Comparison

Feature Extraction

CNN

LSTM

Fully Connected

Softmax

Decoder

Decoder

Softmax

Fully Connected

Feature Extraction

136 ms

42 ms

20 ms

8X vs. CPU / 2X vs. GPU

VU9P Delivers Fastest E2E Time

CPU Only CPU + GPU CPU + Alveo U200

Page 27: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Whole App Acceleration

Page 28: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Focusing on latency and

batching should not take away

from the fact that FPGAs and

programmable hardware can

be used for . . . anything.

Page 29: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Xilinx Machine Learning Customer Successes

Surveillance System

Camera +CV +12 SSD +Display

12 channel object detection

in 1 ZU9 (with pruning)

USB Camera +CV +ML +Display

5x better Perf/Watt than GPU /

SSD (no pruning!)

Automotive OEM

ML benchmarks (pruning)

93% Reduction of resources

within 1% of initial precision

Automotive OEM

SSD+VGG Yolov2

Baseline Map Pruning Result 1 Map

93% size reduction

90% size reduction

GPU

GPU

Page 30: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

ML /

Analytics

Encode

HEVCProcess

Decode

H.264

Video transcoding + AI analytics

1Aup2603

48 ZU7EV

30E5 Servers

Whole Application Acceleration:Online Video Streaming

Page 31: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Video Success Story

Page 32: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Conclusion

>> 32

Page 33: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

Why FPGAs?

The rate of AI innovation

Performance at low latency

Whole app acceleration

Conclusion

Machine Learning Challenges

Page 34: FPGAs for Highest Performance Inference€¦ · FPGAs for Highest Performance Inference. Why FPGAs? The rate of AI innovation Performance at low latency Whole app acceleration Conclusion

© Copyright 2018 Xilinx

Building the Adaptable,

Intelligent World