aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/test/cxx11_tensor_executor.cpp
diff options
context:
space:
mode:
authorGravatar Eugene Zhulenev <ezhulenev@google.com>2018-09-20 15:19:12 -0700
committerGravatar Eugene Zhulenev <ezhulenev@google.com>2018-09-20 15:19:12 -0700
commit719e438a208350474f384b53c76ae062e210d856 (patch)
tree8eadaa3da8baa500b847a88c704ebe9ea7d6aa62 /unsupported/test/cxx11_tensor_executor.cpp
parent8e2be7777eb9b8e75bc40abaa585656e34915565 (diff)
Collapsed revision
* Split cxx11_tensor_executor test * Register test parts with EIGEN_SUFFIXES * Fix EIGEN_SUFFIXES in cxx11_tensor_executor test
Diffstat (limited to 'unsupported/test/cxx11_tensor_executor.cpp')
-rw-r--r--unsupported/test/cxx11_tensor_executor.cpp149
1 files changed, 80 insertions, 69 deletions
diff --git a/unsupported/test/cxx11_tensor_executor.cpp b/unsupported/test/cxx11_tensor_executor.cpp
index 1bb99854c..aa789c2e4 100644
--- a/unsupported/test/cxx11_tensor_executor.cpp
+++ b/unsupported/test/cxx11_tensor_executor.cpp
@@ -31,7 +31,8 @@ static array<Index, NumDims> RandomDims(int min_dim = 1, int max_dim = 20) {
template <typename T, int NumDims, typename Device, bool Vectorizable,
bool Tileable, int Layout>
-static void test_execute_unary_expr(Device d) {
+static void test_execute_unary_expr(Device d)
+{
static constexpr int Options = 0 | Layout;
// Pick a large enough tensor size to bypass small tensor block evaluation
@@ -121,7 +122,8 @@ static void test_execute_broadcasting(Device d)
template <typename T, int NumDims, typename Device, bool Vectorizable,
bool Tileable, int Layout>
-static void test_execute_chipping_rvalue(Device d) {
+static void test_execute_chipping_rvalue(Device d)
+{
auto dims = RandomDims<NumDims>(1, 10);
Tensor<T, NumDims, Layout, Index> src(dims);
src.setRandom();
@@ -159,7 +161,8 @@ static void test_execute_chipping_rvalue(Device d) {
template <typename T, int NumDims, typename Device, bool Vectorizable,
bool Tileable, int Layout>
-static void test_execute_chipping_lvalue(Device d) {
+static void test_execute_chipping_lvalue(Device d)
+{
auto dims = RandomDims<NumDims>(1, 10);
#define TEST_CHIPPING(CHIP_DIM) \
@@ -211,7 +214,8 @@ static void test_execute_chipping_lvalue(Device d) {
template <typename T, int NumDims, typename Device, bool Vectorizable,
bool Tileable, int Layout>
-static void test_execute_shuffle_rvalue(Device d) {
+static void test_execute_shuffle_rvalue(Device d)
+{
static constexpr int Options = 0 | Layout;
auto dims = RandomDims<NumDims>(1, 10);
@@ -246,7 +250,8 @@ static void test_execute_shuffle_rvalue(Device d) {
template <typename T, int NumDims, typename Device, bool Vectorizable,
bool Tileable, int Layout>
-static void test_execute_shuffle_lvalue(Device d) {
+static void test_execute_shuffle_lvalue(Device d)
+{
static constexpr int Options = 0 | Layout;
auto dims = RandomDims<NumDims>(5, 10);
@@ -447,23 +452,26 @@ static void test_execute_slice_lvalue(Device d)
}
}
-#define CALL_SUBTEST_COMBINATIONS(NAME, T, NUM_DIMS) \
- CALL_SUBTEST((NAME<T, NUM_DIMS, DefaultDevice, false, false, ColMajor>(default_device))); \
- CALL_SUBTEST((NAME<T, NUM_DIMS, DefaultDevice, false, true, ColMajor>(default_device))); \
- CALL_SUBTEST((NAME<T, NUM_DIMS, DefaultDevice, true, false, ColMajor>(default_device))); \
- CALL_SUBTEST((NAME<T, NUM_DIMS, DefaultDevice, true, true, ColMajor>(default_device))); \
- CALL_SUBTEST((NAME<T, NUM_DIMS, DefaultDevice, false, false, RowMajor>(default_device))); \
- CALL_SUBTEST((NAME<T, NUM_DIMS, DefaultDevice, false, true, RowMajor>(default_device))); \
- CALL_SUBTEST((NAME<T, NUM_DIMS, DefaultDevice, true, false, RowMajor>(default_device))); \
- CALL_SUBTEST((NAME<T, NUM_DIMS, DefaultDevice, true, true, RowMajor>(default_device))); \
- CALL_SUBTEST((NAME<T, NUM_DIMS, ThreadPoolDevice, false, false, ColMajor>(tp_device))); \
- CALL_SUBTEST((NAME<T, NUM_DIMS, ThreadPoolDevice, false, true, ColMajor>(tp_device))); \
- CALL_SUBTEST((NAME<T, NUM_DIMS, ThreadPoolDevice, true, false, ColMajor>(tp_device))); \
- CALL_SUBTEST((NAME<T, NUM_DIMS, ThreadPoolDevice, true, true, ColMajor>(tp_device))); \
- CALL_SUBTEST((NAME<T, NUM_DIMS, ThreadPoolDevice, false, false, RowMajor>(tp_device))); \
- CALL_SUBTEST((NAME<T, NUM_DIMS, ThreadPoolDevice, false, true, RowMajor>(tp_device))); \
- CALL_SUBTEST((NAME<T, NUM_DIMS, ThreadPoolDevice, true, false, RowMajor>(tp_device))); \
- CALL_SUBTEST((NAME<T, NUM_DIMS, ThreadPoolDevice, true, true, RowMajor>(tp_device)))
+#define CALL_SUBTEST_PART(PART) \
+ CALL_SUBTEST_##PART
+
+#define CALL_SUBTEST_COMBINATIONS(PART, NAME, T, NUM_DIMS) \
+ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, false, false, ColMajor>(default_device))); \
+ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, false, true, ColMajor>(default_device))); \
+ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, true, false, ColMajor>(default_device))); \
+ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, true, true, ColMajor>(default_device))); \
+ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, false, false, RowMajor>(default_device))); \
+ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, false, true, RowMajor>(default_device))); \
+ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, true, false, RowMajor>(default_device))); \
+ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, DefaultDevice, true, true, RowMajor>(default_device))); \
+ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, false, ColMajor>(tp_device))); \
+ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, true, ColMajor>(tp_device))); \
+ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, true, false, ColMajor>(tp_device))); \
+ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, true, true, ColMajor>(tp_device))); \
+ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, false, RowMajor>(tp_device))); \
+ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, false, true, RowMajor>(tp_device))); \
+ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, true, false, RowMajor>(tp_device))); \
+ CALL_SUBTEST_PART(PART)((NAME<T, NUM_DIMS, ThreadPoolDevice, true, true, RowMajor>(tp_device)))
EIGEN_DECLARE_TEST(cxx11_tensor_executor) {
Eigen::DefaultDevice default_device;
@@ -472,53 +480,56 @@ EIGEN_DECLARE_TEST(cxx11_tensor_executor) {
Eigen::ThreadPool tp(num_threads);
Eigen::ThreadPoolDevice tp_device(&tp, num_threads);
- CALL_SUBTEST_COMBINATIONS(test_execute_unary_expr, float, 3);
- CALL_SUBTEST_COMBINATIONS(test_execute_unary_expr, float, 4);
- CALL_SUBTEST_COMBINATIONS(test_execute_unary_expr, float, 5);
-
- CALL_SUBTEST_COMBINATIONS(test_execute_binary_expr, float, 3);
- CALL_SUBTEST_COMBINATIONS(test_execute_binary_expr, float, 4);
- CALL_SUBTEST_COMBINATIONS(test_execute_binary_expr, float, 5);
-
- CALL_SUBTEST_COMBINATIONS(test_execute_broadcasting, float, 3);
- CALL_SUBTEST_COMBINATIONS(test_execute_broadcasting, float, 4);
- CALL_SUBTEST_COMBINATIONS(test_execute_broadcasting, float, 5);
-
- CALL_SUBTEST_COMBINATIONS(test_execute_chipping_rvalue, float, 3);
- CALL_SUBTEST_COMBINATIONS(test_execute_chipping_rvalue, float, 4);
- CALL_SUBTEST_COMBINATIONS(test_execute_chipping_rvalue, float, 5);
-
- CALL_SUBTEST_COMBINATIONS(test_execute_chipping_lvalue, float, 3);
- CALL_SUBTEST_COMBINATIONS(test_execute_chipping_lvalue, float, 4);
- CALL_SUBTEST_COMBINATIONS(test_execute_chipping_lvalue, float, 5);
-
- CALL_SUBTEST_COMBINATIONS(test_execute_shuffle_rvalue, float, 3);
- CALL_SUBTEST_COMBINATIONS(test_execute_shuffle_rvalue, float, 4);
- CALL_SUBTEST_COMBINATIONS(test_execute_shuffle_rvalue, float, 5);
-
- CALL_SUBTEST_COMBINATIONS(test_execute_shuffle_lvalue, float, 3);
- CALL_SUBTEST_COMBINATIONS(test_execute_shuffle_lvalue, float, 4);
- CALL_SUBTEST_COMBINATIONS(test_execute_shuffle_lvalue, float, 5);
-
- CALL_SUBTEST_COMBINATIONS(test_execute_reduction, float, 2);
- CALL_SUBTEST_COMBINATIONS(test_execute_reduction, float, 3);
- CALL_SUBTEST_COMBINATIONS(test_execute_reduction, float, 4);
- CALL_SUBTEST_COMBINATIONS(test_execute_reduction, float, 5);
-
- CALL_SUBTEST_COMBINATIONS(test_execute_reshape, float, 2);
- CALL_SUBTEST_COMBINATIONS(test_execute_reshape, float, 3);
- CALL_SUBTEST_COMBINATIONS(test_execute_reshape, float, 4);
- CALL_SUBTEST_COMBINATIONS(test_execute_reshape, float, 5);
-
- CALL_SUBTEST_COMBINATIONS(test_execute_slice_rvalue, float, 2);
- CALL_SUBTEST_COMBINATIONS(test_execute_slice_rvalue, float, 3);
- CALL_SUBTEST_COMBINATIONS(test_execute_slice_rvalue, float, 4);
- CALL_SUBTEST_COMBINATIONS(test_execute_slice_rvalue, float, 5);
-
- CALL_SUBTEST_COMBINATIONS(test_execute_slice_lvalue, float, 2);
- CALL_SUBTEST_COMBINATIONS(test_execute_slice_lvalue, float, 3);
- CALL_SUBTEST_COMBINATIONS(test_execute_slice_lvalue, float, 4);
- CALL_SUBTEST_COMBINATIONS(test_execute_slice_lvalue, 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(8, test_execute_reduction, float, 2);
+ CALL_SUBTEST_COMBINATIONS(8, test_execute_reduction, float, 3);
+ CALL_SUBTEST_COMBINATIONS(8, test_execute_reduction, float, 4);
+ CALL_SUBTEST_COMBINATIONS(8, test_execute_reduction, 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);
+
+ // Force CMake to split this test.
+ // EIGEN_SUFFIXES;1;2;3;4;5;6;7;8;9;10;11
}
#undef CALL_SUBTEST_COMBINATIONS