[Openmp-dev] Offloading app build error with Trunk

Itaru Kitayama via Openmp-dev openmp-dev at lists.llvm.org
Sun Dec 15 21:42:11 PST 2019


Following up on my post:

Applying below to current Trunk as of this writing:
$ git diff
diff --git a/clang/lib/Headers/__clang_cuda_cmath.h
b/clang/lib/Headers/__clang_
index 834a2e3..fb17660 100644
--- a/clang/lib/Headers/__clang_cuda_cmath.h
+++ b/clang/lib/Headers/__clang_cuda_cmath.h
@@ -53,8 +53,8 @@ __DEVICE__ double abs(double __x) { return ::fabs(__x); }
 #endif
 // TODO: remove once variat is supported.
 #if defined(_OPENMP) && defined(__cplusplus)
-__DEVICE__ const float abs(const float __x) { return ::fabsf((float)__x); }
-__DEVICE__ const double abs(const double __x) { return
::fabs((double)__x); }
+//__DEVICE__ const float abs(const float __x) { return
::fabsf((float)__x); }
+//__DEVICE__ const double abs(const double __x) { return
::fabs((double)__x); }
 #endif
 __DEVICE__ float acos(float __x) { return ::acosf(__x); }
 __DEVICE__ float asin(float __x) { return ::asinf(__x); }
diff --git a/clang/lib/Headers/__clang_cuda_math_forward_declares.h
b/clang/lib/
index 0afe4db..46b95db 100644
--- a/clang/lib/Headers/__clang_cuda_math_forward_declares.h
+++ b/clang/lib/Headers/__clang_cuda_math_forward_declares.h
@@ -47,8 +47,8 @@ __DEVICE__ float abs(float);
 // TODO: Once variant is supported the additional functions will have
 // to be removed.
 #if defined(_OPENMP) && defined(__cplusplus)
-__DEVICE__ const double abs(const double);
-__DEVICE__ const float abs(const float);
+//__DEVICE__ const double abs(const double);
+//__DEVICE__ const float abs(const float);
 #endif
 __DEVICE__ int abs(int) __NOEXCEPT;
 __DEVICE__ double acos(double);

now my app builds again on POWER8.

Experts,
If you guys can come up a work-around patch, would you merge it in trunk so
we don't need to make local changes?

Thanks,

On Mon, Dec 16, 2019 at 11:15 AM Itaru Kitayama <itaru.kitayama at gmail.com>
wrote:

> Hi,
> I am getting a build error:
>
> In file included from
> /gpfs/software/opt/gcc/7.2.0/lib/gcc/powerpc64le-unknown-linux-gnu/7.2.0/../../../../include/c++/7.2.0/cstdlib:77:
> /gpfs/software/opt/gcc/7.2.0/lib/gcc/powerpc64le-unknown-linux-gnu/7.2.0/../../../../include/c++/7.2.0/bits/std_abs.h:70:3:
> error: declaration conflicts with target of using declaration already in
> scope
>   abs(double __x)
>   ^
> /p/scratch/cpcp0/pcp0151/opt/clang/201912160138/lib/clang/10.0.0/include/__clang_cuda_cmath.h:57:25:
> note: target of using declaration
> __DEVICE__ const double abs(const double __x) { return
> ::fabs((double)__x); }
>                         ^
> /gpfs/software/opt/gcc/7.2.0/lib/gcc/powerpc64le-unknown-linux-gnu/7.2.0/../../../../include/c++/7.2.0/bits/std_abs.h:52:11:
> note: using declaration
>   using ::abs;
>           ^
> /gpfs/software/opt/gcc/7.2.0/lib/gcc/powerpc64le-unknown-linux-gnu/7.2.0/../../../../include/c++/7.2.0/bits/std_abs.h:74:3:
> error: declaration conflicts with target of using declaration already in
> scope
>   abs(float __x)
>   ^
> /p/scratch/cpcp0/pcp0151/opt/clang/201912160138/lib/clang/10.0.0/include/__clang_cuda_cmath.h:56:24:
> note: target of using declaration
> __DEVICE__ const float abs(const float __x) { return ::fabsf((float)__x); }
>                        ^
> /gpfs/software/opt/gcc/7.2.0/lib/gcc/powerpc64le-unknown-linux-gnu/7.2.0/../../../../include/c++/7.2.0/bits/std_abs.h:52:11:
> note: using declaration
>   using ::abs;
>           ^
> /p/project/cpcp0/pcp0151/projects/nest-simulator/librandom/binomial_randomdev.cpp:233:34:
> warning: implicit conversion from 'long' to 'double' changes value from
> 9223372036854775807 to 9223372036854775808 [-Wimplicit-int-float-conversion]
>     static_cast< long >( 0.998 * std::numeric_limits< long >::max() );
>                                ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 warning and 2 errors generated.
> make[2]: *** [librandom/CMakeFiles/random.dir/binomial_randomdev.cpp.o]
> Error 1
> make[1]: *** [librandom/CMakeFiles/random.dir/all] Error 2
> make: *** [all] Error 2
>
> Although I have this hunk:
>
> $ git diff
> diff --git a/clang/lib/Headers/__clang_cuda_math_forward_declares.h
> b/clang/lib/Headers/__clang_cuda_math_f
> index 0afe4db..46b95db 100644
> --- a/clang/lib/Headers/__clang_cuda_math_forward_declares.h
> +++ b/clang/lib/Headers/__clang_cuda_math_forward_declares.h
> @@ -47,8 +47,8 @@ __DEVICE__ float abs(float);
>  // TODO: Once variant is supported the additional functions will have
>  // to be removed.
>  #if defined(_OPENMP) && defined(__cplusplus)
> -__DEVICE__ const double abs(const double);
> -__DEVICE__ const float abs(const float);
> +//__DEVICE__ const double abs(const double);
> +//__DEVICE__ const float abs(const float);
>  #endif
>  __DEVICE__ int abs(int) __NOEXCEPT;
>  __DEVICE__ double acos(double);
>
> , as Alexey suggested.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20191216/9135bc7b/attachment.html>


More information about the Openmp-dev mailing list