Leveraging OpenMP 4.5 Support in CLANG for Fortran

2017 
Modern computer systems are increasingly parallel and heterogeneous, and the demand for high-level programming interfaces for such systems is rapidly growing. OpenMP 4.0 extended its CPU-based directives to support device offloading. Programmers can now simply insert directives to identify computations and data to be offloaded. Compilers/runtime with OpenMP support then manage code translation and data transfers. While there are various ongoing efforts to support OpenMP device offloading for Fortran as well as C/C++, the most widely used open-source compiler, LLVM, supports C/C++ only. In this paper, we describe our project, XLFLANG, that aims to build an OpenMP Fortran compiler by bridging an existing Fortran front-end and LLVM C/C++ front-end (CLANG). We translate output from IBM XL Fortran front-end into CLANG AST and feed it to CLANG where OpenMP directives are lowerized to LLVM IR. This approach allowed us to reuse CLANG code generation and LLVM optimizations while handling Fortran-specific features in our XLFLANG. However, language dependences of CLANG AST especially with OpenMP directive representations pose unique challenges both in correctness and performance aspects. We addressed these challenges to generate CLANG AST, taking care to expose possible optimization opportunities. We were able to map all major OpenMP offloading directives/clauses from Fortran to CLANG AST, and our evaluation shows the resulting AST does not add significant overheads or interfere with later optimizations.
    • Correction
    • Source
    • Cite
    • Save
    • Machine Reading By IdeaReader
    6
    References
    0
    Citations
    NaN
    KQI
    []