Skip to content

Commit 32e0645

Browse files
committed
[CUDA] Remove noreturn attribute from __assertfail().
`noreturn` complicates control flow and tends to trigger a known bug in ptxas if the assert is used within loops in sufficiently complicated code. https://bugs.llvm.org/show_bug.cgi?id=27738 Differential Revision: https://reviews.llvm.org/D97708
1 parent e880f8b commit 32e0645

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

clang/lib/Headers/__clang_cuda_runtime_wrapper.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,14 @@ extern "C" {
349349
__device__ int vprintf(const char *, const char *);
350350
__device__ void free(void *) __attribute((nothrow));
351351
__device__ void *malloc(size_t) __attribute((nothrow)) __attribute__((malloc));
352+
353+
// __assertfail() used to have a `noreturn` attribute. Unfortunately that
354+
// contributed to triggering the longstanding bug in ptxas when assert was used
355+
// in sufficiently convoluted code. See
356+
// https://bugs.llvm.org/show_bug.cgi?id=27738 for the details.
352357
__device__ void __assertfail(const char *__message, const char *__file,
353358
unsigned __line, const char *__function,
354-
size_t __charSize) __attribute__((noreturn));
359+
size_t __charSize);
355360

356361
// In order for standard assert() macro on linux to work we need to
357362
// provide device-side __assert_fail()

0 commit comments

Comments
 (0)