the polyhedral model beyond loops
play

The Polyhedral Model Beyond Loops Recursion Optimization and - PowerPoint PPT Presentation

The Polyhedral Model Beyond Loops Recursion Optimization and Parallelization Through Polyhedral Modeling Salwa Kobeissi & Philippe Clauss CAMUS team - Inria, University of Strasbourg, ICPS team - ICube Laboratory IMPACT - HIPEAC 2019,


  1. The Polyhedral Model Beyond Loops Recursion Optimization and Parallelization Through Polyhedral Modeling Salwa Kobeissi & Philippe Clauss CAMUS team - Inria, University of Strasbourg, ICPS team - ICube Laboratory IMPACT - HIPEAC 2019, January 23, 2019 Salwa Kobeissi & Philippe Clauss 1 / 24

  2. Outline 1 Introduction 2 Proposed Solution: From Recursive Functions to Optimized Loops 3 Case Studies 4 Conclusion and Perspectives Salwa Kobeissi & Philippe Clauss 2 / 24

  3. Introduction 1 Introduction 2 Proposed Solution: From Recursive Functions to Optimized Loops 3 Case Studies 4 Conclusion and Perspectives Salwa Kobeissi & Philippe Clauss 3 / 24

  4. Introduction Motivation There may be a huge gap between: • the statements in a program source code • the instructions actually performed by a given processor architecture Salwa Kobeissi & Philippe Clauss 4 / 24

  5. Introduction Motivation There may be a huge gap between: • the statements in a program source code • the instructions actually performed by a given processor architecture Efficient optimizations may be applied as soon as the actual runtime behavior has been discovered • dedicated to specific control structures & memory access patterns Salwa Kobeissi & Philippe Clauss 4 / 24

  6. Introduction Inspiration Apollo Memory Accesses Behavior at Runtime • Captures a polyhedral from statically non-polyhedral loops! behavior of loops at runtime • Applies the polyhedral model Salwa Kobeissi & Philippe Clauss 5 / 24

  7. Introduction Inspiration Apollo Memory Accesses Behavior at Runtime • Captures a polyhedral from statically non-polyhedral loops! behavior of loops at runtime • Applies the polyhedral model We apply the Apollo Approach for codes that are originally not loops! => recursions Salwa Kobeissi & Philippe Clauss 5 / 24

  8. Introduction Objectives We are interested in recursive functions: 1 whose runtime behavior can be modeled as polyhedral loops 2 where the structure of their modeling loops is constant regarding the input Salwa Kobeissi & Philippe Clauss 6 / 24

  9. Introduction Objectives We are interested in recursive functions: 1 whose runtime behavior can be modeled as polyhedral loops 2 where the structure of their modeling loops is constant regarding the input Objectives 1 optimizing recursive functions through transformation into affine loops 2 extending the scope of polyhedral optimizations to cover recursive functions Salwa Kobeissi & Philippe Clauss 6 / 24

  10. Proposed Solution: From Recursive Functions to Optimized Loops 1 Introduction 2 Proposed Solution: From Recursive Functions to Optimized Loops 3 Case Studies 4 Conclusion and Perspectives Salwa Kobeissi & Philippe Clauss 7 / 24

  11. Proposed Solution: From Recursive Functions to Optimized Loops Implementation Recursive Code Clang/LLVM Compiler The implementation Optimized LLVM IR & Call Graph consists of 3 main Recursion Analysis steps: Direct & Indirect Recursions Reachability Analysis & Impacting Instructions Recursive Control 1 Instrumented Recursive Code and Memory Behavior Analysis Execution New Input Trace of Basic Block IDs & Memory Adresses Nested Loop Recognition (NLR) Affine Loop Model Code Generation Iterative Code with Affine Loops Compiler & Polyhedral Optimization Optimized Recursive Code Salwa Kobeissi & Philippe Clauss 8 / 24

  12. Proposed Solution: From Recursive Functions to Optimized Loops Implementation Recursive Code Clang/LLVM Compiler The implementation Optimized LLVM IR & Call Graph consists of 3 main Recursion Analysis steps: Direct & Indirect Recursions Reachability Analysis & Impacting Instructions Recursive Control 1 Instrumented Recursive Code and Memory Behavior Analysis Execution 2 Recursion to Affine New Input Trace of Basic Block IDs & Memory Adresses Loop Nest Nested Loop Recognition (NLR) Transformation Affine Loop Model Code Generation Iterative Code with Affine Loops Compiler & Polyhedral Optimization Optimized Recursive Code Salwa Kobeissi & Philippe Clauss 8 / 24

  13. Proposed Solution: From Recursive Functions to Optimized Loops Implementation Recursive Code Clang/LLVM Compiler The implementation Optimized LLVM IR & Call Graph consists of 3 main Recursion Analysis steps: Direct & Indirect Recursions Reachability Analysis & Impacting Instructions Recursive Control 1 Instrumented Recursive Code and Memory Behavior Analysis Execution 2 Recursion to Affine New Input Trace of Basic Block IDs & Memory Adresses Loop Nest Nested Loop Recognition (NLR) Transformation Affine Loop Model Polyhedral 3 Code Generation Optimizations Iterative Code with Affine Loops Compiler & Polyhedral Optimization Optimized Recursive Code Salwa Kobeissi & Philippe Clauss 8 / 24

  14. Proposed Solution: From Recursive Functions to Optimized Loops Recursive Control and Memory Behavior Analysis Recursive Code Clang/LLVM Compiler Optimized LLVM IR & Call Graph Input: recursive code Recursion Analysis Direct & Indirect Recursions Apply classical LLVM optimization Reachability Analysis & Impacting Inst. passes Instrumented Recursive Code • promote memory to register Execution • simplify CFG New Input Trace of BB IDs & Memory Adresses • dead code elimination Nested Loop Recognition Affine Loop Model Output: optimized LLVM IR & call Code Generation graph Iterative Code with Affine Loops Compiler & Polyhedral Optimization Optimized Recursive Code Salwa Kobeissi & Philippe Clauss 9 / 24

  15. Proposed Solution: From Recursive Functions to Optimized Loops Recursive Control and Memory Behavior Analysis Recursive Code Input: optimized IR & call graph Clang/LLVM Compiler Optimized LLVM IR & Call Graph Recursion Analysis Direct & Indirect Recursions main Reachability Analysis & Impacting Inst. Instrumented Recursive Code h f Execution New Input Trace of BB IDs & Memory Adresses g Nested Loop Recognition j k i Affine Loop Model Code Generation Iterative Code with Affine Loops Output: direct & indirect Compiler & Polyhedral Optimization recursions Optimized Recursive Code Salwa Kobeissi & Philippe Clauss 9 / 24

  16. Proposed Solution: From Recursive Functions to Optimized Loops Recursive Control and Memory Behavior Analysis Recursive Code Input: direct & indirect recursions Clang/LLVM Compiler Optimized LLVM IR & Call Graph Recursion Analysis Direct & Indirect Recursions main Reachability Analysis & Impacting Inst. Instrumented Recursive Code h f Execution New Input Trace of BB IDs & Memory Adresses g Nested Loop Recognition j k i Affine Loop Model Code Generation Iterative Code with Affine Loops Output: instrumented recursive Compiler & Polyhedral Optimization code Optimized Recursive Code Salwa Kobeissi & Philippe Clauss 9 / 24

  17. Proposed Solution: From Recursive Functions to Optimized Loops Recursive Control and Memory Behavior Analysis Recursive Code Clang/LLVM Compiler Input: Trace of the program execution : Optimized LLVM IR & Call Graph Basic Block IDs & Memory Addresses Recursion Analysis Nested Loop Reconginition (NLR) Direct & Indirect Recursions algorithm applications: Reachability Analysis & Impacting Inst. 1 program behavior modeling Instrumented Recursive Code for any measured quantity Execution New Input Trace of BB IDs & Memory Adresses such as memory accesses Nested Loop Recognition (NLR) 2 execution trace compressing Affine Loop Model 3 value prediction Code Generation (ketterlin & Clauss, GGO 2008) Iterative Code with Affine Loops Output: Affine Loop Model Compiler & Polyhedral Optimization Optimized Recursive Code Salwa Kobeissi & Philippe Clauss 9 / 24

  18. Proposed Solution: From Recursive Functions to Optimized Loops Recursion to Affine Loop Nest Transformation Recursive Code Clang/LLVM Compiler Optimized LLVM IR & Call Graph Input: Affine loop model Recursion Analysis Direct & Indirect Recursions Direct & Indirect Recursions 1 Extract NLR resulting loop Reachability Analysis & Impacting Inst. nests structures Instrumented Recursive Code 2 Construct loops in the LLVM IR Execution using: New Input Trace of BB IDs & Memory Adresses • Instrumented basic blocks • Interpolated memory Nested Loop Recognition Affine Loop Model addresses Code Generation Output: Iterative code with affine loops Iterative Code with Affine Loops Compiler & Polyhedral Optimization Optimized Recursive Code Salwa Kobeissi & Philippe Clauss 10 / 24

  19. Proposed Solution: From Recursive Functions to Optimized Loops Polyhedral Optimizations Recursive Code Clang/LLVM Compiler Optimized LLVM IR & Call Graph Recursion Analysis Input: Iterative code with affine loops Direct & Indirect Recursions Direct & Indirect Recursions Reachability Analysis & Impacting Inst. • Apply LLVM optimization Instrumented Recursive Code passes Execution • Use polly LLVM polyhedral New Input Trace of BB IDs & Memory Adresses optimizer (Grosser et al., PPL 2012) Nested Loop Recognition Affine Loop Model Output: Optimized recursive code Code Generation Iterative Code with Affine Loops Compiler & Polyhedral Optimization Optimized Recursive Code Salwa Kobeissi & Philippe Clauss 11 / 24

  20. Case Studies 1 Introduction 2 Proposed Solution: From Recursive Functions to Optimized Loops 3 Case Studies 4 Conclusion and Perspectives Salwa Kobeissi & Philippe Clauss 12 / 24

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