Skip to content

Commit 0c6b32a

Browse files
committed
adopt xsimd changes
1 parent e71c9e7 commit 0c6b32a

File tree

1 file changed

+58
-27
lines changed

1 file changed

+58
-27
lines changed

benchmark/main.cpp

Lines changed: 58 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,50 @@ using namespace std;
2020
using namespace mathter;
2121

2222

23+
void PrintArch(std::string_view name, unsigned supported) {
24+
std::cout << name << (supported ? "YES" : "NO") << std::endl;
25+
}
26+
27+
28+
template <class T, int Dim>
29+
void PrintVectorType(std::string_view name) {
30+
std::cout << " " << name << ": " << (IsBatched<T, Dim, false>() ? "YES" : "NO") << " - " << sizeof(Vector<T, Dim, false>) << " bytes" << std::endl;
31+
}
32+
33+
2334
void DisplayArchitectureInfo() {
2435
#if MATHTER_ENABLE_SIMD
2536
std::cout << "Available on CPU: " << std::endl;
2637
const auto architectures = xsimd::available_architectures();
27-
std::cout << " sse2: " << (architectures.sse2 ? "YES" : "NO") << std::endl;
28-
std::cout << " sse3: " << (architectures.sse3 ? "YES" : "NO") << std::endl;
29-
std::cout << " ssse3: " << (architectures.ssse3 ? "YES" : "NO") << std::endl;
30-
std::cout << " sse4_1: " << (architectures.sse4_1 ? "YES" : "NO") << std::endl;
31-
std::cout << " sse4_2: " << (architectures.sse4_2 ? "YES" : "NO") << std::endl;
32-
std::cout << " sse4a: " << (architectures.sse4a ? "YES" : "NO") << std::endl;
33-
std::cout << " fma3_sse: " << (architectures.fma3_sse ? "YES" : "NO") << std::endl;
34-
std::cout << " fma4: " << (architectures.fma4 ? "YES" : "NO") << std::endl;
35-
std::cout << " xop: " << (architectures.xop ? "YES" : "NO") << std::endl;
36-
std::cout << " avx: " << (architectures.avx ? "YES" : "NO") << std::endl;
37-
std::cout << " fma3_avx: " << (architectures.fma3_avx ? "YES" : "NO") << std::endl;
38-
std::cout << " avx2: " << (architectures.avx2 ? "YES" : "NO") << std::endl;
39-
std::cout << " fma3_avx2: " << (architectures.fma3_avx2 ? "YES" : "NO") << std::endl;
40-
std::cout << " avx512f: " << (architectures.avx512f ? "YES" : "NO") << std::endl;
41-
std::cout << " avx512cd: " << (architectures.avx512cd ? "YES" : "NO") << std::endl;
42-
std::cout << " avx512dq: " << (architectures.avx512dq ? "YES" : "NO") << std::endl;
43-
std::cout << " avx512bw: " << (architectures.avx512bw ? "YES" : "NO") << std::endl;
44-
std::cout << " neon: " << (architectures.neon ? "YES" : "NO") << std::endl;
45-
std::cout << " neon64: " << (architectures.neon64 ? "YES" : "NO") << std::endl;
46-
std::cout << " sve: " << (architectures.sve ? "YES" : "NO") << std::endl;
47-
std::cout << std::endl;
38+
39+
PrintArch("sse2", architectures.sse2);
40+
PrintArch("sse3", architectures.sse3);
41+
PrintArch("ssse3", architectures.ssse3);
42+
PrintArch("sse4_1", architectures.sse4_1);
43+
PrintArch("sse4_2", architectures.sse4_2);
44+
PrintArch("fma3_sse42", architectures.fma3_sse42);
45+
PrintArch("fma4", architectures.fma4);
46+
PrintArch("avx", architectures.avx);
47+
PrintArch("fma3_avx", architectures.fma3_avx);
48+
PrintArch("avx2", architectures.avx2);
49+
PrintArch("avxvnni", architectures.avxvnni);
50+
PrintArch("fma3_avx2", architectures.fma3_avx2);
51+
PrintArch("avx512f", architectures.avx512f);
52+
PrintArch("avx512cd", architectures.avx512cd);
53+
PrintArch("avx512dq", architectures.avx512dq);
54+
PrintArch("avx512bw", architectures.avx512bw);
55+
PrintArch("avx512er", architectures.avx512er);
56+
PrintArch("avx512pf", architectures.avx512pf);
57+
PrintArch("avx512ifma", architectures.avx512ifma);
58+
PrintArch("avx512vbmi", architectures.avx512vbmi);
59+
PrintArch("avx512vnni_bw", architectures.avx512vnni_bw);
60+
PrintArch("avx512vnni_vbmi", architectures.avx512vnni_vbmi);
61+
PrintArch("neon", architectures.neon);
62+
PrintArch("neon64", architectures.neon64);
63+
PrintArch("i8mm_neon64", architectures.i8mm_neon64);
64+
PrintArch("sve", architectures.sve);
65+
PrintArch("rvv", architectures.rvv);
66+
PrintArch("wasm", architectures.wasm);
4867

4968
std::cout << "Enabled in build: " << std::endl;
5069
xsimd::all_architectures::for_each([](const auto& arch) {
@@ -63,12 +82,24 @@ int main(int argc, char* argv[]) {
6382
DisplayArchitectureInfo();
6483

6584
std::cout << "SIMD support:" << std::endl;
66-
std::cout << " float.2: " << (IsBatched<float, 2, false>() ? "YES" : "NO") << " - " << sizeof(Vector<float, 2, false>) << " bytes" << std::endl;
67-
std::cout << " float.3: " << (IsBatched<float, 3, false>() ? "YES" : "NO") << " - " << sizeof(Vector<float, 3, false>) << " bytes" << std::endl;
68-
std::cout << " float.4: " << (IsBatched<float, 4, false>() ? "YES" : "NO") << " - " << sizeof(Vector<float, 4, false>) << " bytes" << std::endl;
69-
std::cout << " double.2: " << (IsBatched<double, 2, false>() ? "YES" : "NO") << " - " << sizeof(Vector<double, 2, false>) << " bytes" << std::endl;
70-
std::cout << " double.3: " << (IsBatched<double, 3, false>() ? "YES" : "NO") << " - " << sizeof(Vector<double, 3, false>) << " bytes" << std::endl;
71-
std::cout << " double.4: " << (IsBatched<double, 4, false>() ? "YES" : "NO") << " - " << sizeof(Vector<double, 4, false>) << " bytes" << std::endl;
85+
PrintVectorType<float, 2>("float2");
86+
PrintVectorType<float, 3>("float3");
87+
PrintVectorType<float, 4>("float4");
88+
PrintVectorType<double, 2>("double2");
89+
PrintVectorType<double, 3>("double3");
90+
PrintVectorType<double, 4>("double4");
91+
PrintVectorType<std::complex<float>, 2>("c_float2");
92+
PrintVectorType<std::complex<float>, 3>("c_float3");
93+
PrintVectorType<std::complex<float>, 4>("c_float4");
94+
PrintVectorType<std::complex<double>, 2>("c_double2");
95+
PrintVectorType<std::complex<double>, 3>("c_double3");
96+
PrintVectorType<std::complex<double>, 4>("c_double4");
97+
PrintVectorType<int32_t, 2>("i32_2");
98+
PrintVectorType<int32_t, 3>("i32_3");
99+
PrintVectorType<int32_t, 4>("i32_4");
100+
PrintVectorType<int64_t, 2>("i64_2");
101+
PrintVectorType<int64_t, 3>("i64_3");
102+
PrintVectorType<int64_t, 4>("i64_4");
72103
std::cout << std::endl;
73104

74105
int ret = Catch::Session().run(argc, argv);

0 commit comments

Comments
 (0)