To: J3 J3/20-111 From: Gary Klimowicz Subject: Flang Open Source Liaison Report Date: 2020-February-24 Flang Open Source Fortran Report ================================ Flang is an open source compiler for Fortran, sponsored by the US Department of Energy (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. Flang has been accepted as a formal LLVM project as its Fortran compiler. The work that is being upstreamed to LLVM is the new "flang" compiler (formerly known as "f18"). There are now LLVM-hosted email lists for Flang. This version of Flang will ultimately replace the current Flang compiler after a period of transition where both compilers are supported. The old flang-dev and flang-announce mailing lists hosted at http://lists.flang-compiler.org/ are no longer in use. Please use the LLVM flang-dev (https://lists.llvm.org/cgi-bin/mailman/listinfo/flang-dev) and flang-commit (https://lists.llvm.org/cgi-bin/mailman/listinfo/flang-commits) email lists. There is a Slack channel, http://flang-compiler.slack.com/ for more interaction with the Flang community at large. NVIDIA hosts a biweekly half-hour conference call providing status updates on Flang. It is held every other Wednesday at 8:30 AM Pacific time (the next is March 4, 2020). Hal Finkel of Argonne National Laboratories hosts a biweekly Flang Community Technical call Mondays 8:30 AM Pacific Time on the weeks alternating with the above call. The next call is scheduled for February 24, 2020. There is a Google Doc with meeting agendas and minutes at https: //docs.google.com/document/d/1Z2U5UAtJ-Dag5wlMaLaW1KRmNgENNAYynJqLW2j2AZQ (line split due to line length restrictions). Recent topics have included: - More LLVM upstreaming status and discussions (2020-02-10) - LLVM upstreaming status and discussions (2020-01-27) - LLVM pre-merge activities (2020-01-13) - Various status updates (2019-12-16) - Feedback on tooling (Appentra) (2019-12-02) - Recap of the LLVM Developers Meeting (2019-11-04) The New LLVM Flang Compiler --------------------------- The older code base used to seed the initial Flang compiler was not going to meet the long-term goals of the project. The Flang community started a new project to rewrite the Fortran front-end in C++ to better align with the LLVM and Clang communities and to better leverage the existing tools and techniques from these communities. This effort is now receiving the bulk of the effort on Flang. This new front-end is available at https://github.com/flang-compiler/f18 until it can be moved to the LLVM monorepo repository (expected March 2020). All development is being done on the open source repository, and you can follow the pull request and review activity from the developers there. No contributor license agreement is needed to contribute to LLVM Flang, which is being developed under the Apache 2.0 license with LLVM extensions (the same as LLVM and Clang). The main focus of the community at large is the work needed to upstream Flang to LLVM. After initial review, it was felt that a number of changes needed to be completed before the project was ready to land in the new LLVM monorepo. These include such things as - Renaming files to end with ".cpp" instead of ".cc" - File locations in directories and directory naming - CMake changes to build in-tree - Use of LLVM data structures in place of std library data structures where appropriate - Adding doxygen comments - Porting the test library to LLVM's "lit" framework These efforts are largely being driven by Arm, and the project items can be found at https://github.com/orgs/flang-compiler/projects/8. The current state of LLVM Flang compiler is - written in modern C++ following LLVM conventions - parses all of Fortran 2018 to abstract syntax trees (AST) - implements preprocessing directives - implements nearly all semantic checks - defines a "Fortran Intermediate Representation" based on MLIR - started lowering to FIR - started implementation of I/O runtime - running existing test suites through Flang We have been taking contributions from other developers, including Arm, Ltd, AMD, the US National Labs and others. Upcoming work includes - completing semantic checks - completing lowering to FIR, OpenMP IR, LLVM IR - completing definition of the runtime environment - implementation of runtime - building up test suite 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). It was published on GitHub in May 2017 at github.com/flang-compiler, and consists of several subprojects (including the Flang driver and compiler itself, and changes to LLVM to support Fortran debug metadata to be upstreamed). The current compiler supports Fortran 2003 and some Fortran 2008 features. We have relicensed the current Flang compiler under the new Apache 2.0 with LLVM Exceptions license adopted by the LLVM community. This license change means that a contributor license agreement is no longer required to contribute to this Flang compiler. Recent improvements to Flang include - many bug fixes and enhancements from the PGI compiler; - support for LLVM 8.0. Flang is available for Linux on x86-64, OpenPOWER and Arm processors, and is the basis of the Arm commercial Fortran compiler. AMD has indicated their interest in adopting flang as well. Members of the community are also working on ports to Mac OS X and packages for OpenBSD and FreeBSD. We have opened up the development of the original Flang compiler to new committers and are putting in place appropriate validation mechanisms for pull requests from the community.