mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-21 17:19:36 +08:00
bug #1526 - CUDA compilation fails on CUDA 9.x SDK when arch is set to compute_60 and/or above
This commit is contained in:
parent
edfb7962fd
commit
6dcd2642aa
@ -272,7 +272,11 @@ namespace half_impl {
|
|||||||
// conversion steps back and forth.
|
// conversion steps back and forth.
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE __device__ half operator + (const half& a, const half& b) {
|
EIGEN_STRONG_INLINE __device__ half operator + (const half& a, const half& b) {
|
||||||
|
#if defined(EIGEN_CUDACC_VER) && EIGEN_CUDACC_VER >= 90000
|
||||||
|
return __hadd(::__half(a), ::__half(b));
|
||||||
|
#else
|
||||||
return __hadd(a, b);
|
return __hadd(a, b);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
EIGEN_STRONG_INLINE __device__ half operator * (const half& a, const half& b) {
|
EIGEN_STRONG_INLINE __device__ half operator * (const half& a, const half& b) {
|
||||||
return __hmul(a, b);
|
return __hmul(a, b);
|
||||||
@ -281,9 +285,13 @@ EIGEN_STRONG_INLINE __device__ half operator - (const half& a, const half& b) {
|
|||||||
return __hsub(a, b);
|
return __hsub(a, b);
|
||||||
}
|
}
|
||||||
EIGEN_STRONG_INLINE __device__ half operator / (const half& a, const half& b) {
|
EIGEN_STRONG_INLINE __device__ half operator / (const half& a, const half& b) {
|
||||||
|
#if defined(EIGEN_CUDACC_VER) && EIGEN_CUDACC_VER >= 90000
|
||||||
|
return __hdiv(a, b);
|
||||||
|
#else
|
||||||
float num = __half2float(a);
|
float num = __half2float(a);
|
||||||
float denom = __half2float(b);
|
float denom = __half2float(b);
|
||||||
return __float2half(num / denom);
|
return __float2half(num / denom);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
EIGEN_STRONG_INLINE __device__ half operator - (const half& a) {
|
EIGEN_STRONG_INLINE __device__ half operator - (const half& a) {
|
||||||
return __hneg(a);
|
return __hneg(a);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user