RateOptimal ResourceConstrained Software Pipelining 1162022 coursecpeg 421 08
- Slides: 29
“Rate-Optimal” Resource-Constrained Software Pipelining 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 1
Objectives • Establish good bounds x. Help compiler writers x. Help architects • Study pragmatic issues when implemented as an option of compilers • Study its payoffs 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 2
A Motivating Example for i = 0 to n do 0: a [i] = X + d [i - 2]; 1: b [i] = a [i] * F + f [i - 2] + e [i - 2]; 2: c [i] = Y - b [i]; 3: d [i] = 2 * c [i]; 4: e [i] = X - b [i]; 5: f [i] = Y + b [i] end 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 3
L: S 0 : S 1 : S 2 : S 3 : S 4 : S 5 : for ( i = 0; i < n; i ++) { a [i] = X + d [i - 2]; b [i] = a [i] * F + f [i - 2] + e [i - 2]; c [i] = Y - b [i]; d [i] = 2 * c [i]; e [i] = X - b [i]; f [i] = Y + b [i] } 0 1 2 3 2 2 2 4 5 Data Dependence Graph Program Representation Assume all statements have a delay = 1 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 4
Question • How fast can L run (I. e. optimal computation rate) without resource constraints? • How many FUs it needs minimally to achieve the optimal rate? 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 5
iter #1 #2 #3 0 S 0 1 S 1 2 S 2, S 4, S 5 S 0 3 S 1 4 S 2, S 4, S 5 S 0 5 S 3 S 1 6 S 2, S 4, S 5 7 S 3 . . . Schedule A: t (i, Sj) = 2 i + tsj where: ts 0 = 0 ts 1 = 1 ts 2 = ts 4 = ts 5 = 2 ts 3 = 3 . . . Schedule A : # of FUs = 4 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 6
Can we do better? 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 7
iter #1 0 1 2 3 4 5 6 7 S 0 S 1 S 2 , S 4 S 3, S 5 #2 S 0 S 1 S 2 , S 4 S 3, S 5 #3 S 0 S 1 S 2 , S 4 S 3, S 5 . . . Schedule B : t (i, Sj) = 2 i + tsj where: ts 0 = 0 ts 1 = 1 ts 2 = ts 4 = 2 ts 3 = ts 5 = 3 . . . Schedule B : # of FUs = 3 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 8
Problem Statements Assumptions: homogeneous function units Problem 0: Given a loop L, determine a “rate-optimal” schedule for L which uses minimum # of FUs. Problem I (FIxed Rate Sof. Tware Pipelining with minimum Resource - FIRST): Given a loop L and a fixed initiation rate determine a schedule for L which uses minimum # of FUs. Problem II (REsource Constrained Sof. Tware Pipelining - REST) Given a loop L and the # of Fus, determine an optimal schedule which can run under the given resource constraints. 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 9
Problem Formulation of FIRST How to formulate resource constraints into a linear form? 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 10
R = Max (width) Min R Subject to: • all dependence constraints • R is the maximum width • for a fixed rate (or period) The SWP kernel: --- The “frustum” 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 11
time r 0 1 2. 3 i . . 0 1 2 1 . . . N-1 1 1 Min (max 1 II-1 R 1 ari) Frustum A Now R = max r 1/16/2022 ari Contribution of node i to step r’s resource requirement [ 0, II - 1] coursecpeg 421 -08 sTopic-7 a. ppt 12
FIRST: A Linear Programming Formulation Example 0 1 2 3 4 5 a 00 a 10 a 01 a 11 a 02 a 12 a 03 a 13 a 04 a 14 a 05 a 15 So for node I: ti = ki II + (aoi , a 1 i ) * 0 1 Where ari = 1 means node i start at step r = 0 otherwise 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 13
FIRST: A Linear Programming Formulation Minimize R Subject to R: Max T T =T Periodic Dependence Constraints and 1/16/2022 are integers coursecpeg 421 -08 sTopic-7 a. ppt 14
Example Revisited Min R Subjected to: R - ( a 00 + a 01 + a 02 + a 03 + a 04 + a 05 ) ³ 0 R - ( a 10 + a 11 + a 12 + a 13 + a 14 + a 15 ) ³ 0 2 2 × k 0 + 0 × a 00 + 1 × a 10 = t 0 × k 1 + 0 × a 01 + 1 × a 11 = t 1 . . 2 × k 5 + 0 × a 05 + 1 × a 15 = t 5 a 00 + a 10 = 1 a 01 + a 11 = 1 . . a 05 + a 15 = 1 t 1 - t 0 ³ 1 t 1 - t 4 t 1 - t 5 . . ³ -3 . t 1 ³ 0, ki ³ 0, ari. ³ 0 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 15
Solution Schedule C t(i, s) = 2 i + ts where t 0 = 0 t 1 = 1 t 2 = 2 t 3 = 3 t 4 = 3 t 5 =2 so, # of FUs = 3! 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 16
Linear Programming • A Linear Program is a problem that can be expressed in the following form: • minimize cx • subject to • Ax = b • x >= 0 where x: vector of variables to be solved A: matrix of known coefficients c, b: vectors of known coefficients cx: it is called the objective function Ax=b is called the constraints 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 17
Linear Programming • “programming” actually means “planning” here. • Importance of LP - many applications - the existence of good general-purpose techniques for finding optimal solutions 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 18
Integer Linear Programming (ILP) • Integer programming have proved valuable for modeling many and diverse types of problems in : - planning, - routing, - scheduling, - assignment, and - design. • Industry applications: - transportation, energy, telecommunications, and manufacturing 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 19
Integer Linear Programming • Classification: - mixed integer (part of variables) - pure integer (all variables) - zero-one (only takes 0 or 1) • Much harder to solve • Many existing tools and product - solve the LP/ILP problem and get optimal solution - help to model the problem, and then solve the problem 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 20
Quiz How to handle cases where di >= 1 for node i ? 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 21
The “Trick” At time step r, the # of FUs required a ((r - 1)%II)i Contributed by node i {Started at steps in [0, (t + di-1)%II]} Note: if actor i requires a FU at time r or 0 otherwise. So objective function becomes: Min 1/16/2022 Max coursecpeg 421 -08 sTopic-7 a. ppt 22
How to extend the FIRST formulation to heterogeneous function units? 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 23
Heterogeneous Function Units Solution Hints: “weighted Sum”! For FU of type k: Mk = max "r Î[ 0, II -1] and so, the objective should be min C k Mk Mk - 0 Where h is the total # of FU types "k Î[0, h -1], "r Î[0, II -1] FU(i) = k 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 24
Solution of the REST Resource - constraint rateoptimal software pipelining problem 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 25
Hints Based on scheme for “FIRST” and play “trial-and improve” 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 26
Solution Space for REST 1 1/16/2022 2 MII = max { Rec. MII, Res. MII} coursecpeg 421 -08 sTopic-7 a. ppt 27
Note: The bounds of initiation interval 1. Loop-carried dependence constraints: Rec. MII = Max cycles C d(C) m(C) 2. Resource constraints Res. MII = # of nodes As a result: # of FUs MII = max {Rec. MII, Res. MII } 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 28
Other Work • Extend the technique to “more benchmarks” and establish “bounds” • Extend the framework to include register constraints • Extend the model for pipelined architectures (with structural “hazards”) • Extend the model to consider superscalar and multithreaded with dynamic scheduling support. 1/16/2022 coursecpeg 421 -08 sTopic-7 a. ppt 29
- Pipelining
- Difference between linear and nonlinear pipeline processors
- Instruction pipelining in computer architecture
- Pipelined protocols
- Pipelining and superscalar techniques
- Superscalar pipeline design
- 4 segment instruction pipeline
- Apa yang dimaksud dengan pipelining
- Data hazard pipeline
- Pipelining
- Principles of pipelining
- Pipelining verilog
- 111011-100100
- Pipelining in 8086 microprocessor
- Adam smith pipelining
- Pipelining
- Pipelining
- Pipelining
- Pipelining dalam arsitektur komputer
- Pipelining
- Pipelining
- Pipelining adalah
- "us pipelining"
- Pengertian pipelining
- "us pipelining"
- "us pipelining"
- Intel 4004 transistor count
- 421 could not create socket
- Cs 421 programming languages and compilers
- 4 2 1 fluid rule