diff options
author | Eugene Zhulenev <ezhulenev@google.com> | 2019-11-12 10:12:28 -0800 |
---|---|---|
committer | Eugene Zhulenev <ezhulenev@google.com> | 2019-11-12 10:12:28 -0800 |
commit | 13c3327f5cf829fd9d04a2ab46861e722cd74ca0 (patch) | |
tree | 20bd1a5f361023db822298696efbcff7378ab4a7 /unsupported/test/cxx11_tensor_executor.cpp | |
parent | 71aa53dd6dfdc497324d9e87f59c4ba820191856 (diff) |
Remove legacy block evaluation support
Diffstat (limited to 'unsupported/test/cxx11_tensor_executor.cpp')
-rw-r--r-- | unsupported/test/cxx11_tensor_executor.cpp | 212 |
1 files changed, 71 insertions, 141 deletions
diff --git a/unsupported/test/cxx11_tensor_executor.cpp b/unsupported/test/cxx11_tensor_executor.cpp index 0e70e1770..66b06e8ee 100644 --- a/unsupported/test/cxx11_tensor_executor.cpp +++ b/unsupported/test/cxx11_tensor_executor.cpp @@ -311,48 +311,6 @@ static void test_execute_shuffle_lvalue(Device d) } template <typename T, int NumDims, typename Device, bool Vectorizable, - TiledEvaluation Tiling, int Layout> -static void test_execute_reduction(Device d) -{ - static_assert(NumDims >= 2, "NumDims must be greater or equal than 2"); - - static constexpr int ReducedDims = NumDims - 2; - static constexpr int Options = 0 | Layout; - - auto dims = RandomDims<NumDims>(5, 10); - Tensor<T, NumDims, Options, Index> src(dims); - src.setRandom(); - - // Pick two random and unique reduction dimensions. - int reduction0 = internal::random<int>(0, NumDims - 1); - int reduction1 = internal::random<int>(0, NumDims - 1); - while (reduction0 == reduction1) { - reduction1 = internal::random<int>(0, NumDims - 1); - } - - DSizes<Index, 2> reduction_axis; - reduction_axis[0] = reduction0; - reduction_axis[1] = reduction1; - - Tensor<T, ReducedDims, Options, Index> golden = src.sum(reduction_axis); - - // Now do the reduction using configured tensor executor. - Tensor<T, ReducedDims, Options, Index> dst(golden.dimensions()); - - auto expr = src.sum(reduction_axis); - - using Assign = TensorAssignOp<decltype(dst), const decltype(expr)>; - using Executor = - internal::TensorExecutor<const Assign, Device, Vectorizable, Tiling>; - - Executor::run(Assign(dst, expr), d); - - for (Index i = 0; i < dst.dimensions().TotalSize(); ++i) { - VERIFY_IS_EQUAL(dst.coeff(i), golden.coeff(i)); - } -} - -template <typename T, int NumDims, typename Device, bool Vectorizable, TiledEvaluation Tiling, int Layout> static void test_execute_reshape(Device d) { @@ -663,57 +621,34 @@ static void test_async_execute_binary_expr(Device d) #define CALL_SUBTEST_PART(PART) \ CALL_SUBTEST_##PART -#define CALL_SUBTEST_COMBINATIONS_V1(PART, NAME, T, NUM_DIMS) \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, false, TiledEvaluation::Off, ColMajor>(default_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, false, TiledEvaluation::Legacy, ColMajor>(default_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, VECTORIZABLE(true), TiledEvaluation::Off, ColMajor>(default_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, VECTORIZABLE(true), TiledEvaluation::Legacy, ColMajor>(default_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, false, TiledEvaluation::Off, RowMajor>(default_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, false, TiledEvaluation::Legacy, RowMajor>(default_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, VECTORIZABLE(true), TiledEvaluation::Off, RowMajor>(default_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, VECTORIZABLE(true), TiledEvaluation::Legacy, RowMajor>(default_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, TiledEvaluation::Off, ColMajor>(tp_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, TiledEvaluation::Legacy, ColMajor>(tp_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, VECTORIZABLE(true), TiledEvaluation::Off, ColMajor>(tp_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, VECTORIZABLE(true), TiledEvaluation::Legacy, ColMajor>(tp_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, TiledEvaluation::Off, RowMajor>(tp_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, TiledEvaluation::Legacy, RowMajor>(tp_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, VECTORIZABLE(true), TiledEvaluation::Off, RowMajor>(tp_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, VECTORIZABLE(true), TiledEvaluation::Legacy, RowMajor>(tp_device))) - - // NOTE: Tiling V2 currently implemented for a limited types of expression, and only with default device. -#define CALL_SUBTEST_COMBINATIONS_V2(PART, NAME, T, NUM_DIMS) \ +#define CALL_SUBTEST_COMBINATIONS(PART, NAME, T, NUM_DIMS) \ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, false, TiledEvaluation::Off, ColMajor>(default_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, false, TiledEvaluation::Legacy, ColMajor>(default_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, false, TiledEvaluation::On, ColMajor>(default_device))); \ + CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, false, TiledEvaluation::On, ColMajor>(default_device))); \ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, VECTORIZABLE(true), TiledEvaluation::Off, ColMajor>(default_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, VECTORIZABLE(true), TiledEvaluation::Legacy, ColMajor>(default_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, VECTORIZABLE(true), TiledEvaluation::On, ColMajor>(default_device))); \ + CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, VECTORIZABLE(true), TiledEvaluation::On, ColMajor>(default_device))); \ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, false, TiledEvaluation::Off, RowMajor>(default_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, false, TiledEvaluation::Legacy, RowMajor>(default_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, false, TiledEvaluation::On, RowMajor>(default_device))); \ + CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, false, TiledEvaluation::On, RowMajor>(default_device))); \ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, VECTORIZABLE(true), TiledEvaluation::Off, RowMajor>(default_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, VECTORIZABLE(true), TiledEvaluation::Legacy, RowMajor>(default_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, VECTORIZABLE(true), TiledEvaluation::On, RowMajor>(default_device))); \ + CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, VECTORIZABLE(true), TiledEvaluation::On, RowMajor>(default_device))); \ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, TiledEvaluation::Off, ColMajor>(tp_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, TiledEvaluation::Legacy, ColMajor>(tp_device))); \ + CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, TiledEvaluation::On, ColMajor>(tp_device))); \ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, VECTORIZABLE(true), TiledEvaluation::Off, ColMajor>(tp_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, VECTORIZABLE(true), TiledEvaluation::Legacy, ColMajor>(tp_device))); \ + CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, VECTORIZABLE(true), TiledEvaluation::On, ColMajor>(tp_device))); \ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, TiledEvaluation::Off, RowMajor>(tp_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, TiledEvaluation::Legacy, RowMajor>(tp_device))); \ + CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, TiledEvaluation::On, RowMajor>(tp_device))); \ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, VECTORIZABLE(true), TiledEvaluation::Off, RowMajor>(tp_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, VECTORIZABLE(true), TiledEvaluation::Legacy, RowMajor>(tp_device))) + CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, VECTORIZABLE(true), TiledEvaluation::On, RowMajor>(tp_device))) // NOTE: Currently only ThreadPoolDevice supports async expression evaluation. #define CALL_ASYNC_SUBTEST_COMBINATIONS(PART, NAME, T, NUM_DIMS) \ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, TiledEvaluation::Off, ColMajor>(tp_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, TiledEvaluation::Legacy, ColMajor>(tp_device))); \ + CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, TiledEvaluation::On, ColMajor>(tp_device))); \ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, VECTORIZABLE(true), TiledEvaluation::Off, ColMajor>(tp_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, VECTORIZABLE(true), TiledEvaluation::Legacy, ColMajor>(tp_device))); \ + CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, VECTORIZABLE(true), TiledEvaluation::On, ColMajor>(tp_device))); \ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, TiledEvaluation::Off, RowMajor>(tp_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, TiledEvaluation::Legacy, RowMajor>(tp_device))); \ + CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, TiledEvaluation::On, RowMajor>(tp_device))); \ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, VECTORIZABLE(true), TiledEvaluation::Off, RowMajor>(tp_device))); \ - CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, VECTORIZABLE(true), TiledEvaluation::Legacy, RowMajor>(tp_device))) + CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, VECTORIZABLE(true), TiledEvaluation::On, RowMajor>(tp_device))) EIGEN_DECLARE_TEST(cxx11_tensor_executor) { Eigen::DefaultDevice default_device; @@ -724,69 +659,64 @@ EIGEN_DECLARE_TEST(cxx11_tensor_executor) { Eigen::ThreadPool tp(num_threads); Eigen::ThreadPoolDevice tp_device(&tp, num_threads); - CALL_SUBTEST_COMBINATIONS_V2(1, test_execute_unary_expr, float, 3); - CALL_SUBTEST_COMBINATIONS_V2(1, test_execute_unary_expr, float, 4); - CALL_SUBTEST_COMBINATIONS_V2(1, test_execute_unary_expr, float, 5); - - CALL_SUBTEST_COMBINATIONS_V2(2, test_execute_binary_expr, float, 3); - CALL_SUBTEST_COMBINATIONS_V2(2, test_execute_binary_expr, float, 4); - CALL_SUBTEST_COMBINATIONS_V2(2, test_execute_binary_expr, float, 5); - - CALL_SUBTEST_COMBINATIONS_V2(3, test_execute_broadcasting, float, 3); - CALL_SUBTEST_COMBINATIONS_V2(3, test_execute_broadcasting, float, 4); - CALL_SUBTEST_COMBINATIONS_V2(3, test_execute_broadcasting, float, 5); - - CALL_SUBTEST_COMBINATIONS_V2(4, test_execute_chipping_rvalue, float, 3); - CALL_SUBTEST_COMBINATIONS_V2(4, test_execute_chipping_rvalue, float, 4); - CALL_SUBTEST_COMBINATIONS_V2(4, test_execute_chipping_rvalue, float, 5); - - CALL_SUBTEST_COMBINATIONS_V2(5, test_execute_chipping_lvalue, float, 3); - CALL_SUBTEST_COMBINATIONS_V2(5, test_execute_chipping_lvalue, float, 4); - CALL_SUBTEST_COMBINATIONS_V2(5, test_execute_chipping_lvalue, float, 5); - - CALL_SUBTEST_COMBINATIONS_V2(6, test_execute_shuffle_rvalue, float, 3); - CALL_SUBTEST_COMBINATIONS_V2(6, test_execute_shuffle_rvalue, float, 4); - CALL_SUBTEST_COMBINATIONS_V2(6, test_execute_shuffle_rvalue, float, 5); - - CALL_SUBTEST_COMBINATIONS_V2(7, test_execute_shuffle_lvalue, float, 3); - CALL_SUBTEST_COMBINATIONS_V2(7, test_execute_shuffle_lvalue, float, 4); - CALL_SUBTEST_COMBINATIONS_V2(7, test_execute_shuffle_lvalue, float, 5); - - CALL_SUBTEST_COMBINATIONS_V1(8, test_execute_reduction, float, 2); - CALL_SUBTEST_COMBINATIONS_V1(8, test_execute_reduction, float, 3); - CALL_SUBTEST_COMBINATIONS_V1(8, test_execute_reduction, float, 4); - CALL_SUBTEST_COMBINATIONS_V1(8, test_execute_reduction, float, 5); - - CALL_SUBTEST_COMBINATIONS_V2(9, test_execute_reshape, float, 2); - CALL_SUBTEST_COMBINATIONS_V2(9, test_execute_reshape, float, 3); - CALL_SUBTEST_COMBINATIONS_V2(9, test_execute_reshape, float, 4); - CALL_SUBTEST_COMBINATIONS_V2(9, test_execute_reshape, float, 5); - - CALL_SUBTEST_COMBINATIONS_V2(10, test_execute_slice_rvalue, float, 2); - CALL_SUBTEST_COMBINATIONS_V2(10, test_execute_slice_rvalue, float, 3); - CALL_SUBTEST_COMBINATIONS_V2(10, test_execute_slice_rvalue, float, 4); - CALL_SUBTEST_COMBINATIONS_V2(10, test_execute_slice_rvalue, float, 5); - - CALL_SUBTEST_COMBINATIONS_V2(11, test_execute_slice_lvalue, float, 2); - CALL_SUBTEST_COMBINATIONS_V2(11, test_execute_slice_lvalue, float, 3); - CALL_SUBTEST_COMBINATIONS_V2(11, test_execute_slice_lvalue, float, 4); - CALL_SUBTEST_COMBINATIONS_V2(11, test_execute_slice_lvalue, float, 5); - - CALL_SUBTEST_COMBINATIONS_V2(12, test_execute_broadcasting_of_forced_eval, float, 2); - CALL_SUBTEST_COMBINATIONS_V2(12, test_execute_broadcasting_of_forced_eval, float, 3); - CALL_SUBTEST_COMBINATIONS_V2(12, test_execute_broadcasting_of_forced_eval, float, 4); - CALL_SUBTEST_COMBINATIONS_V2(12, test_execute_broadcasting_of_forced_eval, float, 5); - - CALL_SUBTEST_COMBINATIONS_V2(13, test_execute_generator_op, float, 2); - CALL_SUBTEST_COMBINATIONS_V2(13, test_execute_generator_op, float, 3); - CALL_SUBTEST_COMBINATIONS_V2(13, test_execute_generator_op, float, 4); - CALL_SUBTEST_COMBINATIONS_V2(13, test_execute_generator_op, float, 5); - - CALL_SUBTEST_COMBINATIONS_V2(14, test_execute_reverse_rvalue, float, 1); - CALL_SUBTEST_COMBINATIONS_V2(14, test_execute_reverse_rvalue, float, 2); - CALL_SUBTEST_COMBINATIONS_V2(14, test_execute_reverse_rvalue, float, 3); - CALL_SUBTEST_COMBINATIONS_V2(14, test_execute_reverse_rvalue, float, 4); - CALL_SUBTEST_COMBINATIONS_V2(14, test_execute_reverse_rvalue, float, 5); + CALL_SUBTEST_COMBINATIONS(1, test_execute_unary_expr, float, 3); + CALL_SUBTEST_COMBINATIONS(1, test_execute_unary_expr, float, 4); + CALL_SUBTEST_COMBINATIONS(1, test_execute_unary_expr, float, 5); + + CALL_SUBTEST_COMBINATIONS(2, test_execute_binary_expr, float, 3); + CALL_SUBTEST_COMBINATIONS(2, test_execute_binary_expr, float, 4); + CALL_SUBTEST_COMBINATIONS(2, test_execute_binary_expr, float, 5); + + CALL_SUBTEST_COMBINATIONS(3, test_execute_broadcasting, float, 3); + CALL_SUBTEST_COMBINATIONS(3, test_execute_broadcasting, float, 4); + CALL_SUBTEST_COMBINATIONS(3, test_execute_broadcasting, float, 5); + + CALL_SUBTEST_COMBINATIONS(4, test_execute_chipping_rvalue, float, 3); + CALL_SUBTEST_COMBINATIONS(4, test_execute_chipping_rvalue, float, 4); + CALL_SUBTEST_COMBINATIONS(4, test_execute_chipping_rvalue, float, 5); + + CALL_SUBTEST_COMBINATIONS(5, test_execute_chipping_lvalue, float, 3); + CALL_SUBTEST_COMBINATIONS(5, test_execute_chipping_lvalue, float, 4); + CALL_SUBTEST_COMBINATIONS(5, test_execute_chipping_lvalue, float, 5); + + CALL_SUBTEST_COMBINATIONS(6, test_execute_shuffle_rvalue, float, 3); + CALL_SUBTEST_COMBINATIONS(6, test_execute_shuffle_rvalue, float, 4); + CALL_SUBTEST_COMBINATIONS(6, test_execute_shuffle_rvalue, float, 5); + + CALL_SUBTEST_COMBINATIONS(7, test_execute_shuffle_lvalue, float, 3); + CALL_SUBTEST_COMBINATIONS(7, test_execute_shuffle_lvalue, float, 4); + CALL_SUBTEST_COMBINATIONS(7, test_execute_shuffle_lvalue, float, 5); + + CALL_SUBTEST_COMBINATIONS(9, test_execute_reshape, float, 2); + CALL_SUBTEST_COMBINATIONS(9, test_execute_reshape, float, 3); + CALL_SUBTEST_COMBINATIONS(9, test_execute_reshape, float, 4); + CALL_SUBTEST_COMBINATIONS(9, test_execute_reshape, float, 5); + + CALL_SUBTEST_COMBINATIONS(10, test_execute_slice_rvalue, float, 2); + CALL_SUBTEST_COMBINATIONS(10, test_execute_slice_rvalue, float, 3); + CALL_SUBTEST_COMBINATIONS(10, test_execute_slice_rvalue, float, 4); + CALL_SUBTEST_COMBINATIONS(10, test_execute_slice_rvalue, float, 5); + + CALL_SUBTEST_COMBINATIONS(11, test_execute_slice_lvalue, float, 2); + CALL_SUBTEST_COMBINATIONS(11, test_execute_slice_lvalue, float, 3); + CALL_SUBTEST_COMBINATIONS(11, test_execute_slice_lvalue, float, 4); + CALL_SUBTEST_COMBINATIONS(11, test_execute_slice_lvalue, float, 5); + + CALL_SUBTEST_COMBINATIONS(12, test_execute_broadcasting_of_forced_eval, float, 2); + CALL_SUBTEST_COMBINATIONS(12, test_execute_broadcasting_of_forced_eval, float, 3); + CALL_SUBTEST_COMBINATIONS(12, test_execute_broadcasting_of_forced_eval, float, 4); + CALL_SUBTEST_COMBINATIONS(12, test_execute_broadcasting_of_forced_eval, float, 5); + + CALL_SUBTEST_COMBINATIONS(13, test_execute_generator_op, float, 2); + CALL_SUBTEST_COMBINATIONS(13, test_execute_generator_op, float, 3); + CALL_SUBTEST_COMBINATIONS(13, test_execute_generator_op, float, 4); + CALL_SUBTEST_COMBINATIONS(13, test_execute_generator_op, float, 5); + + CALL_SUBTEST_COMBINATIONS(14, test_execute_reverse_rvalue, float, 1); + CALL_SUBTEST_COMBINATIONS(14, test_execute_reverse_rvalue, float, 2); + CALL_SUBTEST_COMBINATIONS(14, test_execute_reverse_rvalue, float, 3); + CALL_SUBTEST_COMBINATIONS(14, test_execute_reverse_rvalue, float, 4); + CALL_SUBTEST_COMBINATIONS(14, test_execute_reverse_rvalue, float, 5); CALL_ASYNC_SUBTEST_COMBINATIONS(15, test_async_execute_unary_expr, float, 3); CALL_ASYNC_SUBTEST_COMBINATIONS(15, test_async_execute_unary_expr, float, 4); |