[Openmp-commits] [PATCH] D98649: [libomptarget] Drop assert.h, use freestanding for amdgcn devicertl

Jon Chesterfield via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Mar 15 11:21:30 PDT 2021


JonChesterfield created this revision.
JonChesterfield added reviewers: jdoerfert, tianshilei1992.
Herald added subscribers: mgorny, jvesely.
JonChesterfield requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

[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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98649

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


Index: openmp/libomptarget/deviceRTLs/common/include/target/shuffle.h
===================================================================
--- openmp/libomptarget/deviceRTLs/common/include/target/shuffle.h
+++ 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 @@
 ///}
 
 /// 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);
 
 ///}
 
Index: openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
===================================================================
--- openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
+++ openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
@@ -101,6 +101,7 @@
     -xc++
     -c
     -std=c++14
+    -ffreestanding
     -target amdgcn
     -emit-llvm
     -Xclang -aux-triple -Xclang x86_64-unknown-linux-gnu # see nvptx


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98649.330740.patch
Type: text/x-patch
Size: 1721 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210315/5b8436c2/attachment.bin>


More information about the Openmp-commits mailing list