mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 23:51:56 +00:00
[libomptarget][devicertl] Wrap source in declare target pragmas
[libomptarget][devicertl] Wrap source in declare target pragmas Factored out of D93135 / D94745. C++ and cuda ignore unknown pragmas so this is a NFC for the current implementation language. Removes noise from patches for building deviceRTL as openmp. Reviewed By: tianshilei1992 Differential Revision: https://reviews.llvm.org/D95048
This commit is contained in:
parent
537d90db82
commit
e069662deb
@ -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_destroy_lock(omp_lock_t *) { warn(); }
|
||||
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
|
||||
|
@ -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 @@ DEVICE uint32_t __kmpc_impl_smid() {
|
||||
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
|
||||
|
@ -9,6 +9,7 @@
|
||||
// Definitions of target specific functions
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#pragma omp declare target
|
||||
|
||||
#include "target_impl.h"
|
||||
|
||||
@ -151,3 +152,5 @@ EXTERN uint32_t __kmpc_amdgcn_gpu_num_threads() {
|
||||
// Stub implementations
|
||||
DEVICE void *__kmpc_impl_malloc(size_t) { return nullptr; }
|
||||
DEVICE void __kmpc_impl_free(void *) {}
|
||||
|
||||
#pragma omp end declare target
|
||||
|
@ -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 @@ EXTERN int32_t __kmpc_cancel(kmp_Ident *loc, int32_t global_tid,
|
||||
// disabled
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma omp end declare target
|
||||
|
@ -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 @@ void __kmpc_end_critical(kmp_Ident *loc, int32_t global_tid,
|
||||
PRINT0(LD_IO, "call to kmpc_end_critical()\n");
|
||||
omp_unset_lock((omp_lock_t *)lck);
|
||||
}
|
||||
|
||||
#pragma omp end declare target
|
||||
|
@ -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 @@ EXTERN void __kmpc_restore_team_static_memory(int16_t isSPMDExecutionMode,
|
||||
omptarget_nvptx_simpleMemoryManager.Release();
|
||||
}
|
||||
|
||||
#pragma omp end declare target
|
||||
|
@ -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 @@ EXTERN int omp_test_lock(omp_lock_t *lock) {
|
||||
PRINT(LD_IO, "call omp_test_lock() return %d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
#pragma omp end declare target
|
||||
|
@ -11,6 +11,7 @@
|
||||
// interface as loops.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#pragma omp declare target
|
||||
|
||||
#include "common/omptarget.h"
|
||||
#include "target_impl.h"
|
||||
@ -754,3 +755,5 @@ void __kmpc_for_static_init_8u_simple_generic(
|
||||
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
|
||||
|
@ -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 @@ DEVICE SHARED void *ReductionScratchpadPtr;
|
||||
// Data sharing related variables.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
DEVICE SHARED omptarget_nvptx_SharedArgs omptarget_nvptx_globalArgs;
|
||||
|
||||
#pragma omp end declare target
|
||||
|
@ -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 @@ EXTERN int8_t __kmpc_is_spmd_exec_mode() {
|
||||
PRINT0(LD_IO | LD_PAR, "call to __kmpc_is_spmd_exec_mode\n");
|
||||
return isSPMDMode();
|
||||
}
|
||||
|
||||
#pragma omp end declare target
|
||||
|
@ -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 @@ EXTERN void __kmpc_push_proc_bind(kmp_Ident *loc, uint32_t tid,
|
||||
int proc_bind) {
|
||||
PRINT(LD_IO, "call kmpc_push_proc_bind %d\n", (int)proc_bind);
|
||||
}
|
||||
|
||||
#pragma omp end declare target
|
||||
|
@ -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 @@ EXTERN int32_t __kmpc_nvptx_teams_reduce_nowait_v2(
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma omp end declare target
|
||||
|
@ -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 @@ DEVICE char *GetTeamsReductionScratchpad() {
|
||||
return static_cast<char *>(ReductionScratchpadPtr) + 256;
|
||||
}
|
||||
|
||||
#pragma omp end declare target
|
||||
|
@ -9,6 +9,7 @@
|
||||
// Include all synchronization.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#pragma omp declare target
|
||||
|
||||
#include "common/omptarget.h"
|
||||
#include "target_impl.h"
|
||||
@ -135,3 +136,5 @@ EXTERN void __kmpc_syncwarp(__kmpc_impl_lanemask_t Mask) {
|
||||
PRINT0(LD_IO, "call __kmpc_syncwarp\n");
|
||||
__kmpc_impl_syncwarp(Mask);
|
||||
}
|
||||
|
||||
#pragma omp end declare target
|
||||
|
@ -26,6 +26,7 @@
|
||||
// - end
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#pragma omp declare target
|
||||
|
||||
#include "common/omptarget.h"
|
||||
|
||||
@ -214,3 +215,5 @@ EXTERN void __kmpc_taskloop(kmp_Ident *loc, uint32_t global_tid,
|
||||
|
||||
__kmpc_omp_task_with_deps(loc, global_tid, newKmpTaskDescr, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
#pragma omp end declare target
|
||||
|
@ -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 int __kmpc_impl_test_lock(omp_lock_t *lock) {
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user