Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing tests with Int64 on skylake with gcc-13.2, -O1 -fstrict-aliasing #177

Open
wdconinc opened this issue Jul 1, 2024 · 0 comments
Open

Comments

@wdconinc
Copy link

wdconinc commented Jul 1, 2024

Note: I am not sure if you consider this a bug inside Fastor, or a bug in the compiler, but I'm just going to go ahead and report it. Feel free to close if out of scope.


Steps to reproduce

On master, with gcc-13.2.0, on ubuntu 24.04, on skylake (i7-10510U), I am encountering unit test failures with the following command:

CXX=g++-13 cmake -Bbuild -S. -DBUILD_TESTING=ON -DCMAKE_CXX_FLAGS="-O1 -fstrict-aliasing" --fresh && make -Cbuild -j8 && ctest --test-dir build --output-on-failure

with test output (passed tests removed from output):

Internal ctest changing into directory: /home/wdconinc/git/Fastor/build
Test project /home/wdconinc/git/Fastor/build
...
      Start  2: test_simd_vectors
 2/52 Test  #2: test_simd_vectors ................Subprocess aborted***Exception:   1.10 sec
terminate called after throwing an instance of 'std::runtime_error'
  what():  TEST FAILED

...
      Start  5: test_tensormap
 5/52 Test  #5: test_tensormap ...................Subprocess aborted***Exception:   1.10 sec
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct null not valid

      Start  6: test_numerics
...
      Start 39: test_fixed_views_nd_2
39/52 Test #39: test_fixed_views_nd_2 ............Subprocess aborted***Exception:   1.11 sec
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct null not valid

...
      Start 45: test_views_nd_2
45/52 Test #45: test_views_nd_2 ..................Subprocess aborted***Exception:   1.11 sec
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct null not valid

...
      Start 48: test_mixed_views
48/52 Test #48: test_mixed_views .................Subprocess aborted***Exception:   1.10 sec
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct null not valid

...

90% tests passed, 5 tests failed out of 52

Total Test time (real) =   5.59 sec

The following tests FAILED:
          2 - test_simd_vectors (Subprocess aborted)
          5 - test_tensormap (Subprocess aborted)
         39 - test_fixed_views_nd_2 (Subprocess aborted)
         45 - test_views_nd_2 (Subprocess aborted)
         48 - test_mixed_views (Subprocess aborted)
Errors while running CTest

For one of these, test_simd_vectors, the error occurs in

#9  0x0000555555558f8a in Fastor::FASTOR_DOES_CHECK_PASS (msg=0x55555555a01c "TEST FAILED", cond=false) at /home/wdconinc/git/Fastor/tests/../Fastor/config/macros.h:186
#10 test_simd_vectors<long, Fastor::simd_abi::sse> () at /home/wdconinc/git/Fastor/tests/test_simd_vectors/test_simd_vectors.cpp:192
#11 0x00005555555569d8 in main () at /home/wdconinc/git/Fastor/tests/test_simd_vectors/test_simd_vectors.cpp:273
  • Removal of -O1 or -fstrict-aliasing allows all unit tests to pass.
  • Replacing -O1 with g++-13 -Q -O1 --help=optimizers | grep enabled | awk '{print$1}' | tr '\n' ' ' allows all unit tests to pass (i.e. this is not a specific -O1 flag but falls under "Not all optimizations are controlled directly by a flag."1).
  • Notably, the only other test with Int64, test_binary_cmp_ops, succeeds fine.

Disabling the offending test calls using the following diff allows the unit tests to pass, which might give some information as to where the offending behavior is located.

diff --git a/tests/test_fixed_views_nd/test_fixed_views_nd_2.cpp b/tests/test_fixed_views_nd/test_fixed_views_nd_2.cpp
index 8e95a7e..5e52e7a 100644
--- a/tests/test_fixed_views_nd/test_fixed_views_nd_2.cpp
+++ b/tests/test_fixed_views_nd/test_fixed_views_nd_2.cpp
@@ -323,8 +323,8 @@ int main() {
     run_vectorisable<int>();
     run_non_vectorisable<int>();
     print(FBLU(BOLD("Testing multi-dimensional tensor views: int 64")));
-    run_vectorisable<Int64>();
-    run_non_vectorisable<Int64>();
+    //run_vectorisable<Int64>();
+    //run_non_vectorisable<Int64>();
 
     return 0;
 }
diff --git a/tests/test_mixed_views/test_mixed_views.cpp b/tests/test_mixed_views/test_mixed_views.cpp
index 699d052..3a580cd 100644
--- a/tests/test_mixed_views/test_mixed_views.cpp
+++ b/tests/test_mixed_views/test_mixed_views.cpp
@@ -279,7 +279,7 @@ int main() {
     print(FBLU(BOLD("Testing mixed views - int 32")));
     run_mixed_views<int>();
     print(FBLU(BOLD("Testing mixed views - int 64")));
-    run_mixed_views<Int64>();
+    //run_mixed_views<Int64>();
 
     return 0;
 }
diff --git a/tests/test_simd_vectors/test_simd_vectors.cpp b/tests/test_simd_vectors/test_simd_vectors.cpp
index 9a012c8..4ca920d 100644
--- a/tests/test_simd_vectors/test_simd_vectors.cpp
+++ b/tests/test_simd_vectors/test_simd_vectors.cpp
@@ -270,9 +270,9 @@ int main() {
     print(FBLU(BOLD("Testing SIMDVector of long long - 64")));
     test_simd_vectors<Int64,simd_abi::scalar>();
     print(FBLU(BOLD("Testing SIMDVector of long long - 128")));
-    test_simd_vectors<Int64,simd_abi::sse>();
+    //test_simd_vectors<Int64,simd_abi::sse>();
     print(FBLU(BOLD("Testing SIMDVector of long long - 256")));
-    test_simd_vectors<Int64,simd_abi::avx>();
+    //test_simd_vectors<Int64,simd_abi::avx>();
     print(FBLU(BOLD("Testing SIMDVector of long long - 512")));
 #ifdef FASTOR_AVX512F_IMPL
     test_simd_vectors<Int64,simd_abi::avx512>();
diff --git a/tests/test_tensormap/test_tensormap.cpp b/tests/test_tensormap/test_tensormap.cpp
index 54caf71..0c29c85 100644
--- a/tests/test_tensormap/test_tensormap.cpp
+++ b/tests/test_tensormap/test_tensormap.cpp
@@ -167,7 +167,7 @@ int main() {
     print(FBLU(BOLD("Testing tensor map: int 32")));
     run<int>();
     print(FBLU(BOLD("Testing tensor map: int 64")));
-    run<Int64>();
+    //run<Int64>();
     print(FBLU(BOLD("Testing tensor map: single precision")));
     run<float>();
     print(FBLU(BOLD("Testing tensor map: double precision")));
diff --git a/tests/test_views_nd/test_views_nd_2.cpp b/tests/test_views_nd/test_views_nd_2.cpp
index e61a235..c3e2540 100644
--- a/tests/test_views_nd/test_views_nd_2.cpp
+++ b/tests/test_views_nd/test_views_nd_2.cpp
@@ -324,8 +324,8 @@ int main() {
     run_vectorisable<int>();
     run_non_vectorisable<int>();
     print(FBLU(BOLD("Testing multi-dimensional tensor views: int 64")));
-    run_vectorisable<Int64>();
-    run_non_vectorisable<Int64>();
+    //run_vectorisable<Int64>();
+    //run_non_vectorisable<Int64>();
 
     return 0;
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant