graphite polyhedral analyses and optimizations for gcc
play

GRAPHITE: Polyhedral Analyses and Optimizations for GCC Sebastian - PowerPoint PPT Presentation

GRAPHITE: Polyhedral Analyses and Optimizations for GCC Sebastian Pop 1 , Albert Cohen 2 , edric Bastoul 2 , Sylvain Girbal 2 , C e Silber 1 , Nicolas Vasilache 2 Georges-Andr 1 CRI/ENSMP 2 Alchemy/INRIA, LRI/Paris Sud 11 University June,


  1. GRAPHITE: Polyhedral Analyses and Optimizations for GCC Sebastian Pop 1 , Albert Cohen 2 , edric Bastoul 2 , Sylvain Girbal 2 , C´ e Silber 1 , Nicolas Vasilache 2 Georges-Andr´ 1 CRI/ENSMP 2 Alchemy/INRIA, LRI/Paris Sud 11 University June, 2006 S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  2. Architecture of GCC and Loop Nest Optimizer C C++ Java F95 Ada GENERIC GIMPLE Analyses LNO GIMPLE + CFG + SSA + Loops − aliasing − data dependences − number of iterations Machine description RTL x86 ppc arm S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  3. Problems with Classical LNO Transforms “source to source” modifies the compiled program difficult to undo order of transforms fixed once for all invalidated data deps: ad-hoc correction or rebuild difficult to compose S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  4. Problems with Classical LNO Transforms “source to source” modifies the compiled program difficult to undo order of transforms fixed once for all invalidated data deps: ad-hoc correction or rebuild difficult to compose solved in WRaP-IT (from 2002 at INRIA on ORC/Open64) GRAPHITE = WRaP-IT for GCC S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  5. GRAPHITE : Representation on Top of Gimple-SSA Statements + parametric affine inequalities 1 a domain = bounds of enclosing loops 2 a list of access functions 3 a schedule = execution time i j m n cst for (i=0; i<m; i++) 2 3 i ≥ 0 1 0 0 0 0 for (j=5; j<n; j++) 6 7 − 1 0 1 0 − 1 − i + m ≥ − 1 6 7 A[2*i][j+1] = ... 6 7 0 1 0 0 5 j ≥ 5 4 5 0 − 1 0 1 − 1 − j + n ≥ − 1 S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  6. GRAPHITE : Representation on Top of Gimple-SSA Statements + parametric affine inequalities 1 a domain = bounds of enclosing loops 2 a list of access functions 3 a schedule = execution time for (i=0; i<m; i++) 2 3 i j m n cst for (j=5; j<n; j++) 2 0 0 0 0 2 ∗ i 4 5 A[2*i][j+1] = ... j + 1 0 1 0 0 1 S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  7. GRAPHITE : Representation on Top of Gimple-SSA Statements + parametric affine inequalities 1 a domain = bounds of enclosing loops 2 a list of access functions 3 a schedule = execution time GRAPHITE(1 , 2 , 3) extends LAMBDA(1 , 2) GRAPHITE: Gimple Represented As Polyhedra (with interchangeable envelopes) S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  8. GRAPHITE versus LAMBDA common part: unimodular transform data and iteration order transform regions: extended from loops to SCoP “static control parts”: sequences, affine conditions and loops GRAPHITE knows about the sequence! enables more loop transforms: fusion, fission, tiling, software pipelining, scheduling S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  9. GRAPHITE versus LAMBDA common part: unimodular transform data and iteration order transform regions: extended from loops to SCoP “static control parts”: sequences, affine conditions and loops GRAPHITE knows about the sequence! enables more loop transforms: fusion, fission, tiling, software pipelining, scheduling S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  10. GRAPHITE versus LAMBDA common part: unimodular transform data and iteration order transform regions: extended from loops to SCoP “static control parts”: sequences, affine conditions and loops GRAPHITE knows about the sequence! enables more loop transforms: fusion, fission, tiling, software pipelining, scheduling S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  11. Schedule: Operational Semantics (How Program Works) build a scheduling function S [ [ stmt ] ] → time sequence [ [ s 1 ; s 2 ] ]: trivial S [ [ s 1 ] ] = t S [ [ s 2 ] ] = t + 1 loop [ [ loop 1 s end 1 ] ]: add new dimensions S [ [ loop 1 ] ] = t S [ [ s ] ] = ( t , i 1 , 0) i 1 indexes loop 1 iterations: dynamic time S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  12. Schedule: Operational Semantics (How Program Works) build a scheduling function S [ [ stmt ] ] → time sequence [ [ s 1 ; s 2 ] ]: trivial S [ [ s 1 ] ] = t S [ [ s 2 ] ] = t + 1 loop [ [ loop 1 s end 1 ] ]: add new dimensions S [ [ loop 1 ] ] = t S [ [ s ] ] = ( t , i 1 , 0) i 1 indexes loop 1 iterations: dynamic time S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  13. Schedule: Example S0; S1; for (i=0; i<m; i++) { S2; » – i j m n cst for (j=5; j<n; j++) S [ [ S 0] ] = 0 0 0 0 0 S3; } S4; S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  14. Schedule: Example S0; S1; » – i j m n cst for (i=0; i<m; i++) { S [ [ S 0] ] = 0 0 0 0 0 S2; for (j=5; j<n; j++) S3; » – i j m n cst S [ [ S 1] ] = } 0 0 0 0 1 S4; S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  15. Schedule: Example » i j m n cst – S [ [ S 0] ] = S0; 0 0 0 0 0 S1; for (i=0; i<m; i++) { » i j m n cst – S2; S [ [ S 1] ] = 0 0 0 0 1 for (j=5; j<n; j++) S3; } 2 3 i j m n cst S4; 0 0 0 0 2 6 7 S [ [ S 2] ] = 6 7 1 0 0 0 0 4 5 0 0 0 0 0 S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  16. Schedule: Example » – i j m n cst S [ [ S 0] ] = 0 0 0 0 0 » – i j m n cst S [ [ S 1] ] = S0; 0 0 0 0 1 S1; for (i=0; i<m; i++) { 2 3 S2; i j m n cst 0 0 0 0 2 for (j=5; j<n; j++) 6 7 S [ [ S 2] ] = 6 7 1 0 0 0 0 4 5 S3; 0 0 0 0 0 } S4; i j m n cst 2 3 0 0 0 0 2 6 7 1 0 0 0 0 6 7 S [ [ S 3] ] = 6 7 0 0 0 0 1 6 7 6 7 0 1 0 0 0 4 5 0 0 0 0 0 S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  17. Schedule: Example » – i j m n cst S [ [ S 0] ] = 0 0 0 0 0 S0; S1; » – i j m n cst S [ [ S 1] ] = 0 0 0 0 1 for (i=0; i<m; i++) { S2; for (j=5; j<n; j++) 2 3 i j m n cst S3; 0 0 0 0 2 6 7 S [ [ S 2] ] = } 6 7 1 0 0 0 0 4 5 S4; 0 0 0 0 0 » i – j m n cst i j m n cst S [ [ S 4] ] = 2 3 0 0 0 0 3 0 0 0 0 2 6 7 1 0 0 0 0 6 7 S [ [ S 3] ] = 6 7 0 0 0 0 1 6 7 6 7 0 1 0 0 0 4 5 0 0 0 0 0 S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  18. Schedule: Separation Example i j m n cst 0 0 0 0 2 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 scheduling matrix S [ [ S 3] ] S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  19. Schedule: Separation Example i j m n cst 0 0 0 0 2 i j m n cst 0 0 0 0 1 0 0 0 0 2 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 i j m n cst 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 separate static / dynamic schedules S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  20. Schedule: Separation Example i j m n cst cst 2 0 0 0 0 2 i j m n cst 1 0 0 0 0 1 0 0 0 0 2 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 i j m n cst 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 static scheduling vector fusion, fission, code motion S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  21. Schedule: Separation Example i j m n cst cst 2 0 0 0 0 2 i j m n cst 1 0 0 0 0 1 0 0 0 0 2 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 i j m n cst m n cst 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 Parameter scheduling matrix shifting S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

  22. Schedule: Separation Example i j m n cst cst 2 0 0 0 0 2 i j m n cst 1 0 0 0 0 1 0 0 0 0 2 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 i j m n cst m n cst 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 i j 1 0 0 1 Iteration scheduling matrix interchange, skewing, reversal S.Pop, A.Cohen, C.Bastoul, S.Girbal, G.A.Silber, N.Vasilache GRAPHITE: Polyhedral Analyses and Optimizations for GCC

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend