<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hello Arnamoy,<br>
<br>
Jean Perier from Nvidia recently created a tutorial for adding intrinsics to llvm/flang. </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<a href="https://github.com/flang-compiler/f18-llvm-project/blob/fir-dev/flang/docs/tutorials/addingIntrinsics.md" id="LPlnk">https://github.com/flang-compiler/f18-llvm-project/blob/fir-dev/flang/docs/tutorials/addingIntrinsics.md</a><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks,<br>
Kiran</div>
<div class="_Entity _EType_OWALinkPreview _EId_OWALinkPreview _EReadonly_1"></div>
<br>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> flang-dev <flang-dev-bounces@lists.llvm.org> on behalf of Kiran Chandramohan via flang-dev <flang-dev@lists.llvm.org><br>
<b>Sent:</b> 01 February 2021 19:02<br>
<b>To:</b> Arnamoy Bhattacharyya <arnamoy@ualberta.ca>; flang-dev@lists.llvm.org <flang-dev@lists.llvm.org>; Perry-Holby, Alexis <aperry@lanl.gov><br>
<b>Subject:</b> Re: [flang-dev] [EXTERNAL] Status of Flang runtime</font>
<div> </div>
</div>
<style type="text/css" style="display:none">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hello Arnamoy,<br>
<br>
Thanks for your question. I think this is a question that you can ask during the Flang calls. I will share what I know, but this info might not be accurate.<br>
<br>
I am assuming that your question is about the non-I/O part of the flang runtime. The focus till a couple of months back was to get Flang/F18 working for F77. Since F77 does not have much of a runtime component there might not have been much thought gone into
 sharing a design or keeping a public todo list for the runtime. <span style=""> </span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
There was a lot of work that happened initially for the implementation of folding of intrinsics with constant inputs. You can see the implementation of these in the flang/lib/Evaluate directory. You can see some TODOs in the files in the Evaluate directory.
 I think this is an area that you might be able to contribute to. Also see the following links.<br>
<a href="https://github.com/llvm/llvm-project/blob/main/flang/docs/Intrinsics.md" id="LPlnk">https://github.com/llvm/llvm-project/blob/main/flang/docs/Intrinsics.md</a><br>
<a href="https://github.com/llvm/llvm-project/blob/main/flang/docs/Intrinsics.md#intrinsic-functions-with-missing-folding-support" style="margin:0px; font-size:12pt; background-color:rgb(255,255,255)">https://github.com/llvm/llvm-project/blob/main/flang/docs/Intrinsics.md#intrinsic-functions-with-missing-folding-support</a><br>
<div class="x__Entity x__EType_OWALinkPreview x__EId_OWALinkPreview_2 x__EReadonly_1">
</div>
<br>
<div class="x__Entity x__EType_OWALinkPreview x__EId_OWALinkPreview_1 x__EReadonly_1">
</div>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="font-size:12pt">As of now, I am only aware of the date_and_time intrinsic which is implemented with a runtime function. You can see the implementation in the PR #412 (</span><a href="https://github.com/flang-compiler/f18-llvm-project/pull/412" style="font-size:12pt">https://github.com/flang-compiler/f18-llvm-project/pull/412</a><span style="font-size:12pt">)</span><span style="font-size:12pt">
 in fir-dev branch. If you are interested in the runtime implementation, I believe you can take inspiration from the classic flang runtime (as hinted in </span><a href="https://github.com/flang-compiler/f18-llvm-project/pull/415#pullrequestreview-481755947" id="LPlnk317258" style="font-size:12pt">https://github.com/flang-compiler/f18-llvm-project/pull/415#pullrequestreview-481755947</a><span style="font-size:12pt">).
 Since the array descriptors of classic flang and f18 are different there will be changes needed.</span><br>
</div>
<div style=""><font color="#000000" face="Calibri, Arial, Helvetica, sans-serif"><br>
In general, I have often heard the following in relation to intrinsics/runtime. <br>
For math intrinsics, the plan is to use libpgmath. <br>
If llvm intrinsics are available, we will try to use that. <br>
The runtime should be kept free of other libraries.<br>
<span style="font-family:Calibri,Helvetica,sans-serif; background-color:rgb(255,255,255); display:inline!important"><br>
Jean Perier did much of the folding and the lowering/runtime work in fir-dev branch. He might know more. CCing
<a id="OWAAM815243" class="x__1OtrSZdhKXVv3UhaivrdJ4 x_mention x_ms-bgc-nlr x_ms-fcl-b" href="mailto:jperier@nvidia.com">
@Jean Perier</a>.</span></font><br>
<br>
<font color="#000000" face="Calibri, Arial, Helvetica, sans-serif"><span style="font-size:12pt">Thanks,</span></font><br>
<font color="#000000" face="Calibri, Arial, Helvetica, sans-serif"><span style="font-size:12pt">Kiran</span></font></div>
<div id="x_appendonsend"></div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> flang-dev <flang-dev-bounces@lists.llvm.org> on behalf of Perry-Holby, Alexis via flang-dev <flang-dev@lists.llvm.org><br>
<b>Sent:</b> 27 January 2021 23:13<br>
<b>To:</b> Arnamoy Bhattacharyya <arnamoy@ualberta.ca>; flang-dev@lists.llvm.org <flang-dev@lists.llvm.org><br>
<b>Subject:</b> Re: [flang-dev] [EXTERNAL] Status of Flang runtime</font>
<div> </div>
</div>
<div class="x_BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="x_PlainText">Hi Arnamoy,<br>
<br>
I'm not 100% certain what the status of the runtime is, but if you are looking for ways to contribute you can check out the issues list here:
<a href="https://github.com/flang-compiler/f18-llvm-project/issues">https://github.com/flang-compiler/f18-llvm-project/issues</a> .  There are a couple that I see that have the "Runtime" label attached, which may be a good place to start.<br>
<br>
Thanks!<br>
Alexis Perry-Holby<br>
Los Alamos National Laboratory<br>
Applied Computer Science (CCS-7)<br>
<br>
On 1/9/21, 2:03 PM, "flang-dev on behalf of Arnamoy Bhattacharyya via flang-dev" <flang-dev-bounces@lists.llvm.org on behalf of flang-dev@lists.llvm.org> wrote:<br>
<br>
    Hello all;<br>
<br>
    I just wanted to ask what is the status of the flang runtime?  I see a<br>
    few commits from 5 days ago in fir-dev, but could not find any status<br>
    tracking info or any milestones?  Can anyone shed some light on what<br>
    contribution areas are open in the runtime?<br>
<br>
    Thank you very much.<br>
    _______________________________________________<br>
    flang-dev mailing list<br>
    flang-dev@lists.llvm.org<br>
    <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/flang-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/flang-dev</a><br>
<br>
_______________________________________________<br>
flang-dev mailing list<br>
flang-dev@lists.llvm.org<br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/flang-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/flang-dev</a><br>
</div>
</span></font></div>
</div>
</body>
</html>