mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-21 08:53:17 +08:00
Fixed a number of compilation warnings generated by the cuda tests
This commit is contained in:
parent
6720b38fbf
commit
e80ed948e1
@ -25,6 +25,16 @@ template <typename T, size_t n> class array {
|
|||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
EIGEN_STRONG_INLINE const T& operator[] (size_t index) const { return values[index]; }
|
EIGEN_STRONG_INLINE const T& operator[] (size_t index) const { return values[index]; }
|
||||||
|
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
|
EIGEN_STRONG_INLINE T& front() { return values[0]; }
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
|
EIGEN_STRONG_INLINE const T& front() const { return values[0]; }
|
||||||
|
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
|
EIGEN_STRONG_INLINE T& back() { return values[n-1]; }
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
|
EIGEN_STRONG_INLINE const T& back() const { return values[n-1]; }
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
|
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
|
||||||
static std::size_t size() { return n; }
|
static std::size_t size() { return n; }
|
||||||
|
|
||||||
@ -123,13 +133,33 @@ template <typename T> class array<T, 0> {
|
|||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
EIGEN_STRONG_INLINE T& operator[] (size_t) {
|
EIGEN_STRONG_INLINE T& operator[] (size_t) {
|
||||||
eigen_assert(false && "Can't index a zero size array");
|
eigen_assert(false && "Can't index a zero size array");
|
||||||
return *static_cast<T*>(NULL);
|
return dummy;
|
||||||
}
|
}
|
||||||
|
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
EIGEN_STRONG_INLINE const T& operator[] (size_t) const {
|
EIGEN_STRONG_INLINE const T& operator[] (size_t) const {
|
||||||
eigen_assert(false && "Can't index a zero size array");
|
eigen_assert(false && "Can't index a zero size array");
|
||||||
return *static_cast<const T*>(NULL);
|
return dummy;
|
||||||
|
}
|
||||||
|
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
|
EIGEN_STRONG_INLINE T& front() {
|
||||||
|
eigen_assert(false && "Can't index a zero size array");
|
||||||
|
return dummy;
|
||||||
|
}
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
|
EIGEN_STRONG_INLINE const T& front() const {
|
||||||
|
eigen_assert(false && "Can't index a zero size array");
|
||||||
|
return dummy;
|
||||||
|
}
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
|
EIGEN_STRONG_INLINE T& back() {
|
||||||
|
eigen_assert(false && "Can't index a zero size array");
|
||||||
|
return dummy;
|
||||||
|
}
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
|
EIGEN_STRONG_INLINE const T& back() const {
|
||||||
|
eigen_assert(false && "Can't index a zero size array");
|
||||||
|
return dummy;
|
||||||
}
|
}
|
||||||
|
|
||||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE std::size_t size() { return 0; }
|
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE std::size_t size() { return 0; }
|
||||||
@ -142,6 +172,9 @@ template <typename T> class array<T, 0> {
|
|||||||
eigen_assert(l.size() == 0);
|
eigen_assert(l.size() == 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
private:
|
||||||
|
T dummy;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
@ -21,7 +21,7 @@ namespace Eigen {
|
|||||||
*/
|
*/
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
template <typename Index, typename InputDims, size_t NumKernelDims, int Layout>
|
template <typename Index, typename InputDims, int NumKernelDims, int Layout>
|
||||||
class IndexMapper {
|
class IndexMapper {
|
||||||
public:
|
public:
|
||||||
IndexMapper(const InputDims& input_dims, const array<Index, NumKernelDims>& kernel_dims,
|
IndexMapper(const InputDims& input_dims, const array<Index, NumKernelDims>& kernel_dims,
|
||||||
@ -123,7 +123,7 @@ class IndexMapper {
|
|||||||
}
|
}
|
||||||
inputIndex += p * m_inputStrides[NumKernelDims];
|
inputIndex += p * m_inputStrides[NumKernelDims];
|
||||||
} else {
|
} else {
|
||||||
int limit = 0;
|
std::ptrdiff_t limit = 0;
|
||||||
if (NumKernelDims < NumDims) {
|
if (NumKernelDims < NumDims) {
|
||||||
limit = NumDims - NumKernelDims - 1;
|
limit = NumDims - NumKernelDims - 1;
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ class IndexMapper {
|
|||||||
}
|
}
|
||||||
outputIndex += p * m_outputStrides[NumKernelDims];
|
outputIndex += p * m_outputStrides[NumKernelDims];
|
||||||
} else {
|
} else {
|
||||||
int limit = 0;
|
std::ptrdiff_t limit = 0;
|
||||||
if (NumKernelDims < NumDims) {
|
if (NumKernelDims < NumDims) {
|
||||||
limit = NumDims - NumKernelDims - 1;
|
limit = NumDims - NumKernelDims - 1;
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ class IndexMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const size_t NumDims = internal::array_size<InputDims>::value;
|
static const int NumDims = internal::array_size<InputDims>::value;
|
||||||
array<Index, NumDims> m_inputStrides;
|
array<Index, NumDims> m_inputStrides;
|
||||||
array<Index, NumDims> m_outputStrides;
|
array<Index, NumDims> m_outputStrides;
|
||||||
array<Index, NumDims> m_cudaInputStrides;
|
array<Index, NumDims> m_cudaInputStrides;
|
||||||
|
@ -463,7 +463,7 @@ struct TensorEvaluator<const TensorReductionOp<Op, Dims, ArgType>, Device>
|
|||||||
m_outputStrides[i] = m_outputStrides[i - 1] * m_dimensions[i - 1];
|
m_outputStrides[i] = m_outputStrides[i - 1] * m_dimensions[i - 1];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_outputStrides[NumOutputDims - 1] = 1;
|
m_outputStrides.back() = 1;
|
||||||
for (int i = NumOutputDims - 2; i >= 0; --i) {
|
for (int i = NumOutputDims - 2; i >= 0; --i) {
|
||||||
m_outputStrides[i] = m_outputStrides[i + 1] * m_dimensions[i + 1];
|
m_outputStrides[i] = m_outputStrides[i + 1] * m_dimensions[i + 1];
|
||||||
}
|
}
|
||||||
@ -479,7 +479,7 @@ struct TensorEvaluator<const TensorReductionOp<Op, Dims, ArgType>, Device>
|
|||||||
input_strides[i] = input_strides[i-1] * input_dims[i-1];
|
input_strides[i] = input_strides[i-1] * input_dims[i-1];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
input_strides[NumInputDims - 1] = 1;
|
input_strides.back() = 1;
|
||||||
for (int i = NumInputDims - 2; i >= 0; --i) {
|
for (int i = NumInputDims - 2; i >= 0; --i) {
|
||||||
input_strides[i] = input_strides[i + 1] * input_dims[i + 1];
|
input_strides[i] = input_strides[i + 1] * input_dims[i + 1];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user