HIPIFY: [HIPIFY] hipify-clang terminates with error.

After f19e7c29dfcef3d0c941c977ce6d1448ad4e288a commit hipify-clang terminates with this error:

~/source/HIP/samples/0_Intro/square$ ~/software/hip/hipify-clang square.cu  -- -x cuda --cuda-path=$CUDA_PATH
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:537:3: error: constexpr function 'fpclassify' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  fpclassify(float __x)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:248:9: note: conflicting __device__ function declared here
using ::fpclassify;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:542:3: error: constexpr function 'fpclassify' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  fpclassify(double __x)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:248:9: note: conflicting __device__ function declared here
using ::fpclassify;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:562:3: error: constexpr function 'isfinite' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  isfinite(float __x)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:252:9: note: conflicting __device__ function declared here
using ::isfinite;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:566:3: error: constexpr function 'isfinite' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  isfinite(double __x)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:252:9: note: conflicting __device__ function declared here
using ::isfinite;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:584:3: error: constexpr function 'isinf' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  isinf(float __x)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:255:9: note: conflicting __device__ function declared here
using ::isinf;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:592:3: error: constexpr function 'isinf' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  isinf(double __x)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:255:9: note: conflicting __device__ function declared here
using ::isinf;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:611:3: error: constexpr function 'isnan' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  isnan(float __x)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:259:9: note: conflicting __device__ function declared here
using ::isnan;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:619:3: error: constexpr function 'isnan' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  isnan(double __x)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:259:9: note: conflicting __device__ function declared here
using ::isnan;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:638:3: error: constexpr function 'isnormal' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  isnormal(float __x)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:260:9: note: conflicting __device__ function declared here
using ::isnormal;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:642:3: error: constexpr function 'isnormal' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  isnormal(double __x)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:260:9: note: conflicting __device__ function declared here
using ::isnormal;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:661:3: error: constexpr function 'signbit' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  signbit(float __x)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:287:9: note: conflicting __device__ function declared here
using ::signbit;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:665:3: error: constexpr function 'signbit' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  signbit(double __x)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:287:9: note: conflicting __device__ function declared here
using ::signbit;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:683:3: error: constexpr function 'isgreater' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  isgreater(float __x, float __y)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:253:9: note: conflicting __device__ function declared here
using ::isgreater;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:687:3: error: constexpr function 'isgreater' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  isgreater(double __x, double __y)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:253:9: note: conflicting __device__ function declared here
using ::isgreater;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:709:3: error: constexpr function 'isgreaterequal' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  isgreaterequal(float __x, float __y)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:254:9: note: conflicting __device__ function declared here
using ::isgreaterequal;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:713:3: error: constexpr function 'isgreaterequal' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  isgreaterequal(double __x, double __y)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:254:9: note: conflicting __device__ function declared here
using ::isgreaterequal;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:735:3: error: constexpr function 'isless' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  isless(float __x, float __y)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:256:9: note: conflicting __device__ function declared here
using ::isless;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:739:3: error: constexpr function 'isless' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  isless(double __x, double __y)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:256:9: note: conflicting __device__ function declared here
using ::isless;
        ^
In file included from <built-in>:1:
In file included from /home/kaveh/software/hip/include/__clang_cuda_runtime_wrapper.h:36:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:761:3: error: constexpr function 'islessequal' without __host__ or __device__ attributes cannot overload __device__ function with same signature.  Add a __host__ attribute, or build with -fno-cuda-host-device-constexpr.
  islessequal(float __x, float __y)
  ^
/home/kaveh/software/hip/include/__clang_cuda_math_forward_declares.h:257:9: note: conflicting __device__ function declared here
using ::islessequal;
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated when compiling for host.
Error while processing /tmp/square.cu-937183.hip.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 28

Commits related to this issue

Most upvoted comments

I should add that to CPATH if I want for example compile HIP codes with other compilers (or I have to add that with -I).

Please, try once again. I believe, now you don’t need CPATH to bin/include as only hipify-clang related headers installed there, finally.

1- The rest of HIP executables goes to -> bin/bin 2- HIP’s (not only hipify-clang) include folder goes to -> bin/include

Ok, now I see it, sorry, will fix it soon.

3- stddef.h is in ->bin/include and if I add this to the CPATH I see conflicts with nvcc.

Why do you need to add bin/include to CPATH?

Ok, could you please check HIP’s fallback (nvcc) path as well? Anyway:

  1. The new issue should be filed on [HIP].
  2. Close this ticket.

It also has an impact on nvcc. When HIP is included in CPATH, nvcc uses HIP’s stddef.h and introduces errors there. Maybe we have a similar conflict here.

Just for clarification: by nvcc here, you mean HIP fallback path, right?

If I add this line to my environment then nvcc would not function correctly:

export CPATH=/home/kaveh/software/hip/include/:$CPATH

because it uses stddef.h in /home/kaveh/software/hip/include .

The error vanishes if I exclude HIP_INSTALL_PATH/include from the CPATH environment variable.

So, the changed environment indeed? hipify-clang doesn’t need HIP includes, and now it looks like there might be conflicts.

What is trunk LLVM?

It is up-to-date LLVM’s source code, resides here: https://github.com/llvm/llvm-project.git

Here is a quick guide: http://llvm.org/docs/GettingStarted.html#getting-started-quickly-a-summary

But it looks like it is not needed for the issue, right?

Under investigation. Could you please also run against trunk LLVM twice (with and without installation)? Thanks in advance.

Btw, unrelated, you may omit -- -x cuda.