Skip to content

Commit be37147

Browse files
committed
fix(gcc16): import fix, INT_MAX fix and build fix for gcc16
1 parent a848695 commit be37147

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

‎cpp/CMakeLists.txt‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,11 @@ else() # Native build
7070

7171
# setup compiler flags
7272
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
73+
# Portable native build: generic code is compiled for the build machine's
74+
# baseline ISA only (no explicit AVX-512), so the module imports cleanly on
75+
# CPUs without AVX-512. AVX-512 kernels are per-function target attributes
76+
# (DEGLIB_TARGET_AVX512*), gated at runtime by deglib::cpu::select_dist().
7377
target_compile_options(compile-options INTERFACE -O3 -march=native -fpic -w -pthread -ftree-vectorize)
74-
if(SUPPORT_AVX512F)
75-
target_compile_options(compile-options INTERFACE -mavx512f -mfma)
76-
elseif(SUPPORT_AVX2)
77-
target_compile_options(compile-options INTERFACE -mavx2 -mfma)
78-
endif()
7978
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
8079
target_compile_options(compile-options INTERFACE -O2 -DNDEBUG -march=native -fpic)
8180
elseif(MSVC)

‎cpp/deglib/include/deglib/optimization/flas/junker_volgenant_solver.h‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#define EVP_FLAS_JUNKER_VOLGENANT_SOLVER_H
44

55
#include <algorithm>
6+
#include <climits>
7+
#include <limits>
68
#include <concepts>
79
#include <cstddef>
810
#include <vector>
@@ -137,7 +139,7 @@ inline void compute_assignment(const int* matrix, int dim, JVScratch& scratch) {
137139
num_free++;
138140
} else if (matches[i] == 1) {
139141
j1 = out_perm[i];
140-
min = INT_MAX;
142+
min = std::numeric_limits<int>::max();
141143
for (j = 0; j < dim; j++) {
142144
if (j != j1 && matrix[i * dim + j] - v[j] < min) {
143145
min = matrix[i * dim + j] - v[j];
@@ -156,7 +158,7 @@ inline void compute_assignment(const int* matrix, int dim, JVScratch& scratch) {
156158
k++;
157159
int umin = matrix[i * dim + 0] - v[0];
158160
j1 = 0;
159-
int usubmin = INT_MAX;
161+
int usubmin = std::numeric_limits<int>::max();
160162

161163
for (j = 1; j < dim; j++) {
162164
int h = matrix[i * dim + j] - v[j];

‎python/src/deg_cpp/deglib_cpp.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <pybind11/stl.h>
1616

1717
#include <algorithm>
18+
#include <climits>
1819
#include <limits>
1920
#include <optional>
2021
#include <stdexcept>

0 commit comments

Comments
 (0)