ON CHOOSING A PLAN FOR THE EKECUTION OF DATA FLOW PROGRAM GRAPH INFORIVIATICA3/86 Borut Robič, Jurij Šile Jožef Štefan Institute, Ljubljana UDK: 681.519,7 ABSTRACT - In the paper ue present a generalized analisy5 af static data the plan is used by the architecture com- ponents during the actual ext!Culion of a graph in deciding uhich executable nodes should be retained. The execution according to a properly chosen plan may result in roini- nization of some resources needed, such as the number of processing elements. Ue point out three special plans for the executiQn. Execution according to the first of them is esBentially the immediate execution, des- oribed ahove. The execution according to the second plan is the opposite of the immediate execution, uhile the executian according to the third plan often ušes minimum number of processing elements. Executing graphs accor­ ding to this plan we may avoid the problema discussed above. STATIC DATA FLOW PROGRAM GRAPH There are two uays of envisaging a data ilaw program: as a static or as a dynamic data flow program graph. Ue limit our discussion to static graphs. In short, static data flow program graphs are acyclio, uhile the dynamic are not. 13 We define a static data fSow program gi-aph 6 = ( V,A ), in further discussion program graph, ta be a directed, acyc\ic, and simple (no inultiple arcs ol the same direction bet- ween two nodes) gL'aph. The sst V ol noJes is partitioned into three disjoint sets Vj ,V| , Vp ol starting, internal and final nodes, respectively. The starting nodes have no input archs uhile the (inal nodes have no output archs. Furtherinore, there oiust always eyist a path to any internal or final node {rosi some starting node and, similarly, a path troB any starting or internal node to soae final node. Starting nodes are used to carry the input values uhile the final nodes store the results. Internal nodes carry ope- rations CRQfi863. The tirne of the eKScution of a node n is t„, uhere t„ = 1 (or ali starting and (inal nodes n. K node n is beeing eKtouted at the moment j we define l' , the plan Impl/es a certain degree of control flou in data flow architeoture and is realized by a time control vector associated to each node o( a program graph. The plan lor the eKeoution o( a graph is de- terained by the rule whloh selects the sets Ej. There are two trivial plans for the ene­ cution of a graph. These are a plan for inne- diate and a plan for lazy eKeoution, The plan for iamediate eKecution is determined by choosing E] to consists of ali those enecuta- ble nodes at the moment j Ihat could be fl- red even later. The plan for the lazy enecu­ tion is determined by forcing Ej to be eaipty at ali ooinents j. Consequently, the inimediate e«ecution fires the nodes as soon as possible while the la2y eKecution defers firing to the last possible moment. In gener.al, none of these tuo eKecutions minimizes the number of prooessing elements needed. The plan for the eKecution that ušes minimum number of proces- sing elements could be found by sistematic eKaminatiun of ali possible rules for the choosinc) tne sets E' . Sinoe ue want to avoid the co»t)indt.ori 3! explosion we try to find a heuristic rule sucn tnat the eKecution accor- ding to the associated heuristic plan wouId use the number of processing elements as close as possible to the theoretical louei- bound. For eKample, enecution of the graph on Fig.3 according to the immediate plan needs n+1 processing eleoients, since at the moment j = 1 the node 1 is fired simultaneousIy uith the nodes n + i, 14iin. Similarly, the la2y plan implies the execution that tnvolves n+1 processing elements, too. Namely, at the last step the node n is fired together uith the nodes n + i, 1iiin. On the other hand, the heuristic plan offers ar\ eKecution uith only twa processing elements for at each step only the pair of nodes k, and r\*k are beeing exe- cuted. The plan for the heuristic eKecution uill be discussed belou. 6. THE TIME CONTROL VECTOR Every node n is associated uith a time con­ trol VeCtor T„ = ( Tc„ , tE.„ , Tfn ) . ^Cn t 'E.n ^""^ V.n ^^^ the iiioments uhen the node n becomes created, eKecutable and fired. Time control vectors are camputed for each node uhile the plan for the execution is bee­ ing constructed. Sinoe ali the sets described above are affected by the rule for choosing the set Ej , the time control vectors depend on 3 plan constructed. Every plan for the eKecution has its oun set of time control vectors. To point out that the time control vector of a node n is coraputed according to the plan for immediate or lazy eKecution we ti"* urite Ti(™"or ti?'", respectively. 7. THE PLAN FOR HEURISTIC EXECUTION 7.1. CRITICAL NODES and tl,"i = D internal nodes n, , n2 i. .., n,, on the path p are criti­ cal. Consec|uently, the flrst moment at uhich the node nj,^, can be fired Is the moment l + E-L, tn.. Slnce the node njj^^ is on the longest path' from the set V^ to the set Vp this is also the last moment, uhen it can be fired, so as not to lengthen the total eKecution time of the graph lmplylng that the node n,,^, is critical. Canversely, suppose a node n is .critical. Conslder the longest path p of the ali paths from V^ to Vp , passlng the node n. Ue dedne the subpath p' of the path p tu be the path consistlng of ali the nodes from Vg to the father of the node n. Simllarly, the subpath p" of the path p consists of ali the nodes from the son of the node n to the set Vp . Ue deflne l(p') and Up") to be the lengthfi of the paths p' and p", respectively. Note, that slnce p is the longest path from Vg to Vf through the node n, the path p' must b« the longest of the paths from V^ to the tet of fathers of n. Similarly, the path p" oust be the longest path from the set of sons of the node n to the Vp . Suppose the relation Hp')+tn+l,' and p = oiniia2y >• Then the following theorea illustrates the upper and lower bounds on p„i„ . eise Choose m nodes n from Ej - E* having the longest values l(n,Vp) and put them into the set E' ; end; THEORE« 3. Minioal number of processing elements needed is bounded by ct ^ ^i^in - ?•. PHOOFi In čase of ? since there exist5 ^ critical nodes mus that 5 U (Ej n Vp ) i Choose a subset E; of the set E := E' U E' old := Dj.i U FP U Fi* V - ( Ci U F, U Di ) Adjust the components of tirne control vectors for the nodes in c;"" , E™"" and Fj""" ; Fig.5: Algorithm for ohtaining execution plans of a program graph. CONCLUSION Uhat on F is O of ali plEX sine each coiop tiae IS O is the tiin ig.5? The t ( IVl^ ) , sin the comput nodes in a ity of the e the loop of the ste lEKitv 0( I V COAplBKit ( IVt^ ) . e coalexity at the algorithm ime coaplexit/ of the step (1) ce this is the tirne complexity ing the longest paths between graph CLaw7fc3. The tirne com- steps (2) to (20) is 0( IVI^ ) , (3) is entered O(IVI) times, ps (A) to (20) having tirne I). Consequently, the overall y of the algorithm on Fig.5 is The gener nodes was o than botn of ca risti optim proce o, a this very cuted resul algorithm w ated progra . In only O btained. In or equal to immediate a ses. Furthe C execution al, since th ssing elemen s uas the ca number is probably gr using only ts are depic as tested m Qi'aphs Sy. of ana ali other Heuri nd lazy e r m • r e , m a s were e associ ts needed se on the pesimisti aphs tha a proces ted on Fi on uit lysed čase Stic xecut ny (5 also ated equa Fig C si t cou sing g.6. 'iOO randomIy h at most ti graphs >Jhou >& s fj^ou uas less plan inprovsd ion in SC1.2S7. 5.75'/.) of heu- proved to be numbers of the led the values 7. Note, that nce thure uere Id not be exe- elements. The It is to point out that the algorithm on Fig.5 oan be used for minimiiation of some other resources suoh as the number of primary meaory locations needed . Mheu > P (O.SQX> ^-,:;:.i^|f|ip^ I T-i] I I Mhou = p ('.9.25X) Mheu < e (50.25X) Mheu « « (55.751) Flg.6i The behavior of the heuristic plan. 1 v I Ti"«" 1 T'i'y I TJ«" I F. v ^.v r.v + + + + + I a K O, O, 0)I( O, Q, 0)I( O, 0. 0)I + + + + • + I b I C Q, Q, 0) I( O, O, 0) I ( O, O, 0)I + + + + • + I C K O, O, 0)I( O, O, 0)I( O, O, 0)I + + • • + I d I C 1, 1, 1)I( 1, 1, 6)I( 1 , 1 , 1)1 + + + + . + I e 1( 1, 1, 1)I( 1, 1, 1)I( 1 , 1 , 1)1 + + + • • 1 I K 1 , 1 , 1) I ( 1 , 1 ,10) I C -1, 1 , *) I + + + + • I g K 1, 1, 1) I ( 1 , 1 , 9) I ( 1 , 1 , 1)1 + + + • + • I h K 2, 7, 7)I( 7, 7, 7)I( 2, 7, 7)1 + + + . + f I i K 1, 1, 1)I C 1, 1 ,19) 1 ( 1, 1 , 9)1 + + 4 .• + 4 I j K 1, 1, 1)I( 1, 1 ,10) I ( 1 , 1 , 2) I + + + + + 1 k K 1, 1, 1)I( 1, 1,18)1 ( 1, 1 , 6) I + • + + + I 1 K 1 , 1 , 1) I ( 1 , 1 ,1',) I ( 1 , 1 , 4) I + + + + * I a K 3,12,12)I(12,12,12) I C A,12,12)1 •. + + 1 + 1 n K 1, 1, 1)I< 1, 1 ,15) K 1; 1 , 6) I t-..^^ + + 1 I o M 3,1A,1',) I (1<,,16,16) I ( 6,1',,U)I + + + 1 1 I p K 1,1',,1'i)l( 1,1'i,1'>)l( 1,H,U)I • *--• + + • I q I (16,16,16)I(16,16,16)I(16,16,16)I + + + •-- + + I r K 5,19,19)1(19,19,19)1(10,19,19)1 + + + + 1 I s K 3,21,21)I(19,21 ,21) 1 ( 9,21,21)1 + + + .__ + _• + I t 1(22,22,22)1(22,22,22)1(22,22,22)1 . M imm ~ ' ? = 1 Mheu In thls čase the heuristic plan is also optiaal1 Fig.7: Plans (or immediate, la2y and heuristic execution of a given program graph. 10. LITERATURE CC0MB23 COMPUTER, Soecial Issue On OataflGw SvBlems, Vol.15, No.2, Feb.1982 CKFSSa^D Kapauan A L.Snyder J.T.Field, O.B.Gannoni The Pringle Parallel Computer', Proč. 11th Int'1 S/op. Conp. Arch., IEEE Press, New York, 198'., pp.12-20 CRaSfi6] RobiC B., J.Silo : 'Analyeis o( Static Data Flow Program Graphs' , to be published in Elektrotehniški vestnik, (in Slovene) CTJSS3] Tokoro M., J.R,Jagannathan, H.Suna- hara: 'On the Uorking Set Concept for Data-llow Machines', Proč. 10th Int'1 Syiiip. Computer Architecture, IEEE Press, New Vork, 1983, pp.90- 97 CLaw76: Lauler E.: Combinatorial Optimiza- tioni Networks and Matroids, Holt, RinehartiWinston, New Vork, 1976 CSiRasa Silo J., B.RobiC : 'Basic .Princip- les ol Data Flou Systeiiis' , Infor- matica 2/85, pp.10-15 (in Slovene)