mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-21 12:24:25 +08:00
Merged in henryiii/eigen/henryiii/device33 (pull request PR-344)
Branch 3.3: Fixing missing inlines on device functions for newer CUDA cards
This commit is contained in:
commit
71d1198ccd
@ -147,55 +147,55 @@ namespace half_impl {
|
|||||||
// versions to get the ALU speed increased), but you do save the
|
// versions to get the ALU speed increased), but you do save the
|
||||||
// conversion steps back and forth.
|
// conversion steps back and forth.
|
||||||
|
|
||||||
__device__ half operator + (const half& a, const half& b) {
|
EIGEN_STRONG_INLINE __device__ half operator + (const half& a, const half& b) {
|
||||||
return __hadd(a, b);
|
return __hadd(a, b);
|
||||||
}
|
}
|
||||||
__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);
|
||||||
}
|
}
|
||||||
__device__ half operator - (const half& a, const half& b) {
|
EIGEN_STRONG_INLINE __device__ half operator - (const half& a, const half& b) {
|
||||||
return __hsub(a, b);
|
return __hsub(a, b);
|
||||||
}
|
}
|
||||||
__device__ half operator / (const half& a, const half& b) {
|
EIGEN_STRONG_INLINE __device__ half operator / (const half& a, const half& b) {
|
||||||
float num = __half2float(a);
|
float num = __half2float(a);
|
||||||
float denom = __half2float(b);
|
float denom = __half2float(b);
|
||||||
return __float2half(num / denom);
|
return __float2half(num / denom);
|
||||||
}
|
}
|
||||||
__device__ half operator - (const half& a) {
|
EIGEN_STRONG_INLINE __device__ half operator - (const half& a) {
|
||||||
return __hneg(a);
|
return __hneg(a);
|
||||||
}
|
}
|
||||||
__device__ half& operator += (half& a, const half& b) {
|
EIGEN_STRONG_INLINE __device__ half& operator += (half& a, const half& b) {
|
||||||
a = a + b;
|
a = a + b;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
__device__ half& operator *= (half& a, const half& b) {
|
EIGEN_STRONG_INLINE __device__ half& operator *= (half& a, const half& b) {
|
||||||
a = a * b;
|
a = a * b;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
__device__ half& operator -= (half& a, const half& b) {
|
EIGEN_STRONG_INLINE __device__ half& operator -= (half& a, const half& b) {
|
||||||
a = a - b;
|
a = a - b;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
__device__ half& operator /= (half& a, const half& b) {
|
EIGEN_STRONG_INLINE __device__ half& operator /= (half& a, const half& b) {
|
||||||
a = a / b;
|
a = a / b;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
__device__ bool operator == (const half& a, const half& b) {
|
EIGEN_STRONG_INLINE __device__ bool operator == (const half& a, const half& b) {
|
||||||
return __heq(a, b);
|
return __heq(a, b);
|
||||||
}
|
}
|
||||||
__device__ bool operator != (const half& a, const half& b) {
|
EIGEN_STRONG_INLINE __device__ bool operator != (const half& a, const half& b) {
|
||||||
return __hne(a, b);
|
return __hne(a, b);
|
||||||
}
|
}
|
||||||
__device__ bool operator < (const half& a, const half& b) {
|
EIGEN_STRONG_INLINE __device__ bool operator < (const half& a, const half& b) {
|
||||||
return __hlt(a, b);
|
return __hlt(a, b);
|
||||||
}
|
}
|
||||||
__device__ bool operator <= (const half& a, const half& b) {
|
EIGEN_STRONG_INLINE __device__ bool operator <= (const half& a, const half& b) {
|
||||||
return __hle(a, b);
|
return __hle(a, b);
|
||||||
}
|
}
|
||||||
__device__ bool operator > (const half& a, const half& b) {
|
EIGEN_STRONG_INLINE __device__ bool operator > (const half& a, const half& b) {
|
||||||
return __hgt(a, b);
|
return __hgt(a, b);
|
||||||
}
|
}
|
||||||
__device__ bool operator >= (const half& a, const half& b) {
|
EIGEN_STRONG_INLINE __device__ bool operator >= (const half& a, const half& b) {
|
||||||
return __hge(a, b);
|
return __hge(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user