Skip to content

Commit 400dd17

Browse files
authored
Merge pull request #18 from jcarpent/devel
Use PROXSUITE_VECTORIZE and change logic
2 parents ce3c417 + cb799a0 commit 400dd17

File tree

5 files changed

+13
-20
lines changed

5 files changed

+13
-20
lines changed

CMakeLists.txt

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,6 @@ set(EXPORTED_TARGETS_LIST proxsuite)
109109

110110
add_header_group(${PROJECT_NAME}_HEADERS)
111111

112-
add_library(proxsuite-not-vectorized INTERFACE)
113-
target_link_libraries(
114-
proxsuite-not-vectorized
115-
PUBLIC
116-
INTERFACE proxsuite)
117-
target_compile_definitions(
118-
proxsuite-not-vectorized
119-
PUBLIC
120-
INTERFACE PROXSUITE_DONT_VECTORIZE)
121-
list(APPEND EXPORTED_TARGETS_LIST proxsuite-not-vectorized)
122-
123112
if(BUILD_WITH_VECTORIZATION_SUPPORT)
124113
add_library(proxsuite-vectorized INTERFACE)
125114
target_link_libraries(
@@ -130,6 +119,10 @@ if(BUILD_WITH_VECTORIZATION_SUPPORT)
130119
proxsuite-vectorized
131120
PUBLIC
132121
INTERFACE simde)
122+
target_compile_definitions(
123+
proxsuite-vectorized
124+
PUBLIC
125+
INTERFACE PROXSUITE_VECTORIZE)
133126
list(APPEND EXPORTED_TARGETS_LIST proxsuite-vectorized)
134127
endif()
135128

bindings/python/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function(CREATE_PYTHON_TARGET target_name COMPILE_OPTIONS dependencies)
6161
install(TARGETS ${target_name} DESTINATION ${${PYWRAP}_INSTALL_DIR})
6262
endfunction()
6363

64-
create_python_target(proxsuite_pywrap "" proxsuite-not-vectorized)
64+
create_python_target(proxsuite_pywrap "" proxsuite)
6565
if(BUILD_WITH_VECTORIZATION_SUPPORT)
6666
if(BUILD_BINDINGS_WITH_AVX2_SUPPORT)
6767
create_python_target(proxsuite_pywrap_avx2 "-mavx2;-mfma"

include/proxsuite/linalg/dense/core.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#include <immintrin.h>
1313

14-
#ifndef PROXSUITE_DONT_VECTORIZE
14+
#ifdef PROXSUITE_VECTORIZE
1515
#include <cmath> // to avoid error of the type no member named 'isnan' in namespace 'std';
1616
#include <simde/x86/avx2.h>
1717
#include <simde/x86/fma.h>
@@ -161,7 +161,7 @@ struct Pack<T, 1>
161161
}
162162
};
163163

164-
#ifndef PROXSUITE_DONT_VECTORIZE
164+
#ifdef PROXSUITE_VECTORIZE
165165
template<>
166166
struct Pack<f32, 4>
167167
{
@@ -272,7 +272,7 @@ struct NativePackInfo
272272
using Type = Pack<f32, N>;
273273
};
274274

275-
#ifndef PROXSUITE_DONT_VECTORIZE
275+
#ifdef PROXSUITE_VECTORIZE
276276
template<>
277277
struct NativePackInfo<f32>
278278
{
@@ -308,7 +308,7 @@ round_up(T a, T b) noexcept -> T
308308
return a + (b - 1) / b * b;
309309
}
310310

311-
#ifndef PROXSUITE_DONT_VECTORIZE
311+
#ifdef PROXSUITE_VECTORIZE
312312
template<typename T>
313313
using should_vectorize =
314314
proxsuite::linalg::veg::meta::bool_constant<VEG_CONCEPT(same<T, f32>) ||

include/proxsuite/linalg/dense/ldlt.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ template<>
3232
struct proxsuite::linalg::veg::mem::Alloc<
3333
proxsuite::linalg::dense::_detail::SimdAlignedSystemAlloc>
3434
{
35-
#ifdef PROXSUITE_DONT_VECTORIZE
36-
static constexpr usize min_align = 0;
37-
#else
35+
#ifdef PROXSUITE_VECTORIZE
3836
static constexpr usize min_align = alignof(std::max_align_t) >
3937
SIMDE_NATURAL_VECTOR_SIZE / 8
4038
? SIMDE_NATURAL_VECTOR_SIZE / 8
4139
: alignof(std::max_align_t);
40+
#else
41+
static constexpr usize min_align = 0;
4242
#endif
4343

4444
using RefMut = proxsuite::linalg::veg::RefMut<

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ target_include_directories(proxsuite-test-util PUBLIC ./include)
1616
if(BUILD_WITH_VECTORIZATION_SUPPORT)
1717
target_link_libraries(proxsuite-test-util proxsuite-vectorized matio)
1818
else()
19-
target_link_libraries(proxsuite-test-util proxsuite-not-vectorized matio)
19+
target_link_libraries(proxsuite-test-util proxsuite matio)
2020
endif()
2121

2222
macro(proxsuite_test name path)

0 commit comments

Comments
 (0)