Status of Flang runtime

Hello all;

I just wanted to ask what is the status of the flang runtime? I see a
few commits from 5 days ago in fir-dev, but could not find any status
tracking info or any milestones? Can anyone shed some light on what
contribution areas are open in the runtime?

Thank you very much.

Hi Arnamoy,

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: https://github.com/flang-compiler/f18-llvm-project/issues . There are a couple that I see that have the "Runtime" label attached, which may be a good place to start.

Thanks!
Alexis Perry-Holby
Los Alamos National Laboratory
Applied Computer Science (CCS-7)

Hello Arnamoy,

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.

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.

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.
https://github.com/llvm/llvm-project/blob/main/flang/docs/Intrinsics.md
https://github.com/llvm/llvm-project/blob/main/flang/docs/Intrinsics.md#intrinsic-functions-with-missing-folding-support

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 (https://github.com/flang-compiler/f18-llvm-project/pull/412) 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 https://github.com/flang-compiler/f18-llvm-project/pull/415#pullrequestreview-481755947). Since the array descriptors of classic flang and f18 are different there will be changes needed.

In general, I have often heard the following in relation to intrinsics/runtime.
For math intrinsics, the plan is to use libpgmath.
If llvm intrinsics are available, we will try to use that.
The runtime should be kept free of other libraries.

Jean Perier did much of the folding and the lowering/runtime work in fir-dev branch. He might know more. CCing @Jean Perier.

Thanks,
Kiran

Hello Arnamoy,

Jean Perier from Nvidia recently created a tutorial for adding intrinsics to llvm/flang.

https://github.com/flang-compiler/f18-llvm-project/blob/fir-dev/flang/docs/tutorials/addingIntrinsics.md

Thanks,
Kiran

Thanks Kiran for sharing and Thanks Jean for creating the tutorial,
this is very helpful.