+ All Categories
Home > Documents > Study the effects of approximation on conjugate gradient ... · Study the effects of approximation...

Study the effects of approximation on conjugate gradient ... · Study the effects of approximation...

Date post: 09-May-2020
Category:
Upload: others
View: 8 times
Download: 0 times
Share this document with a friend
59
Examiners: Prof. Dr. Christian Plessl Prof. Dr. Marco Platzner Guide: Michael Laß Presenter: Tasneem Filmwala Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform
Transcript
Page 1: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

Examiners:Prof. Dr. Christian PlesslProf. Dr. Marco Platzner

Guide:Michael Laß

Presenter:Tasneem Filmwala

Study the effects of approximation on conjugate gradient algorithm

and accelerate it on FPGA platform

Page 2: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

2

Outline➔ Problem Description

➔ Motivation

➔ Approximate Computing

➔ Algorithm Background

➔ Tools and Hardware Platform

➔ Design

➔ Approximation Techniques

➔ Precision Scaling in CG

➔ Error Analysis

➔ Evaluation

➔ Conclusion

Page 3: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

3

Outline➔ Problem Description

➔ Motivation

➔ Approximate Computing

➔ Algorithm Background

➔ Tools and Hardware Platform

➔ Design

➔ Approximation Techniques

➔ Precision Scaling in CG

➔ Error Analysis

➔ Evaluation

➔ Conclusion

Page 4: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

4

Problem Description

Huge data available

Clusters to compute them

HPC

Increased complex mathematical modelsand simulation environment

HPC Meets Approximate Computing

Page 5: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

5

Outline➔ Problem Description

➔ Motivation

➔ Approximate Computing

➔ Algorithm Background

➔ Tools and Hardware Platform

➔ Design

➔ Approximation Techniques

➔ Precision Scaling in CG

➔ Error Analysis

➔ Evaluation

➔ Conclusion

Page 6: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

6

Motivation

● Computing nodes already advanced● Focus on optimizing algorithms● Use of approximation for performance/resource

benefits

● Iterative Algorithms promising targets in HPC● Conjugate Gradient method used in HPC for

iteratively solving systems of linear equation● Approximate data paths of algorithm

● Accelerate on FPGA

Page 7: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

7

Outline➔ Problem Description

➔ Motivation

➔ Approximate Computing

➔ Algorithm Background

➔ Tools and Hardware Platform

➔ Design

➔ Approximation Techniques

➔ Precision Scaling in CG

➔ Error Analysis

➔ Evaluation

➔ Conclusion

Page 8: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

8

Approximate Computing

● Key Idea

Page 9: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

9

Approximate Computing● Key Idea

● Error Resilient Domains

Image ProcessingMachine LearningSignal Processing

Page 10: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

10

Approximate Computing

HPC Meets Approximation

Approximate Iterative Algorithms

Tolerate imperfect solutions

Page 11: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

11

Outline➔ Problem Description

➔ Motivation

➔ Approximate Computing

➔ Algorithm Background

➔ Tools and Hardware Platform

➔ Design

➔ Approximation Techniques

➔ Precision Scaling in CG

➔ Error Analysis

➔ Evaluation

➔ Conclusion

Page 12: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

12

Algorithmic Background

Conjugate Gradient Method➢ Iterative Approach➢ Optimization of quadratic function

F(x) = ½ F(x) = ½ xxT T A x - B x A x - B xT T + C+ C

F(x) = Ax – B =0F(x) = Ax – B =0

Page 13: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

13

Algorithmic Background

➢ Solves large system of linear equation

➢ Advanced variation of steepest descent method

➢ Converges in few iterations

Input(Known) Matrix

A x – B = 0

Input (Known) Vector

Solution vector

Page 14: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

14

Algorithmic Background

Page 15: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

15

Algorithmic Background

➢ Move along A Conjugate Search direction ➢ Pk

T A Pk-1 = 0➢ Initial search direction is same as gradient vector

➢ Next search direction (Pk) is linear combination of current gradient vector and previous search direction

Xk+1

= Xk + step-size * P

k

P

k = R

k + beta * P

k-1

Page 16: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

16

Algorithmic Background

CG Algorithm

initial guess: x0 = 0

