predic ve modeling in a polyhedral op miza on space
play

Predic've Modeling in a Polyhedral Op'miza'on Space - PowerPoint PPT Presentation

Predic've Modeling in a Polyhedral Op'miza'on Space Eunjung EJ Park 1 , Louis-Nol Pouchet 2 , John Cavazos 1 , Albert Cohen 3 , and P. Sadayappan 2


  1. Predic've ¡Modeling ¡ ¡ in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ Eunjung ¡“EJ” ¡Park 1 , ¡Louis-­‑Noël ¡Pouchet 2 , ¡John ¡Cavazos 1 , ¡ ¡ Albert ¡Cohen 3 , ¡and ¡P. ¡Sadayappan 2 ¡ ¡ 1 ¡ University ¡of ¡Delaware ¡ 2 ¡The ¡Ohio ¡State ¡University ¡ 3 ¡ALCHEMY ¡group, ¡INRIA ¡Saclay ¡-­‑ ¡Île-­‑de-­‑France ¡ ¡ April ¡5 th , ¡2011 ¡ IEEE/ACM ¡Symposium ¡on ¡Code ¡Genera'on ¡and ¡Op'miza'on ¡ Chamonix, ¡France ¡

  2. 4/7/11 ¡ Predic've ¡Modeling ¡in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ 1 ¡ Do ¡you ¡want ¡good ¡performance? ¡ • Op'mizing ¡loops ¡is ¡crucial! ¡ • Difficulty ¡on ¡finding ¡good ¡loop ¡op'miza'ons ¡ – Complex ¡interplay ¡between ¡hardware ¡resources ¡ – Conflicts ¡between ¡op'miza'on ¡strategies ¡ – Large ¡compiler ¡op'miza'on ¡space ¡ • Any ¡Solu'ons? ¡ – Using ¡itera've ¡compila'on ¡ – Using ¡polyhedral ¡framework ¡

  3. 4/7/11 ¡ Predic've ¡Modeling ¡in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ 2 ¡ Why ¡polyhedral ¡framework? ¡ • Advantages ¡over ¡standard ¡compiler ¡framework ¡ – Good ¡expressiveness ¡ – Complex ¡op'miza'on ¡sequences ¡ – Loop ¡'ling ¡of ¡imperfectly ¡nested ¡loop ¡ • Very ¡large ¡op'miza'on ¡space ¡ Our ¡Solu?on ¡ Let’s ¡take ¡advantages ¡of ¡ Polyhedral ¡Framework ¡ and ¡ Itera?ve ¡Compila?on! ¡

  4. 4/7/11 ¡ Predic've ¡Modeling ¡in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ 3 ¡ Contribu?ons ¡of ¡this ¡paper ¡ • Power ¡of ¡three ¡approaches ¡ – Expressiveness ¡from ¡polyhedral ¡framework ¡ – Performance ¡predic'on ¡by ¡machine ¡learning ¡ – Itera've ¡compila'on ¡ • Build ¡predic'on ¡model ¡for ¡polyhedral ¡op'miza'on ¡ primi'ves ¡ • Reduce ¡number ¡of ¡evalua'ons, ¡achieve ¡good ¡ performance ¡ ¡

  5. 4/7/11 ¡ Predic've ¡Modeling ¡in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ 4 ¡ Polyhedral ¡Compiler ¡Framework ¡ Input ¡Program ¡ PoCC : ¡source-­‑to-­‑source ¡itera've ¡and ¡ ¡ model-­‑driven ¡polyhedral ¡compiler ¡ Extract ¡ Build ¡Legal ¡ Source ¡Code ¡ Polyhedral ¡ Transforma'ons ¡ Genera'on ¡ Representa'on ¡ Transformed ¡Program ¡by ¡ Polyhedral ¡Op'miza'ons ¡

  6. 4/7/11 ¡ Predic've ¡Modeling ¡in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ 5 ¡ Polyhedral ¡Op?miza?on ¡Space ¡ Encode ¡in ¡fixed ¡length ¡vector ¡ T ¡ Op'miza'ons ¡Handled ¡in ¡each ¡step ¡ -­‑ ¡Fusion/Distribu'on/Code ¡Mo'on ¡ Fusion/Distribu'on ¡ Compute ¡a ¡schedule ¡(Pluto) ¡ -­‑ ¡Auto ¡Paralleliza'on, ¡Tileability ¡ -­‑ ¡Vectoriza'on ¡ Modify ¡schedule ¡ Individually ¡Tile ¡Loops ¡ -­‑ ¡Tiling ¡ 864 ¡possible ¡ points ¡ Process ¡all ¡other ¡op'miza'ons ¡ -­‑ ¡OpenMP ¡Pragma, ¡Unrolling ¡ Final ¡Search ¡ Space ¡

  7. 4/7/11 ¡ Predic've ¡Modeling ¡in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ 6 ¡ Finding ¡Best ¡Speedup ¡is ¡Hard ¡ 14 Actual Low ¡density ¡of ¡best ¡points ¡in ¡actual ¡curve ¡ Performance ¡Improvement ¡over ¡Baseline ¡ 12 10 Performance Imp. 8 6 4 2 1 ¡ 0 Op'miza'on ¡sequences ¡applied ¡(sorted ¡by ¡actual ¡speedup) ¡ 0 50 100 150 200 250 300 350

  8. 4/7/11 ¡ Predic've ¡Modeling ¡in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ 7 ¡ Predic?on ¡Model ¡ • Model ¡Descrip'on ¡ • Building ¡Model ¡ – Model ¡Construc'on ¡ – Model ¡Usage ¡

  9. 8 ¡ 4/7/11 ¡ Predic've ¡Modeling ¡in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ Speedup ¡Predic?on ¡Model ¡ Performance Counter � Characteristics � Optimizations � … … Predicted speedup of optimizations over a baseline �

  10. 4/7/11 ¡ Predic've ¡Modeling ¡in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ 9 ¡ Building ¡Model ¡ • Leave-­‑one-­‑out ¡cross ¡valida'on ¡ for ¡i-­‑th ¡program ¡where ¡i=1 ¡to ¡N ¡ do ¡ ¡ ¡Train ¡a ¡model ¡on ¡N-­‑1 ¡programs ¡excluding ¡i-­‑th ¡program ¡ ¡Test ¡the ¡model ¡on ¡the ¡i-­‑th ¡program ¡lek ¡out ¡ ¡ done ¡

  11. 4/7/11 ¡ Predic've ¡Modeling ¡in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ 10 ¡ Model ¡Construc?on ¡ • Collect ¡dynamic ¡behavior ¡for ¡a ¡program ¡ Backend ¡ Compiler ¡ 1 ¡Program ¡ ICC ¡ Performance ¡Counters ¡ ¡ for ¡the ¡program ¡ … ¡ Underlying ¡Architecture ¡ Performance ¡Counters ¡include ¡total ¡number ¡of ¡ -­‑ accesses ¡and ¡misses ¡in ¡all ¡levels ¡of ¡cache ¡and ¡TLB ¡ -­‑ stall ¡cycles ¡ -­‑ vector ¡instruc'ons ¡ -­‑ issued ¡instruc'ons ¡

  12. 4/7/11 ¡ Predic've ¡Modeling ¡in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ 11 ¡ Model ¡Construc?on ¡ • Now ¡do ¡this ¡for ¡N-­‑1 ¡programs ¡ … ¡ … ¡ Backend ¡ … ¡ Compiler ¡ … ¡ ICC ¡ Performance ¡Counters ¡ ¡ for ¡N-­‑1 ¡programs ¡ N-­‑1 ¡Programs ¡ … ¡ Underlying ¡Architecture ¡

  13. 4/7/11 ¡ Predic've ¡Modeling ¡in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ 12 ¡ Model ¡Construc?on ¡ • Run ¡transformed ¡programs, ¡and ¡get ¡speedups ¡ Baseline ¡(-­‑fast) ¡ Backend ¡ Compiler ¡ … ¡ ICC ¡ One ¡Program ¡ … ¡ … ¡ Speedup ¡over ¡ Primi've ¡Sequences( T ) ¡ baseline ¡ Primi've ¡sequences ¡and ¡ their ¡speedup ¡over ¡baseline ¡ Polyhedral ¡ Compiler ¡ Transformed ¡Polyhedral ¡Programs ¡ ¡ for ¡the ¡one ¡Program ¡

  14. 4/7/11 ¡ Predic've ¡Modeling ¡in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ 13 ¡ Model ¡Construc?on ¡ • Now ¡do ¡this ¡for ¡N-­‑1 ¡programs ¡ … ¡ Baseline ¡(-­‑fast) ¡ … ¡ Backend ¡ Compiler ¡ … ¡ ICC ¡ … ¡ … ¡ … ¡ … ¡ N-­‑1 ¡Programs ¡ Primi've ¡sequences ¡(T) ¡ Speedup ¡over ¡ … ¡ baseline ¡ Primi've ¡sequences ¡and ¡ Polyhedral ¡ their ¡speedup ¡over ¡baseline ¡ Compiler ¡ Transformed ¡Programs ¡ ¡ from ¡each ¡of ¡N-­‑1 ¡Programs ¡

  15. 4/7/11 ¡ Predic've ¡Modeling ¡in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ 14 ¡ Model ¡Construc?on ¡ Primi've ¡sequences ¡and ¡ Performance ¡Counters ¡ ¡ their ¡speedup ¡over ¡baseline ¡ for ¡a ¡program ¡ … ¡ … ¡ … ¡ Linear ¡Regression ¡/ ¡Support ¡Vector ¡Machine ¡(SVM) ¡ … … Generated ¡model ¡ ¡ for ¡a ¡given ¡machine ¡

  16. 4/7/11 ¡ Predic've ¡Modeling ¡in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ 15 ¡ Model ¡Construc?on ¡ Primi've ¡sequences ¡and ¡their ¡speedup ¡ Performance ¡Counters ¡ ¡ over ¡baseline ¡for ¡N-­‑1 ¡programs ¡ for ¡N-­‑1 ¡programs ¡ … ¡ … ¡ … ¡ … ¡ … ¡ … ¡ … ¡ … ¡ … ¡ Linear ¡Regression ¡/ ¡Support ¡Vector ¡Machine ¡(SVM) ¡ … … Generated ¡model ¡ ¡ for ¡a ¡given ¡machine ¡

  17. 4/7/11 ¡ Predic've ¡Modeling ¡in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ 16 ¡ Using ¡Model ¡ Primi've ¡Sequences ¡ … ¡ Performance ¡ ¡ Counters ¡ ¡ Backend ¡ … ¡ Compiler ¡ … ¡ Nth ¡Program ¡ ICC ¡-­‑fast ¡ (one ¡lek ¡out) ¡ … … Generated ¡model ¡ ¡ for ¡a ¡given ¡machine ¡ We ¡can ¡use ¡predicted ¡speedups ¡in ¡two ¡ways ¡ Predicted ¡speedup ¡for ¡ -­‑ Non-­‑itera've ¡Fashion ¡ each ¡sequences ¡ -­‑ Itera've ¡Fashion ¡

  18. 4/7/11 ¡ Predic've ¡Modeling ¡in ¡a ¡Polyhedral ¡Op'miza'on ¡Space ¡ 17 ¡ Experimental ¡Configura?on ¡ • Hardware ¡configura'on ¡ – Nehalem ¡ • Intel ¡Xeon ¡E5620 ¡2.4GHz, ¡2 ¡sockets ¡4 ¡cores, ¡16 ¡H/W ¡threads, ¡L3 ¡12MB ¡ – R900/Dunnington ¡ • Intel ¡Xeon ¡E7450 ¡2.4GHz, ¡4 ¡sockets ¡6 ¡cores, ¡24 ¡H/W ¡threads, ¡L3 ¡12MB ¡ • Sokware ¡Configura'on ¡ – Backend ¡compiler: ¡ICC ¡ ¡ – Baseline: ¡ICC ¡with ¡–fast, ¡single ¡threaded ¡(no ¡auto-­‑par) ¡ – Machine ¡learning ¡framework: ¡Weka ¡v3.6.2 ¡ • Linear ¡Regression/SVM ¡(SMOReg) ¡ – Benchmark: ¡PolyBench ¡2.0 ¡(28 ¡different ¡kernels ¡and ¡applica'ons) ¡

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