[Openmp-commits] [PATCH] D95986: [OpenMP][deviceRTLs] Drop `assert` in common parts of `deviceRTLs`

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Feb 3 17:49:20 PST 2021


tianshilei1992 updated this revision to Diff 321277.
tianshilei1992 added a comment.
Herald added a subscriber: jvesely.

Remove useless function in `amdgcn`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95986/new/

https://reviews.llvm.org/D95986

Files:
  openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
  openmp/libomptarget/deviceRTLs/common/debug.h
  openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h


Index: openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
===================================================================
--- openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
+++ openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
@@ -12,7 +12,6 @@
 #ifndef _TARGET_IMPL_H_
 #define _TARGET_IMPL_H_
 
-#include <assert.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
Index: openmp/libomptarget/deviceRTLs/common/debug.h
===================================================================
--- openmp/libomptarget/deviceRTLs/common/debug.h
+++ openmp/libomptarget/deviceRTLs/common/debug.h
@@ -142,13 +142,17 @@
 template <typename... Arguments>
 NOINLINE static void check(bool cond, const char *fmt,
                            Arguments... parameters) {
-  if (!cond)
+  if (!cond) {
     printf(fmt, (int)GetBlockIdInKernel(), (int)GetThreadIdInBlock(),
            (int)GetWarpId(), (int)GetLaneId(), parameters...);
-  assert(cond);
+    __builtin_trap();
+  }
 }
 
-NOINLINE static void check(bool cond) { assert(cond); }
+NOINLINE static void check(bool cond) {
+  if (!cond)
+    __builtin_trap();
+}
 #endif
 
 // set flags that are tested (inclusion properties)
Index: openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
===================================================================
--- openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
+++ openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
@@ -68,11 +68,6 @@
   __kmpc_impl_all_lanes = ~(__kmpc_impl_lanemask_t)0
 };
 
-// DEVICE versions of part of libc
-INLINE void __assert_fail(const char *, const char *, unsigned int,
-                          const char *) {
-  __builtin_trap();
-}
 EXTERN int printf(const char *, ...);
 
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95986.321277.patch
Type: text/x-patch
Size: 1758 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210204/d8dbe724/attachment.bin>


More information about the Openmp-commits mailing list