[PATCH] D83832: [OpenMP] Provide a flag to disable safety checks for GPU optimizations

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 17:41:44 PDT 2020


jdoerfert added a comment.

In D83832#2152027 <https://reviews.llvm.org/D83832#2152027>, @JonChesterfield wrote:

> I think there's an unfortunate interaction with link time optimisation here. If there are external regions, but their code is combined with llvm-link before codegen, then a user could reasonably assume this flag is safe.


If you set this flag and reach a parallel region from a target region outside the translation unit, you will experience problems as calling a non-function pointer is likely not to work. If you don't do this, you are all good.

> Would it would be correct to compile the individual source assuming there may be external uses, then llvm-link the source, then run the pass assuming there are no external uses? That's of interest to the amdgcn case as we can (currently) assume the whole program is available towards the end of the compilation.

If you run O2 <https://reviews.llvm.org/owners/package/2/> after linking *and* properly set the linkage of all your non-kernel functions to internal at that point, you don't need the flag. All the safe cases will then be handled automatically, all the unsafe ones rejected. At least that is what I suspect will happen.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83832/new/

https://reviews.llvm.org/D83832





More information about the llvm-commits mailing list