Skip to content

Roadmap

Gary Klimowicz edited this page Feb 5, 2019 · 9 revisions

Flang Roadmap and Backlog

What's New

(10.April.2018) The math intrinsic library libpgmath has been added and integrated with flang. Most math intrinsic functions are faster now. The new relaxed math intrinsics are available using the new option -frelaxed-math.

In-flight Projects

The following projects are actively being developed now.

Integrating LLVM 6.0

The LLVM 6.0.0 final release was recently announced. After a new branch of LLVM is created, the Flang forks of LLVM and Clang must be updated. Often, because flang does not use IRBuilder, flang must be updated to match any changes in the textual form of LLVM IR or its debug metadata.

Status 10.April.2018: The forked llvm and clang (flang-driver) are up-to-date with release 6.0. NVIDIA is testing flang + llvm 6.0 to see if old workarounds can be removed or if new issues have arisen.

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. Work is actively underway on this effort.

Debug Metadata Plan

Fortran 2008 pointers to inner procedures

Work is underway to support the new Fortran 2008 features. In Flang, pointers are generally represented as a pointer to data and a pointer to a descriptor. For pointers to inner procedures, the descriptor represents the closure of the procedure.

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). More work is underway, for example, SIMD and DECLARE SIMD are implemented as compiler hints to disable dependency checks and inline functions, respectively.

Clang is being updated to support OpenMP 4.5 TARGET offloading to a GPU. A team at NVIDIA is following the Clang model to add offload support to Flang.

libpgmath precise/fast/relaxed intrinsics library

Update the flang fork of LLVM to generate calls to the vector versions of libpgmath functions. This feature will be implemented with -veclib=PGMATH.

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

libpgmath precise/fast/relaxed intrinsics library

The current version libpgmath supports x86 and OpenPOWER. A generic implementation that uses libm to implement the math intrinsics would be useful.

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:

  • Pointers to inner procedures
  • DO CONCURRENT
  • BLOCK construct
  • SUBMODULEs
  • Coarrays
  • Intrinsics and intrinsics used as initializers

Current implementation status (10.April.2018) of Fortran 2008.

C++ Migration

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

The top priority here is to convert flang02 to the C-like subset of C++ so IRBuilder can replace printf.

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

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.