summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Chesterfield <jonathanchesterfield@gmail.com>2020-01-14 19:27:44 +0000
committerJon Chesterfield <jonathanchesterfield@gmail.com>2020-01-14 19:27:45 +0000
commit2a43688a0a074a70e395491fa0c3cdb4556ccea4 (patch)
tree7edd9a780339788e605b741808944f6c27a9eb0e
parent2d287bec3c5b63b7df9946163ba02987858b1736 (diff)
downloadbcm5719-llvm-2a43688a0a074a70e395491fa0c3cdb4556ccea4.tar.gz
bcm5719-llvm-2a43688a0a074a70e395491fa0c3cdb4556ccea4.zip
[nfc][libomptarget] Refactor nvptx/target_impl.cu
Summary: [nfc][libomptarget] Refactor nxptx/target_impl.cu Use __kmpc_impl_atomic_add instead of atomicAdd to match the rest of the file. Alternatively, target_impl.cu could use the cuda functions directly. Using a mixture in this file was an oversight, happy to resolve in either direction. Removed some comments that look outdated. Call __kmpc_impl_unset_lock directly to avoid a redundant diagnostic and remove an implict dependency on interface.h. Reviewers: ABataev, grokos, jdoerfert Reviewed By: jdoerfert Subscribers: jfb, openmp-commits Tags: #openmp Differential Revision: https://reviews.llvm.org/D72719
-rw-r--r--openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu11
1 files changed, 3 insertions, 8 deletions
diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu b/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu
index 97a5ce34962..50867bc4010 100644
--- a/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu
+++ b/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu
@@ -19,17 +19,14 @@
#define SET 1u
EXTERN void __kmpc_impl_init_lock(omp_lock_t *lock) {
- omp_unset_lock(lock);
+ __kmpc_impl_unset_lock(lock);
}
EXTERN void __kmpc_impl_destroy_lock(omp_lock_t *lock) {
- omp_unset_lock(lock);
+ __kmpc_impl_unset_lock(lock);
}
EXTERN void __kmpc_impl_set_lock(omp_lock_t *lock) {
- // int atomicCAS(int* address, int compare, int val);
- // (old == compare ? val : old)
-
// TODO: not sure spinning is a good idea here..
while (__kmpc_atomic_cas(lock, UNSET, SET) != UNSET) {
clock_t start = clock();
@@ -49,7 +46,5 @@ EXTERN void __kmpc_impl_unset_lock(omp_lock_t *lock) {
}
EXTERN int __kmpc_impl_test_lock(omp_lock_t *lock) {
- // int atomicCAS(int* address, int compare, int val);
- // (old == compare ? val : old)
- return atomicAdd(lock, 0);
+ return __kmpc_atomic_add(lock, 0u);
}
OpenPOWER on IntegriCloud