To: J3 J3/21-133 From: Gary Klimowicz Subject: Flang Open Source Liaison Report Date: 2021-March-03 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. 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. No contributor license agreement is needed to contribute to LLVM Flang, which is being developed under the Apache 2.0 license with LLVM exceptions (the same as LLVM and Clang). The current state of LLVM Flang compiler is - written in modern C++ following LLVM conventions - over 183,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" based on LLVM's MLIR; this work is being upstreamed into LLVM - can lower most OpenMP and OpenACC constructs - can compile and correctly run Fortran 77 programs (passes FCVS test suite) - new driver being developed for Flang Upcoming work includes - completing constraint checking and semantics for modern Fortran - continuing merge of FIR dialect definitions; starting on operations - completing definition of the runtime environment - implementation of runtime - continued work on the new driver - adding Fortran tests to LLVM suite (separate from Flang) Current Flang Compiler ---------------------- The initial version of Flang is derived from the PGI Fortran compiler, with some proprietary features removed (OpenACC support, inter-procedure analysis). Recent improvements to Flang include - many bug fixes and enhancements from the PGI compiler - support for LLVM 9.0 being phased out - support for LLVM 10.0, LLVM 11.0 using the LLVM monorepo - support for LLVM 12.0 being added - bug fixes (array initialization, etc.) - enhanced Fortran debug metadata support (adjustable, allocatable, assumed size, assumed rank arrays) - continuing to add support for Windows 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.