From 40d6d020a098d9f828bad5e2a1accfc5ee1a1289 Mon Sep 17 00:00:00 2001 From: Mehdi Goli Date: Thu, 2 Aug 2018 13:34:53 +0100 Subject: [PATCH 1/3] Fixing ambigous constructor error for Clang compiler. --- unsupported/test/cxx11_tensor_concatenation.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/unsupported/test/cxx11_tensor_concatenation.cpp b/unsupported/test/cxx11_tensor_concatenation.cpp index 9189a609b..f53515b4e 100644 --- a/unsupported/test/cxx11_tensor_concatenation.cpp +++ b/unsupported/test/cxx11_tensor_concatenation.cpp @@ -50,7 +50,13 @@ static void test_static_dimension_failure() .reshape(Tensor::Dimensions(2, 3, 1)) .concatenate(right, 0); Tensor alternative = left - .concatenate(right.reshape(Tensor::Dimensions{{{2, 3}}}), 0); + // Clang compiler break with {{{}}} with an ambigous error on copy constructor + // the variadic DSize constructor added for #ifndef EIGEN_EMULATE_CXX11_META_H. + // Solution: + // either the code should change to + // Tensor::Dimensions{{2, 3}} + // or Tensor::Dimensions{Tensor::Dimensions{{2, 3}}} + .concatenate(right.reshape(Tensor::Dimensions{{2, 3}}), 0); } template From 516d2621b96a0c41ff999781b8bbcaa527a7c6ee Mon Sep 17 00:00:00 2001 From: Mehdi Goli Date: Thu, 2 Aug 2018 14:30:48 +0100 Subject: [PATCH 2/3] fixing compilation error for cxx11_tensor_trace.cpp error on Microsoft Visual Studio. --- unsupported/test/cxx11_tensor_trace.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/unsupported/test/cxx11_tensor_trace.cpp b/unsupported/test/cxx11_tensor_trace.cpp index 1579bc1eb..0cb23060e 100644 --- a/unsupported/test/cxx11_tensor_trace.cpp +++ b/unsupported/test/cxx11_tensor_trace.cpp @@ -37,7 +37,7 @@ static void test_all_dimensions_trace() { VERIFY_IS_EQUAL(result1(), sum); Tensor tensor2(7, 7, 7, 7, 7); - array dims({{2, 1, 0, 3, 4}}); + array dims = { { 2, 1, 0, 3, 4 } }; Tensor result2 = tensor2.trace(dims); VERIFY_IS_EQUAL(result2.rank(), 0); sum = 0.0f; @@ -52,7 +52,7 @@ template static void test_simple_trace() { Tensor tensor1(3, 5, 3); tensor1.setRandom(); - array dims1({{0, 2}}); + array dims1 = { { 0, 2 } }; Tensor result1 = tensor1.trace(dims1); VERIFY_IS_EQUAL(result1.rank(), 1); VERIFY_IS_EQUAL(result1.dimension(0), 5); @@ -67,7 +67,7 @@ static void test_simple_trace() { Tensor tensor2(5, 5, 7, 7); tensor2.setRandom(); - array dims2({{2, 3}}); + array dims2 = { { 2, 3 } }; Tensor result2 = tensor2.trace(dims2); VERIFY_IS_EQUAL(result2.rank(), 2); VERIFY_IS_EQUAL(result2.dimension(0), 5); @@ -82,7 +82,7 @@ static void test_simple_trace() { } } - array dims3({{1, 0}}); + array dims3 = { { 1, 0 } }; Tensor result3 = tensor2.trace(dims3); VERIFY_IS_EQUAL(result3.rank(), 2); VERIFY_IS_EQUAL(result3.dimension(0), 7); @@ -99,7 +99,7 @@ static void test_simple_trace() { Tensor tensor3(3, 7, 3, 7, 3); tensor3.setRandom(); - array dims4({{0, 2, 4}}); + array dims4 = { { 0, 2, 4 } }; Tensor result4 = tensor3.trace(dims4); VERIFY_IS_EQUAL(result4.rank(), 2); VERIFY_IS_EQUAL(result4.dimension(0), 7); @@ -116,7 +116,7 @@ static void test_simple_trace() { Tensor tensor4(3, 7, 4, 7, 5); tensor4.setRandom(); - array dims5({{1, 3}}); + array dims5 = { { 1, 3 } }; Tensor result5 = tensor4.trace(dims5); VERIFY_IS_EQUAL(result5.rank(), 3); VERIFY_IS_EQUAL(result5.dimension(0), 3); @@ -140,7 +140,7 @@ template static void test_trace_in_expr() { Tensor tensor(2, 3, 5, 3); tensor.setRandom(); - array dims({{1, 3}}); + array dims = { { 1, 3 } }; Tensor result(2, 5); result = result.constant(1.0f) - tensor.trace(dims); VERIFY_IS_EQUAL(result.rank(), 2); @@ -168,4 +168,4 @@ EIGEN_DECLARE_TEST(cxx11_tensor_trace) { CALL_SUBTEST(test_simple_trace()); CALL_SUBTEST(test_trace_in_expr()); CALL_SUBTEST(test_trace_in_expr()); -} +} \ No newline at end of file From 2bf1cc8cf72396c8c0c8103a5e941121534cf858 Mon Sep 17 00:00:00 2001 From: Gustavo Lima Chaves Date: Thu, 2 Aug 2018 15:55:36 -0700 Subject: [PATCH 3/3] Fix 256 bit packet size assumptions in unit tests. Like in change 2606abed535744fcaa41b923c71338a06b8ed3fa , we have hit the threshould again. With AVX512 builds we would never have Vector8f packets aligned at 64 bytes (the new value of EIGEN_MAX_ALIGN_BYTES after change 405859f18dac56f324e1d93ca8721d5f7fd22c62 , for AVX512-enabled builds). This makes test/dynalloc.cpp pass for those builds. --- test/dynalloc.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/dynalloc.cpp b/test/dynalloc.cpp index ceecd76e3..1c74866ba 100644 --- a/test/dynalloc.cpp +++ b/test/dynalloc.cpp @@ -15,6 +15,7 @@ #define ALIGNMENT 1 #endif +typedef Matrix Vector16f; typedef Matrix Vector8f; void check_handmade_aligned_malloc() @@ -70,7 +71,7 @@ struct MyStruct { EIGEN_MAKE_ALIGNED_OPERATOR_NEW char dummychar; - Vector8f avec; + Vector16f avec; }; class MyClassA @@ -78,7 +79,7 @@ class MyClassA public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW char dummychar; - Vector8f avec; + Vector16f avec; }; template void check_dynaligned() @@ -145,6 +146,7 @@ EIGEN_DECLARE_TEST(dynalloc) CALL_SUBTEST(check_dynaligned() ); CALL_SUBTEST(check_dynaligned() ); CALL_SUBTEST(check_dynaligned() ); + CALL_SUBTEST(check_dynaligned() ); } {