Skip to content

Commit 3998465

Browse files
alonfarajAlon Faraj
andauthored
ci : more platforms coverage (#1101)
* add multi platform * add image name * fix * fix /bin/sh path * add missing \ * add all platforms for check * remove platforms * remove s390x * - add arm v6 - format run cmd * remove arm v6 * - bump checkout to v3 - use setup emsdk action - add arch to all ubuntu jobs * mymindstorm/setup-emsdk to v12 * add missing QEMU step * add fail-fast: false for debug * add freebsd * remark all jobs except freebsd for test * add sudo * enable all tests again * format * check __AVX__ support before include immintrin.h * try auto detect flag by cmake * fix check for immintrin.h * fix include check for immintrin.h * Remove all platforms for sanitizer build except amd64 We have no clue why they failed. --------- Co-authored-by: Alon Faraj <[email protected]>
1 parent 4774d2f commit 3998465

File tree

3 files changed

+99
-75
lines changed

3 files changed

+99
-75
lines changed

.github/workflows/build.yml

Lines changed: 94 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
11
name: CI
22
on: [push, pull_request]
33

4+
env:
5+
ubuntu_image: "ubuntu:22.04"
6+
47
jobs:
58
ubuntu-latest:
69
runs-on: ubuntu-latest
10+
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
arch: [linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le]
715

816
steps:
917
- name: Clone
10-
uses: actions/checkout@v1
11-
12-
- name: Dependencies
13-
run: |
14-
sudo apt-get update
15-
sudo apt-get install build-essential
16-
sudo apt-get install libsdl2-dev
18+
uses: actions/checkout@v3
19+
20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v2
1722

18-
- name: Build
23+
- name: Build ${{ matrix.arch }}
1924
run: |
20-
make
21-
make stream
25+
docker run --platform ${{ matrix.arch }} --rm \
26+
-v ${{ github.workspace }}:/workspace \
27+
-w /workspace ${{ env.ubuntu_image }} /bin/sh -c '
28+
apt update
29+
apt install -y build-essential libsdl2-dev
30+
make
31+
make stream'
2232
2333
macOS-latest:
2434
runs-on: macOS-latest
2535

2636
steps:
2737
- name: Clone
28-
uses: actions/checkout@v1
38+
uses: actions/checkout@v3
2939

3040
- name: Dependencies
3141
run: |
@@ -36,83 +46,105 @@ jobs:
3646
run: |
3747
make
3848
make stream
49+
50+
freeBSD-latest:
51+
runs-on: macos-12
52+
53+
steps:
54+
- name: Clone
55+
uses: actions/checkout@v3
56+
57+
- name: Build
58+
uses: cross-platform-actions/[email protected]
59+
with:
60+
operating_system: freebsd
61+
version: '13.2'
62+
run: |
63+
sudo pkg update
64+
sudo pkg install -y gmake sdl2
65+
gmake
66+
gmake stream
3967
4068
ubuntu-latest-gcc:
4169
runs-on: ubuntu-latest
4270

4371
strategy:
72+
fail-fast: false
4473
matrix:
4574
build: [Debug, Release]
75+
arch: [linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le]
4676

4777
steps:
4878
- name: Clone
49-
uses: actions/checkout@v1
79+
uses: actions/checkout@v3
5080

51-
- name: Dependencies
52-
run: |
53-
sudo apt-get update
54-
sudo apt-get install build-essential
55-
sudo apt-get install cmake
56-
sudo apt-get install libsdl2-dev
57-
58-
- name: Configure
59-
run: cmake . -DWHISPER_SUPPORT_SDL2=ON -DCMAKE_BUILD_TYPE=${{ matrix.build }}
81+
- name: Set up QEMU
82+
uses: docker/setup-qemu-action@v2
6083

61-
- name: Build
84+
- name: Build ${{ matrix.arch }}
6285
run: |
63-
make
64-
ctest -L gh --output-on-failure
86+
docker run --platform ${{ matrix.arch }} --rm \
87+
-v ${{ github.workspace }}:/workspace \
88+
-w /workspace ${{ env.ubuntu_image }} /bin/sh -c '
89+
apt update
90+
apt install -y build-essential cmake libsdl2-dev
91+
cmake . -DWHISPER_SUPPORT_SDL2=ON -DCMAKE_BUILD_TYPE=${{ matrix.build }}
92+
make
93+
ctest -L gh --output-on-failure'
6594
6695
ubuntu-latest-clang:
6796
runs-on: ubuntu-latest
6897

6998
strategy:
99+
fail-fast: false
70100
matrix:
71101
build: [Debug, Release]
102+
arch: [linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le]
72103

73104
steps:
74105
- name: Clone
75-
uses: actions/checkout@v1
76-
77-
- name: Dependencies
78-
run: |
79-
sudo apt-get update
80-
sudo apt-get install build-essential
81-
sudo apt-get install cmake
82-
sudo apt-get install libsdl2-dev
106+
uses: actions/checkout@v3
83107

84-
- name: Configure
85-
run: cmake . -DWHISPER_SUPPORT_SDL2=ON -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
108+
- name: Set up QEMU
109+
uses: docker/setup-qemu-action@v2
86110

87-
- name: Build
111+
- name: Build ${{ matrix.arch }}
88112
run: |
89-
make
90-
ctest -L gh --output-on-failure
113+
docker run --platform ${{ matrix.arch }} --rm \
114+
-v ${{ github.workspace }}:/workspace \
115+
-w /workspace ${{ env.ubuntu_image }} /bin/sh -c '
116+
apt update
117+
apt install -y build-essential cmake libsdl2-dev
118+
cmake . -DWHISPER_SUPPORT_SDL2=ON -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
119+
make
120+
ctest -L gh --output-on-failure'
91121
92122
ubuntu-latest-gcc-sanitized:
93123
runs-on: ubuntu-latest
94124

95125
strategy:
126+
fail-fast: false
96127
matrix:
97128
sanitizer: [ADDRESS, THREAD, UNDEFINED]
129+
arch: [linux/amd64]
98130

99131
steps:
100132
- name: Clone
101-
uses: actions/checkout@v1
102-
103-
- name: Dependencies
104-
run: |
105-
sudo apt-get update
106-
sudo apt-get install build-essential
107-
sudo apt-get install cmake
108-
109-
- name: Configure
110-
run: cmake . -DCMAKE_BUILD_TYPE=Debug -DWHISPER_SANITIZE_${{ matrix.sanitizer }}=ON
111-
112-
- name: Build
133+
uses: actions/checkout@v3
134+
135+
- name: Set up QEMU
136+
uses: docker/setup-qemu-action@v2
137+
138+
- name: Build ${{ matrix.arch }}
113139
run: |
114-
make
115-
ctest -L gh --output-on-failure
140+
docker run --platform ${{ matrix.arch }} --rm \
141+
-v ${{ github.workspace }}:/workspace \
142+
-w /workspace ${{ env.ubuntu_image }} /bin/sh -c '
143+
apt update
144+
apt install -y build-essential cmake
145+
cmake . -DCMAKE_BUILD_TYPE=Debug -DWHISPER_SANITIZE_${{ matrix.sanitizer }}=ON
146+
make
147+
ctest -L gh --output-on-failure'
116148
117149
windows:
118150
runs-on: windows-latest
@@ -134,7 +166,7 @@ jobs:
134166

135167
steps:
136168
- name: Clone
137-
uses: actions/checkout@v1
169+
uses: actions/checkout@v3
138170

139171
- name: Add msbuild to PATH
140172
uses: microsoft/setup-msbuild@v1
@@ -195,7 +227,7 @@ jobs:
195227

196228
steps:
197229
- name: Clone
198-
uses: actions/checkout@v1
230+
uses: actions/checkout@v3
199231

200232
- name: Add msbuild to PATH
201233
uses: microsoft/setup-msbuild@v1
@@ -261,7 +293,7 @@ jobs:
261293

262294
steps:
263295
- name: Clone
264-
uses: actions/checkout@v1
296+
uses: actions/checkout@v3
265297

266298
- name: Add msbuild to PATH
267299
uses: microsoft/setup-msbuild@v1
@@ -308,24 +340,16 @@ jobs:
308340

309341
steps:
310342
- name: Clone
311-
uses: actions/checkout@v1
343+
uses: actions/checkout@v3
312344

313-
- name: Dependencies
314-
run: |
315-
wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz
316-
tar -xvf master.tar.gz
317-
emsdk-master/emsdk update
318-
emsdk-master/emsdk install latest
319-
emsdk-master/emsdk activate latest
345+
- name: Setup emsdk
346+
uses: mymindstorm/setup-emsdk@v12
320347

321-
- name: Configure
322-
run: echo "tmp"
348+
- name: Verify
349+
run: emcc -v
323350

324351
- name: Build
325352
run: |
326-
pushd emsdk-master
327-
source ./emsdk_env.sh
328-
popd
329353
emcmake cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
330354
make
331355
@@ -338,7 +362,7 @@ jobs:
338362

339363
steps:
340364
- name: Clone
341-
uses: actions/checkout@v1
365+
uses: actions/checkout@v3
342366

343367
- name: Configure
344368
run: |
@@ -356,7 +380,7 @@ jobs:
356380

357381
steps:
358382
- name: Clone
359-
uses: actions/checkout@v1
383+
uses: actions/checkout@v3
360384

361385
- name: Install Java
362386
uses: actions/setup-java@v3
@@ -376,7 +400,7 @@ jobs:
376400
needs: [ 'windows' ]
377401
runs-on: windows-latest
378402
steps:
379-
- uses: actions/checkout@v1
403+
- uses: actions/checkout@v3
380404

381405
- name: Install Java
382406
uses: actions/setup-java@v1

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,16 +256,16 @@ else()
256256
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
257257
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
258258
else()
259-
if(NOT WHISPER_NO_AVX)
259+
if(__AVX__)
260260
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx")
261261
endif()
262-
if(NOT WHISPER_NO_AVX2)
262+
if(__AVX2__)
263263
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2")
264264
endif()
265-
if(NOT WHISPER_NO_FMA)
265+
if(__FMA__)
266266
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfma")
267267
endif()
268-
if(NOT WHISPER_NO_F16C)
268+
if(__F16C__)
269269
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mf16c")
270270
endif()
271271
endif()

ggml.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ typedef double ggml_float;
292292
#if defined(_MSC_VER) || defined(__MINGW32__)
293293
#include <intrin.h>
294294
#else
295-
#if !defined(__riscv)
295+
#if defined(__AVX__) || defined(__AVX2__) || defined(__AVX512F__) || defined(__SSSE3__)
296296
#include <immintrin.h>
297297
#endif
298298
#endif

0 commit comments

Comments
 (0)