This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][MLIR][Flang][bbc][Driver] Add OpenMP RTL Flags to Flang and generate omp.FlagsAttr from them
ClosedPublic

Authored by agozillon on Mar 31 2023, 7:07 AM.

Details

Summary

This patch ports OpenMP RTL flags from the shared Clang compiler
options to Flang. As well as adding a limited subset to bbc.

This patch enables the flags below (and any equals or inverse variants)
for Flang that exist in Clang:

-fopenmp-target-debug
-fopenmp-assume-threads-oversubscription
-fopenmp-assume-teams-oversubscription
-fopenmp-assume-no-nested-parallelism
-fopenmp-assume-no-thread-state

For the bbc tool it only utilises the primary variants to minimize
additional complexity in the tool.

The patch also provides FlagAttr generation from these flags. Which
will be lowered to LLVM-IR in a subsequent patch.

Diff Detail

Event Timeline

agozillon created this revision.Mar 31 2023, 7:07 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
agozillon requested review of this revision.Mar 31 2023, 7:07 AM
Herald added a project: Restricted Project. · View Herald Transcript

The flag addition and FlagsAttr generation component of: https://reviews.llvm.org/D145264 the LLVM-IR generation will come in a subsequent phabricator patch once I have created some additional tests.

  • Add FIR -> LLVM Dialect test here, more fitting than the other patch

Hi @awarzynski would it please be possible to get this reviewed when you have a spare moment or few, it's essentially the segment of the modifications from this patch which you accepted: https://reviews.llvm.org/D145264 the lowering has been separated into a different phab review as was requested. This pass just adds flags and creates the attribute on the Module! So it is hopefully good to go or close to it depending on your feedback :-) although I'll commit it at the same time as the lowering segment of the pass is accepted.

Thank you very much as always for your time reviewing my patches, I appreciate it greatly.

kiranchandramohan accepted this revision.Apr 5 2023, 7:43 AM

LG. This portion of the patch was accepted in https://reviews.llvm.org/D145264.

See inline comment about location of LLVM Dialect tests. You may either remove the LLVM dialect tests from this patch and land it. Or you can submit this and move the tests in a separate NFC patch and submit without review.

flang/test/Lower/OpenMP/rtl-flags.f90
11–28

The tests for LLVM dialect should be in https://github.com/llvm/llvm-project/blob/main/flang/test/Fir/convert-to-llvm-openmp-and-fir.fir.

Same for other LLVM dialect RUN lines below.

This revision is now accepted and ready to land.Apr 5 2023, 7:43 AM

LG. This portion of the patch was accepted in https://reviews.llvm.org/D145264.

See inline comment about location of LLVM Dialect tests. You may either remove the LLVM dialect tests from this patch and land it. Or you can submit this and move the tests in a separate NFC patch and submit without review.

Hi Kiran,

Thanks for the quick reply. I'll do the former and remove the tests and land the patch today (back tracking on the previous statement of leaving landing it till later), I don't believe they add anything to the test suite as there is no modifications between FIR -> LLVM Dialect as far as this attribute and the ModuleOp go.