]> granicus.if.org Git - clang/commit
[CUDA][HIP] Fix host/device check with -fopenmp
authorYaxun Liu <Yaxun.Liu@amd.com>
Wed, 9 Oct 2019 23:54:10 +0000 (23:54 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Wed, 9 Oct 2019 23:54:10 +0000 (23:54 +0000)
commite619d987e2081639eb24647634f72bab001100de
tree4566e1286938490397675c822c1dfab0e893b22d
parentc3ac76787baac0a23865951a726b192c00e7cb1a
[CUDA][HIP] Fix host/device check with -fopenmp

CUDA/HIP program may be compiled with -fopenmp. In this case, -fopenmp is only passed to host compilation
to take advantages of multi-threads computation.

CUDA/HIP and OpenMP both use Sema::DeviceCallGraph to store functions to be analyzed and remove them
once they decide the function is sure to be emitted. CUDA/HIP and OpenMP have different functions to determine
if a function is sure to be emitted.

To check host/device correctly for CUDA/HIP when -fopenmp is enabled, there needs a unified logic to determine
whether a function is to be emitted. The logic needs to be aware of both CUDA and OpenMP logic.

Differential Revision: https://reviews.llvm.org/D67837

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374263 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Sema/Sema.h
lib/Sema/SemaCUDA.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaOpenMP.cpp
test/CodeGenCUDA/openmp-target.cu [new file with mode: 0644]
test/OpenMP/declare_target_messages.cpp
test/SemaCUDA/call-device-fn-from-host.cu
test/SemaCUDA/host-device-constexpr.cu
test/SemaCUDA/openmp-static-func.cu [new file with mode: 0644]
test/SemaCUDA/openmp-target.cu [new file with mode: 0644]