mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
applying EIGEN_DECLARE_TEST to *gpu* tests
Also, a few minor fixes for GPU tests running in HIP mode. 1. Adding an include for hip/hip_runtime.h in the Macros.h file For HIP __host__ and __device__ are macros which are defined in hip headers. Their definitions need to be included before their use in the file. 2. Fixing the compile failure in TensorContractionGpu introduced by the commit to "Fuse computations into the Tensor contractions using output kernel" 3. Fixing a HIP/clang specific compile error by making the struct-member assignment explicit
This commit is contained in:
@@ -449,8 +449,7 @@ struct TensorContractionEvaluatorBase
|
||||
// tensor dimensions (i, j) into the original tensor dimensions.
|
||||
// TODO(ezhulenev): Add parameters required to infer output tensor index for
|
||||
// more complex contractions than 2x2 on internal dimension.
|
||||
m_tensor_contraction_params = {
|
||||
/**swapped_arguments=*/static_cast<int>(Layout) == RowMajor};
|
||||
m_tensor_contraction_params.swapped_arguments = static_cast<int>(Layout) == RowMajor;
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Dimensions& dimensions() const { return m_dimensions; }
|
||||
|
||||
@@ -1215,16 +1215,16 @@ EigenFloatContractionKernel16x16(const LhsMapper lhs, const RhsMapper rhs,
|
||||
}
|
||||
|
||||
|
||||
template<typename Indices, typename LeftArgType, typename RightArgType>
|
||||
struct TensorEvaluator<const TensorContractionOp<Indices, LeftArgType, RightArgType>, GpuDevice> :
|
||||
public TensorContractionEvaluatorBase<TensorEvaluator<const TensorContractionOp<Indices, LeftArgType, RightArgType>, GpuDevice> > {
|
||||
template<typename Indices, typename LeftArgType, typename RightArgType, typename OutputKernelType>
|
||||
struct TensorEvaluator<const TensorContractionOp<Indices, LeftArgType, RightArgType, OutputKernelType>, GpuDevice> :
|
||||
public TensorContractionEvaluatorBase<TensorEvaluator<const TensorContractionOp<Indices, LeftArgType, RightArgType, OutputKernelType>, GpuDevice> > {
|
||||
|
||||
typedef GpuDevice Device;
|
||||
|
||||
typedef TensorEvaluator<const TensorContractionOp<Indices, LeftArgType, RightArgType>, Device> Self;
|
||||
typedef TensorEvaluator<const TensorContractionOp<Indices, LeftArgType, RightArgType, OutputKernelType>, Device> Self;
|
||||
typedef TensorContractionEvaluatorBase<Self> Base;
|
||||
|
||||
typedef TensorContractionOp<Indices, LeftArgType, RightArgType> XprType;
|
||||
typedef TensorContractionOp<Indices, LeftArgType, RightArgType, OutputKernelType> XprType;
|
||||
typedef typename internal::remove_const<typename XprType::Scalar>::type Scalar;
|
||||
typedef typename XprType::Index Index;
|
||||
typedef typename XprType::CoeffReturnType CoeffReturnType;
|
||||
|
||||
@@ -242,7 +242,7 @@ void test_gpu_argmin_dim()
|
||||
}
|
||||
}
|
||||
|
||||
void test_cxx11_tensor_gpu()
|
||||
EIGEN_DECLARE_TEST(cxx11_tensor_argmax_gpu)
|
||||
{
|
||||
CALL_SUBTEST_1(test_gpu_simple_argmax<RowMajor>());
|
||||
CALL_SUBTEST_1(test_gpu_simple_argmax<ColMajor>());
|
||||
|
||||
@@ -72,7 +72,7 @@ void test_fallback_conversion() {
|
||||
}
|
||||
|
||||
|
||||
void test_cxx11_tensor_cast_float16_gpu()
|
||||
EIGEN_DECLARE_TEST(cxx11_tensor_cast_float16_gpu)
|
||||
{
|
||||
CALL_SUBTEST(test_gpu_conversion());
|
||||
CALL_SUBTEST(test_fallback_conversion());
|
||||
|
||||
@@ -193,7 +193,7 @@ void test_gpu_contraction_sizes() {
|
||||
}
|
||||
}
|
||||
|
||||
void test_cxx11_tensor_gpu()
|
||||
EIGEN_DECLARE_TEST(cxx11_tensor_contract_gpu)
|
||||
{
|
||||
CALL_SUBTEST_1(test_gpu_contraction<ColMajor>(128, 128, 128));
|
||||
CALL_SUBTEST_1(test_gpu_contraction<RowMajor>(128, 128, 128));
|
||||
|
||||
@@ -389,7 +389,7 @@ void test_gpu() {
|
||||
}
|
||||
|
||||
|
||||
void test_cxx11_tensor_device()
|
||||
EIGEN_DECLARE_TEST(cxx11_tensor_device)
|
||||
{
|
||||
CALL_SUBTEST_1(test_cpu());
|
||||
CALL_SUBTEST_2(test_gpu());
|
||||
|
||||
@@ -1472,7 +1472,7 @@ void test_gpu_gamma_sample_der_alpha()
|
||||
gpuFree(d_out);
|
||||
}
|
||||
|
||||
void test_cxx11_tensor_gpu()
|
||||
EIGEN_DECLARE_TEST(cxx11_tensor_gpu)
|
||||
{
|
||||
CALL_SUBTEST_1(test_gpu_nullary());
|
||||
CALL_SUBTEST_1(test_gpu_elementwise_small());
|
||||
|
||||
@@ -479,7 +479,7 @@ void test_gpu_forced_evals() {
|
||||
#endif
|
||||
|
||||
|
||||
void test_cxx11_tensor_of_float16_gpu()
|
||||
EIGEN_DECLARE_TEST(cxx11_tensor_of_float16_gpu)
|
||||
{
|
||||
CALL_SUBTEST_1(test_gpu_numext<void>());
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ static void test_complex()
|
||||
}
|
||||
|
||||
|
||||
void test_cxx11_tensor_random_gpu()
|
||||
EIGEN_DECLARE_TEST(cxx11_tensor_random_gpu)
|
||||
{
|
||||
CALL_SUBTEST(test_gpu_random_uniform());
|
||||
CALL_SUBTEST(test_gpu_random_normal());
|
||||
|
||||
@@ -134,7 +134,7 @@ static void test_last_dim_reductions() {
|
||||
}
|
||||
|
||||
|
||||
void test_cxx11_tensor_reduction_gpu() {
|
||||
EIGEN_DECLARE_TEST(cxx11_tensor_reduction_gpu) {
|
||||
CALL_SUBTEST_1((test_full_reductions<float, ColMajor>()));
|
||||
CALL_SUBTEST_1((test_full_reductions<double, ColMajor>()));
|
||||
CALL_SUBTEST_2((test_full_reductions<float, RowMajor>()));
|
||||
|
||||
@@ -71,7 +71,7 @@ void test_gpu_cumsum(int m_size, int k_size, int n_size)
|
||||
}
|
||||
|
||||
|
||||
void test_cxx11_tensor_scan_gpu()
|
||||
EIGEN_DECLARE_TEST(cxx11_tensor_scan_gpu)
|
||||
{
|
||||
CALL_SUBTEST_1(test_gpu_cumsum<ColMajor>(128, 128, 128));
|
||||
CALL_SUBTEST_2(test_gpu_cumsum<RowMajor>(128, 128, 128));
|
||||
|
||||
Reference in New Issue
Block a user