fodinabor created this revision. Herald added subscribers: cfe-commits, guansong, yaxunl. Herald added a project: clang. fodinabor requested review of this revision. Herald added a reviewer: jdoerfert. Herald added a subscriber: sstefan1.
This is very similar to 7f1e6fcff942 <https://reviews.llvm.org/rG7f1e6fcff9427adfa8efa3bfeeeac801da788b87>, just fixing a left-over. With this it should be possible to use both, -x cuda and -fopenmp in the same invocation, enabling to use both OpenMP, targeting CPU, and CUDA, targeting the GPU. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D90415 Files: clang/lib/Headers/__clang_cuda_complex_builtins.h Index: clang/lib/Headers/__clang_cuda_complex_builtins.h =================================================================== --- clang/lib/Headers/__clang_cuda_complex_builtins.h +++ clang/lib/Headers/__clang_cuda_complex_builtins.h @@ -16,7 +16,7 @@ // to work with CUDA and OpenMP target offloading [in C and C++ mode].) #pragma push_macro("__DEVICE__") -#ifdef _OPENMP +#ifdef __OPENMP_NVPTX__ #pragma omp declare target #define __DEVICE__ __attribute__((noinline, nothrow, cold, weak)) #else @@ -26,7 +26,7 @@ // To make the algorithms available for C and C++ in CUDA and OpenMP we select // different but equivalent function versions. TODO: For OpenMP we currently // select the native builtins as the overload support for templates is lacking. -#if !defined(_OPENMP) +#if !defined(__OPENMP_NVPTX__) #define _ISNANd std::isnan #define _ISNANf std::isnan #define _ISINFd std::isinf @@ -276,7 +276,7 @@ #undef _fmaxd #undef _fmaxf -#ifdef _OPENMP +#ifdef __OPENMP_NVPTX__ #pragma omp end declare target #endif
Index: clang/lib/Headers/__clang_cuda_complex_builtins.h =================================================================== --- clang/lib/Headers/__clang_cuda_complex_builtins.h +++ clang/lib/Headers/__clang_cuda_complex_builtins.h @@ -16,7 +16,7 @@ // to work with CUDA and OpenMP target offloading [in C and C++ mode].) #pragma push_macro("__DEVICE__") -#ifdef _OPENMP +#ifdef __OPENMP_NVPTX__ #pragma omp declare target #define __DEVICE__ __attribute__((noinline, nothrow, cold, weak)) #else @@ -26,7 +26,7 @@ // To make the algorithms available for C and C++ in CUDA and OpenMP we select // different but equivalent function versions. TODO: For OpenMP we currently // select the native builtins as the overload support for templates is lacking. -#if !defined(_OPENMP) +#if !defined(__OPENMP_NVPTX__) #define _ISNANd std::isnan #define _ISNANf std::isnan #define _ISINFd std::isinf @@ -276,7 +276,7 @@ #undef _fmaxd #undef _fmaxf -#ifdef _OPENMP +#ifdef __OPENMP_NVPTX__ #pragma omp end declare target #endif
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits