<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The first patch was merged last week and I have just opened a new pull request with the actual FIR implementation:
<a href="https://github.com/flang-compiler/f18/pull/1035">https://github.com/flang-compiler/f18/pull/1035</a><o:p></o:p></p>
<p class="MsoNormal">Feel free to join the review !<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Note that you will need to use an LLVM version with MLIR to build this PR. Otherwise, I have taken out the in-tree builds configurations from this patch (since Pat is working on that), so the cmake changes are minimal.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Jean<o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> David Truby <David.Truby@arm.com> <br>
<b>Sent:</b> Thursday, February 13, 2020 6:14 PM<br>
<b>To:</b> Jean Perier <jperier@nvidia.com><br>
<b>Cc:</b> Mehdi AMINI <joker.eph@gmail.com>; flang-dev@lists.llvm.org<br>
<b>Subject:</b> Re: [flang-dev] RFC: Merging FIR<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<table class="MsoNormalTable" border="1" cellspacing="5" cellpadding="0" style="background:#FFEB9C">
<tbody>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><b><span style="font-size:7.5pt;font-family:"Verdana",sans-serif;color:black">External email: Use caution opening links or attachments</span></b><span style="font-size:7.5pt;font-family:"Verdana",sans-serif;color:black">
</span><o:p></o:p></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi Jean, <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I’ve opened a PR to add libz-dev to the drone files. However, drone still fails randomly due to out of memory errors periodically, so I’m not sure how useful it’ll be going forwards.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">David Truby<o:p></o:p></p>
<div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On 13 Feb 2020, at 15:20, Jean Perier via flang-dev <<a href="mailto:flang-dev@lists.llvm.org">flang-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Thanks Mehdi, I will do so in the next PR (it should be MLIR related).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I believe all the comments of the first PR have now been addressed/replied.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">The last commits have added some tests and have an actual link dependency to LLVM (need LLVMSupport library). This broke the<span class="apple-converted-space"> </span><a href="http://cloud.drone.io/"><span style="color:purple">cloud.drone.io</span></a><span class="apple-converted-space"> </span>integration
tests at link time for clang builds.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">It seems the LLVM package of clang builds depends on zlib that is not installed (“ld.lld: error: unable to find library -lz”)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">@David Turby, could you install `<span style="font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729;background:white">libz-dev</span>` on amd64-clang and arm64-clang or change llvm to a version version that does not depend upon
zlib ?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Jean<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<div>
<p class="MsoNormal"><b>From:</b><span class="apple-converted-space"> </span>Mehdi AMINI <<a href="mailto:joker.eph@gmail.com"><span style="color:purple">joker.eph@gmail.com</span></a>><span class="apple-converted-space"> </span><br>
<b>Sent:</b><span class="apple-converted-space"> </span>Saturday, February 8, 2020 4:34 AM<br>
<b>To:</b><span class="apple-converted-space"> </span>Jean Perier <<a href="mailto:jperier@nvidia.com"><span style="color:purple">jperier@nvidia.com</span></a>><br>
<b>Cc:</b><span class="apple-converted-space"> </span><a href="mailto:flang-dev@lists.llvm.org"><span style="color:purple">flang-dev@lists.llvm.org</span></a>; River Riddle <<a href="mailto:riddleriver@gmail.com"><span style="color:purple">riddleriver@gmail.com</span></a>><br>
<b>Subject:</b><span class="apple-converted-space"> </span>Re: [flang-dev] RFC: Merging FIR<o:p></o:p></p>
</div>
</div>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<table class="MsoNormalTable" border="1" cellspacing="5" cellpadding="0" style="background:#FFEB9C;background-position:initial initial;background-repeat:initial initial">
<tbody>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<div>
<p class="MsoNormal"><b><span style="font-size:7.5pt;font-family:"Verdana",sans-serif">External email: Use caution opening links or attachment<span style="color:black">s</span></span></b><o:p></o:p></p>
</div>
</td>
</tr>
</tbody>
</table>
<div>
<p class="MsoNormal"><span style="color:white"> </span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">Hi,<span class="apple-converted-space"> </span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">This is super exciting :)<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">Feel free to CC River Riddle and myself on the PR!<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">We're interested to keep an eye on it from the perspective of the future maintenance when we're in the same repo (in the sense that MLIR Core changes will take care of updating FIR API usages and tests).<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">Cheers,<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">-- <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">Mehdi<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">On Tue, Jan 28, 2020 at 1:24 PM Jean Perier via flang-dev <<a href="mailto:flang-dev@lists.llvm.org"><span style="color:purple">flang-dev@lists.llvm.org</span></a>> wrote:<o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal">Hello everyone,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">This RFC proposes the process for moving FIR from its experiment branch to the flang mainline branch.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">FIR is a dialect of MLIR. The adoption and evolution of both of these IRs has been discussed in many forums and generally met with acceptance and enthusiasm.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">MLIR, since its unveiling in April 2019, and its adoption as an LLVM subproject late 2019, has been a rapidly evolving target. Such evolution is expected and should not be read as a criticism. The FIR experimental branch started as an
exploration to gauge the suitability of MLIR as an IR for Fortran, and, as positive result accrued, this branch evolved into the work that we propose to upstream to flang.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Because the FIR branch started as an experiment branch, and because it has been chasing MLIR changes, the complete commit history is not of particular value. Also, because the sum total of the work as it stands is too large to be properly
reviewed in one pull request, the patches will be presented as a series of incremental changes, each freestanding and logically organized.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">The actual series of patches will depend on review comments; however, currently, the rough organization is like this:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">* Add clang-format files for FIR source code (MLIR style)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">* Add ASTBuilder structure to help lowering the parse-tree<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">The ASTBuilder structure is a transient data structure that<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">is meant to be built from the parse tree just before lowering to<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">FIR and that will be deleted just afterwards. It is not meant to perform<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">optimization analysis and transformations. It only provides temporary<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">information, such as label target information or parse tree parent nodes,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">that is meant to be used to lower the parse tree structure into<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">FIR operations.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">A pretty printer is available to visualize this data structure.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">* Finish adding CMake files to build f18<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- Add cmake/modules files<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- Update f18 tools CMakeLists.txt<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- Update README.md with build instructions<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- Add a Version.h and<span class="apple-converted-space"> </span><a href="http://version.inic.in/" target="_blank"><span style="color:purple">Version.inic.in</span></a><span class="apple-converted-space"> </span>files for flang<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- These CMake files are temporary; better versions are under development<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">* Add Doxygen configuration to flang<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">* Add Fortran IR (FIR) MLIR dialect implementation<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Adds FIR library that implements an MLIR dialect to which Fortran<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">parse-tree will be lowered to.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">FIR is documented in FIRLangRef.md added with this commit.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">* Add AbstractConverter interface and implement lowering of types to FIR<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- Add the AbstractConverter class that provides an interface to<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">lower expressions and types but does not provide any implementation.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- Add an implementation of lowering of front-end types to FIR types.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- Add lowering of parser::CharBlock to mlir::Location<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">* Lowering of Fortran Expression to FIR<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- Add helpers to manipulate MLIR OpBuilder and hide<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> boilerplate.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- Lower Fortran scalar intrinsic operations<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- Add a framework to describe runtime and insert runtime calls in FIR.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> It allows to create a constexpr map to describe the<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> runtime.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- Start Lowering of numerical intrinsics<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">* Add bridge from AST to FIR<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- Add the class that implements the lowering of<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">the Fortran ASTs to FIR operations as described in<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">BurnsidetoFIR.md.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- The lowering of IO statements is done in another file<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> to keep the bridge smaller.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">* Add FIR optimizer library<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">This library provides transformation passes that can be run of FIR<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">to perform several high-level optimizations.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">* Add testing tools<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- Add bbc tool that takes a Fortran input file, drives parsing,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">semantic analysis, and then lowers the parse-tree to FIR. It can<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">then run transformation passes on the obtained MLIR before<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">generating LLVM IR. The bbc tool is used for testing.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- Add tco tool that is meant to process mlir input files and<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">drives transformations on it. The tco tool is used for testing.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">* Update lit config for FIR tests<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">* Add FIR and lowering tests<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- A FIR round-trip tests (in test/fir)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- Add new FIR lit tests (in test-lit/fir)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- Add expression lowering test (in test/lower)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">The patches will be sent in successive PRs into f18 master because the later patches depend on the first ones.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">The first patch will bring a dependency upon LLVM but not MLIR. Note that current CMake files already require LLVM package but no code was actually using it yet (apart from LIT tests). Subsequent patches will require MLIR and new CMake
files.<o:p></o:p></p>
</div>
</div>
<div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="1" width="100%" align="center">
</div>
</div>
<div>
<div>
<p class="MsoNormal">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.<span class="apple-converted-space"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="1" width="100%" align="center">
</div>
</div>
</div>
<div>
<p class="MsoNormal">_______________________________________________<br>
flang-dev mailing list<br>
<a href="mailto:flang-dev@lists.llvm.org" target="_blank"><span style="color:purple">flang-dev@lists.llvm.org</span></a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/flang-dev" target="_blank"><span style="color:purple">https://lists.llvm.org/cgi-bin/mailman/listinfo/flang-dev</span></a><o:p></o:p></p>
</div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">_______________________________________________<br>
flang-dev mailing list<br>
<a href="mailto:flang-dev@lists.llvm.org">flang-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/flang-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/flang-dev</a></span><o:p></o:p></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</body>
</html>