Flang support in LLVM (FLANG)
Introduction
Linaro and Linaro Members' are working on flang targeting AArch64 on Linux and Windows. Linux has had a head start in flang, so in general Linux support has been slightly ahead of Windows support. Therefore, part of our work is to bring Windows on Arm (WoA) support to the same level of parity as Linux. However, we also strive to improve flang in general, for any platform. Enabling Flang in LLVM is a big project with plenty of work for to go around.
General flang AArch64 enablement work
Fujitsu-specific bugs and feature improvement
Windows-specific work
https://linaro.atlassian.net/browse/WOA-47 (link may require special permissions to access)
Scope
Include flang in AArch64 releases for both Linux and Windows
Provide CI for flang for both Linux and Windows, running check-all and the llvm-test-suite
Test relevant open-source workloads with flang; add them to CI if license/resources permit
Fix bugs, add missing features as needed by the workloads that we choose to prioritize
Check flang’s integration with CMake and provide CI if necessary
Publish developer notes on how to generate a WoA binary
Help the flang community as much as possible (e.g. with upstreaming from fir-dev/classic-flang)
Project lead(s): @Carlos Seo
Project Contacts
Join the linaro-toolchain@ mailing list (archive)
Contact Carlos Seo for anything private or sensitive
Source Code
LLVM Buildbots CI
LLVM Releases
Upstream Wiki
Upstream Collaboration (Slack, Technical and Community calls etc)
Community Production-Ready Criteria and Linaro Goals
The LLVM community currently agrees that flang-new will be renamed to flang only when:
Make HLFIR the default Fortran IR (done)
Remove
-flang-experimental-execflag (done)Build and run SPEC CPU 2017 (done)
Full procedure pointers support (mostly done)
Most of the gfortran testsuite not crashing — special interest in fixing all the segmentation faults (done)
This happened in October 2024 and will be available in LLVM 20.
AArch64 enablement
We currently have full feature parity with x86_64 as of LLVM 19.
Support for trampoline intrinsics currently depend on compiler-rt and this dependency is planned to be removed when Flang has support for procedure pointers for internal procedures.
Linaro “production ready” criteria
In addition to the community criteria for renaming flang-new to flang, Linaro also considers that Flang will be production ready when:
Can build and run both SPEC CPU 2006 and 2017 (done)
Has debug information support (done)
Has Fortran 2008 support, except for coarrays
OpenMP support is stabilised (almost done)
Feature parity with x86 (done)
Performance is no slower than 25% compared to gfortran in SPEC CPU 2017 ‘rate’. (done)
Linaro development completion criteria
Based on the current state of the compiler, Linaro should declare this project completed when the following conditions are met:
Next-generation SPEC CPU is supported
As the next generation of SPEC CPU is close to release, Flang should be able to build it and correctly run all of its benchmarks in both ‘rate’ and ‘speed’ modes.
OpenMP 2.5+ essential features are supported
OpenMP is becoming increasingly important with AI, so we need to support at least:
OpenMP 2.5
Workshare
Reprivatisation
Reduction (arrays)
Threadprivate (variables) (done)
Copyin (variables) (done)
Numthreads (done)
Copyprivate (done)
Directives can contain comments
_OPENMPmacroomp_libmodule contains interfaceOpenMP runtime routines
OpenMP 3.x — community goal for LLVM 20
Task (mostly done, missing support for delayed execution of tasks)
Taskwait
taskyield