[PATCH] D72962: [MLIR, OpenMP] Translation of OpenMP barrier construct to LLVM IR

Compiler Developer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 10:42:55 PST 2020


compiler_developer added a comment.

In D72962#1872679 <https://reviews.llvm.org/D72962#1872679>, @kiranchandramohan wrote:

> In D72962#1872562 <https://reviews.llvm.org/D72962#1872562>, @compiler_developer wrote:
>
> >
>
>
> Thanks for your comments.
>
> > **MLIROpenMP** and **LLVMFrontendOpenMP** libraries looks like ** an additional dependency for MLIR users who wants LLVM lowering and doesn't want anything to do with the OpenMP**! I think Toy example cmake file changes is one of the early symptoms.
>
> One way to handle that would be to go back to the first version of this patch which implements translation by deriving from  public LLVM::ModuleTranslation.


I think conversion patterns would be more appropriate. But, I think, that is dependent on the decision to emit LLVM IR instead of LLVM Dialect.

>> Can't OpenMP dialect have a separate LLVM dialect lowering similar to all other dialects in MLIR? I think it makes sense to lower OpenMP constructs in LLVM dialect rather than having a OpenMPIRBuilder based on LLVM IR.
> 
> We decided to use the OpenMPIRBuilder since that way we will be able to reuse existing code in the llvm-project (clang) for OpenMP code generation.

Given that MLIR has potential to support various parellel IR semantics as different dialects, I think having an LLVM dilaect lowering for OpenMP would be much cleaner solution. Also, shouldn't there be minimum difference between the LLVM Dialect and LLVM IR. If I am not wrong the goal (or atleast it definitely makes sense) is to have a tablegen based LLVM Dialect to LLVM IR conversion and viceversa. Having OpenMP dialect would affect it?

>> What happens in case of LLM IR + OpenMP to LLVM dialect conversion? OpenMP dialect will be created too? Or else the LLVM IR to/from LLVM dialect (+ OpenMP dialect) will behave differently!
> 
> I believe we can support this option under a flag. With the flag OpenMP + LLVM dialect is created. Without the flag only LLVM dialect will be created.

But, would it be possible to extract the OpenMP operations from the LLVM IR? I think that is a difficult problem to solve, especially when the IR is optimized. Also, I dont think it can be under a flag as conversion should be round-trippable?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72962/new/

https://reviews.llvm.org/D72962





More information about the llvm-commits mailing list