This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Create and use `__kmpc_is_generic_main_thread`
ClosedPublic

Authored by jdoerfert on Jul 10 2021, 5:41 PM.

Details

Summary

In order to fold calls based on high-level knowledge and control flow
tracking it helps to expose the information as a runtime call. The
logic: !SPMD && getTID() == getMasterTID() was used in various places
and is now encapsulated in __kmpc_is_generic_main_thread. As part of
this rewrite we replaced eager computation of arguments with on-demand
computation, especially helpful if the calls can be folded and arguments
don't need to be computed consequently.

Diff Detail

Event Timeline

jdoerfert created this revision.Jul 10 2021, 5:41 PM
jdoerfert requested review of this revision.Jul 10 2021, 5:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 10 2021, 5:41 PM
Herald added a subscriber: sstefan1. · View Herald Transcript
tianshilei1992 added inline comments.Jul 10 2021, 6:39 PM
openmp/libomptarget/deviceRTLs/common/src/loop.cu
458

why do we still check location to tell if SPMD mode? Don't we want to completely remove it?

jdoerfert updated this revision to Diff 357776.Jul 10 2021, 6:59 PM

Address comment

jdoerfert marked an inline comment as done.Jul 10 2021, 6:59 PM
This revision is now accepted and ready to land.Jul 10 2021, 7:00 PM
This revision was landed with ongoing or failed builds.Jul 11 2021, 5:18 PM
This revision was automatically updated to reflect the committed changes.