240 likes | 394 Views
FADA: F uzzy A rray D ataflow A nalysis. ADaAn: A rray Da taflow An alyzer. Work directed by : D. Barthou and S. Touati PRiSM laboratory - University of Versailles ARPA-informal seminar 19/02/2008. By : M. BELAOUCHA bem@prism.uvsq.fr. Introduction.
E N D
FADA:FuzzyArray Dataflow Analysis.ADaAn:Array DataflowAnalyzer. Work directed by : D. Barthouand S. Touati PRiSM laboratory - University of Versailles ARPA-informal seminar 19/02/2008 By : M. BELAOUCHAbem@prism.uvsq.fr
Introduction • Technologicalbarrier reached (soon ?) • Parallelization • Automatic (icc,…) • Bad detection [Padua, 2001, 2006] • Led by directives (OpenMP, MPI,…) • Parallelismdetection • We need an efficient Dataflow analysis method.
Outline • FADA • Exact analysis • Fuzzy Analysis (FADA) • FADA Vs. State-of-art • Applications & parallel work • Implementation : ADaAn • Conclusion
Dependence Analysis, the Evolution Parametric Integer Programming (PIP) Feautrier’s Exact Analysis Fuzzy Analysis : FADA Exact Analysis (PETIT) Adaptation of PETIT Parametric solver (Omega) 1990 1995 2000 ZIV, MIV, GCD, BanerjeeTest … Region Analysis (PIPS) Hybrid Analysis (Polaris)
May be from S1 during (iw, jw, kw) May be from S1 during (iw, jw, kw) May be S0 during (iw, jw) Maybe S0 during (iw, jw) The exact source of T[i,j] read by S1 during iteration (ir, jr, kr) Exact Analysis (Feautrier’s modeling) Array Dataflow Analysis (ADA) Which Operation writes the value of T[i,j] read by S1 during iteration (ir, jr, kr) ? for (i=1; i<=N; i++) for (j=1; j<=M; j++){ S0: T[i,j]=0; for (k=1; k<=L; k++) S1: T[i,j] = T[i,j]+ A[i,k]*B[k,j]; } } ADA works only for static control programs P. Feautrier ”Dataflow Analysis of scalar and array references.” International Journal of Parallel Computing, 20(1):23-53, 1991.
ADA-like modeling Parameterized solution FADA (Fuzzy Array Dataflow Analysis) Can <S0,iw>be the source of ‘A’ read by <S2,ir> ? for (i=1; i<=N; i++) if( c(i) ) S0: A = … ; else S1: A = …; endif S2: … = …A; endfor J-F. Collard, D. Barthou, P. Feautrier. “Fuzzy Array dataflow analysis”. ACM Symp. On Principles and Practice of Parallel Programming, 30(8):29-101, Aug. 1995.
FADA’s advanced analyses • Structural Analysis • Iterative Analysis • Translating Properties Red and blue elements Blue elements Reducing Fuzziness
Structural Analysis FADA proves, there is no dependence carried by the i-loop for (i=1; i<=N; i++) if( c(i) ) S0: A = … ; else S1: A = …; endif S2: … = …A; endfor Structural property of an if-then-else construct :One and only one branch can be executed during a given iteration. FADA can deduce : that the value of A read by ‘S2’ is produced during the same iteration by S0 or S1.
Iterative Analysis Improved Version iterative analysis : compare two non-affine constraints by comparing the source of referenced variables (Here, A-cells). FADA proves, there is no dependence at all for (i=1; i<=N; i++){ if (A[i-1]) S0: …=…B[i-1]; if(!A[i]) S1: B[i]=…; } • FADA’s inference: • May be there is a confilct on B[i], between S0 during i+1, and S1 during i. • FADA Compares if-conditions, and deduces : • S0 can not be executed during iteration i+1 if S1 was executed during i. (for k>0 or k<1) A[i+k]=…; FADA can deduce : source of “B-cells”, read by S0, can not be an S1 operation.
Translating Properties • A demonstrator, with external/internal knowledge (iterative analysis, structural analysis,…) • Desired cases : • Obtain trivial values “true/false” • Interpret all non affine constraints (and solve the rest using a parametric solver)
FADA FADA, a global view Program basic analysis • advanced analyses • Structural analysis • Iterative analysis • Translating properties Exact Definitions Parameterized Definitions
RO(i) WR(i) RW(i) Hybrid Analysis Rus & Rauchwerger Work Regions DS {out, anti,flow} Program USR USR DS={} No Yes • Statically : • Building: Regions, Ds And predicate DS=Empty • Dynamically : • Check the predicate and branch to the correct version PDAG Sequential Version Parallel Version USR: Uniform Sets of References PDAG: Predicate Directed Acyclic Graph DS: dependencies Set RO: Read Only WR: Write first (write, read) RW: Read first (read, write).
Hybrid Analysis Vs. Fuzzy Analysis Albert don’t agree, I think that recurrence operator (On USR sets) do not handle while loops (the operator requires upper and lower bounds).
Outline • FADA • Applications & parallel work • Parallelism detection • Improving communications • Source to source transformations • Implementation : ADaAn • Conclusion
FADA’s Applications 1. Parallelismdetection No dependence carried by the i-loop No dependence at all for (i=1; i<=N; i++) if( c(i) ) S0: A = … ; else S1: A = …; endif S3: … = …A; endfor for (i=1; i<=N; i++){ if (A[i-1]){ …=…B[i-1]; } A[i-2]=…; if(!A[i]){ B[i]=…; } } Example 1 Example 2
#pragma omp nowait Applications 2. Improve synchronizations and communications • #pragma omp parallel cyclic • for (i=1; i<=N; i++){ • j=0; • while (f(A[i,j])){ • B[a[f(i)],b[j]] = … ; • j++; • } • } • #pragma omp parallel cyclic • for (i=1; i<=N; i++){ • j=0; • while (f(A[i,j])){ • …= … B[a[f(i)],b[j]] ; • j++; • } • } We can remove the implicit barrier
Applications 3. Source-to-source transformations A simplified deep-jam example
Dependencies are preserved ? X2(j”) X1(j’) X3(j”’) S0’ S0’’ X4(j””) X(j) • True : Validate the step • False : Reject The transformation • Demonstration not achieved • Generate appropriate code to correct transformed program. S0 Y1(i’) Y(i) Y2(i””) Y3(i’”) Y2(i’’) S1 S1’ S1’’ Irregular code transformation Main idea G G’
Outline • FADA • Applications & parallel work • ADaAn • Input • Preprocessing • output • Conclusion
ADaAn Input file PROGRAM ADaAn_input; BEGIN for(i:1:N){ S0: j=0; /*labled statement*/ [do whith j] while(C(i,j)){ if (a[i,j]){ A[i,j] += B[i,j]; }else{ A[i,b[j]] = 5; }; j++; }; }; END ADaAn (Array Dataflow Analyzer) Overview Program Preprocessing FADA’s basic analysis PIPlib BeeCl@ck Polylib FADA’s advanced analyses SWI-PROLOG Verification code Definitions Dependence graph
Preprocessing step : Single loop counter ID and loop normalization ADaAn Preprocessing step : Advanced symbolic constants identification Preprocessing step : Automatic symbolic constants identification C=…; for (i:1:N){ …=…i; C=…C; }; C=C…; for (i:N-50:N){ …=…C; }; C=…; for (i:1:N){ …=…i; C=…C; }; C1=C…; for (i:N-50:N){ …=…C1; }; For(i:1:N){ j=0; while (C(i,j)){ …=…T[i]; …=…V; j++; }; V=…; }; … for (i:1:N){ …=…i; }; … for (i:lb(…):ub(…)){ …=…i; }; … for (i:1:N){ …=…i; }; … for (i0:0:ub(…)-lb(…)){ …=…i0-lb(…); }; ADaAn (Array Dataflow Analyzer) Overview Program Preprocessing FADA’s basic analysis PIPlib BeeCl@ck Polylib FADA’s advanced analyses SWI-PROLOG Verification code Definitions Dependence graph
ADaAn ADaAn Output Program Preprocessing FADA’s basic analysis PIPlib BeeCl@ck Polylib FADA’s advanced analyses SWI-PROLOG Verification code Definitions Dependence graph
ADaAn In progress • Achieved • Basic analysis • Structural Analysis • In progress • Parametric PROLOG-like demonstrator (for : Iterative analysis and Translating properties)