Page MenuHomePhabricator

[OpenMP][MLIR] Lower and apply RTLModuleFlagsAttr
Needs ReviewPublic

Authored by agozillon on Fri, Mar 3, 12:13 PM.

Details

Summary

This patch adds the lowering for the RTLModuleFlagsAttr to LLVM-IR,
which lowers each individual argument of the attribute to globals. As well
as the application of it by flags in the frontend which have been activated
for flang fc1.

This patch enables the RTL 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

Then generates an OpenMP MLIR Dialect RTLModuleFlagsAttr to hold this information and proliferate it down to the translation to LLVM-IR that occurs in OpenMPToLLVMIRTranslation, allowing use of the OpenMPIRBuilder.

Diff Detail

Event Timeline

agozillon created this revision.Fri, Mar 3, 12:13 PM
Herald added a reviewer: ftynse. · View Herald Transcript
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
agozillon requested review of this revision.Fri, Mar 3, 12:13 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript

This builds on the following phabricator patches that are in review at the moment, so there are components that are used here that are added from these:

https://reviews.llvm.org/D144864 : add fopenmp-is-device and an mlir is-device attribute for the OpenMP dialect
https://reviews.llvm.org/D144896 : the RTLModuleFlagsAttr that is in use within this patch for lowering and application
https://reviews.llvm.org/D144883 : an infrastructure addition for the MLIR LLVM translation interface

For the moment, this patch is primarily to give context to the usage of the RTLModuleFlagsAttr mlir attribute and give some further understanding for a reviewer, however, please feel free to review it if you have time as I will eventually ask for some revision of it after all the components it depends on have been progressed.

agozillon edited the summary of this revision. (Show Details)Fri, Mar 3, 12:29 PM