diff --git a/openmp/libomptarget/deviceRTLs/amdgcn/src/amdgcn_locks.hip b/openmp/libomptarget/deviceRTLs/amdgcn/src/amdgcn_locks.hip --- a/openmp/libomptarget/deviceRTLs/amdgcn/src/amdgcn_locks.hip +++ b/openmp/libomptarget/deviceRTLs/amdgcn/src/amdgcn_locks.hip @@ -14,6 +14,7 @@ // a SIMD => wavefront mapping once that is implemented. // //===----------------------------------------------------------------------===// +#pragma omp declare target #include "common/debug.h" @@ -26,3 +27,5 @@ DEVICE void __kmpc_impl_set_lock(omp_lock_t *) { warn(); } DEVICE void __kmpc_impl_unset_lock(omp_lock_t *) { warn(); } DEVICE int __kmpc_impl_test_lock(omp_lock_t *lock) { warn(); } + +#pragma omp end declare target diff --git a/openmp/libomptarget/deviceRTLs/amdgcn/src/amdgcn_smid.hip b/openmp/libomptarget/deviceRTLs/amdgcn/src/amdgcn_smid.hip --- a/openmp/libomptarget/deviceRTLs/amdgcn/src/amdgcn_smid.hip +++ b/openmp/libomptarget/deviceRTLs/amdgcn/src/amdgcn_smid.hip @@ -5,6 +5,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// +#pragma omp declare target #include "target_impl.h" @@ -59,3 +60,5 @@ ENCODE_HWREG(HW_ID_SE_ID_SIZE, HW_ID_SE_ID_OFFSET, HW_ID)); return (se_id << HW_ID_CU_ID_SIZE) + cu_id; } + +#pragma omp end declare target diff --git a/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.hip b/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.hip --- a/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.hip +++ b/openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.hip @@ -9,6 +9,7 @@ // Definitions of target specific functions // //===----------------------------------------------------------------------===// +#pragma omp declare target #include "target_impl.h" @@ -151,3 +152,5 @@ // Stub implementations DEVICE void *__kmpc_impl_malloc(size_t) { return nullptr; } DEVICE void __kmpc_impl_free(void *) {} + +#pragma omp end declare target diff --git a/openmp/libomptarget/deviceRTLs/common/src/cancel.cu b/openmp/libomptarget/deviceRTLs/common/src/cancel.cu --- a/openmp/libomptarget/deviceRTLs/common/src/cancel.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/cancel.cu @@ -9,6 +9,7 @@ // Interface to be used in the implementation of OpenMP cancel. // //===----------------------------------------------------------------------===// +#pragma omp declare target #include "interface.h" #include "common/debug.h" @@ -26,3 +27,5 @@ // disabled return 0; } + +#pragma omp end declare target diff --git a/openmp/libomptarget/deviceRTLs/common/src/critical.cu b/openmp/libomptarget/deviceRTLs/common/src/critical.cu --- a/openmp/libomptarget/deviceRTLs/common/src/critical.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/critical.cu @@ -9,6 +9,7 @@ // This file contains the implementation of critical with KMPC interface // //===----------------------------------------------------------------------===// +#pragma omp declare target #include "interface.h" #include "common/debug.h" @@ -26,3 +27,5 @@ PRINT0(LD_IO, "call to kmpc_end_critical()\n"); omp_unset_lock((omp_lock_t *)lck); } + +#pragma omp end declare target diff --git a/openmp/libomptarget/deviceRTLs/common/src/data_sharing.cu b/openmp/libomptarget/deviceRTLs/common/src/data_sharing.cu --- a/openmp/libomptarget/deviceRTLs/common/src/data_sharing.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/data_sharing.cu @@ -9,6 +9,8 @@ // This file contains the implementation of data sharing environments // //===----------------------------------------------------------------------===// +#pragma omp declare target + #include "common/omptarget.h" #include "target_impl.h" @@ -275,3 +277,4 @@ omptarget_nvptx_simpleMemoryManager.Release(); } +#pragma omp end declare target diff --git a/openmp/libomptarget/deviceRTLs/common/src/libcall.cu b/openmp/libomptarget/deviceRTLs/common/src/libcall.cu --- a/openmp/libomptarget/deviceRTLs/common/src/libcall.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/libcall.cu @@ -10,6 +10,7 @@ // invoked by the user in an OpenMP region // //===----------------------------------------------------------------------===// +#pragma omp declare target #include "common/omptarget.h" #include "common/target_atomic.h" @@ -362,3 +363,5 @@ PRINT(LD_IO, "call omp_test_lock() return %d\n", rc); return rc; } + +#pragma omp end declare target diff --git a/openmp/libomptarget/deviceRTLs/common/src/loop.cu b/openmp/libomptarget/deviceRTLs/common/src/loop.cu --- a/openmp/libomptarget/deviceRTLs/common/src/loop.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/loop.cu @@ -11,6 +11,7 @@ // interface as loops. // //===----------------------------------------------------------------------===// +#pragma omp declare target #include "common/omptarget.h" #include "target_impl.h" @@ -754,3 +755,5 @@ EXTERN void __kmpc_for_static_fini(kmp_Ident *loc, int32_t global_tid) { PRINT0(LD_IO, "call kmpc_for_static_fini\n"); } + +#pragma omp end declare target diff --git a/openmp/libomptarget/deviceRTLs/common/src/omp_data.cu b/openmp/libomptarget/deviceRTLs/common/src/omp_data.cu --- a/openmp/libomptarget/deviceRTLs/common/src/omp_data.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/omp_data.cu @@ -9,6 +9,7 @@ // This file contains the data objects used on the GPU device. // //===----------------------------------------------------------------------===// +#pragma omp declare target #include "common/omptarget.h" #include "common/device_environment.h" @@ -66,3 +67,5 @@ // Data sharing related variables. //////////////////////////////////////////////////////////////////////////////// DEVICE SHARED omptarget_nvptx_SharedArgs omptarget_nvptx_globalArgs; + +#pragma omp end declare target diff --git a/openmp/libomptarget/deviceRTLs/common/src/omptarget.cu b/openmp/libomptarget/deviceRTLs/common/src/omptarget.cu --- a/openmp/libomptarget/deviceRTLs/common/src/omptarget.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/omptarget.cu @@ -9,6 +9,7 @@ // This file contains the initialization code for the GPU // //===----------------------------------------------------------------------===// +#pragma omp declare target #include "common/omptarget.h" #include "target_impl.h" @@ -157,3 +158,5 @@ PRINT0(LD_IO | LD_PAR, "call to __kmpc_is_spmd_exec_mode\n"); return isSPMDMode(); } + +#pragma omp end declare target diff --git a/openmp/libomptarget/deviceRTLs/common/src/parallel.cu b/openmp/libomptarget/deviceRTLs/common/src/parallel.cu --- a/openmp/libomptarget/deviceRTLs/common/src/parallel.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/parallel.cu @@ -31,6 +31,7 @@ // To make a long story short... // //===----------------------------------------------------------------------===// +#pragma omp declare target #include "common/omptarget.h" #include "target_impl.h" @@ -300,3 +301,5 @@ int proc_bind) { PRINT(LD_IO, "call kmpc_push_proc_bind %d\n", (int)proc_bind); } + +#pragma omp end declare target diff --git a/openmp/libomptarget/deviceRTLs/common/src/reduction.cu b/openmp/libomptarget/deviceRTLs/common/src/reduction.cu --- a/openmp/libomptarget/deviceRTLs/common/src/reduction.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/reduction.cu @@ -9,6 +9,7 @@ // This file contains the implementation of reduction with KMPC interface. // //===----------------------------------------------------------------------===// +#pragma omp declare target #include "common/omptarget.h" #include "common/target_atomic.h" @@ -312,3 +313,4 @@ return 0; } +#pragma omp end declare target diff --git a/openmp/libomptarget/deviceRTLs/common/src/support.cu b/openmp/libomptarget/deviceRTLs/common/src/support.cu --- a/openmp/libomptarget/deviceRTLs/common/src/support.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/support.cu @@ -9,6 +9,7 @@ // Wrapper implementation to some functions natively supported by the GPU. // //===----------------------------------------------------------------------===// +#pragma omp declare target #include "common/support.h" #include "common/debug.h" @@ -264,3 +265,4 @@ return static_cast(ReductionScratchpadPtr) + 256; } +#pragma omp end declare target diff --git a/openmp/libomptarget/deviceRTLs/common/src/sync.cu b/openmp/libomptarget/deviceRTLs/common/src/sync.cu --- a/openmp/libomptarget/deviceRTLs/common/src/sync.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/sync.cu @@ -9,6 +9,7 @@ // Include all synchronization. // //===----------------------------------------------------------------------===// +#pragma omp declare target #include "common/omptarget.h" #include "target_impl.h" @@ -135,3 +136,5 @@ PRINT0(LD_IO, "call __kmpc_syncwarp\n"); __kmpc_impl_syncwarp(Mask); } + +#pragma omp end declare target diff --git a/openmp/libomptarget/deviceRTLs/common/src/task.cu b/openmp/libomptarget/deviceRTLs/common/src/task.cu --- a/openmp/libomptarget/deviceRTLs/common/src/task.cu +++ b/openmp/libomptarget/deviceRTLs/common/src/task.cu @@ -26,6 +26,7 @@ // - end // //===----------------------------------------------------------------------===// +#pragma omp declare target #include "common/omptarget.h" @@ -214,3 +215,5 @@ __kmpc_omp_task_with_deps(loc, global_tid, newKmpTaskDescr, 0, 0, 0, 0); } + +#pragma omp end declare target diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu b/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu --- a/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu +++ b/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu @@ -9,6 +9,7 @@ // Definitions of target specific functions // //===----------------------------------------------------------------------===// +#pragma omp declare target #include "target_impl.h" #include "common/debug.h" @@ -158,3 +159,5 @@ DEVICE void *__kmpc_impl_malloc(size_t x) { return malloc(x); } DEVICE void __kmpc_impl_free(void *x) { free(x); } + +#pragma omp end declare target