-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clang + NVPTX reports ptxas fatal : Unresolved extern function '__assert_fail'
#125782
Comments
Running a single GPU-side sub-compilation with Also, CUDA on ARM is something that is substantially less well tested. It works reasonably well with CUDA-12.8, but I can't tell what to expect with older CUDA versions.So, if you run into troubles with CUDA-12.5 try with a newer version. |
Looking at the Preprocessed source file the compilation error generates, I can see that these lines seem to be getting included: // __assertfail() used to have a `noreturn` attribute. Unfortunately that
// contributed to triggering the longstanding bug in ptxas when assert was used
// in sufficiently convoluted code. See
// https://bugs.llvm.org/show_bug.cgi?id=27738 for the details.
__device__ void __assertfail(const char *__message, const char *__file,
unsigned __line, const char *__function,
size_t __charSize);
// In order for standard assert() macro on linux to work we need to
// provide device-side __assert_fail()
__device__ static inline void __assert_fail(const char *__message,
const char *__file, unsigned __line,
const char *__function) {
__assertfail(__message, __file, __line, __function, sizeof(char));
} They are coming from the |
Is that the verbatim output of compilation with "-E -dD" ? What exactly do you see for these two functions? If you can reproduce your issue on godbolt.org that would help figuring out what's going on. |
From using #undef __NV_TEX_SPARSE
# 389 "/usr/projects/eap/users/csolomon/local/install/cos3/venado/clang-trunk/lib/clang/21/include/__clang_cuda_runtime_wrapper.h" 2 3
#undef __CUDABE__
#define __CUDACC__
extern "C" {
__attribute__((device)) int vprintf(const char *, const char *);
__attribute__((device)) void free(void *) __attribute((nothrow));
__attribute__((device)) void *malloc(size_t) __attribute((nothrow)) __attribute__((malloc));
__attribute__((device)) void __assertfail(const char *__message, const char *__file,
unsigned __line, const char *__function,
size_t __charSize);
__attribute__((device)) static inline void __assert_fail(const char *__message,
const char *__file, unsigned __line,
const char *__function) {
__assertfail(__message, __file, __line, __function, sizeof(char));
}
__attribute__((device)) int printf(const char *, ...);
} coming from I also see multiple places where # 63 "/usr/include/assert.h" 3 4
extern "C" {
extern void __assert_fail (const char *__assertion, const char *__file,
unsigned int __line, const char *__function)
throw () __attribute__ ((__noreturn__));
extern void __assert_perror_fail (int __errnum, const char *__file,
unsigned int __line, const char *__function)
throw () __attribute__ ((__noreturn__));
extern void __assert (const char *__assertion, const char *__file, int __line)
throw () __attribute__ ((__noreturn__));
} Then I see multiple places where the
Note that I don't know that it is this specific instance that is causing the problem. I cannot put the source into Compiler Explorer because it is controlled...I understand the complication this adds to helping resolve the issue. |
So, the function itself does appear to be present in the source code. The question is -- why its definition does not make it to the PTX. For what ti's worth, asserts are commonly used all over the place in CUDA code and are working. Most likely the issue is specific to your build. Unless you can reduce the resproducer to something you can make public, there's not much I can do. |
I'm getting the following error when compiling a file without
-DNDEBUG
:I'm using CUDA 12.5 which i understand is marked only partially supported.
The file does compile when
-DNDEBUG
is defined on the compile line.I cannot (currently) share the reproducer as the source is controlled. I've worked (briefly) at generating a reproducer without success.
The text was updated successfully, but these errors were encountered: