31
Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi Wu, Chuyu Shen, Yi Jia, and Weikang Qian University of Michigan-SJTU Joint Institute Shanghai Jiao Tong University Asia and South Pacific Design Automation Conference Chiba/Tokyo, Japan, Jan 17, 2017 1

Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change

Yi Wu, Chuyu Shen, Yi Jia, and Weikang QianUniversity of Michigan-SJTU Joint Institute

Shanghai Jiao Tong University

Asia and South Pacific Design Automation ConferenceChiba/Tokyo, Japan, Jan 17, 2017

1

Page 2: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

• Introduction and Motivation

• Proposed Method

• Experimental Results

• Conclusion

Outline

2

Page 3: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

• Introduction and Motivation

• Proposed Method

• Experimental Results

• Conclusion

Outline

3

Page 4: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Error-Tolerant Applications

Error-tolerant applications

Low-powerVLSI

4

Page 5: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Exact Results Not Necessary

5

(a) From accurateprocessing

(b) From inaccurate processing

• A few erroneous pixels do not affect human recognition of the image.

[Han and Orshansky, 2013]

Page 6: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Numerical Values Not Matter

6

• Handwritten Digit Recognition

8

0

Similarity (probability)

0.9257

0.1563

0.93060.8928

9

1 0.0984

0.2435

... ...

Page 7: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

No Golden Standard Answer

7

Page 8: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Approximate Computing• Design a circuit that may not be 100% correct

– Targeting error-tolerant applications– Trade accuracy for area/delay/power

00 01 11 1000 000 000 000 000

01 000 001 011 010

11 000 011 110

10 000 010 110 100

Original correct K-map

B1B0

A1A0

[Kulkarni et al. 2011]

1001

8

00 01 11 1000 000 000 000 000

01 000 001 011 010

11 000 011 110

10 000 010 110 100

111

Approximate K-map

B1B0

A1A0

Page 9: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

• A 2-bit approximate multiplierApproximate Computing

9

Approximate digital circuitAccurate digital circuit

ComparisonNearly half area; Shorter critical path; Smaller switching capacitance (less dynamic power)

Page 10: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Error Metrics for Approximate Computing• Error rate (ER): Pr(𝑓𝑓(�⃗�𝑋) ≠ 𝑓𝑓′(�⃗�𝑋))

• Error magnitude (EM): max𝑋𝑋

|𝑓𝑓 �⃗�𝑋 − 𝑓𝑓′(�⃗�𝑋)|

– Applicable to arithmetic circuits

10

00 01 11 1000 000 000 000 000

01 000 001 011 010

11 000 011 110

10 000 010 110 100

1001

B1B0

A1A0

ER = 2/16EM = 2111

001

Page 11: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Approximate Logic Synthesis (ALS)

Logic synthesis tool

Original Design

ApproximateDesign

Errorspecification

(E.g., error rate< 1%)

11

• Input: an original circuit and error specification• Output: an optimal approximate circuit, satisfying the

error constraint

Page 12: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Related Works: ALS for Multi-level Circuits

12

• Inject stuck-at-faults, composite constraint on ER & EM [Shin and Gupta, DATE’2011]

• SALSA — Encode EM constraint as a funciton[Venkataramani et al., DAC’2012]

• SASIMI — Substitute a signal with another one that takes the same value with high probability, ER constraint [Venkataramani et al., DATE’2013]

• Solve ER-unconstrained ALS first: ER + EM [Miao et al., ICCAD’2014]

• Remove literals from factored-form expressions of local nodes: ER [Wu and Qian, DAC’2016]

All of these works target at ASICs !

Page 13: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

FPGA Architecture

13

• Basic building block: 𝑘𝑘-input look-up table (𝑘𝑘-LUT)– Can implement any Boolean function with up to 𝑘𝑘

variables

A

BCD

Y LUTABCD

Y

A B C D Y0 0 0 0 00 0 0 1 1

1 1 1 0 11 1 1 1 0

LUT

LUT

LUT

LUTIn FPGA, a circuit is a LUT network

Page 14: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Problem Formulation

Logic synthesis tool

Original FPGADesign

ApproximateFPGA Design

Error rate constraint

(E.g., < 1%)

14

Approximate Logic Synthesis for FPGAs• Input: an original FPGA design and error rate constraint 𝐸𝐸𝐸𝐸• Output: an FPGA design with minimal area, satisfying the error

rate constraint∝ power, usually

Page 15: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

• Introduction and Motivation

• Proposed Method

• Experimental Results

• Conclusion

Outline

15

Page 16: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Basic Idea

16

• Remove inputs + Change function– Remove inputs: can reduce #LUT– Change function: minimize error Where to apply the

basic idea?— Fanout-free cone (FFC) in the network

Note: when # inputs from 4 to 3, the number of LUTs needed is guaranteed to be reduced by 1! Not guaranteed for ASIC!

Page 17: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

FFC (Fanout-Free Cone)

Cone of 𝑣𝑣 : for any node 𝑤𝑤in 𝐶𝐶𝑣𝑣, there is a path from 𝑤𝑤to 𝑣𝑣 that lies entirely in 𝐶𝐶𝑣𝑣.

