<div dir="ltr">Last I looked there's a lot of char * based string manipulation in f18. I'd like that moved to std::string/string_view/StringRef uses.<div><br></div><div>-eric</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 24, 2020 at 4:57 PM Timothy Keith <<a href="mailto:tkeith@nvidia.com">tkeith@nvidia.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div>
<p class="MsoNormal">Can you elaborate on this?<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">- to move the std::string/string_view/StringRef changes to pre-merge unless you're going to have someone dedicated to handling them post-merge (rather than "time permits"). The C vs C++ ism here is fairly strong
and I'd like to get the C-style string handling out fairly quickly.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I understood this item to be looking into replacing uses of std::string with a more appropriate LLVM data structure where there is one. What is the “C-style string handling” part of it?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Tim<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12pt;color:black">From: </span></b><span style="font-size:12pt;color:black">llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>> on behalf of Eric Christopher via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br>
<b>Reply-To: </b>Eric Christopher <<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>><br>
<b>Date: </b>Monday, February 24, 2020 at 3:26 PM<br>
<b>To: </b>Richard Barton <<a href="mailto:Richard.Barton@arm.com" target="_blank">Richard.Barton@arm.com</a>><br>
<b>Cc: </b>"<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>" <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br>
<b>Subject: </b>Re: [llvm-dev] Plan for landing flang in monorepo<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<table border="1" cellpadding="0" style="background:rgb(255,235,156)">
<tbody>
<tr>
<td style="padding:0.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><u></u><u></u></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">Hi Richard, <u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks for the work and mail with a plan. Other than the two comments below I think this plan is quite workable and am in support.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I think the only requests I'd make is:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> - to move the std::string/string_view/StringRef changes to pre-merge unless you're going to have someone dedicated to handling them post-merge (rather than "time permits"). The C vs C++ ism here is fairly strong and I'd like to get the
C-style string handling out fairly quickly. In my personal priority list I'd put this above the std:list migration.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"> - large scale renames: For naming issues I think you can automate a lot of it via clang-tidy ahead of time if you wanted to go down that path. I think it could turn it from a fairly arduous task to one that's a little easier.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks!<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">-eric<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Thu, Feb 20, 2020 at 9:41 AM Richard Barton <<a href="mailto:Richard.Barton@arm.com" target="_blank">Richard.Barton@arm.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">Hi llvm-dev<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">It's been a few weeks since I last gave an update on F18 and our progress on readying it for inclusion into the monorepo. Last time we discussed this the community challenged us to make the F18 source code look more like an LLVM project
and to come up with a plan and schedule for completing this work (<a href="http://lists.llvm.org/pipermail/llvm-dev/2020-January/137989.html" target="_blank"><span style="color:rgb(5,99,193)">http://lists.llvm.org/pipermail/llvm-dev/2020-January/137989.html</span></a>)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">The full list of changes that could be made to make F18 more LLVM-like is very long. We're interested in identifying what the absolute dealbreakers are that block inclusion into the monorepo and which changes would be acceptable to make
after inclusion to the monorepo. We've come up with strawman lists for each and would like to propose the following plan of action:<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>1.<span style="font:7pt "Times New Roman"">
</span></span><u></u>We have captured our strawman proposal for all the changes that need to happen to F18 to make it ready for inclusion into the monorepo on a github project board:
<a href="https://github.com/orgs/flang-compiler/projects/8" target="_blank"><span style="color:rgb(5,99,193)">https://github.com/orgs/flang-compiler/projects/8</span></a> (also repeated at the end of this mail.)
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>1.<span style="font:7pt "Times New Roman"">
</span></span><u></u>We are working through this list and we believe that we can complete this work in time for a new upstreaming date of 16th March.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>2.<span style="font:7pt "Times New Roman"">
</span></span><u></u>We have captured further work that we plan to complete on F18 after merging to the monorepo
<a href="https://github.com/orgs/flang-compiler/projects/10" target="_blank"><span style="color:rgb(5,99,193)">https://github.com/orgs/flang-compiler/projects/10</span></a> (also repeated below)<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>3.<span style="font:7pt "Times New Roman"">
</span></span><u></u>We believe that we can complete this work before the LLVM11 branching date in June.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>4.<span style="font:7pt "Times New Roman"">
</span></span><u></u>After this date, we'll keep improving the code as we go along and not on any specific timescale.
<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">We'd really appreciate feedback on the two lists of changes, specifically: are these lists complete? Is everyone satisfied that with all the items on
<a href="https://github.com/orgs/flang-compiler/projects/8" target="_blank"><span style="color:rgb(5,99,193)">https://github.com/orgs/flang-compiler/projects/8</span></a>, we'd be happy to accept F18 into the monorepo? Are there any further changes that would need
to be made to F18 for this to happen?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Rich<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">More info on the lists:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Pre-merge list: <a href="https://github.com/orgs/flang-compiler/projects/8" target="_blank">
<span style="color:rgb(5,99,193)">https://github.com/orgs/flang-compiler/projects/8</span></a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">The status today is that many of the items on the pre-merge list are well underway or complete.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>1.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Integrate into the monorepo CMake <u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>a.<span style="font:7pt "Times New Roman"">
</span></span><u></u>This will be as an optional project, and default to not building.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>b.<span style="font:7pt "Times New Roman"">
</span></span><u></u>This also adds Doxygen infrastructure so we can start to improve interface documentation and continue post-merge.
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>2.<span style="font:7pt "Times New Roman"">
</span></span><u></u>F18 changes to make it more LLVM-like in code style <u></u>
<u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>c.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Rationalise headers to put public headers in /include and not /lib<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>d.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Examine F18's clang-format file and minimise deviations to the LLVM clang-format<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>e.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Rename all .cc files to .cpp<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>f.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Capitalize the module directory names in /lib and /include (e.g. /lib/Parser)
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>3.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Increase use of LLVM APIs and utilities in F18 <u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>g.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Switch F18 custom File handling to LLVM's File handling (helps with non-POSIX platform support)<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>h.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Change uses of C++ standard stream IO library to LLVM's equivalent library<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>i.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Audit use of std::list and consider migrating to a suitable alternative in LLVM's API<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>j.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Use llvm_unreachable with an error message for unreachable cases
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>4.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Convert the regression test suite to using lit rather than ctest
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>k.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Porting off the custom scripts to FileCheck will continue after this but we think it should not gate inclusion to the monorepo.
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>5.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Ensure that F18 builds with the same compilers as the rest of the monorepo
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>l.<span style="font:7pt "Times New Roman"">
</span></span><u></u>One caveat is that we can only support C++17 compilers<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>m.<span style="font:7pt "Times New Roman"">
</span></span><u></u>We propose to defer Windows support until after we merge<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>n.<span style="font:7pt "Times New Roman"">
</span></span><u></u>We will specifically also check with the latest LLVM 10 rc
<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Post-merge list: <a href="https://github.com/orgs/flang-compiler/projects/10" target="_blank">
<span style="color:rgb(5,99,193)">https://github.com/orgs/flang-compiler/projects/10</span></a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">This is the work that will happen right away after merging to the monorepo<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>1.<span style="font:7pt "Times New Roman"">
</span></span><u></u>F18 changes to make it more LLVM-like in code style - We will perform a one-off exercise where we audit the code to find these instances and bring them in line. We'll look at:
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>a.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Braces on all single-line if statements<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>b.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Uses of else-after-return. <u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>2.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Increase use of LLVM APIs and utilities in F18 - We'll audit the uses of these datatypes and try to move to a suitable LLVM alternative
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>c.<span style="font:7pt "Times New Roman"">
</span></span><u></u>std::string/std::string_view<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>d.<span style="font:7pt "Times New Roman"">
</span></span><u></u>std::vector<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>e.<span style="font:7pt "Times New Roman"">
</span></span><u></u>std::set<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>f.<span style="font:7pt "Times New Roman"">
</span></span><u></u>std::map <u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>3.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Further work on porting the test suite to make it more LLVM-like
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>g.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Port lit tests to FileCheck<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>h.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Port unit tests to gtest<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>i.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Implement equivalent to clang -verify and port tests to that
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>4.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Support Windows <u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>j.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Porting to LLVM file I/O is the main blocker - included in the post-merge worklist - but there will be more to do after this.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>k.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Isuru Fernando is going to lead this effort <u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>5.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Set up official builders <u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>l.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Arm will handle bots for AArch64<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>m.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Nvidia will handle X86<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>n.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Tarique Islam at IBM will set up a builder for Power: <a href="http://lists.llvm.org/pipermail/flang-dev/2020-February/000232.html" target="_blank">
<span style="color:rgb(5,99,193)">http://lists.llvm.org/pipermail/flang-dev/2020-February/000232.html</span></a><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>o.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Any further help from community bot maintainers to cover all the platforms and compilers would be greatly appreciated.
<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">One specific ask in the last round of feedback was on sharing lib/common/Although we see the benefit of doing this exercise, we feel it is a bit too early to start. One design principle we wish to stick to is for the Fortran runtime and
compiler align on their implementations. For the specific example of <a href="https://github.com/flang-compiler/f18/blob/master/include/flang/common/bit-population-count.h" target="_blank">
<span style="color:rgb(5,99,193)">https://github.com/flang-compiler/f18/blob/master/include/flang/common/bit-population-count.h</span></a> we'd want the compiler and runtime POPCNT intrinsic to align on implementation. The F18 runtime is still a work in progress.
We need to decide on how or if this could share code with LLVM libraries and then we can revisit the implementations in include/flang/common.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Future work<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">After all the above is done, we will continue to bring the code more in line with LLVM style and API usage by fixing things as we find them during development and enforce the new style through code review. A few specific areas that have
been mentioned before that we will tackle in this way are: <u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>1.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Add Doxygen style comments to interfaces<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>2.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Classes, files, names, etc. where a more LLVM-standard naming can be used.
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>3.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Refactor code to use early exits when suitable<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0in">
<u></u><span>4.<span style="font:7pt "Times New Roman"">
</span></span><u></u>Audit functions in include/flang/common and port to LLVM equivalents (e.g. builtin_popcount)
<u></u><u></u></p>
<div>
<p class="MsoNormal"><span style="font-family:"Times New Roman",serif"> </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Times New Roman",serif"> </span><u></u><u></u></p>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<div>
<hr>
</div>
<div>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. </div>
<div>
<hr>
</div>
</div>
</blockquote></div>