Skip to content

Commit 425f55d

Browse files
authored
Merge pull request #220 from r-devulap/msvc
BLD: Add MSVC build support on windows
2 parents e6edb07 + 43124bd commit 425f55d

7 files changed

Lines changed: 406 additions & 173 deletions

File tree

.github/workflows/c-cpp.yml

Lines changed: 51 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,54 @@ on:
99
permissions: read-all
1010

1111
jobs:
12+
build-windows-msvc:
13+
runs-on: windows-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
# Set up MSVC environment
19+
- name: Set up MSVC Developer Command Prompt
20+
uses: ilammy/msvc-dev-cmd@v1
21+
with:
22+
arch: x64
23+
24+
# Install Python (Meson requires it)
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.x'
29+
30+
# Install Meson and Ninja
31+
- name: Install Meson + Ninja
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install meson ninja
35+
36+
- name: Setup environment
37+
run: |
38+
echo "PKG_CONFIG=${{ github.workspace }}/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe" >> $env:GITHUB_ENV
39+
echo "PKG_CONFIG_PATH=${{ github.workspace }}/vcpkg/installed/x64-windows/lib/pkgconfig" >> $env:GITHUB_ENV
40+
echo "LIB=${{ github.workspace }}/vcpkg/installed/x64-windows/lib;$env:LIB" >> $env:GITHUB_ENV
41+
echo "INCLUDE=${{ github.workspace }}/vcpkg/installed/x64-windows/include;$env:INCLUDE" >> $env:GITHUB_ENV
42+
shell: pwsh
43+
44+
- name: Setup vcpkg and install pkg-config and gtest
45+
run: |
46+
git clone https://github.com/Microsoft/vcpkg.git
47+
.\vcpkg\bootstrap-vcpkg.bat
48+
.\vcpkg\vcpkg install gtest:x64-windows pkgconf:x64-windows
49+
50+
# Configure and build with Meson (MSVC will be used automatically)
51+
- name: Configure (Meson)
52+
run: meson setup -Dbuild_tests=true --warnlevel 2 --buildtype release builddir --backend=ninja
53+
54+
- name: Build (Ninja)
55+
run: ninja -C builddir
56+
57+
- name: Run tests
58+
run: meson test -C builddir --test-args "\-\-gtest_filter=*qsort*" -v
59+
1260
SKL-gcc9:
1361

1462
runs-on: ubuntu-24.04
@@ -135,7 +183,7 @@ jobs:
135183
- name: Run test suite on SPR
136184
run: sde -spr -- ./builddir/testexe --gtest_filter="*simdsort*"
137185

138-
ADL-ASAN-clang18:
186+
ASAN-clang18:
139187

140188
runs-on: ubuntu-24.04
141189

@@ -169,48 +217,9 @@ jobs:
169217
cd builddir
170218
ninja
171219
172-
- name: Run test suite on ADL
173-
run: sde -adl -- ./builddir/testexe --gtest_filter="*simdsort*"
174-
175-
SPR-ASAN-clang18:
176-
177-
runs-on: intel-ubuntu-24.04
178-
179-
steps:
180-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
181-
182-
- name: Install dependencies
183-
run: |
184-
sudo apt update
185-
sudo apt -y install clang-18 libomp-18-dev libgtest-dev meson curl git
186-
187-
- name: Install Intel SDE
188-
run: |
189-
curl -o /tmp/sde.tar.xz https://downloadmirror.intel.com/859732/sde-external-9.58.0-2025-06-16-lin.tar.xz
190-
mkdir /tmp/sde && tar -xvf /tmp/sde.tar.xz -C /tmp/sde/
191-
sudo mv /tmp/sde/* /opt/sde && sudo ln -s /opt/sde/sde64 /usr/bin/sde
192-
193-
- name: Build examples
194-
env:
195-
CXX: clang++-18
196-
run: |
197-
cd examples
198-
make all
199-
200-
- name: Build
201-
env:
202-
CXX: clang++-18
203-
run: |
204-
make clean
205-
meson setup -Dbuild_tests=true -Duse_openmp=true -Db_sanitize=address,undefined -Dfatal_sanitizers=true -Dasan_ci_dont_validate=true -Db_lundef=false --warnlevel 0 --buildtype release builddir
206-
cd builddir
207-
ninja
220+
- name: Run test suite
221+
run: ./builddir/testexe --gtest_filter="*simdsort*"
208222

209-
- name: Run test suite on SPR
210-
run: sde -spr -- ./builddir/testexe
211-
- name: Run ICL fp16 tests
212-
# Note: This filters for the _Float16 tests based on the number assigned to it, which could change in the future
213-
run: sde -icx -- ./builddir/testexe --gtest_filter="*/simdsort/2*"
214223

