[Openmp-commits] [PATCH] D158546: [openmp] Fix flang detection for offloading test

Jan Sjödin via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Aug 29 08:32:47 PDT 2023


jsjodin accepted this revision.
jsjodin added a comment.
This revision is now accepted and ready to land.

In D158546#4623296 <https://reviews.llvm.org/D158546#4623296>, @elmcdonough wrote:

> Fixes the actual test.  Adding `!$omp declare target` to the offloaded function prevents the OMPFunctionFiltering <https://github.com/llvm/llvm-project/blob/main/flang/lib/Optimizer/Transforms/OMPFunctionFiltering.cpp#L67> pass from optimizing it out.  I'm not sure if we want public functions to be hidden from object files targeting GPUs, but I think that might be outside the scope of this patch.

LGTM, the test passes for me.

I'm not sure what the correct behavior is. The standard says:
"If a procedure is explicitly or implicitly referenced in a target construct that does not specify a device clause in which the ancestor device-modifier appears then that procedure is treated as if its name had appeared in an enter clause on a declare target directive"
It doesn't say it has to be in the same compilation unit, but it also doesn't seem unreasonable to have to specify declare target if it is outside the compilation unit. @jdoerfert, do you know correct behavior is?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158546



More information about the Openmp-commits mailing list