Skip to content

Commit 5cd2475

Browse files
authored
[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.
1 parent 2cc4b3d commit 5cd2475

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

libcxx/test/std/experimental/simd/simd.reference/reference_assignment.pass.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,10 @@
88

99
// UNSUPPORTED: c++03, c++11, c++14
1010

11-
// FIXME: Timeouts.
12-
// UNSUPPORTED: sanitizer-new-delete
13-
1411
// <experimental/simd>
1512
//
1613
// [simd.reference]
1714
// template<class U> reference=(U&& x) && noexcept;
18-
//
19-
// XFAIL: LIBCXX-AIX-FIXME
2015

2116
#include "../test_utils.h"
2217
#include <experimental/simd>

libcxx/test/std/experimental/simd/test_utils.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@ struct TestAllSimdAbiFunctor {
2828

2929
template <class T, std::size_t... Ns>
3030
void instantiate_with_n(std::index_sequence<Ns...>) {
31-
(types::for_each(sized_abis<T, Ns + 1>{}, F<T, Ns + 1>{}), ...);
31+
(types::for_each(sized_abis<T, Ns>{}, F<T, Ns>{}), ...);
3232
}
3333

3434
template <class T>
3535
void operator()() {
3636
using abis = types::type_list<ex::simd_abi::scalar, ex::simd_abi::native<T>, ex::simd_abi::compatible<T>>;
3737
types::for_each(abis{}, F<T, 1>());
3838

39-
instantiate_with_n<T>(std::make_index_sequence<max_simd_size - 1>{});
39+
instantiate_with_n<T>(
40+
std::index_sequence<1, 2, 3, 4, 8, 16, max_simd_size - 2, max_simd_size - 1, max_simd_size>{});
4041
}
4142
};
4243

0 commit comments

Comments
 (0)