FFC of 𝑣𝑣 : a cone in which the fanouts of every node other than the root 𝑣𝑣 are in the cone.

17

Cone, non-FFC

Cone, FFC

Page 18: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Proposed Method

Remove I3

• Apply the basic idea to FFCs in a network

• For each FFC of each node, consider all cases in which one input of the FFC is removed

18

a b c d

f

b c d

f1

a c d

f2

a b d

f3

a b c

f4

?

Page 19: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Determining the New Function

19

A B C Y0 0 0 10 0 1 10 1 0 00 1 1 11 0 0 11 0 1 01 1 0 01 1 1 0

A B Y0 0 ?0 1 ?1 0 ?1 1 ?

1

0

0

Suppose Pr(010)>Pr(011)Suppose Pr(100)>Pr(101)

1

Rule: if output values differ, always keep the output value of the input pattern with larger probability

the induced error rate is minimal

1

2

3

4

Page 20: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Candidate Transformations• Map the modified function of an FFC into a

new LUT network• If fewer LUTs than original FFC• If the error rate <= error margin• If using it won’t increase delay

20

candidate transformation

• Many candidate transformations exist• We will pick multiple candidate transformations to

apply• Formulated as an Integer Linear Programming

(ILP)

Page 21: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

ILP Formulation• m candidate transformations: 𝑡𝑡1, 𝑡𝑡2, …,𝑡𝑡𝑚𝑚, each

associated with a binary variable 𝑣𝑣𝑖𝑖;• For each 𝑡𝑡𝑖𝑖, its error rate is 𝑒𝑒𝑖𝑖, LUT number reduction

is 𝑎𝑎𝑖𝑖 .

21

Objective: maximize ∑𝑖𝑖=1𝑚𝑚 𝑎𝑎𝑖𝑖𝑣𝑣𝑖𝑖 (a) (total reduction in LUT number)

Constraints: 𝑣𝑣𝑖𝑖 + 𝑣𝑣𝑗𝑗 ≤ 1 (b) (overlapped transformations cannot be selected at same time)

∑𝑖𝑖=1𝑚𝑚 𝑒𝑒𝑖𝑖𝑣𝑣𝑖𝑖 ≤ 𝑡𝑡 (c) (total error rate

should be within error rate margin 𝑡𝑡)

OverlappedTransformations

Page 22: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Algorithm

22

ER: error rate of current network

T: user-specified error rate threshold

ILP solver: GLPKReference: http://www.gnu.org/software/glpk/

Page 23: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Speed-up Techniques

23

• Set upper bound on the number of inputs of FFC we consider: input_limit = 7~9.

• Discard transformations whose scores are the lowest 40% among all candidate transformations of each node, where score = #LUT_save/error_rate.

• Exclude FFCs whose all input patterns have probability > error rate margin.

Page 24: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

• Introduction and Motivation

• Proposed Method

• Experimental Results

• Conclusion

Outline

24

Page 25: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Experimental Results: # LUT Saving

25

• Setup: C++ on a virtual machine running Linux OS (1GB memory); FPGA technology: 4-LUT; Assume all PI patterns are of same probability

input_limit: 9

Page 26: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Experimental Results: Comparison• Compared with SASIMI

- input_limit = 9: 87%~97% of that produced by SASIMI in terms of LUT number

.

26

Page 27: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Remaining Error Rate Margin after SASIMI

27

Observation: some approximate circuits obtained by SASIMI still have error rate margin.

Error rate of the final approximate circuits obtained by SASIMI

Page 28: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

28

Experimental Results by SASIMI + Ours

Our method is able to search a different solution space and is a good complement to SASIMI.

# 𝐿𝐿𝐿𝐿𝑇𝑇_𝑠𝑠𝑎𝑎𝑣𝑣𝑒𝑒 𝑏𝑏𝑏𝑏 𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 + 𝑂𝑂𝑂𝑂𝑂𝑂𝑠𝑠# 𝐿𝐿𝐿𝐿𝑇𝑇_𝑠𝑠𝑎𝑎𝑣𝑣𝑒𝑒 𝑏𝑏𝑏𝑏 𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆

Method combination1. Apply SASIMI withoriginal T

2. Apply Ours with T = remaining error rate margin

0

0.5

1

1.5

2

2.5

c2670 c3540 c5315 apex6 dalu

T = 0.01

T = 0.03

T = 0.05

Page 29: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

• Introduction and Motivation

• Proposed Method

• Experimental Results

• Conclusion

Outline

29

Page 30: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Conclusion

30

• Multi-level approximate logic synthesis for FPGAs under error rate constraint

• A novel technique which removes an input of an FFC and changes its function simultaneously.

• Formulation of an ILP problem for the selection of multiple changes and a practical flow to synthesize approximate FPGA designs.

Page 31: Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change · 2017-10-25 · Approximate Logic Synthesis for FPGA by Wire Removal and Local Function Change Yi

Thank You!Questions?

31