1 / 76

Embedded Systems and Software

Ed F. Deprettere, Todor Stefanov, Hristo Nikolov {edd, stefanov, nikolov}@liacs.nl Leiden Embedded Research Center Spring 2010; http://www.liacs.nl/~cserc/EMBSYST/ESSOFIA2010. Embedded Systems and Software. Part II Process Networks. More general than dataflow graphs are process

deidra
Download Presentation

Embedded Systems and Software

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ed F. Deprettere, Todor Stefanov, Hristo Nikolov {edd, stefanov, nikolov}@liacs.nl Leiden Embedded Research Center Spring 2010; http://www.liacs.nl/~cserc/EMBSYST/ESSOFIA2010 Embedded Systems and Software

  2. Part II Process Networks More general than dataflow graphs are process networks. Communicating Sequential Processes (CSP) Kahn Process Networks (KPN) Dataflow Process Networks (DPN) Polyhedral process Networks (PPN)

  3. What is the difference CSP : typical control-type applications, not necessarily determinate. Processes communicate by means of rendez-vous KPN : processes are fuctional when seen as maps from streams to streams. Are determinate. DPN : processes are functional maps from tokens to tokens PPN : special case of DPN (see later)

  4. 04ESSOFIA Usage of KPNs The KPN model of computation is used to specify applications in a concurrent language. Processes are specified in a host language (C, C++, Java). The communication between processes is specified in a co-ordination language: blocking read. KPN is a convenient model for streaming data applications: audio, and video, multimedia in general. Processes operate on infinite streams of date, one quantum of data at a time, i.e., the streams need not be available as a whole.

  5. 04ESSOFIA Dataflow and Kahn Process Networks Recall: Actors in Dataflow Graphs are functional. Dataflow Graphs that operate on (unbounded) streams are called Dataflow Process Networks. In Dataflow Process Networks, the processes are repetitively firing functional actors that are guided by firing rules. They are globally scheduled. In Kahn Process Networks, the processes are threads. There are no firing rules, and there is no global schedule.

  6. 04ESSOFIA KPN: an example process P2 C4 P1 C1 C3 Unbounded FIFO Process P1 (‘producer’) ProcessP2 (‘consumer’) While (1){ Read(C1, token); if (token != Token) { Write(C2, Execute(token)); { else{ Write(C3, token); } } While(1){ Read(C2, token); Write(C4, Execute(token)); } Characteristic operation triplet is {Read, Execute, Write}. Execute refers to some abstract computational operator; Communication is point-to-point.

  7. 04ESSOFIA Stream Based Function Model State. S = C x D, C U D = 0 Controller transition function. ω: C x D→C, ω(c, d) = c’ Binding function. μ: C → {f}, μ(c) = f. Function repertoire {f} Private mem A-gen store load Each f binds to its own unique subset of input and output channels Channels execute get {f} put select controller channels

  8. 04ESSOFIA Mapping PU PU PU Bus Shared Memory An application modeled in terms of a KPN is to be transformed (mapped or deployed) to a parallel multi-processor architecture.

  9. 04ESSOFIA Part II: applying it allOverview KPN application model Sequential Process Applications platform / / Mem Mem Mem Mem ... platform Communication Structure FPGA PE PE PE PE ... Component –

  10. 04ESSOFIA Converting C to KPN Model Most applications are (still) specified as imperative sequential programs in C, C++, or other host languages. In some cases, they can be automatically converted to input-output equivalent Kahn or Dataflow Process Networks. Process Networks are better suited for mapping on multi-processor execution platflorms.

  11. 04ESSOFIA Translating and Mapping EASY to specify DIFFICULT to specify Sequential Application Specification Parallel Application Specification for j = 1:1:N, [x(j)] = Source1( ); end for i = 1:1:K, [y(i)] = Source2( ); end for j = 1:1:N, for i = 1:1:K, [y(i), x(j)] = F( y(i), x(j) ); end end for i = 1:1:K, [Out(i)] = Sink( y( I ) ); end sourse1 sink F source2 Programmable Interconnect (NoC) Memory EASY to map DIFFICULT to map IPcore RPU CPU Memory Micro Processor ... Application Programming Translator Mapper

  12. 04ESSOFIA Affine Nested Loop Programs From now on: given sequential programs are static affine nested loop Programs (for simplicity, some dynamic behavior als possible). nested loops: statements are surrounded by one or more loops → for k = k lower bound (parameters) : stride : k upper bound(parameters) for l = l lower bound (k, parameters) : stride : lupper bound(k, parameters) static: no data dependent conditions affine: loop bounds, conditions, and variable index functions (see next page) are affine functions of the iterators and parameters f(x, y, z) is affine if of the form ax + by +cz +d linear if of the form ax + by + cz

  13. 04ESSOFIA Affine Nested Loop Programs (2) Variable indexing function: x(f(k,l)) is variable with name x and indexing function f(k,l) → f(k,l) affine (ak + bl + c) Loop bound: l = k+1 : 1 : N → lower bound is k+1 or l – k – 1 ≥ 0 upper bound is N or N – l ≥ 0 Condition: if l – k ≤ N → if k – l + N ≥ 0 Extensions to non-static conditions do exist.

  14. 04ESSOFIA Extensions • Affine nested loop programs, except for the fact that conditions may be data dependent and of any form. E.g., if f(x) ≥ y. 2. Affine nested loop programs with non-static parameters. Values of parameters may change (possible from internally) during execution. E.g., [ v(i), w(j), N] = f(v(i), w(j), M); for i = 1 : 1 : N, for j = 1: 1 : M,

  15. 04ESSOFIA Affine Nested Loop Programs (3) Structure of affine nested loop program. • parameter range: % parameter N 20 100 • initialization of input data, called sources [x(n)] = Read_SourceX(); • loops, conditions, and functions for i = 1 : 1 : N, if i-2 ≥ 0. [y(i,j), x(i,j)] = f(y(i,j), x(i,j); • collecting output data, called sinks [sink(y(i,j)] = Write(y(i,j));

  16. 04ESSOFIA Affine NLP – Example (2) h x y y x h y = y + h.x n = 1 : 1 : N+M-1, m = max(1, n-(N-1)) :1 : min (n,M), for n = 1 : 1 : N+M-1, if n < M, for m = 1 : 1 : n, [ y(n) ] = y(n) + h(m).x(n-m+1); end end if n > N, for m = n – (N-1) : 1 : M, [ y(n) ] = y(n) + h(m).x(n-m+1); end end for m = 1 : 1 : M, [ y(n) ] = y(n) + h(m).x(n-m+1); end end • Main

  17. 04ESSOFIA From ANLP to KPN • Converting ANLPs to input/output equivalent KPNs provides (equivalent) concurrent processing specifications that facilitate mapping onto parallel architectures • Because ANLPs are static, the corresponding KPNs are also static. They are in some sense similar to Cyclo-Static dataflow process networks. • Global schedules can be derived, and sizes of buffers can be determined, at least an upper bound for them.

  18. 04ESSOFIA From ANLP to PN (2) Requires three steps • conversion to single assignment code (dependency analysis) variables in an ANLP may be assigned more than one value: e.g., x(i+j) may have different values for all i+j = c. In a SAC, each variable gets assigned only one value: e.g., x1 (i+1, j-1). • an intermediate compact dependence graph representation of the SAC • construction of the PN from the intermediate format

  19. 04ESSOFIA Steps involved: overview initialR F outputR G Data Dependency Analysis MatParser inputSamples SAC Single Assignment Code Matlab Program (or C, C++, Java) DgParser %parameter N 8 16; %parameter K 100 1000; for k = 1:1:K, for j = 1:1:N, [r(j,j), x(k,j), t ]=F( r(j,j), x(k,j) ); for i = j+1:1:N, [r(j,i), x(k,i), t]=G( r(j,i), x(k,i), t ); end end end Polyhedral Reduced Dependence Graph (PRDG) PRDG Panda Linearization Kahn Process Network Matlab Application Process Network

  20. 04ESSOFIA Data Dependency Analysis i+j=6 a(i,j)→ a(i-1,j+1) dependency j for i= 1 : 1 : N, for j= 1 : 1 : N, [ a(i+j) ] = f( a(i+j) ); end end N=6 1 2 3 4 5 1 2 i 3 4 5 N=6 Lexicographic schedule Consumer reads from Producer The for loops define a rectangular iteration domain. Each dot is an invocation of f().

  21. 04ESSOFIA Data Dependency Analysis (2) I = i j Is iteration vector (iterators i and j) x(h(I)) variable with name x and indexing function h(I). Example: h(I) = [1 1]. i =(i+j) j i = 1 : 1 : N, j = 1 : 1 : M, | [ x(g(I))]= F1 (); | [ ] = F2 (x(f(I)); | end end Observe that [1 1] has a null space • consumer F2 is dependent on producer F1 iff - in the domain {i,j | 1 ≤ i ≤ N ^ 1 ≤ j ≤ M} , (a) g(I1) = f(I2) (b) I1 <l I2 (<l means lexicographic preceding = prod. before cons.) (c) I1 is lexicographic largest iteration satisfying (a) and (b)

  22. 04ESSOFIA Data Dependency Analysis (3) j I1 d I2 i consumer F2 is dependent on producer F1 iff - in the domain (a) g(I1) = f(I2) (b) I1 <l I2 (<l means lexicographic preceding) (c) I1 is lexicographic largest iteration satisfying (a) and (b) Dependency: d = I1 – I2 (consumer takes from producer) Equations look like (integer) linear program problem, except for (b) which is not an affine expression. This problem can be overcome:

  23. 04ESSOFIA Data Dependency Analysis (4) consumer F2 is dependent on producer F1 iff – in the domain (a) g(I1) = f(I2) (b) I1 <l I2 (<l means lexicographic preceding) (c) I1 is lexicographic largest iteration satisfying (a) and (b) I1 <l I2 is either i1 < i2 or i1 = i2 and j1 < j2. This gives two sets of linear equations instead of one non-linear set. Of course, we have to add the range of the parameters, e.g., 30 ≤ N ≤ 100, M ≤ N.

  24. 04ESSOFIA Single Assignment Code i = 1 j a(4) a1(1,3) i a1 (2,2) a1 (3,1) i ≥ 2 and j = M i≥ 2 and j ≤ M-1 % parameter N 10 20; % parameter N 10 20; % parameter M 10 20; % parameter M 10 20; for i = 1 : 1 : N, for i = 1 : 1 : N, for j = 1 : 1 : M, for j = 1 : 1 : M, [ a(i+j)] = f (a(i+j) )); if i -2 ≥ 0, end if j ≤ M - 1, end [in0] = ipd (a1(i -1, j +1)); else [in0] = ipd (a (i + j)); end else [in0 ] = ipd (a (i + j)); end [out0 ] = f (in0 ); [a1(i,j)] = opd (out0 ); end end ipd input port domain opd output port domain → identity functions

  25. 04ESSOFIA x x Half-space a Hyper-plane b A polyhedron P is the intersection of a set of finitely many closed half - spaces      n P { x Q | Ax b Cx d } where A is an integral k x n matrix, b is an integral k - vector, C is an integral l x n matrix, and d is an integral l - vector. Polyhedron Hyper-plane and half-space

  26. 04ESSOFIA Polytopes → we only consider convex polytopes f(λx1+(1-λ)x2) f(x1) f(x2) f(x) is convex if f(λx1 + (1-λ)x2) ≤ λf(x1) + (1-λ)f(x2), x1 and x2 in domain of f, and λ є [0,1]. k x1(λ=0) x2(λ=0) Example: k = 1 : 1 : K, j = 1 : 1 : N, i = j : 1 : N, 1 0 0 0 1 0 0 -1 1 -1 0 0 0 -1 0 0 0 -1 k j i 1 1 0 -K -N -N ≥ (1,1,1) N i N j Informally: a multidimensional volume with flat faces (multidimensional extension of polygon) Formally: bounded N-dimensional figure whose faces are hyperplanes

  27. 04ESSOFIA Polytopes(2) k Example: k = 1 : 1 : K, j = 1 : 1 : N, i = j : 1 : N, 1 0 0 0 1 0 0 -1 1 -1 0 0 0 -1 0 0 0 -1 k j i 1 1 0 -K -N -N ≥ (1,1,1) N i N j Is of the form P(p) = AI ≥ Bp + dwith A, B, and d integral and p the parameter vector. Each row is a half space : an I≥ bn p + dn (rows of A are normals to half planes anI = bnp + dn) T T T T More general: P(p) = Ax≥ Bp + d where xis rational . The points of interest are still integral points in the polytope, i.e., P(p) ∩

  28. 04ESSOFIA Polytopes (3) x2 (0,0) l x1 Wy x rational? one of the faces is the line l : x1 = -1/2 x2 + 6 coming in the polytope as 2x1 ≤ -x2 + 12 or 2x1 + x2 ≤ 12 the point (x1, x2) = (9/2, 3) satisfies this equation (lies on l) but is not an integral point (black dot) The nearest integral point is (4,3) Rational is sufficient because l goes at least to two integral points.

  29. 04ESSOFIA Example j N=6 1 2 3 4 5 1 2 i 3 4 5 N=6 1 1 -N -N • 0 x1 0 1 x2 -1 0 0 -1 ≥ 2 dots are intersection with Z for i= 1 : 1 : N, for j= 1 : 1 : N, [ a(i+j) ] = f( a(i+j) ); end end x rational vector

  30. 04ESSOFIA Dependence Graph j x1(i-1, j+2) x1(i,j) F i → ANLP : x(f(I)) → f(I): [ 1 1] i → x(I + j ) j [ 1 1] has a null space μ = 1 → f(I+aμ) = f(I) -1 In SAC, variables get assigned only once a value → SAC : x(f(I)) → x1(Φ(I)) → Φ(I) = I or I + d no null space; d is dependency vector Variables x1(Φ(I)) propagate from function call to function call example: [ x1(i,j) ] = F((x1(i-1, j+2)) → leads to dependence graph Can be visualized graphically

  31. 04ESSOFIA ANLP, SAC, and DG i = 1 j a(4) a1(1,3) i a1 (2,2) a1 (3,1) i ≥ 2 and j = M i≥ 2 and j ≤ M-1 % parameter N 10 20; % parameter N 10 20; % parameter M 10 20; % parameter M 10 20; for i = 1 : 1 : N, for i = 1 : 1 : N, for j = 1 : 1 : M, for j = 1 : 1 : M, [ a(i+j)] = f (a(i+j) )); if i -2 ≥ 0, end if j ≤ M - 1, end [in0] = ipd (a1(i -1, j +1)); else [in0] = ipd (a (i + j)); end else [in0 ] = ipd (a (i + j)); end [out0 ] = f (in0 ); [a1(i,j)] = opd (out0 ); end end

  32. 04ESSOFIA Other example Matlab Code Dependence Graph (some k ≠ 1 or K) %parameter N 8 16; %parameter K 100 1000; for k = 1:1:K, for j = 1:1:N, [r(j,j), x(k,j), t ]=F( r(j,j),x(k,j) ); for i = j+1:1:N, [ r(j,i), x(k,i), t]=G( r(j,i), x(k,i), t ); end end end x t1 x1 k r1 i F j SAC G

  33. 04ESSOFIA Polyhedral Reduced Dependence Graph x r1 Polytope “D” r ← k=1 t1 x1 A C r1(K,j,j)) r ← k=1 t1 x1 E r1 x r1(K,j,i) Polytope “C” B D x →t1 → x1 → r1 A function call with its surrounding loops forms a polytope and becomes a Node (in fact a node domain) in the reduced DG.

  34. 04ESSOFIA PRDG (2) x r1 Polytope “D” r ← k=1 A C t1 r1(K,j,j)) x1 r ← k=1 t1 x1 E x r1 r1(K,j,i) B D x Polytope “C” →t1 → x1 → r1 The Nodes in the PRDG have Ports (input and output) which are also polyhedral domains. Example: the input Port of (yellow) Node C for variable r1 corresponds to all r1 input ports of the atomic yellow function calls in the SAC or DG. Port domains are subsets of Node domain

  35. 04ESSOFIA PRDG (3) A C E B D Example: out: x1 (k,j,i) in: x1 (k,j-1,i) mapping function: (k,j,i-1) = (k,j,i) + (0,-1, 0) (consumer (k,j,i) takes from producer (k,j-1,i)) D out in x1 The arrows are called Channels. A Channel is directed from an output Port (domain) of a Node (domain) to an input Port (domain) of another or the same Node (domain). There is an affine mapping function between points in the input Port to points in the output Port which is the dependency function from the SAC or DG (opposite of token flow direction). Mapping function + input Port domain defines output Port domain.

  36. 04ESSOFIA PRDG (4) Example: out: x1 (k,j,i) in: x1 (k,j-1,i) mapping function: (k,j-1,i) = (k,j,i) + (0,-1, 0) (consumer (k,j,i) takes from producer (k,j-1,i)) D out in x1 x Polytope “D” t1 x1 Example: input Port domain { j = 2:1:N-1 ^ i = j+1:1:N} mapping function (-1, 0) output Port domain {j = 1:1:N-2 ^ I = j+1:1:N} r1 Polytope “C” The SAC is in output normal form : output variables are always of the form v(I) where I is the iteration vector. The SAC does not tell where they are sent. This follows from input Port domain and mapping function.

  37. 04ESSOFIA Producer Consumer Pair X1 channel Np Nc write read port port NP NC j1 i1 1 2 3 4 5 N=6 1 2 3 4 5 N=6 i2 j2 Schedule: Schedule: for j2 = 1 : 1 : N for i1 = 1 : 1 : N for j1 = j2 : 1 : N for i2 = 1 : 1 : i1 Mx1 Producer with Node Np - domain 1≤ j2 ≤ N ^ j2 ≤ j1 ≤ N – and Node function [ x1(j2, j1), r1(j2, j1) ] = f( ); Consumer with Node Nc - domain 1 ≤ i1 ≤ N ^ 1 ≤ i2 ≤ i1 – and Node function [ ] = g(x1(i1, i2), r1(i1, i2)); With each input (output) variable corresponds an input (output) Port and Port domain. Shown here are output Port domain (left gray triangle) for variable x1 and input Port domain (right gray triangle) for variable x1

  38. 04ESSOFIA Producer Consumer Pair (2) X1 channel Np Nc write read port port j2 = Mx1( i1 ) is the (dependency) affine mapping function, j1 i2 Here: j2 = 0 1 i1 + -1 j1 1 0 i2 0 right (4,4) → left (3,4) NP NC j1 i1 1 2 3 4 5 N=6 1 2 3 4 5 N=6 i2 j2 Schedule: Schedule: for j2 = 1 : 1 : N for i1 = 1 : 1 : N for j1 = j2 : 1 : N for i2 = 1 : 1 : i1 Mx1 Consumer takes from producer ‘function’ But – of course – producer tokens are sent to consumer

  39. 04ESSOFIA Linearization This is because the P and C schedules are loop nests Schedule: Schedule: for j2 = 1 : 1 : N for i1 = 1 : 1 : N for j1 = j2 : 1 : N for i2 = 1 : 1 : i1 Nevertheless a schedule is a linear ordering: { (j2, j1)}→ {k} i=1:1:N j=i:1:N Tokens are sent from Producer to Consumer over a linear (FIFO) Channel buffer. However, the corresponding produced and consumed variables are multidimensional: [x1(j2, j1), r1(j1, j2)] = g(x1(i1-1, i2), r1(i1, i2)); I shall show that we can get these maps by means of polynomials:

  40. 04ESSOFIA Linearization (2) i=1:1:N j=i:1:N For the given domain {(i,j) | 1 ≤ i ≤ N ^ i ≤ j ≤ N}, and the given lexicographic order: for i = 1 : 1 : N, for j = i : 1 : N, there exists a (pseudo) polynomial E(i,j) such that, if (i’,j’ ) is the lexicographic k-th vector, then E(i’,j’ ) = k. Pseudo polynomial to be defined on next slide. Because the polynomial E(i,j) represents a ranking of vectors, we call it the ranking polynomial. Underlying theory is polynomial counting of integral points in polytopes.

  41. 04ESSOFIA Polynomial counting 0 1 2 3 4 p = 4 p=5 d If P (p) is a parameteriz ed polytope in Q then the number of  d points in P (p) Z is called the enumerator of P (p). Example: It is a polynomial or a pseudo-polynomial and called Ehrhart polynomial E(p). for p = 2q: E(p) = p/2+1; for p = 2q + 1: E(p) = p/2 + 3/2 The function c(p) from Z to Q : c(p) = c (p mod l) is called a periodic coefficient with period l. The l possible values are made explicit by representing c(p) as an indexed l-array: [ c0, c1, …, cl-1] p → if (p mod l) = k, then ck E(p) = ½*p + [1 3/2] pis a pseudo polynomial ( l =2)

  42. 04ESSOFIA Theorem ax≥b v The number of integer point in a parameterized polytope is given as a pseudo-polynomial iff the polytope is an affine-vertex polytope. P(p) with vertex set {vi(p)} is an affine-vertex polytope when Vi(p) = Mip + mi With Mi a rational matrix and mi a rational vector, and all vi (p) valid for the whole parameter range. If a polytope is not an affine-vertex polytope, then it has to be partitioned into a number of affine-vertex polytopes and a pseudo-polynomial can be derived for each of its affine-vertex polytopes.

  43. 04ESSOFIA Theorem (2) Let P(p) = {x є | Ax ≥ Bp + d} be an affine-vertex polytope. The enumerator E(p) of P(p) is a pseudo-polynomial of degree d and pseudo-period equal to the denominator of P(p). The dimension of the pseudo-coefficients is equal to the dimension of p. The denominator of P(p) is the least common multiple of the denominators of its vertices. The denominator of a vertex V(p) is the least common multiple of the denominators of its co-ordinates.

  44. 04ESSOFIA Polynomial counting (2) x2 (q,1/2q) (q+1/2p, 1/2q) (0,0) (1/2p,0) x1 Each P(p,q) = {(x1, x2)| 0≤ x2 ≤ 1/2q ^ 2x2 ≤ x1 ≤ 2x2 + 1/2p}, p,q ≥ 0 24 unknowns: set up set of 24 equations with 24 particular values of E(p,q) for particular values of p and q. For example E(p + Δp, q + Δq) with (p,q) = (0,0), (2,0), (4,0), (0,2), (0,4), and (2,2), and Δp,Δqє{0,1}.

  45. 04ESSOFIA General polytope 2 P(p) = {(x1, x2) є Q | 0 ≤ x2 ≤ 4 ^ x2 ≤ x1 ≤ x2 + 9 ^ x1 ≤ p ^ p ≤ 40} x2 Four polynomials: 0≤p ≤4 4≤p ≤9 9≤p ≤13 13≤p ≤40 v7 v8 4 v5 v6 v4 9 13 x1 v3 v1 v2 x1≤ p Four affine-vertex polytopes: 0 ≤ p ≤ 4 {v1, v2, v6} = {(0,0), (p,0), (p,p)} 4 ≤ p ≤ 9 {v1, v2, v7, v8} = {(0,0), (p,0), (4,4), (p,4)} 9 ≤ p ≤ 13 {v1, v3, v4, v7, v8} = {(0,0), (9,0), (p,p-9), (4,4), (p,4)} 13 ≤ p ≤ 40 {v1, v3, v5, v7} = {(0,0), (9,0), (13,4), (4,4)}

  46. NP NC j1 i1 1 2 3 4 5 N=6 1 2 3 4 5 N=6 i2 j2 Schedule: Schedule: for j2 = 1 : 1 : N for i1 = 1 : 1 : N for j1 = j2 : 1 : N for i2 = 1 : 1 : i1 Mx1 What to be counted? How many times has a function been fired before it is invocated in point (i,j) in its function domain D(i,j).

  47. NP NC j1 i1 1 2 3 4 5 N=6 1 2 3 4 5 N=6 i2 j2 Schedule: Schedule: for j2 = 1 : 1 : N for i1 = 1 : 1 : N for j1 = j2 : 1 : N for i2 = 1 : 1 : i1 Mx1 What is to be counted? Recall that destination (address) is not given: If the m-th invocation of function fc in the consumer domainhas to consume a token produced by the n-th invocation of function gp in the producer domain, what is n given m.

  48. What is to be counted? Recall that producer-consumer communication is through FIFO buffers. Readingis always in-order (FIFO order) Consumingmay be out-of-order. ? 5 4 3 2 1

  49. 04ESSOFIA Ranking polynomials X1 channel Np Nc write read port port NP NC j1 i1 1 2 3 4 5 N=6 1 2 3 4 5 N=6 i2 j2 Producer-consumer pair Schedule: Schedule: for j2 = 1 : 1 : N for i1 = 1 : 1 : N for j1 = j2 : 1 : N for i2 = 1 : 1 : i1 Ranking polynomial is polynomial counting lexicographic ordered points (j2,j1) resp. (i1,i2) Example: (j2,j1) = (3,4) → 13 (i1,i2) = (4,3) → 9

  50. 04ESSOFIA Ranking polynomials (2) NP NC j1 i1 1 2 3 4 5 N=6 1 2 3 4 5 N=6 i2 j2 Producer-consumer pair Schedule: Schedule: for j2 = 1 : 1 : N for i1 = 1 : 1 : N for j1 = j2 : 1 : N for i2 = 1 : 1 i1 These are all lexicographic less than # remaining points up to and including (j1 – j2 ) Take Producer # points in shaded triangle is ½ j2(j2 + 1) # points in shaded rectangle is (j2 – 1)(N – j2)

More Related