Page MenuHomePhabricator

[OPENMP] Implementation of codegen for firstprivate clause of target directive
ClosedPublic

Authored by carlo.bertolli on Mar 15 2016, 8:04 PM.

Details

Reviewers
kkwli0
ABataev
Summary

This patch implements the following aspects:

  • It extends sema to check that a variable is not reference in both a map clause and firstprivate or private. This is needed to ensure correct functioning at codegen level, apart from being useful for the user.
  • It implements firstprivate for target in codegen. The implementation applies to both host and nvptx devices.
  • It adds regression tests for codegen of firstprivate, host and device side when using the host as device, and nvptx side.

Please note that the regression test for nvptx codegen is missing VLAs. This is because VLAs currently require saving and restoring the stack which appears not to be a supported operation by nvptx backend.

  • It adds a check in sema regression tests for target map, firstprivate, and private clauses.

Diff Detail

Repository
rL LLVM

Event Timeline

carlo.bertolli retitled this revision from to [OPENMP] Implementation of codegen for firstprivate clause of target directive.
carlo.bertolli updated this object.
carlo.bertolli added reviewers: ABataev, kkwli0.
carlo.bertolli set the repository for this revision to rL LLVM.
ABataev added inline comments.Mar 15 2016, 10:41 PM
lib/Sema/SemaOpenMP.cpp
9767–9768

You still use getTopDSA() here, maybe it is better to not call isPrivate() and use direct checks like this:

auto DVar = DSAStack->getTopDSA(D, false);
if (VD && isOpenMPPrivate(DVar.CKind))
 .....

Besides, I don't think we need isPrivate() and isFirstPrivate() member functions.

9770–9771

Again, DSAStack->isFirstPrivate(VD) ? OMPC_firstprivate : OMPC_private can be replaced by simple code like this one DVar.CKind
Also, additional checks must be added to private clauses, which does not allow to privatize variables, that already are mapped. Maybe you need to use new DSA kind OMPC_map and mark all mapped variables as one having OMPC_map data-sharing attribute?

carlo.bertolli marked 2 inline comments as done.Mar 16 2016, 8:52 AM
carlo.bertolli added inline comments.
lib/Sema/SemaOpenMP.cpp
9770–9771

Done the first part.

About the second part of the comment: please look at lines 7474 and 7230 in the new version of the diff. Those are the places where we are looking if a private or firstprivate variable was already referenced in a map clause on the same construct. Is this what you meant?

carlo.bertolli marked an inline comment as done.

Modify diff to reflect comments.

Update against trunk as dependence was committed to trunk.

ABataev accepted this revision.Mar 17 2016, 2:33 AM
ABataev edited edge metadata.

LG

This revision is now accepted and ready to land.Mar 17 2016, 2:33 AM

Committed revision 263837.