Compiler Development for the Openacc Programming Model Using the LLVM Compiler Infrastructure

Compiler Development for the Openacc Programming Model Using the LLVM Compiler Infrastructure

View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by University of Thessaly Institutional Repository Compiler development for the OpenACC programming model using the LLVM compiler infrastructure Ανάπτυξη μεταγλωττιστή για το μοντέλο προγραμματισμού OpenACC με χρήση της υποδομής μεταγλώττισης LLVM Εμμανουήλ Μαρούδας [email protected] Πανεπιστήμιο Θεσσαλίας Τμήμα Ηλεκτρολόγων Μηχανικών και Μηχανικών Υπολογιστών Βόλος, Οκτώβρης 2013 1 Institutional Repository - Library & Information Centre - University of Thessaly 09/12/2017 04:34:19 EET - 137.108.70.7 Author Emmanouil Maroudas Thesis Supervisors Christos Antonopoulos, Assistant Professor at University of Thessaly Nikos Bellas, Associate Professor at University of Thessaly University of Thessaly Department of Computer & Communication Engineering Volos, October 2013 2 Institutional Repository - Library & Information Centre - University of Thessaly 09/12/2017 04:34:19 EET - 137.108.70.7 Table of Contents Abstract......................................................................................................................................6 Περίληψη...................................................................................................................................7 Chapter 1....................................................................................................................................8 Introduction................................................................................................................................8 Chapter 2..................................................................................................................................11 Background..............................................................................................................................11 2.1 The OpenCL Standard...................................................................................................11 2.1.1 Execution Model....................................................................................................11 2.1.2 Memory Model......................................................................................................13 2.1.2.1 Synchronization.............................................................................................14 2.1.2.2 Memory Objects............................................................................................14 2.2 The OpenACC Programming Model............................................................................15 2.2.1 Execution Model...................................................................................................15 2.2.2 Memory Model......................................................................................................16 2.2.3 Directive Format....................................................................................................16 2.2.4 Conditional Compilation.......................................................................................17 2.2.5 Internal Control Variables......................................................................................17 2.2.6 Subarray Support...................................................................................................18 2.3 The LLVM Infrastructure..............................................................................................18 2.4 Clang Compiler - The LLVM Front end for C/C++......................................................18 2.4.1 Abstract Syntax Tree (AST)..................................................................................18 2.4.2 AST Context & AST Nodes...................................................................................18 2.4.3 RecursiveASTVisitor.............................................................................................19 2.4.4 LibTooling Library & Replacements Mechanism.................................................19 Chapter 3..................................................................................................................................20 ACCLL - OpenACC to OpenCL Transformation Tool............................................................20 3.1 Clang Internal Changes.................................................................................................22 3.2 Driver & Front end Support..........................................................................................22 3.3 Representation of Directives.........................................................................................22 3.3.1 Class DirectiveInfo................................................................................................22 3.3.2 Class ClauseInfo....................................................................................................22 3.3.3 Class Arg and Derived Classes..............................................................................23 3.3.4 Class AccStmt........................................................................................................23 3.4 Parser Support...............................................................................................................24 3.5 Semantic Checking Support..........................................................................................25 Chapter 4..................................................................................................................................27 Map OpenACC Constructs to OpenCL Structures & API Calls..............................................27 Chapter 5..................................................................................................................................29 External Transformation Tool..................................................................................................29 5.1 Transformation Stages...................................................................................................29 5.2 Input File Validation......................................................................................................30 5.3 Unraveling of the If Clause...........................................................................................31 3 Institutional Repository - Library & Information Centre - University of Thessaly 09/12/2017 04:34:19 EET - 137.108.70.7 5.4 Resolve Ambiguity of Parallelization Method..............................................................32 5.5 Data Transfers...............................................................................................................33 5.6 Kernel Preparation........................................................................................................37 5.7 Generation of OpenCL kernels and API calls...............................................................38 5.8 Formatting the Output...................................................................................................40 5.9 Runtime Support...........................................................................................................40 5.9.1 OpenACC Runtime Support..................................................................................41 5.9.2 ACCLL Runtime Library.......................................................................................41 5.10 Asynchronous Execution Model Details.....................................................................41 5.10.1 Blocking Execution.............................................................................................42 5.10.2 Asynchronous Execution and Synchronization...................................................42 Chapter 6..................................................................................................................................43 Evaluation & Testing...............................................................................................................43 Conclusion...............................................................................................................................46 A complete example: VectorAdd.............................................................................................47 OpenACC version...............................................................................................................47 OpenCL version (host program)..........................................................................................48 OpenCL version (device code – kernels)............................................................................52 Bibliography............................................................................................................................53 4 Institutional Repository - Library & Information Centre - University of Thessaly 09/12/2017 04:34:19 EET - 137.108.70.7 List of Figures Figure 1: OpenCL Platform Model..........................................................................................11 Figure 2: An example of NDRange index................................................................................12 Figure 3: OpenCL Memory Model..........................................................................................13 Figure 4: Stage data flow.........................................................................................................30 Figure 5: ACCLL components and data flow..........................................................................30 List of Tables Table 1: Work-item synchronization equivalent in OpenACC................................................14

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    55 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us