HomeFreeBSD

MFC r354255:

Description

MFC r354255:

Add isnan()/isnanf() aliases for compatibility with glibc and CUDA

Even though clang comes with a number of internal CUDA wrapper headers,
compiling sample CUDA programs will result in errors similar to:

In file included from <built-in>:1:
In file included from /usr/lib/clang/9.0.0/include/__clang_cuda_runtime_wrapper.h:204:
/usr/home/arr/cuda/var/cuda-repo-10-0-local-10.0.130-410.48/usr/local/cuda-10.0//include/crt/math_functions.hpp:2910:7: error: no matching function for call to '__isnan'

if (__isnan(a)) {
    ^~~~~~~

/usr/lib/clang/9.0.0/include/__clang_cuda_device_functions.h:460:16: note: candidate function not viable: call to device function from host function
DEVICE int isnan(double a) { return nv_isnand(a); }

^

CUDA expects isnan() and isnanf() declarations to be available,
which are glibc specific extensions, equivalent to the regular isnan()
and isnanf().

To provide these, define isnan() and isnanf() as aliases of the
already existing static inline functions inline_isnan() and
inline_isnanf() from math.h.

Reported by: arrowd
PR: 241550

Details

Provenance
dimAuthored on
Parents
rS354595: MFV r354582: file 5.37.
Branches
Unknown
Tags
Unknown