This is an archive of the discontinued LLVM Phabricator instance.

[flang][OpenMP] upstream OpenMP lowering
ClosedPublic

Authored by SouraVX on Jul 13 2020, 12:25 AM.

Details

Summary

This patch implements lowering of OpenMP barrier construct from
pft to OpenMPDialect.

Patch is carved out of following merged PR's from fir-dev branch
of https://github.com/flang-compiler/f18-llvm-project/

PR's:
https://github.com/flang-compiler/f18-llvm-project/pull/248
https://github.com/flang-compiler/f18-llvm-project/pull/251

Unfortunately primary tool bbc for functional validation is not
yet upstreamed. So this patch includes a unittest for lowering
!OMP barrier construct.

Some part of the these PR's still remains downstream(functional test
and dialect registration to legalizer) for obvious reasons.
Will upstream them when the dependencies are upstreamed.

Diff Detail

Event Timeline

SouraVX created this revision.Jul 13 2020, 12:25 AM
kiranchandramohan added a project: Restricted Project.Jul 13 2020, 10:49 AM

Thanks @SouraVX for adding the lowering code for barrier.

Could you clarify in the commit message that the lowering is from parse-tree/pft to MLIR.

A few nits inline.

flang/include/flang/Lower/OpenMP.h
35–40

Do these need to be visible outside?

flang/include/flang/Optimizer/Dialect/FIRDialect.h
46

Are mlir dialects listed in alphabetical order? If so openmp dialect should also be.

flang/lib/Lower/OpenMP.cpp
32

is this line empty as per coding style or accidental?

SouraVX updated this revision to Diff 277523.Jul 13 2020, 12:07 PM
SouraVX marked 3 inline comments as done.

Thanks @kiranchandramohan for reviewing this.

  • Addressed nit comments.
  • updated commit message accordingly.
flang/include/flang/Lower/OpenMP.h
35–40

No, I'll make them static. Thanks. genOpenMPConstruct is the only public interface needed.

flang/include/flang/Optimizer/Dialect/FIRDialect.h
46

Sure, it's looking a bit odd. I'll correct.

flang/lib/Lower/OpenMP.cpp
32

Accidental I believe. clang-format didn't caught it. Removed.

SouraVX edited the summary of this revision. (Show Details)Jul 13 2020, 12:11 PM

LGTM. Please wait for a day before submitting.

flang/include/flang/Lower/OpenMP.h
19–20

Are these required now?

This revision is now accepted and ready to land.Jul 13 2020, 1:01 PM
schweitz accepted this revision.Jul 14 2020, 5:13 AM
This revision was automatically updated to reflect the committed changes.
SouraVX marked an inline comment as done.Jul 14 2020, 5:32 AM
SouraVX added inline comments.
flang/include/flang/Lower/OpenMP.h
19–20

Removed, thanks!