This is an archive of the discontinued LLVM Phabricator instance.

[libomptarget-nvptx] loop: Determine if runtime uninitialized
ClosedPublic

Authored by Hahnfeld on May 21 2018, 2:42 AM.

Details

Summary

The generic entry points for static loop scheduling previously
hardcoded that the runtime was initialized. This can be wrong if
the compiler analyzes that the runtime is not needed and calls
the init functions accordingly.

This didn't affect clang-ykt because they have entry points for
different combinations of SPMD x Runtime not needed. I didn't do
measurements yet but with inlining we might get away with always
calling the generic interface and letting compiler and runtime
figure out the rest.
In any case, a correct runtime is always better than having
functions that may only be called if previous calls passed in
a specific set of arguments!

Diff Detail

Repository
rL LLVM

Event Timeline

Hahnfeld created this revision.May 21 2018, 2:42 AM
grokos accepted this revision.May 22 2018, 8:13 AM

Looks good. I don't see any reason why performance would be affected and it is a necessary change for the sake of correctness.

This revision is now accepted and ready to land.May 22 2018, 8:13 AM

I meant to say that I'm not sure if it's enough to always call __kmpc_for_static_init_4 and friends or if Clang still needs to generate calls to __kmpc_for_static_init_4_simple_spmd and the like if this is proven to be safe.

This revision was automatically updated to reflect the committed changes.