To: J3 J3/21-156 From: Gary Klimowicz Subject: Flang Liaison Report Date: 2021-June-21 Flang Open Source Fortran Report ================================ Flang is an open source compiler for Fortran, sponsored by the US Department of Energy Exascale Computing Project (particularly, LLNL, Sandia and LANL). The goals of the project are to - Create a new, open source Fortran 2018 compiler with Apache 2.0 licensing, - that can be used for language and parallelization experimentation, - that exists as a peer in the LLVM community of languages, like Clang, - that can rely on LLVM code generation and parallelism support for CPUs and GPUs. There is a Slack workspace for Flang and a number of conference calls related to Flang development. - Flang biweekly sync call ("umbrella call") - Flang biweekly technical call - "Classic Flang" biweekly call - Flang/Clang driver refactoring call - OpenMP and OpenMP IR weekly call (refactor for clang and flang) - OpenACC biweekly call for upstreaming work to LLVM Details can be found on the Getting Involved page http://flang.llvm.org/docs/GettingInvolved.html. The New LLVM Flang Compiler --------------------------- The new front-end is available at https://github.com/llvm/llvm-project (the LLVM monorepo) in the flang/ directory. As of LLVM 12, it will be a full-fledged member of the LLVM projects. LLVM Flang is being developed under the Apache 2.0 license with LLVM exceptions (the same as LLVM, Clang, OpenMP, etc.). Recent efforts have concentrated on - upstreaming the lowering code from the 'fir-dev' branch to LLVM 'main' - adding Fortran 95 semantics - adding intrinsics, including folding and runtime support - creating a new driver program to replace the original temporary driver - OpenMP semantics and runtime - fixing issues identified from test cases The current state of LLVM Flang compiler is - written in modern C++ following LLVM conventions - over 200,000 lines of code, tests and scripts - parses all of Fortran 2018 to abstract syntax trees (AST) - parses OpenMP 4.5 and some OpenMP 5.0 - parses OpenACC 3.0 - defines a "Fortran Intermediate Representation" (FIR) based on LLVM's MLIR - can lower most OpenMP and OpenACC constructs - can compile and correctly run Fortran 77 programs (passes FCVS test suite) - has a new driver, refactored to share libraries with the clang driver Upcoming work includes - completing constraint checking and semantics for modern Fortran (344 checked of 606 constraints in F2018) - pull request of code required to support feature set (up through current F95 support) lowering to FIR - completing implementation of the runtime environment - completing implementation of intrinsics - continued work on the new driver - adding Fortran tests to LLVM suite (separate from Flang) Current ("Classic") Flang Compiler ---------------------------------- The initial version of Flang is derived from the PGI Fortran compiler, with some proprietary features removed (OpenACC support, inter-procedure analysis). It is the basis of the Arm and AMD commercial Fortran compilers. Recent improvements to Flang include - support for LLVM 10.0, LLVM 11.0 using the LLVM monorepo - support for LLVM 12.0 being added - performance improvements (function specialization, etc.) - enhanced Fortran debug metadata support - continuing to add support for Windows; investigating Arm Current Flang is available for Linux on x86-64, OpenPOWER and Arm processors, and is the basis of the Arm and AMD commercial Fortran compilers. Huawei has made significant contributions as well. Detailed status can be found in the biweekly call Google doc //docs.google.com/document/d/1-OuiKx4d7O6eLEJDBDKSRnSiUO2rgRR-c2Ga4AkrzOI