Skip to content

Roadmap

Gary Klimowicz edited this page May 24, 2019 · 9 revisions

Flang Roadmap and Backlog

What's New (24.May.2019)

LLVM 7.0

We've switched to LLVM 7 for flang and the flang-driver.

Fortran 2008 Features

We've implemented the following Fortran 2008 features:

  • SUBMODULE
  • DO CONCURRENT (serial implementation only)
  • Pointers to internal procedures passed as actual arguments
  • ERROR STOP

Fortran Debug Metadata

We've added Fortran debug metadata support for

  • COMMON blocks
  • Allocatable arrays and pointers
  • MODULE and SUBMODULE

Two of our patches for Fortran debug metadata generation have been upstreamed to LLVM. (We have one patch remaining.)

C++ Migration

Flang is written in C, not C++. This makes code sharing and reuse of LLVM components difficult.

We converted flang2 to the C-like subset of C++.

libpgmath precise/fast/relaxed intrinsics library

We have added libpgmath intrinsics library to Flang.

OpenMP 4.5 TARGET offload to GPUs and multi-core CPUs

Flang already implements most of OpenMP 4.5 for multi-core CPUs. This functionality is enabled by default with -fopenmp. It is implemented on top of the existing pre-4.5 OpenMP runtime API (kmpc).

NVIDIA is following the Clang 7.0 model to add offload support to Flang. This support can be enabled by building Flang with -DFLANG_OPENMP_GPU_NVIDIA=ON.

Bug fixes

We have fixed many Flang issues, and provided other bug fixes:

  • Fixes from the PGI Fortran compiler
  • Bugs related to structure constructors
  • Bugs related to finalizers
  • Fixes for OpenMP

See the GitHub Issues list for the current status on issues.

In-flight Projects

The following projects are actively being developed now.

F18 New Fortran Front-End

The new Fortran 2018 front-end is being developed entirely in open source.

The list of projects and tasks can be found on the F18 Projects page.

Integrating LLVM 8.0

The LLVM 8.0.0 final release was recently announced. Flang can be built with LLVM 7.0.1 and LLVM 8.0.

Status 24.May.2019: The forked llvm and flang-driver are up-to-date with release 8.0.

Better Fortran debugging information

By default, LLVM supports a rich set of debug metadata for C and C++. Some parts of Fortran map well to these meta data; other parts of Fortran are, for example, supported in DWARF, but there is no metadata maps to that DWARF. The flang fork of llvm implements several extensions for Fortran.

Debug Metadata Plan

C++ Migration

Flang2 has been migrated to the C-like subset of C++, but we have not yet replaced the use of printf with IRBuilder for generating LLVM IR.

Windows Port

Many pull requests are queued that enable Flang on Windows. These changes have been stalled by the lack of a Contributor License Agreement. Now that the CLAs are finished, the code owners and developers need to start integrating these patches.

Bug fixes

Bugs are tracked using GitHub Issues. NVIDIA continues to contribute bug fixes, both in response to GitHub issues and bug reports from its customers.

As of now, there's no indication in the GitHub Issue that someone is working on a particular issue.

Backlog

Fortran 2008 Features

Flang is a fairly complete Fortran 2003 compiler. Little work has been done to implement features of Fortran 2008 or Fortran 2018.

We have gotten input and feedback from various sources about the relative priority of Fortran 2008 features.

The current priority of the F2008 features is:

  • G0 edit descriptor
  • BACK optional argument on MAXLOC/MINLOC
  • BLOCK construct
  • Allocation of polymorphic variables
  • EXECUTE_COMMAND_LINE
  • Vector NORM2
  • Multiple sourced allocations in a single statement
  • Coarrays
  • Intrinsics and intrinsics used as initializers

The current implementation status (10.April.2018) can be found in the Fortran 2008 features list.

Replace printf with IRBuilder

A number of users and potential contributors have complained that flang IR generation is more difficult than it needs to be because IRBuilder is not used.

A good implementation of this change depends on converting flang02 to C++.

Monolithic Front-end

The front end is a large, monolithic C program. Functionally, flang is a good compiler. Its major data structures and intermediate forms are well documented. The base source code, from PGI, has been used in many many successful Fortran projects.

However, that said, Flang has shortcomings when compared to modern compilers:

  • LALR Parser has no hooks for tools
  • A monolithic C program without structured libraries
  • Written in C, not C++, making code sharing and reuse difficult
  • Error messages do not convey much context or detail compared to clang
  • AST is lowered early; not suitable for source-to-source translation
  • Missing Fortran 2008 and 2018 features
  • Difficult for new users to engage

It's been determined that the fastest way to resolve these issues is to rewrite the Fortran front-end.

See the F18 Project. This will ultimately replace the current Flang front-end with a modern C++ implementation of Fortran 2018.

Rework Obscure Option Handling

Flang configuration and options are built on -x flags and x bits. In the past, this style of option capture was commonplace; nowadays programmers expect well-named objects.

  • Source-code uses x bits instead of meaningful variable names
  • Command-line uses obscure -x flags instead of meaningful command-line options (in flang1 and flang2)

Upstream flang-driver Changes to Clang

The driver for flang is a modified version of clang. Changes to clang are in a forked repository, flang-compiler/flang-driver.

It would be good if the flang changes could be pushed upstream.

Investigate LLVM infrastructure libraries

LLVM has infrastructure classes that support, among other things, option handling and file systems.

MacOS Port

The PGI compiler runs on Mac. Porting flang to Mac should be relatively straightforward.

Documentation

Flang runtime descriptors, including array descriptors, are described in the file flang/runtime/flang/fioMacros.h.

This documentation could be expanded and written to be extracted with doxygen.