Introduction Intra-Array Storage Optimization Problem Conflicts, Conflict Satisfaction Exploiting Inter-Array Reuse Opportunities A Global Unified SMO: An Integrated Approach To Intra-Array And Inter-Array Storage Optimization Somashekaracharya G. Bhaskaracharya 1 , 3 Uday Bondhugula 1 Albert Cohen 2 Indian Institute of Science 1 ENS Paris, INRIA 2 National Instruments 3 January 21, 2016 1 / 29
Introduction Intra-Array Storage Optimization Problem Conflicts, Conflict Satisfaction Exploiting Inter-Array Reuse Opportunities A Global Unified Outline Introduction 1 Intra-Array Storage Optimization Problem 2 Conflicts, Conflict Satisfaction 3 Exploiting Inter-Array Reuse Opportunities 4 A Global Unified Array Space 5 Statement-Wise Storage Hyperplanes 6 Experimental Evaluation II 7 Summary 8 2 / 29
Introduction Intra-Array Storage Optimization Problem Conflicts, Conflict Satisfaction Exploiting Inter-Array Reuse Opportunities A Global Unified Storage Optimization Basic Goal Reuse memory locations for values without overlapping lifetimes − Reuse within a given array or across different arrays − Crucial for data-intensive programs − run larger problem size with a fixed amount of main memory − stencils, image processing applications, DSL compilers − affine loop-nests 3 / 29
Introduction Intra-Array Storage Optimization Problem Conflicts, Conflict Satisfaction Exploiting Inter-Array Reuse Opportunities A Global Unified Contracting A Particular Array ❢♦r✭t❂✶❀t❁❂◆❀✐✰✰✮ ❢♦r✭✐❂✶❀✐❁❂◆❀✐✰✰✮ ✴✯❙✯✴ ❆❬t✪✷✱✐❪❂❢✭❆❬✭t✲✶✮✪✷✱✐✲✶❪ ❢♦r✭t❂✶❀t❁❂◆❀✐✰✰✮ ✰❆❬✭t✲✶✮✪✷✱✐❪ ❢♦r✭✐❂✶❀✐❁❂◆❀✐✰✰✮ ✰❆❬✭t✲✶✮✪✷✱✐✰✶❪✮❀ ✴✯❙✯✴ ❆❬t✱✐❪❂❢✭❆❬t✲✶✱✐✲✶❪ ✰❆❬t✲✶✱✐❪ (b) Array contracted to size 2 × N ✰❆❬t✲✶✱✐✰✶❪✮❀ (a) 1-d stencil using N 2 storage ❢♦r✭t❂✶❀t❁❂◆❀✐✰✰✮ ❢♦r✭✐❂✶❀✐❁❂◆❀✐✰✰✮ ✴✯❙✯✴ ❆❬✭✐✲t✰◆✮✪✭◆✰✶✮❪❂❢✭❆❬✭✐✲t✰◆✮✪✭◆✰✶✮❪ Dependences ( 1 , − 1 ) , ( 1 , 0 ) and ( 1 , 1 ) ✰❆❬✭✐✲t✰✶✰◆✮✪✭◆✰✶✮❪ ✰❆❬✭✐✲t✰✷✰◆✮✪✭◆✰✶✮❪✮❀ Live-out A [ T , ∗ ] (c) Array contracted to N+1 cells. Storage optimal! 4 / 29
Introduction Intra-Array Storage Optimization Problem Conflicts, Conflict Satisfaction Exploiting Inter-Array Reuse Opportunities A Global Unified Contracting A Particular Array ❢♦r✭t❂✶❀t❁❂◆❀✐✰✰✮ ❢♦r✭✐❂✶❀✐❁❂◆❀✐✰✰✮ ✴✯❙✯✴ ❆❬t✪✷✱✐❪❂❢✭❆❬✭t✲✶✮✪✷✱✐✲✶❪ ❢♦r✭t❂✶❀t❁❂◆❀✐✰✰✮ ✰❆❬✭t✲✶✮✪✷✱✐❪ ❢♦r✭✐❂✶❀✐❁❂◆❀✐✰✰✮ ✰❆❬✭t✲✶✮✪✷✱✐✰✶❪✮❀ ✴✯❙✯✴ ❆❬t✱✐❪❂❢✭❆❬t✲✶✱✐✲✶❪ ✰❆❬t✲✶✱✐❪ (b) Array contracted to size 2 × N ✰❆❬t✲✶✱✐✰✶❪✮❀ (a) 1-d stencil using N 2 storage ❢♦r✭t❂✶❀t❁❂◆❀✐✰✰✮ ❢♦r✭✐❂✶❀✐❁❂◆❀✐✰✰✮ ✴✯❙✯✴ ❆❬✭✐✲t✰◆✮✪✭◆✰✶✮❪❂❢✭❆❬✭✐✲t✰◆✮✪✭◆✰✶✮❪ Dependences ( 1 , − 1 ) , ( 1 , 0 ) and ( 1 , 1 ) ✰❆❬✭✐✲t✰✶✰◆✮✪✭◆✰✶✮❪ ✰❆❬✭✐✲t✰✷✰◆✮✪✭◆✰✶✮❪✮❀ Live-out A [ T , ∗ ] (c) Array contracted to N+1 cells. Storage optimal! 4 / 29
Introduction Intra-Array Storage Optimization Problem Conflicts, Conflict Satisfaction Exploiting Inter-Array Reuse Opportunities A Global Unified Contracting A Particular Array ❢♦r✭t❂✶❀t❁❂◆❀✐✰✰✮ ❢♦r✭✐❂✶❀✐❁❂◆❀✐✰✰✮ ✴✯❙✯✴ ❆❬t✪✷✱✐❪❂❢✭❆❬✭t✲✶✮✪✷✱✐✲✶❪ ❢♦r✭t❂✶❀t❁❂◆❀✐✰✰✮ ✰❆❬✭t✲✶✮✪✷✱✐❪ ❢♦r✭✐❂✶❀✐❁❂◆❀✐✰✰✮ ✰❆❬✭t✲✶✮✪✷✱✐✰✶❪✮❀ ✴✯❙✯✴ ❆❬t✱✐❪❂❢✭❆❬t✲✶✱✐✲✶❪ ✰❆❬t✲✶✱✐❪ (b) Array contracted to size 2 × N ✰❆❬t✲✶✱✐✰✶❪✮❀ (a) 1-d stencil using N 2 storage ❢♦r✭t❂✶❀t❁❂◆❀✐✰✰✮ ❢♦r✭✐❂✶❀✐❁❂◆❀✐✰✰✮ ✴✯❙✯✴ ❆❬✭✐✲t✰◆✮✪✭◆✰✶✮❪❂❢✭❆❬✭✐✲t✰◆✮✪✭◆✰✶✮❪ Dependences ( 1 , − 1 ) , ( 1 , 0 ) and ( 1 , 1 ) ✰❆❬✭✐✲t✰✶✰◆✮✪✭◆✰✶✮❪ ✰❆❬✭✐✲t✰✷✰◆✮✪✭◆✰✶✮❪✮❀ Live-out A [ T , ∗ ] (c) Array contracted to N+1 cells. Storage optimal! 4 / 29
Introduction Intra-Array Storage Optimization Problem Conflicts, Conflict Satisfaction Exploiting Inter-Array Reuse Opportunities A Global Unified Reuse Across Arrays - Image Processing Applications ★❞❡❢✐♥❡ ✐s❜♦✉♥❞✭✐✱❥✮ ✭✐❂❂✵✮⑤⑤✭✐❂❂✭◆✲✶✮✮ ⑤⑤✭❥❂❂✵✮⑤⑤✭❥❂❂✭◆✲✶✮✮ ❢♦r✭✐♥t ✐❂✵❀ ✐❁◆❀ ✰✰✐✮ ❢♦r✭✐♥t ❥❂✵❀ ❥❁◆✿ ✰✰❥✮ ✴✯❙✵✯✴ ❆✵❬✐✱❥❪❂ ✐s❜♦✉♥❞✭✐✱❥✮ ❄ ❛❬✐✱❥❪ ✿❛❬✐✱❥❪✰✭❛❬✐✲✶✱❥❪✰❛❬✐✰✶✱❥❪ ✰❛❬✐✱❥✲✶❪✰❛❬✐❪❬❥✰✶❪✮❀ S 0 : A 0 [ i , j ] → A [( i + 3 ) mod ( N + 2 ) , j mod N ] ❢♦r✭✐♥t ✐❂✵❀ ✐❁◆❀ ✰✰✐✮ ❢♦r✭✐♥t ❥❂✵❀ ❥❁◆✿ ✰✰❥✮ S 1 : A 1 [ i , j ] → A [( i + 1 ) mod ( N + 2 ) , j mod N ] ✴✯❙✶✯✴ ❆✶❬✐✱❥❪❂✐s❜♦✉♥❞✭✐✱❥✮ ❄ ❆✵❬✐✱❥❪ S 2 : A 2 [ i , j ] → A [( i − 1 ) mod ( N + 2 ) , j mod N ] ✿❆✵❬✐✱❥❪✰✭❆✵❬✐✲✶✱❥❪✰❆✵❬✐✰✶✱❥❪ ✰❆✵❬✐✱❥✲✶❪✰❆✵❬✐✱❥✰✶❪✮❀ (b) The storage mapping enabling inter-array reuse. Overall storage requirement is ❢♦r✭✐♥t ✐❂✵❀ ✐❁◆❀ ✰✰✐✮ reduced from 3N 2 to N 2 + N . ❢♦r✭✐♥t ❥❂✵❀ ❥❁◆✿ ✰✰❥✮ ✴✯❙✷✯✴ ❆✷❬✐✱❥❪❂✦✐s❜♦✉♥❞✭✐✱❥✮ ❄ ❆✶❬✐❪❬❥❪ ✿❆✶❬✐✱❥❪✰✭❆✶❬✐✲✶✱❥❪✰❆✶❬✐✰✶✱❥❪ ✰❆✶❬✐✱❥✲✶❪✰❆✶❬✐✱❥✰✶❪✮❀ (a) A 0 , A 1 are just intermediate arrays which are not live-out. 5 / 29
Introduction Intra-Array Storage Optimization Problem Conflicts, Conflict Satisfaction Exploiting Inter-Array Reuse Opportunities A Global Unified Reuse Across Arrays - Image Processing Applications ★❞❡❢✐♥❡ ✐s❜♦✉♥❞✭✐✱❥✮ ✭✐❂❂✵✮⑤⑤✭✐❂❂✭◆✲✶✮✮ ⑤⑤✭❥❂❂✵✮⑤⑤✭❥❂❂✭◆✲✶✮✮ ❢♦r✭✐♥t ✐❂✵❀ ✐❁◆❀ ✰✰✐✮ ❢♦r✭✐♥t ❥❂✵❀ ❥❁◆✿ ✰✰❥✮ ✴✯❙✵✯✴ ❆✵❬✐✱❥❪❂ ✐s❜♦✉♥❞✭✐✱❥✮ ❄ ❛❬✐✱❥❪ ✿❛❬✐✱❥❪✰✭❛❬✐✲✶✱❥❪✰❛❬✐✰✶✱❥❪ ✰❛❬✐✱❥✲✶❪✰❛❬✐❪❬❥✰✶❪✮❀ S 0 : A 0 [ i , j ] → A [( i + 3 ) mod ( N + 2 ) , j mod N ] ❢♦r✭✐♥t ✐❂✵❀ ✐❁◆❀ ✰✰✐✮ ❢♦r✭✐♥t ❥❂✵❀ ❥❁◆✿ ✰✰❥✮ S 1 : A 1 [ i , j ] → A [( i + 1 ) mod ( N + 2 ) , j mod N ] ✴✯❙✶✯✴ ❆✶❬✐✱❥❪❂✐s❜♦✉♥❞✭✐✱❥✮ ❄ ❆✵❬✐✱❥❪ S 2 : A 2 [ i , j ] → A [( i − 1 ) mod ( N + 2 ) , j mod N ] ✿❆✵❬✐✱❥❪✰✭❆✵❬✐✲✶✱❥❪✰❆✵❬✐✰✶✱❥❪ ✰❆✵❬✐✱❥✲✶❪✰❆✵❬✐✱❥✰✶❪✮❀ (b) The storage mapping enabling inter-array reuse. Overall storage requirement is ❢♦r✭✐♥t ✐❂✵❀ ✐❁◆❀ ✰✰✐✮ reduced from 3N 2 to N 2 + N . ❢♦r✭✐♥t ❥❂✵❀ ❥❁◆✿ ✰✰❥✮ ✴✯❙✷✯✴ ❆✷❬✐✱❥❪❂✦✐s❜♦✉♥❞✭✐✱❥✮ ❄ ❆✶❬✐❪❬❥❪ ✿❆✶❬✐✱❥❪✰✭❆✶❬✐✲✶✱❥❪✰❆✶❬✐✰✶✱❥❪ ✰❆✶❬✐✱❥✲✶❪✰❆✶❬✐✱❥✰✶❪✮❀ (a) A 0 , A 1 are just intermediate arrays which are not live-out. 5 / 29
Introduction Intra-Array Storage Optimization Problem Conflicts, Conflict Satisfaction Exploiting Inter-Array Reuse Opportunities A Global Unified Outline Introduction 1 Intra-Array Storage Optimization Problem 2 Conflicts, Conflict Satisfaction 3 Exploiting Inter-Array Reuse Opportunities 4 A Global Unified Array Space 5 Statement-Wise Storage Hyperplanes 6 Experimental Evaluation II 7 Summary 8 6 / 29
Recommend
More recommend