[Openmp-commits] [openmp] f675b3d - [libomptarget] Drop assert.h, use freestanding for amdgcn devicertl

Jon Chesterfield via Openmp-commits openmp-commits at lists.llvm.org
Mon Mar 15 11:50:22 PDT 2021


Author: Jon Chesterfield
Date: 2021-03-15T18:50:09Z
New Revision: f675b3df4848bae5a8203c2508b721b41086471f

URL: https://github.com/llvm/llvm-project/commit/f675b3df4848bae5a8203c2508b721b41086471f
DIFF: https://github.com/llvm/llvm-project/commit/f675b3df4848bae5a8203c2508b721b41086471f.diff

LOG: [libomptarget] Drop assert.h, use freestanding for amdgcn devicertl

[libomptarget] Drop assert.h, use freestanding for amdgcn devicertl

Promotes the runtime assert to a link time error for the unimplemented
fallback functions. Enables amdgcn to build with only clang provided
headers, which makes it less likely to break other builds when enabled.

Reviewed By: jdoerfert

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

Added: 
    

Modified: 
    openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
    openmp/libomptarget/deviceRTLs/common/include/target/shuffle.h

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt b/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
index 2c278f7ea7d8..f1ec8221ec56 100644
--- a/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
+++ b/openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
@@ -101,6 +101,7 @@ macro(add_cuda_bc_library)
     -xc++
     -c
     -std=c++14
+    -ffreestanding
     -target amdgcn
     -emit-llvm
     -Xclang -aux-triple -Xclang x86_64-unknown-linux-gnu # see nvptx

diff  --git a/openmp/libomptarget/deviceRTLs/common/include/target/shuffle.h b/openmp/libomptarget/deviceRTLs/common/include/target/shuffle.h
index e61c3798bfe1..e05315c49d98 100644
--- a/openmp/libomptarget/deviceRTLs/common/include/target/shuffle.h
+++ b/openmp/libomptarget/deviceRTLs/common/include/target/shuffle.h
@@ -15,7 +15,6 @@
 #ifndef LIBOMPTARGET_DEVICERTL_SHUFFLE_H
 #define LIBOMPTARGET_DEVICERTL_SHUFFLE_H
 
-#include <assert.h>
 #include <stdint.h>
 
 #pragma omp declare target
@@ -41,20 +40,14 @@ uint64_t __kmpc_impl_pack(uint32_t lo, uint32_t hi);
 ///}
 
 /// Fallback implementations of the shuffle sync idiom.
+/// Unavailable at present (would error at link time if used).
 ///
 ///{
 
-inline int32_t __kmpc_impl_shfl_sync(uint64_t Mask, int32_t Var,
-                                     int32_t SrcLane) {
-  assert(false &&
-         "Fallback version of __kmpc_impl_shfl_sync is not available!");
-}
+int32_t __kmpc_impl_shfl_sync(uint64_t Mask, int32_t Var, int32_t SrcLane);
 
-inline int32_t __kmpc_impl_shfl_down_sync(uint64_t Mask, int32_t Var,
-                                          uint32_t Delta, int32_t Width) {
-  assert(false &&
-         "Fallback version of __kmpc_impl_shfl_down_sync is not available!");
-}
+int32_t __kmpc_impl_shfl_down_sync(uint64_t Mask, int32_t Var, uint32_t Delta,
+                                   int32_t Width);
 
 ///}
 


        


More information about the Openmp-commits mailing list