Compute: r0 = Ax

0 - b, p

0 = -r

0

For(k = 0, 1, 2, .. until convergence){α

k = rT

k .r

k / pT

k .Ap

k

xk+1

= xk + α

k . p

k

rk+1

= rk + α

k A p

k

βk = r

k+1T .r

k+1 / r

k T . r

k

pk+1

= rk+1

+ βk p

k

}

Calculate Step-size

Calculate X

Calculate Residual

Calculate search step

Calculate search Direction

Page 17: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

17

Outline➔ Problem Description

➔ Motivation

➔ Approximate Computing

➔ Algorithm Background

➔ Tools and Hardware Platform

➔ Design

➔ Approximation Techniques

➔ Precision Scaling in CG

➔ Error Analysis

➔ Evaluation

➔ Conclusion

Page 18: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

Tools and Hardware Platforms 18

Tool FlowTools and Hardware Platform

Page 19: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

19

Hardware Platform● IBM POWER8 system with virtex7 based FPGA

card.

● Coherent memory access of host memory by FPGA.

Tools and Hardware Platform

Page 20: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

20

Hardware Platform

Coherent Accelerator Processor Interface

CAPI

Host

Accelerator Function UnitAFU

Tools and Hardware Platform

Page 21: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

21

Hardware Platform

● Components of CAPI

Main components of CAPIapplication and accelerator

Coherent Attached Processor Proxy(proxy for accelerator)

Links coherency protocol between CAPP and PSL

Power Service Layer(local cache for accelerator)

Tools and Hardware Platform

Page 22: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

22

Outline➔ Problem Description

➔ Motivation

➔ Approximate Computing

➔ Algorithm Background

➔ Tools and Hardware Platform

➔ Design

➔ Approximation Techniques

➔ Precision Scaling in CG

➔ Error Analysis

➔ Evaluation

➔ Conclusion

Page 23: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

23

Design

➢ Optimization of AFU➢ Design Methodology➢ Framework

Page 24: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

24

Optimization of AFU

➢ Increase the data width of AXI bus➢ Partition Vector and Matrix➢ Pipeline and unroll operations➢ Optimize Floating point MAC operation

and achieve II=1 by partial accumulation of product

➢ MAC operation achieved II=1 in HLS simulation but failed in hardware

Design

Page 25: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

25

Design MethodologyDesign

Page 26: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

26

Framework

ha_pclock

Verilog top module

for PSL Signals

Clock at 250M

Clock at 125M

Reset at 125M

Reset at 250MData Transfer

AFU

CAPI ADAPTER

CAPIAXI Interconnect

AFU AXI Interconnect

Clocking Wizard

rst_Clock_125MHz

rst_Clock_250MHz

Design

Page 27: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

27

Outline➔ Problem Description

➔ Motivation

➔ Approximate Computing

➔ Algorithm Background

➔ Tools and Hardware Platform

➔ Design

➔ Approximation Techniques

➔ Precision Scaling in CG

➔ Error Analysis

➔ Evaluation

➔ Conclusion

Page 28: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

28

Approximation Techniques

➢ Loop Perforation➢ Inexact Circuits➢ Voltage Over-scaling➢ Over-clocking➢ Skipping tasks and memory access➢ Precision scaling Shall be used

Page 29: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

29

Outline➔ Problem Description

➔ Motivation

➔ Approximate Computing

➔ Algorithm Background

➔ Tools and Hardware Platform

➔ Design

➔ Approximation Techniques

➔ Precision Scaling in CG

➔ Error Analysis

➔ Evaluation

➔ Conclusion

Page 30: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

30

Precision Scaling in CG

ApproximateStorage

ApproximateComputation

Page 31: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

31

Outline➔ Problem Description

➔ Motivation

➔ Approximate Computing

➔ Algorithm Background

➔ Tools and Hardware Platform

➔ Design

➔ Approximation Techniques

➔ Precision Scaling in CG

➔ Error Analysis

➔ Evaluation

➔ Conclusion

Page 32: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

32

Error analysis➢ Residual not used to check error distance➢ Residual propagates error from previous

residual➢ Causes CG to converge at wrong solution➢ Use euclidean error distance to study

error distance for different approaches➢ Study Error Distance for approximate

