[libcxx-commits] [libcxx] 5cd2475 - [libc++] Reduce the compilation time required by SIMD tests (#72602)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 20 10:28:03 PST 2023


Author: Louis Dionne
Date: 2023-11-20T13:27:59-05:00
New Revision: 5cd24759c41864215e67c280234b6c745a4cd369

URL: https://github.com/llvm/llvm-project/commit/5cd24759c41864215e67c280234b6c745a4cd369
DIFF: https://github.com/llvm/llvm-project/commit/5cd24759c41864215e67c280234b6c745a4cd369.diff

LOG: [libc++] Reduce the compilation time required by SIMD tests (#72602)

Testing all the SIMD widths exhaustively is nice in theory, however in
practice it leads to extremely slow tests. Given that
1. our testing resources are finite and actually pretty costly
2. we have thousands of other tests we also need to run
3. the value of executing these SIMD tests for absolutely all supported
SIMD widths is fairly small compared to cherry-picking a few relevant
widths

I think it makes a lot of sense to reduce the exhaustiveness of these
tests. I'm getting a ~4x speedup for the worst offender
(reference_assignment.pass.cpp) after this patch.

I'd also like to make this a reminder to anyone seeing this PR that
tests impact everyone's productivity. Slow unit tests contribute to
making the CI slower as a whole, and that has a direct impact on
everyone's ability to iterate quickly during PRs. Even though we have a
pretty robust CI setup in place, we should remember that it doesn't come
for free and should strive to keep our tests at a good bang for the buck
ratio.

Added: 
    

Modified: 
    libcxx/test/std/experimental/simd/simd.reference/reference_assignment.pass.cpp
    libcxx/test/std/experimental/simd/test_utils.h

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/experimental/simd/simd.reference/reference_assignment.pass.cpp b/libcxx/test/std/experimental/simd/simd.reference/reference_assignment.pass.cpp
index bf84cc4b04e3d84..04862507535362d 100644
--- a/libcxx/test/std/experimental/simd/simd.reference/reference_assignment.pass.cpp
+++ b/libcxx/test/std/experimental/simd/simd.reference/reference_assignment.pass.cpp
@@ -8,15 +8,10 @@
 
 // UNSUPPORTED: c++03, c++11, c++14
 
-// FIXME: Timeouts.
-// UNSUPPORTED: sanitizer-new-delete
-
 // <experimental/simd>
 //
 // [simd.reference]
 // template<class U> reference=(U&& x) && noexcept;
-//
-// XFAIL: LIBCXX-AIX-FIXME
 
 #include "../test_utils.h"
 #include <experimental/simd>

diff  --git a/libcxx/test/std/experimental/simd/test_utils.h b/libcxx/test/std/experimental/simd/test_utils.h
index 65ffc736096f446..30a48521aa589c6 100644
--- a/libcxx/test/std/experimental/simd/test_utils.h
+++ b/libcxx/test/std/experimental/simd/test_utils.h
@@ -28,7 +28,7 @@ struct TestAllSimdAbiFunctor {
 
   template <class T, std::size_t... Ns>
   void instantiate_with_n(std::index_sequence<Ns...>) {
-    (types::for_each(sized_abis<T, Ns + 1>{}, F<T, Ns + 1>{}), ...);
+    (types::for_each(sized_abis<T, Ns>{}, F<T, Ns>{}), ...);
   }
 
   template <class T>
@@ -36,7 +36,8 @@ struct TestAllSimdAbiFunctor {
     using abis = types::type_list<ex::simd_abi::scalar, ex::simd_abi::native<T>, ex::simd_abi::compatible<T>>;
     types::for_each(abis{}, F<T, 1>());
 
-    instantiate_with_n<T>(std::make_index_sequence<max_simd_size - 1>{});
+    instantiate_with_n<T>(
+        std::index_sequence<1, 2, 3, 4, 8, 16, max_simd_size - 2, max_simd_size - 1, max_simd_size>{});
   }
 };
 


        


More information about the libcxx-commits mailing list