215224
SKX-SKL-openmp:
216225

lib/meson.build

Lines changed: 28 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,41 @@
11
libtargets = []
2+
libtargets += static_library('libavx',
3+
files(
4+
'x86simdsort-avx2.cpp',
5+
),
6+
include_directories : [src],
7+
cpp_args : cpp.get_id() == 'msvc' ? ['/arch:AVX2'] : ['-march=haswell'],
8+
gnu_symbol_visibility : 'inlineshidden',
9+
dependencies: [omp_dep],
10+
)
211

3-
if cpp.has_argument('-march=haswell')
4-
libtargets += static_library('libavx',
5-
files(
6-
'x86simdsort-avx2.cpp',
7-
),
8-
include_directories : [src],
9-
cpp_args : ['-march=haswell'],
10-
gnu_symbol_visibility : 'inlineshidden',
11-
dependencies: [omp_dep],
12-
)
13-
endif
14-
15-
if cpp.has_argument('-march=skylake-avx512')
16-
libtargets += static_library('libskx',
17-
files(
18-
'x86simdsort-skx.cpp',
19-
),
20-
include_directories : [src],
21-
cpp_args : ['-march=skylake-avx512'],
22-
gnu_symbol_visibility : 'inlineshidden',
23-
dependencies: [omp_dep],
24-
)
25-
endif
12+
libtargets += static_library('libskx',
13+
files(
14+
'x86simdsort-skx.cpp',
15+
),
16+
include_directories : [src],
17+
cpp_args : cpp.get_id() == 'msvc' ? ['/arch:AVX512'] : ['-march=skylake-avx512'],
18+
gnu_symbol_visibility : 'inlineshidden',
19+
dependencies: [omp_dep],
20+
)
2621

27-
if cpp.has_argument('-march=icelake-client')
28-
libtargets += static_library('libicl',
29-
files(
30-
'x86simdsort-icl.cpp',
31-
),
32-
include_directories : [src],
33-
cpp_args : ['-march=icelake-client'],
34-
gnu_symbol_visibility : 'inlineshidden',
35-
dependencies: [omp_dep],
36-
)
37-
endif
22+
libtargets += static_library('libicl',
23+
files(
24+
'x86simdsort-icl.cpp',
25+
),
26+
include_directories : [src],
27+
cpp_args : cpp.get_id() == 'msvc' ? ['/arch:AVX512'] : ['-march=icelake-client'],
28+
gnu_symbol_visibility : 'inlineshidden',
29+
dependencies: [omp_dep],
30+
)
3831

3932
if cancompilefp16
4033
libtargets += static_library('libspr',
4134
files(
4235
'x86simdsort-spr.cpp',
4336
),
4437
include_directories : [src],
45-
cpp_args : ['-march=sapphirerapids'],
38+
cpp_args : cpp.get_id() == 'msvc' ? ['/arch:AVX512'] : ['-march=sapphirerapids'],
4639
gnu_symbol_visibility : 'inlineshidden',
4740
dependencies: [omp_dep],
4841
)

lib/x86simdsort-icl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// ICL specific routines:
22
#include "x86simdsort-static-incl.h"
33
#include "x86simdsort-internal.h"
4+
#ifdef _MSC_VER
5+
#include "avx512-16bit-qsort.hpp"
6+
#endif
47

58
namespace xss {
69
namespace avx512 {

0 commit comments

Comments
 (0)