storage➢ Study Error Distance for approximate

computation

Page 33: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

33

Approximate Storage

➢ Single Precision Storage➢ Half Precision Storage ➢ Fixed Point Storage (using varied bit-

widths)

Error Analysis

Page 34: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

34

Approximate Storage

Half Precision Storage

Single Precision Storage

Error Analysis

Page 35: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

35

Approximate Computation

➢ Half Precision Computation

➢ Fixed Point Matrix-Vector Computation(using varied bit-widths)

➢ All operations calculated in fixed point(using varied bit-widths)

Error Analysis

Page 36: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

36

Approximate ComputationHalf Precision ComputationFixed Point Matrix Vector Computation

HP Mat-Vec

FP Mat-Vec

Single Precision

Error Analysis

Page 37: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

37

Designs EvaluatedError Analysis

Page 38: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

38

Outline➔ Problem Description

➔ Motivation

➔ Approximate Computing

➔ Algorithm Background

➔ Tools and Hardware Platform

➔ Design

➔ Approximation Techniques

➔ Precision Scaling in CG

➔ Error Analysis

➔ Evaluation

➔ Conclusion

Page 39: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

39

Evaluation➢ BRAM Utilization➢ Latency Comparison➢ DSP Utilization➢ Hardware Evaluation

Page 40: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

40

BRAM UtilizationEvaluation

➢ ~40-50 % reduction in BRAM using half precision storage

Page 41: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

41

Latency ComparisonEvaluation

➢ Speed up of around 2.0x for designs using half precision storage

Page 42: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

42

DSP UtilizationEvaluation

Page 43: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

43

Hardware Evaluation

➢ Designs Evaluated on Hardware➢ Resources available on hardware➢ Resource Utilization Results➢ Performance Results

Evaluation

Page 44: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

44

Designs Evaluatedon Hardware

➢ Single precision storage with fixed point matrix-vector multiplication

➢ Half Precision storage with fixed point matrix-vector multiplication

Evaluation

Page 45: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

45

Resources AvailableEvaluation

Page 46: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

46

Resource UtilizationReport

Evaluation

➢ Half precision uses 63 % less BRAM as compared with single precision

➢ More DSP usage by half precision in comparison with single precision

Page 47: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

47

Performance ResultsEvaluation

➢ FPGA implementations better than software

➢ Half Precision gave 1.5x speed up as compared to single precision

➢ Half precision achieved 2.0x times speed up as compare to software implementation

Page 48: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

48

Outline➔ Problem Description

➔ Motivation

➔ Approximate Computing

➔ Algorithm Background

➔ Tools and Hardware Platform

➔ Design

➔ Approximation Techniques

➔ Precision Scaling in CG

➔ Error Analysis

➔ Evaluation

➔ Conclusion

Page 49: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

49

Conclusion➢ Proposed use of approximate computing in HPC

domain

➢ Approximate Conjugate Gradient method using precision scaling

➢ Built an IP core to connect HLS design with CAPI

➢ Implemented CG using HLS, approximated it and performed error analysis

➢ Evaluated 5 designs in terms of resource and performance

➢ Successfully ran 2 designs and compared performance/resources against software implementation

➢ Gained speed up and resource benefits using approximation

Page 50: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

50

Key Findings➢ Floating point worked better for

approximate storage➢ Matrix-Vector multiplication more error

resilient than rest of the operations ➢ Residual Calculation proved erroneous

Page 51: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

51

Thank YouAny Questions ?

Page 52: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

52

Backup Slides

Page 53: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

53

Pipeline

Page 54: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

54

Residual Problem

Page 55: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

55

Effect of condition numberand matrix sizes

Page 56: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

56

Rest Operations using Fixed Point

Page 57: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

57

Fixed Point ComputationResidual Pattern

Page 58: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

58

Framework

Page 59: Study the effects of approximation on conjugate gradient ... · Study the effects of approximation on conjugate gradient algorithm and accelerate it on FPGA platform. 2 Outline ...

59

Precision Scaling in CG

➢ Approximate Storage for saving BRAM➢ Approximate Computation for matrix-

vector operations➢ Use of custom HLS data types➢ Use of type casting feature of HLS


Recommended