polyhedral ast generation is more than scanning polyhedra
play

Polyhedral AST generation is more than scanning polyhedra Tobias - PowerPoint PPT Presentation

s p c l.in f.e th z .c h @s p c l_e th Polyhedral AST generation is more than scanning polyhedra Tobias Grosser, Sven Verdoolaege, Albert Cohen ETH Zurich, Polly Labs, INRIA TOPLAS - Presented at PLDI16 15. June 2015, Santa


  1. s p c l.in f.e th z .c h @s p c l_e th Polyhedral AST generation is more than scanning polyhedra Tobias Grosser, Sven Verdoolaege, Albert Cohen ETH Zurich, Polly Labs, INRIA TOPLAS - Presented at PLDI’16 15. June 2015, Santa Barbara, USA 1 / 38

  2. s p c l.in f.e th z .c h @s p c l_e th AST Generation at the Heart of Research PolyMage - ASPLOS’15 Associative Reordering - PLDI’14 LLVM Polly - PPL’12 Pluto - PLDI’08 L U G LU LG = + U G L GU GG LU Basic Structured Linear Algebra Hybrid-Hexagonal Tiling of Compiler - CGO’16 Stencils - CGO’14 2 / 38

  3. s p c l.in f.e th z .c h @s p c l_e th Hybrid-Hexagonal Tiling for Stencil Computations 3 / 38

  4. s p c l.in f.e th z .c h @s p c l_e th Copy code from hybrid hexagonal tiling - Original for (c2 = 0; c2 <= 1; c2 += 1) for (c3 = 1; c3 <= 4; c3 += 1) for (c4 = max(((t1-c3+130) % 128) + c3 - 2, ((t1+c3+125) % 128) - c3 + 3); c4 <= min(((c2+c3) % 2) + c3 + 128, -((c2+c3) % 2) - c3 + 134); c4 += 128) if (c3 + c4 >= 7 || (c4 == t1 && c3 + 2 >= t1 && t1 + c3 <= 6 && t1 + c3 >= ((t1 + c2 + 2 * c3 + 1) % 2) + 3 && t1 + 2 >= ((t1 + c2 + 2 * c3 + 1) % 2) + c3) || (c4 == t1 && c3 == 1 && t1 <= 5 && t1 >= 4 && c2 <= 1 && c2 >= 0)) A[c2][6 * b0 + c3][128 * g7 + c4 - 4] = ...; 4 / 38

  5. s p c l.in f.e th z .c h @s p c l_e th Copy code from hybrid hexagonal tiling - Unrolled A[0][6 * b0 + 1][128 * g7 + (t1 + 125) % 128) - 1] = ...; A[0][6 * b0 + 2][128 * g7 + (t1 + 127) % 128) - 3] = ...; if (t1 <= 2 && t1 >= 1) A[0][6 * b0 + 2][128 * g7 + t1 + 128] = ...; A[0][6 * b0 + 3][128 * g7 + (t1 + 127) % 128) - 3] = ...; if (t1 <= 2 && t1 >= 1) A[0][6 * b0 + 3][128 * g7 + t1 + 128] = ...; A[0][6 * b0 + 4][128 * g7 + (t1 + 125) % 128) - 1] = ...; A[1][6 * b0 + 1][128 * g7 + (t1 + 126) % 128) - 2] = ...; A[1][6 * b0 + 2][128 * g7 + (t1 + 126) % 128) - 2] = ...; if (t1 <= 3 && t1 >= 2) A[1][6 * b0 + 2][128 * g7 + t1 + 128] = ...; A[1][6 * b0 + 3][128 * g7 + (t1 + 126) % 128) - 2] = ...; if (t1 <= 3 && t1 >= 2) A[1][6 * b0 + 3][128 * g7 + t1 + 128] = ...; A[1][6 * b0 + 4][128 * g7 + (t1 + 126) % 128) - 2] = ...; 5 / 38

  6. 5 4 3 2 i 1 0 1 1 0 1 2 3 4 5 j s p c l.in f.e th z .c h @s p c l_e th State of Variables Program for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed 6 / 38

  7. 5 4 3 2 i 1 0 1 1 0 1 2 3 4 5 j s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 0, j = 0 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed S(0,0) 6 / 38

  8. 5 4 3 2 i 1 0 1 1 0 1 2 3 4 5 j s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 1, j = 0 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed S(1,0), S(0,0) 6 / 38

  9. 5 4 3 2 i 1 0 1 1 0 1 2 3 4 5 j s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 1, j = 1 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed S(1,0), S(1,1) S(0,0) 6 / 38

  10. 5 4 3 2 i 1 0 1 1 0 1 2 3 4 5 j s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 2, j = 0 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed S(2,0), S(1,0), S(1,1) S(0,0) 6 / 38

  11. 5 4 3 2 i 1 0 1 1 0 1 2 3 4 5 j s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 2, j = 1 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed S(2,0), S(2,1), S(1,0), S(1,1) S(0,0) 6 / 38

  12. 5 4 3 2 i 1 0 1 1 0 1 2 3 4 5 j s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 2, j = 2 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed S(2,0), S(2,1), S(2,2) S(1,0), S(1,1) S(0,0) 6 / 38

  13. 5 4 3 2 i 1 0 1 1 0 1 2 3 4 5 j s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 3, j = 0 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed S(3,0), S(2,0), S(2,1), S(2,2) S(1,0), S(1,1) S(0,0) 6 / 38

  14. 5 4 3 2 i 1 0 1 1 0 1 2 3 4 5 j s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 3, j = 1 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed S(3,0), S(3,1), S(2,0), S(2,1), S(2,2) S(1,0), S(1,1) S(0,0) 6 / 38

  15. 5 4 3 2 i 1 0 1 1 0 1 2 3 4 5 j s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 3, j = 2 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed S(3,0), S(3,1), S(3,2), S(2,0), S(2,1), S(2,2) S(1,0), S(1,1) S(0,0) 6 / 38

  16. 5 4 3 2 i 1 0 1 1 0 1 2 3 4 5 j s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 3, j = 3 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed S(3,0), S(3,1), S(3,2), S(3,3) S(2,0), S(2,1), S(2,2) S(1,0), S(1,1) S(0,0) 6 / 38

  17. 5 4 3 2 i 1 0 1 1 0 1 2 3 4 5 j s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 4, j = 0 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed S(4,0), S(3,0), S(3,1), S(3,2), S(3,3) S(2,0), S(2,1), S(2,2) S(1,0), S(1,1) S(0,0) 6 / 38

  18. 5 4 3 2 i 1 0 1 1 0 1 2 3 4 5 j s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 4, j = 1 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed S(4,0), S(4,1), S(3,0), S(3,1), S(3,2), S(3,3) S(2,0), S(2,1), S(2,2) S(1,0), S(1,1) S(0,0) 6 / 38

  19. 5 4 3 2 i 1 0 1 1 0 1 2 3 4 5 j s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 4, j = 2 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed S(4,0), S(4,1), S(4,2), S(3,0), S(3,1), S(3,2), S(3,3) S(2,0), S(2,1), S(2,2) S(1,0), S(1,1) S(0,0) 6 / 38

  20. 5 4 3 2 i 1 0 1 1 0 1 2 3 4 5 j s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 4, j = 3 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed S(4,0), S(4,1), S(4,2), S(4,3), S(3,0), S(3,1), S(3,2), S(3,3) S(2,0), S(2,1), S(2,2) S(1,0), S(1,1) S(0,0) 6 / 38

  21. 5 4 3 2 i 1 0 1 1 0 1 2 3 4 5 j s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 4, j = 4 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed S(4,0), S(4,1), S(4,2), S(4,3), S(4,4) S(3,0), S(3,1), S(3,2), S(3,3) S(2,0), S(2,1), S(2,2) S(1,0), S(1,1) S(0,0) 6 / 38

  22. s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 4, j = 4 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed Iteration space S(4,0), S(4,1), S(4,2), S(4,3), S(4,4) 5 S(3,0), S(3,1), S(3,2), S(3,3) 4 S(2,0), S(2,1), S(2,2) S(1,0), S(1,1) 3 S(0,0) 2 i 1 0 1 1 0 1 2 3 4 5 j 6 / 38

  23. s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 0, j = 0 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed Iteration space S(4,0), S(4,1), S(4,2), S(4,3), S(4,4) 5 S(3,0), S(3,1), S(3,2), S(3,3) 4 S(2,0), S(2,1), S(2,2) S(1,0), S(1,1) 3 S(0,0) 2 i 1 0 1 1 0 1 2 3 4 5 j 6 / 38

  24. s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 1, j = 0 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed Iteration space S(4,0), S(4,1), S(4,2), S(4,3), S(4,4) 5 S(3,0), S(3,1), S(3,2), S(3,3) 4 S(2,0), S(2,1), S(2,2) S(1,0), S(1,1) 3 S(0,0) 2 i 1 0 1 1 0 1 2 3 4 5 j 6 / 38

  25. s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 1, j = 1 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed Iteration space S(4,0), S(4,1), S(4,2), S(4,3), S(4,4) 5 S(3,0), S(3,1), S(3,2), S(3,3) 4 S(2,0), S(2,1), S(2,2) S(1,0), S(1,1) 3 S(0,0) 2 i 1 0 1 1 0 1 2 3 4 5 j 6 / 38

  26. s p c l.in f.e th z .c h @s p c l_e th State of Variables Program n = 4, i = 2, j = 0 for (i = 0; i <= n; i++) for (j = 0; j <= i; j++) S(i,j); Statement Instances Executed Iteration space S(4,0), S(4,1), S(4,2), S(4,3), S(4,4) 5 S(3,0), S(3,1), S(3,2), S(3,3) 4 S(2,0), S(2,1), S(2,2) S(1,0), S(1,1) 3 S(0,0) 2 i 1 0 1 1 0 1 2 3 4 5 j 6 / 38

Recommend


More recommend