This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][Offloading] Replace all calls to `isSPMDMode` with `__kmpc_is_spmd_exec_mode`
ClosedPublic

Authored by tianshilei1992 on Jun 30 2021, 10:35 AM.

Details

Summary

In our ongoing work, we are using AbstractAttributor to deduct execution model
of device functions, and potententially remove unnecessary function calls to
__kmpc_is_spmd_exec_mode. In current device runtime, we have mixed use of
isSPMDMode and __kmpc_is_spmd_exec_mode, but in fact in __kmpc_is_spmd_exec_mode
it simply calls isSPMDMode. Since all functions starting with __kmpc is C
function, which doesn't have things like name mangling. It is more optimization
friendly. In this patch, we simply replaced all calls to isSPMDMode with
__kmpc_is_spmd_exec_mode to pave the way for the optimization.

Diff Detail

Event Timeline

tianshilei1992 requested review of this revision.Jun 30 2021, 10:35 AM
Herald added a reviewer: baziotis. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript

If you replace isSPMDMode with __kmpc_is_spmd_exec_mode let's delete the former.

remove isSPMDMode completely

tianshilei1992 edited the summary of this revision. (Show Details)Jun 30 2021, 10:58 AM
openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
164–165

Ah, bad. This change introduces PRINT0 calls absolutely everywhere. That will make a mess.

My preference would be to delete this PRINT0 call.

If we can't do that, I guess we could still with one function called internally that doesn't print and one function called externally that does, but 'external' in this context is clang.

tianshilei1992 marked an inline comment as done.Jun 30 2021, 11:55 AM
JonChesterfield accepted this revision.Jun 30 2021, 11:55 AM
This revision is now accepted and ready to land.Jun 30 2021, 11:55 AM
This revision was landed with ongoing or failed builds.Jun 30 2021, 12:40 PM
This revision was automatically updated to reflect the committed changes.