File tree Expand file tree Collapse file tree 4 files changed +74
-0
lines changed Expand file tree Collapse file tree 4 files changed +74
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2025 Intel Corporation
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ #pragma once
18
+
19
+ #ifdef __x86_64__
20
+ #include " svs/third-party/eve.h"
21
+ #endif
22
+
23
+ #include < dlfcn.h>
24
+
25
+ namespace svs ::detail {
26
+
27
+ inline bool is_avx2_supported () {
28
+ #ifdef __x86_64__
29
+ return eve::is_supported (eve::avx2);
30
+ #else
31
+ return false ;
32
+ #endif
33
+ }
34
+
35
+ inline bool is_avx512_supported () {
36
+ #ifdef __x86_64__
37
+ return eve::is_supported (eve::avx512);
38
+ #else
39
+ return false ;
40
+ #endif
41
+ }
42
+
43
+ } // namespace svs::detail
Original file line number Diff line number Diff line change 16
16
17
17
#pragma once
18
18
19
+ #include " eve/detection.hpp"
19
20
#include " eve/module/core.hpp"
20
21
#include " eve/wide.hpp"
21
22
Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ set(TEST_SOURCES
91
91
${TEST_DIR} /svs/lib/version.cpp
92
92
${TEST_DIR} /svs/lib/uuid.cpp
93
93
${TEST_DIR} /svs/lib/concurrency/readwrite_protected.cpp
94
+ ${TEST_DIR} /svs/lib/avx_detection.cpp
94
95
# Third Party
95
96
${TEST_DIR} /svs/third-party/fmt.cpp
96
97
${TEST_DIR} /svs/third-party/toml.cpp
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2025 Intel Corporation
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ // header under test
18
+ #include " svs/lib/avx_detection.h"
19
+
20
+ // catch2
21
+ #include " catch2/catch_test_macros.hpp"
22
+ #include < iostream>
23
+
24
+ CATCH_TEST_CASE (" AVX detection" , " [lib][lib-avx-detection]" ) {
25
+ std::cout << " Checking AVX availability...\n " ;
26
+ std::cout << " AVX 2: " << std::boolalpha << svs::detail::is_avx2_supported () << " \n " ;
27
+ std::cout << " AVX 512: " << std::boolalpha << svs::detail::is_avx512_supported ()
28
+ << " \n " ;
29
+ }
You can’t perform that action at this time.
0 commit comments