[Flang-dev] RFC: lowering Fortran AST to an IR

Troy Johnson troyj at cray.com
Thu Oct 25 10:43:03 EDT 2018

We weren't aware of any of these f18 documents.  We'll read them over and get back to you.

From: flang-dev <flang-dev-bounces at lists.flang-compiler.org> on behalf of Stephen Scalpone <sscalpone at nvidia.com>
Sent: Wednesday, October 24, 2018 5:52:06 PM
To: xoviat; Eric Schweitz (PGI); flang-dev at lists.flang-compiler.org
Subject: Re: [Flang-dev] RFC: lowering Fortran AST to an IR

The Fortran-to-Fortran rendering is a way to test the correctness of the parser (and unparser).  That code is a model for how to walk the parse tree; however, it is not a prototype for a formatter or similar tool.  The plan is to lower the F18 AST to a control flow graph and then directly to LLVM IR.   The PGI ILM and ILL will be abandoned.

For the runtime libraries, we are thinking:

- For OpenMP, continue to use the llvm implementation of OpenMP.  Right now, we’re thinking that the implementation of outlining and lowering to KMPC calls will happen in F18 just before lowering to LLVM IR.

- Preserve libpgmath for math intrinsics.  The interface between the compiler and library might change – perhaps using more llvm intrinsics or perhaps using the scheme described by Francesco at the 2018 fall LLVM developer’s meeting.

- Write new routines for derived types, allocatables, memory management and the related intrinsics.  The existing Flang runtime uses a runtime model and descriptors based on HPF.  You can see the proposal for F18 descriptors on github in https://github.com/flang-compiler/f18/blob/master/documentation/RuntimeDescriptor.md

- For i/o, we’re thinking we’ll refactor and reuse the current Flang i/o runtime.

From: flang-dev <flang-dev-bounces at lists.flang-compiler.org> on behalf of xoviat <xoviat at gmail.com>
Date: Wednesday, October 24, 2018 at 1:27 PM
To: "Eric Schweitz (PGI)" <eric.schweitz at pgroup.com>, "flang-dev at lists.flang-compiler.org" <flang-dev at lists.flang-compiler.org>
Subject: Re: [Flang-dev] RFC: lowering Fortran AST to an IR

Hello Eric:

The F18 project seems to currently be a pure C++ project without any meaningful runtime or math libraries. Is the plan to eventually copy the f18 tool into the flang source tree, or to copy the flang source runtime libraries into the f18 source tree? I assume that you’ll need to depend on pgmath, as I don’t think that rewriting the math library in C++ will be an effective use of time.

As I understand matters, f18 currently transforms Fortran to Fortran; is this correct? Are you going to lower to the PG MIR eventually (and re-use flang2) or replace flang2 completely?


From: Eric Schweitz (PGI)<mailto:eric.schweitz at pgroup.com>
Sent: Wednesday, October 24, 2018 2:42 PM
To: flang-dev at lists.flang-compiler.org<mailto:flang-dev at lists.flang-compiler.org>
Subject: [Flang-dev] RFC: lowering Fortran AST to an IR

The f18 project has a high-level design document out for several months on an intermediate representation for lowering and optimizing Fortran ASTs. The document can be found here: https://bit.ly/2q9IRaQ

Some context for this document can be found in the github documentation at: https://github.com/flang-compiler/f18/tree/master/documentation

Of particular note:

* Parsing: https://bit.ly/2ERlXyO

* Semantics: https://bit.ly/2CAybcB

* Label Resolution: https://bit.ly/2PlXQfP

The purpose of the f18 CFG will be to lower Fortran surface syntax into an semantically clean operational structure amenable to high-level transformations and further lowering into LLVM-IR.

As the project continues to move forward, we would like to know of if there are any relevant thoughts, concerns, or questions.



This email message is for the sole use of the intended recipient(s) and may contain confidential information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.flang-compiler.org/pipermail/flang-dev_lists.flang-compiler.org/attachments/20181025/98969e20/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 149 bytes
Desc: image001.png
URL: <http://lists.flang-compiler.org/pipermail/flang-dev_lists.flang-compiler.org/attachments/20181025/98969e20/attachment-0001.png>

More information about the flang-dev mailing list