constant aspect ratio tiling
play

Constant Aspect-Ratio Tiling Guillaume Iooss, Sanjay Rajopadhye, - PowerPoint PPT Presentation

Introduction Polyhedron Affine function Extensions Conclusion Constant Aspect-Ratio Tiling Guillaume Iooss, Sanjay Rajopadhye, Christophe Alias, Yun Zou Colorado State University - ENS Lyon January 20, 2014 1/15 Introduction Polyhedron


  1. Introduction Polyhedron Affine function Extensions Conclusion Constant Aspect-Ratio Tiling Guillaume Iooss, Sanjay Rajopadhye, Christophe Alias, Yun Zou Colorado State University - ENS Lyon January 20, 2014 1/15

  2. Introduction Polyhedron Affine function Extensions Conclusion Parametric tiling Tiling is an important transformation: → Locality improvement → New level of granularity (can be exploited for parallelism) If the tile sizes are constant, polyhedral ( i = 4 .α + ii , 0 ≤ ii < 4 ) Parametric tiling : tiling where the tile sizes are parameters → Tile size can be selected during runtime (autotuning) Not a polyhedral transformation ( i = b .α + ii , 0 ≤ ii < b ) 2/15

  3. Introduction Polyhedron Affine function Extensions Conclusion Parametric tiling - State of the art Parametric tiling is embedded in the code generation phase: Fourier-Motzkin symbolic elimination [Gösslinger, CPC2004] Tile the bounding box of the iteration domain [Lakshmi, PLDI2007] D-tiling [Kim, LCPC10] (outset, inset) PrimeTile [Hartono, ICS09], DynTile [Hartono, IDPDS10] and PTile [Baskaran, CGO10] Later transformations/analysis must be "hard-coded": DynTile: find a wavefront schedule Parametric GPU code generation [Athanasios, Kelly, LCPC13] → Exploit wavefront/rectangular parallelism 3/15

  4. Introduction Polyhedron Affine function Extensions Conclusion Contribution Parametric tiling with one tile size parameter and fixed ratio for every dimensions → obtain a polyhedral program representation. Example: b × 2 b and not b × c ⇒ Constant Aspect-Ratio Tiling (CART) 4/15

  5. Introduction Polyhedron Affine function Extensions Conclusion Contribution Parametric tiling with one tile size parameter and fixed ratio for every dimensions → obtain a polyhedral program representation. Example: b × 2 b and not b × c ⇒ Constant Aspect-Ratio Tiling (CART) Rest of the talk: We focus on polyhedron and affine function Polyhedron CART − − − − → union of "tiled" polyhedra �→ Improvment to have only one polyhedron per tiles Affine function CART − − − − → piecewise affine function In general, might admit modulo constraints Under a condition, only admit polyhedral constraints for ( i , j ) ∈ D A = D : ( i , j -> i + 1 , j − 1)@B A[ i , j ] = B[ i + 1 , j − 1] 4/15

  6. Introduction Polyhedron Affine function Extensions Conclusion Notations and CART hypothesis � Given a polyhedron D � p = { i | . . . } : i 2 � α + � ii where � 0 ≤ � ii < b . D .� i = b . D .� 1 ii 2 - All dimensions tiled along canonical ( α 1 , α 2 ) b axis ii 1 α / � - � ii : blocked/local indices - b : tile size parameter i 1 2 . b - D : ratio (diagonal matrix) i 1 = 2 . b .α 1 + ii 1 p = b .� pp where � pp < b .� � λ + � 0 ≤ � 1 i 2 = b .α 2 + ii 2 - � λ / � pp : blocked/local parameters � � 2 0 D = 0 1 5/15

  7. Introduction Polyhedron Affine function Extensions Conclusion Notations and CART hypothesis � Given a polyhedron D � p = { i | . . . } : i 2 � α + � ii where � 0 ≤ � ii < b . D .� i = b . D .� 1 ii 2 - All dimensions tiled along canonical ( α 1 , α 2 ) b axis ii 1 α / � - � ii : blocked/local indices - b : tile size parameter i 1 2 . b - D : ratio (diagonal matrix) i 1 = 2 . b .α 1 + ii 1 p = b .� pp where � pp < b .� � λ + � 0 ≤ � 1 i 2 = b .α 2 + ii 2 - � λ / � pp : blocked/local parameters � � 2 0 D = 0 1 α,� ⇒ Question: How to obtain ∆ � pp = { � ii | . . . } ? λ, � 5/15

  8. Introduction Polyhedron Affine function Extensions Conclusion Deriving the blocked union of polyhedra Example: D = { i , j | i + j ≤ N − 1 ∧ j ≤ M ∧ 0 ≤ i , j } with tiles of size b × b . Let us focus on the first constraint: N − i − j − 1 ≥ 0 j M D 0 i N − 1 6/15

  9. Introduction Polyhedron Affine function Extensions Conclusion Deriving the blocked union of polyhedra Example: D = { i , j | i + j ≤ N − 1 ∧ j ≤ M ∧ 0 ≤ i , j } with tiles of size b × b . Let us focus on the first constraint: N − i − j − 1 ≥ 0 j � M ( N , i , j ) = ( N bl , α, β ) . b + ( N loc , ii , jj ) � ( substitution ) � D ( N bl − α − β ) . b +( N loc − ii − jj − 1 ) ≥ 0 0 i N − 1 6/15

  10. Introduction Polyhedron Affine function Extensions Conclusion Deriving the blocked union of polyhedra Example: D = { i , j | i + j ≤ N − 1 ∧ j ≤ M ∧ 0 ≤ i , j } with tiles of size b × b . Let us focus on the first constraint: N − i − j − 1 ≥ 0 j � M ( N , i , j ) = ( N bl , α, β ) . b + ( N loc , ii , jj ) � ( substitution ) � D ( N bl − α − β ) . b +( N loc − ii − jj − 1 ) ≥ 0 � 0 i � b > 0 � N − 1 N bl − α − β + N loc − ii − jj − 1 ≥ 0 b 6/15

  11. Introduction Polyhedron Affine function Extensions Conclusion Deriving the blocked union of polyhedra Example: D = { i , j | i + j ≤ N − 1 ∧ j ≤ M ∧ 0 ≤ i , j } with tiles of size b × b . Let us focus on the first constraint: N − i − j − 1 ≥ 0 j � M ( N , i , j ) = ( N bl , α, β ) . b + ( N loc , ii , jj ) � ( substitution ) � D ( N bl − α − β ) . b +( N loc − ii − jj − 1 ) ≥ 0 � 0 i � b > 0 � N − 1 N bl − α − β + N loc − ii − jj − 1 ≥ 0 b � � a ≥ 0 ⇔ ⌊ a ⌋ ≥ 0 � � � N loc − ii − jj − 1 N bl − α − β + ≥ 0 b 6/15

  12. Introduction Polyhedron Affine function Extensions Conclusion Computing k min and k max � � N loc − ii − jj − 1 k 1 = , where 0 ≤ ii , jj , N loc < b , is bounded. b Maximum of k 1 : reached for N loc = b − 1, ii = jj = 0. � � ( b − 1 ) − 1 → k 1 , max = = 0 b Minimum of k 1 : reached for N loc = 0, ii = jj = b − 1 � � � � 0 − ( b − 1 ) − ( b − 1 ) − 1 1 → k 1 , min = = − 2 + = − 2 b b ⇒ k 1 ∈ {− 2 , − 1 , 0 } 7/15

  13. Introduction Polyhedron Affine function Extensions Conclusion Computing k min and k max � � N loc − ii − jj − 1 k 1 = , where 0 ≤ ii , jj , N loc < b , is bounded. b Maximum of k 1 : reached for N loc = b − 1, ii = jj = 0. � � ( b − 1 ) − 1 → k 1 , max = = 0 b Minimum of k 1 : reached for N loc = 0, ii = jj = b − 1 � � � � 0 − ( b − 1 ) − ( b − 1 ) − 1 1 → k 1 , min = = − 2 + = − 2 b b ⇒ k 1 ∈ {− 2 , − 1 , 0 } � � M loc − jj Other constraints: k 2 = = − 1 or 0, k 3 = k 4 = 0. b We can derive the values of ii , jj corresponding to each k i . 7/15

  14. Introduction Polyhedron Affine function Extensions Conclusion Deriving the blocked union of polyhedra: result ∆ is the union of 6 polyhedra ( − 2 ≤ k 1 ≤ 0, k 2 = − 1 or 0)  N bl − α − β − 2 ≥ 0    M bl − β − 1 ≥ 0       α, β ≥ 0     ∆ = α, β, ii , jj | − 2 . b ≤ N loc − ii − jj − 1 < − b ∪ . . . − b ≤ M loc − jj < 0       0 ≤ ii , jj < b       ( for k 1 = − 2 and k 2 = − 1 ) j k 1 = 0 k 2 = 0 k 1 = − 1 k 2 = 0 M k 1 = 0 k 2 = − 1 k 1 = − 1 k 2 = − 1 k 1 = − 2 k 2 = − 1 0 i N − 1 8/15

  15. Introduction Polyhedron Affine function Extensions Conclusion Merging tiles We can merge them to obtain one polyhedron per tiles: j k 1 = 0 k 2 = 0 k 1 = − 1 k 2 = 0 M k 1 = 0 k 2 = − 1 k 1 = − 1 k 2 = − 1 k 1 = − 2 k 2 = − 1 0 i N − 1 ❀ ❀ ❀ ❀ ❀ j N bl − α − β = 0 | M bl − β = 0 N bl − α − β = 0 | M bl − β ≥ 1 M N bl − α − β = 1 | M bl − β = 0 N bl − α − β = 1 | M bl − β ≥ 1 N bl − α − β ≥ 2 | M bl − β ≥ 1 0 i N − 1 9/15

  16. Introduction Polyhedron Affine function Extensions Conclusion Notations and CART hypothesis � Given an affine function f : ( i �→ . . . ) , we have 2 different tilings: - Antecedent domain: � α + � ii where � 0 ≤ � ii < b . D .� i = b . D .� 1 ′ where � ′ < b . D ′ .� α ′ + � i ′ = b . D ′ .� - Image domain: � 0 ≤ � 1 ii ii p = b .� pp where � pp < b .� - Parameters: � λ + � 0 ≤ � 1 i 2 ii 2 �→ d 2 . b ( α 1 , α 2 ) i ′ 1 d ′ 1 . b ii 1 i 1 d 1 . b 10/15

  17. Introduction Polyhedron Affine function Extensions Conclusion Notations and CART hypothesis � Given an affine function f : ( i �→ . . . ) , we have 2 different tilings: - Antecedent domain: � α + � ii where � 0 ≤ � ii < b . D .� i = b . D .� 1 ′ where � ′ < b . D ′ .� α ′ + � i ′ = b . D ′ .� - Image domain: � 0 ≤ � 1 ii ii p = b .� pp where � pp < b .� - Parameters: � λ + � 0 ≤ � 1 i 2 ii 2 �→ d 2 . b ( α 1 , α 2 ) i ′ 1 d ′ 1 . b ii 1 i 1 d 1 . b ′ ) ? α,� α ′ ,� ⇒ Question: How to obtain φ such that φ ( � ii ) = ( � ii 10/15

  18. Introduction Polyhedron Affine function Extensions Conclusion Deriving the piecewise affine function: polyhedral case � ( i , j ) �→ ( 2 . N + 2 . i + 4 . j − 1 ) Example: f : b × b 2 b ❀ 11/15

Recommend


More recommend