This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Add support for the 'private pointer' flag to signal variables captured in target regions and used in first-private clauses.
ClosedPublic

Authored by sfantao on May 10 2016, 9:32 AM.

Details

Summary

If a variable is implicitly mapped (doesn't show in a map clause), the runtime library has to be informed if the corresponding capture shows up in first-private clause, so that the storage previously allocated in the device is used. This patch adds the support for that.

Diff Detail

Event Timeline

sfantao updated this revision to Diff 56734.May 10 2016, 9:32 AM
sfantao retitled this revision from to [OpenMP] Add support for the 'private pointer' flag to signal variables captured in target regions and used in first-private clauses..
sfantao updated this object.
sfantao added subscribers: cfe-commits, caomhin.
ABataev added inline comments.May 10 2016, 9:24 PM
lib/CodeGen/CGOpenMPRuntime.cpp
5609

I think this is too greedy. You're rescanning list of firstprivates clauses/variables for each variable.

5615

What if the variable is also referenced in lastprivate clause?

sfantao updated this revision to Diff 57420.May 16 2016, 4:35 PM
  • Move the flags adjustment for first private declarations to the mappable expressions handler.
sfantao marked 2 inline comments as done.May 16 2016, 4:38 PM

Hi Alexey,

Thanks for the review!

lib/CodeGen/CGOpenMPRuntime.cpp
5609

Ok, I'm now saving the extracted first private info in the mappable expression handler so it can be reused for different captures.

5615

The directives with target only take firstprivate or private. So, we disregard lastprivate in this code.

ABataev edited edge metadata.May 18 2016, 5:39 AM

Please, update to latest revision. I made some changes in firstprivates that may affect your patch. Will review it after it.

sfantao updated this revision to Diff 58253.May 24 2016, 9:42 AM
sfantao marked 2 inline comments as done.
sfantao edited edge metadata.
  • Rebase after last changes related to first private.
ABataev added inline comments.May 24 2016, 8:13 PM
lib/CodeGen/CGOpenMPRuntime.cpp
5651–5652

Maybe it is better to join all this code into a single function?

sfantao updated this revision to Diff 58453.May 25 2016, 10:33 AM
sfantao marked an inline comment as done.
  • Create function for the generation of the default map information.

Hi Alexey,

Thanks for the review!

lib/CodeGen/CGOpenMPRuntime.cpp
5651–5652

I agree. Moved all the default map information generation to a new function in the mappable expressions handler.

ABataev accepted this revision.May 25 2016, 7:58 PM
ABataev edited edge metadata.

LG

This revision is now accepted and ready to land.May 25 2016, 7:58 PM
sfantao closed this revision.May 26 2016, 9:59 AM