Spaces:
Running
Running
alonfaraj
Alon Faraj
commited on
ci : more platforms coverage (#1101)
Browse files* 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]>
- .github/workflows/build.yml +94 -70
- CMakeLists.txt +4 -4
- ggml.c +1 -1
.github/workflows/build.yml
CHANGED
|
@@ -1,31 +1,41 @@
|
|
| 1 |
name: CI
|
| 2 |
on: [push, pull_request]
|
| 3 |
|
|
|
|
|
|
|
|
|
|
| 4 |
jobs:
|
| 5 |
ubuntu-latest:
|
| 6 |
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
steps:
|
| 9 |
- name: Clone
|
| 10 |
-
uses: actions/checkout@
|
| 11 |
-
|
| 12 |
-
- name:
|
| 13 |
-
|
| 14 |
-
sudo apt-get update
|
| 15 |
-
sudo apt-get install build-essential
|
| 16 |
-
sudo apt-get install libsdl2-dev
|
| 17 |
|
| 18 |
-
- name: Build
|
| 19 |
run: |
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
macOS-latest:
|
| 24 |
runs-on: macOS-latest
|
| 25 |
|
| 26 |
steps:
|
| 27 |
- name: Clone
|
| 28 |
-
uses: actions/checkout@
|
| 29 |
|
| 30 |
- name: Dependencies
|
| 31 |
run: |
|
|
@@ -36,83 +46,105 @@ jobs:
|
|
| 36 |
run: |
|
| 37 |
make
|
| 38 |
make stream
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
ubuntu-latest-gcc:
|
| 41 |
runs-on: ubuntu-latest
|
| 42 |
|
| 43 |
strategy:
|
|
|
|
| 44 |
matrix:
|
| 45 |
build: [Debug, Release]
|
|
|
|
| 46 |
|
| 47 |
steps:
|
| 48 |
- name: Clone
|
| 49 |
-
uses: actions/checkout@
|
| 50 |
|
| 51 |
-
- name:
|
| 52 |
-
|
| 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 }}
|
| 60 |
|
| 61 |
-
- name: Build
|
| 62 |
run: |
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
ubuntu-latest-clang:
|
| 67 |
runs-on: ubuntu-latest
|
| 68 |
|
| 69 |
strategy:
|
|
|
|
| 70 |
matrix:
|
| 71 |
build: [Debug, Release]
|
|
|
|
| 72 |
|
| 73 |
steps:
|
| 74 |
- name: Clone
|
| 75 |
-
uses: actions/checkout@
|
| 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
|
| 83 |
|
| 84 |
-
- name:
|
| 85 |
-
|
| 86 |
|
| 87 |
-
- name: Build
|
| 88 |
run: |
|
| 89 |
-
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
ubuntu-latest-gcc-sanitized:
|
| 93 |
runs-on: ubuntu-latest
|
| 94 |
|
| 95 |
strategy:
|
|
|
|
| 96 |
matrix:
|
| 97 |
sanitizer: [ADDRESS, THREAD, UNDEFINED]
|
|
|
|
| 98 |
|
| 99 |
steps:
|
| 100 |
- name: Clone
|
| 101 |
-
uses: actions/checkout@
|
| 102 |
-
|
| 103 |
-
- name:
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 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
|
| 113 |
run: |
|
| 114 |
-
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
windows:
|
| 118 |
runs-on: windows-latest
|
|
@@ -134,7 +166,7 @@ jobs:
|
|
| 134 |
|
| 135 |
steps:
|
| 136 |
- name: Clone
|
| 137 |
-
uses: actions/checkout@
|
| 138 |
|
| 139 |
- name: Add msbuild to PATH
|
| 140 |
uses: microsoft/setup-msbuild@v1
|
|
@@ -195,7 +227,7 @@ jobs:
|
|
| 195 |
|
| 196 |
steps:
|
| 197 |
- name: Clone
|
| 198 |
-
uses: actions/checkout@
|
| 199 |
|
| 200 |
- name: Add msbuild to PATH
|
| 201 |
uses: microsoft/setup-msbuild@v1
|
|
@@ -261,7 +293,7 @@ jobs:
|
|
| 261 |
|
| 262 |
steps:
|
| 263 |
- name: Clone
|
| 264 |
-
uses: actions/checkout@
|
| 265 |
|
| 266 |
- name: Add msbuild to PATH
|
| 267 |
uses: microsoft/setup-msbuild@v1
|
|
@@ -308,24 +340,16 @@ jobs:
|
|
| 308 |
|
| 309 |
steps:
|
| 310 |
- name: Clone
|
| 311 |
-
uses: actions/checkout@
|
| 312 |
|
| 313 |
-
- name:
|
| 314 |
-
|
| 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
|
| 320 |
|
| 321 |
-
- name:
|
| 322 |
-
run:
|
| 323 |
|
| 324 |
- name: Build
|
| 325 |
run: |
|
| 326 |
-
pushd emsdk-master
|
| 327 |
-
source ./emsdk_env.sh
|
| 328 |
-
popd
|
| 329 |
emcmake cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
|
| 330 |
make
|
| 331 |
|
|
@@ -338,7 +362,7 @@ jobs:
|
|
| 338 |
|
| 339 |
steps:
|
| 340 |
- name: Clone
|
| 341 |
-
uses: actions/checkout@
|
| 342 |
|
| 343 |
- name: Configure
|
| 344 |
run: |
|
|
@@ -356,7 +380,7 @@ jobs:
|
|
| 356 |
|
| 357 |
steps:
|
| 358 |
- name: Clone
|
| 359 |
-
uses: actions/checkout@
|
| 360 |
|
| 361 |
- name: Install Java
|
| 362 |
uses: actions/setup-java@v3
|
|
@@ -376,7 +400,7 @@ jobs:
|
|
| 376 |
needs: [ 'windows' ]
|
| 377 |
runs-on: windows-latest
|
| 378 |
steps:
|
| 379 |
-
- uses: actions/checkout@
|
| 380 |
|
| 381 |
- name: Install Java
|
| 382 |
uses: actions/setup-java@v1
|
|
|
|
| 1 |
name: CI
|
| 2 |
on: [push, pull_request]
|
| 3 |
|
| 4 |
+
env:
|
| 5 |
+
ubuntu_image: "ubuntu:22.04"
|
| 6 |
+
|
| 7 |
jobs:
|
| 8 |
ubuntu-latest:
|
| 9 |
runs-on: ubuntu-latest
|
| 10 |
+
|
| 11 |
+
strategy:
|
| 12 |
+
fail-fast: false
|
| 13 |
+
matrix:
|
| 14 |
+
arch: [linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le]
|
| 15 |
|
| 16 |
steps:
|
| 17 |
- name: Clone
|
| 18 |
+
uses: actions/checkout@v3
|
| 19 |
+
|
| 20 |
+
- name: Set up QEMU
|
| 21 |
+
uses: docker/setup-qemu-action@v2
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
- name: Build ${{ matrix.arch }}
|
| 24 |
run: |
|
| 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'
|
| 32 |
|
| 33 |
macOS-latest:
|
| 34 |
runs-on: macOS-latest
|
| 35 |
|
| 36 |
steps:
|
| 37 |
- name: Clone
|
| 38 |
+
uses: actions/checkout@v3
|
| 39 |
|
| 40 |
- name: Dependencies
|
| 41 |
run: |
|
|
|
|
| 46 |
run: |
|
| 47 |
make
|
| 48 |
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
|
| 67 |
|
| 68 |
ubuntu-latest-gcc:
|
| 69 |
runs-on: ubuntu-latest
|
| 70 |
|
| 71 |
strategy:
|
| 72 |
+
fail-fast: false
|
| 73 |
matrix:
|
| 74 |
build: [Debug, Release]
|
| 75 |
+
arch: [linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le]
|
| 76 |
|
| 77 |
steps:
|
| 78 |
- name: Clone
|
| 79 |
+
uses: actions/checkout@v3
|
| 80 |
|
| 81 |
+
- name: Set up QEMU
|
| 82 |
+
uses: docker/setup-qemu-action@v2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
+
- name: Build ${{ matrix.arch }}
|
| 85 |
run: |
|
| 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'
|
| 94 |
|
| 95 |
ubuntu-latest-clang:
|
| 96 |
runs-on: ubuntu-latest
|
| 97 |
|
| 98 |
strategy:
|
| 99 |
+
fail-fast: false
|
| 100 |
matrix:
|
| 101 |
build: [Debug, Release]
|
| 102 |
+
arch: [linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le]
|
| 103 |
|
| 104 |
steps:
|
| 105 |
- name: Clone
|
| 106 |
+
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
+
- name: Set up QEMU
|
| 109 |
+
uses: docker/setup-qemu-action@v2
|
| 110 |
|
| 111 |
+
- name: Build ${{ matrix.arch }}
|
| 112 |
run: |
|
| 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'
|
| 121 |
|
| 122 |
ubuntu-latest-gcc-sanitized:
|
| 123 |
runs-on: ubuntu-latest
|
| 124 |
|
| 125 |
strategy:
|
| 126 |
+
fail-fast: false
|
| 127 |
matrix:
|
| 128 |
sanitizer: [ADDRESS, THREAD, UNDEFINED]
|
| 129 |
+
arch: [linux/amd64]
|
| 130 |
|
| 131 |
steps:
|
| 132 |
- name: Clone
|
| 133 |
+
uses: actions/checkout@v3
|
| 134 |
+
|
| 135 |
+
- name: Set up QEMU
|
| 136 |
+
uses: docker/setup-qemu-action@v2
|
| 137 |
+
|
| 138 |
+
- name: Build ${{ matrix.arch }}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
run: |
|
| 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'
|
| 148 |
|
| 149 |
windows:
|
| 150 |
runs-on: windows-latest
|
|
|
|
| 166 |
|
| 167 |
steps:
|
| 168 |
- name: Clone
|
| 169 |
+
uses: actions/checkout@v3
|
| 170 |
|
| 171 |
- name: Add msbuild to PATH
|
| 172 |
uses: microsoft/setup-msbuild@v1
|
|
|
|
| 227 |
|
| 228 |
steps:
|
| 229 |
- name: Clone
|
| 230 |
+
uses: actions/checkout@v3
|
| 231 |
|
| 232 |
- name: Add msbuild to PATH
|
| 233 |
uses: microsoft/setup-msbuild@v1
|
|
|
|
| 293 |
|
| 294 |
steps:
|
| 295 |
- name: Clone
|
| 296 |
+
uses: actions/checkout@v3
|
| 297 |
|
| 298 |
- name: Add msbuild to PATH
|
| 299 |
uses: microsoft/setup-msbuild@v1
|
|
|
|
| 340 |
|
| 341 |
steps:
|
| 342 |
- name: Clone
|
| 343 |
+
uses: actions/checkout@v3
|
| 344 |
|
| 345 |
+
- name: Setup emsdk
|
| 346 |
+
uses: mymindstorm/setup-emsdk@v12
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 347 |
|
| 348 |
+
- name: Verify
|
| 349 |
+
run: emcc -v
|
| 350 |
|
| 351 |
- name: Build
|
| 352 |
run: |
|
|
|
|
|
|
|
|
|
|
| 353 |
emcmake cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
|
| 354 |
make
|
| 355 |
|
|
|
|
| 362 |
|
| 363 |
steps:
|
| 364 |
- name: Clone
|
| 365 |
+
uses: actions/checkout@v3
|
| 366 |
|
| 367 |
- name: Configure
|
| 368 |
run: |
|
|
|
|
| 380 |
|
| 381 |
steps:
|
| 382 |
- name: Clone
|
| 383 |
+
uses: actions/checkout@v3
|
| 384 |
|
| 385 |
- name: Install Java
|
| 386 |
uses: actions/setup-java@v3
|
|
|
|
| 400 |
needs: [ 'windows' ]
|
| 401 |
runs-on: windows-latest
|
| 402 |
steps:
|
| 403 |
+
- uses: actions/checkout@v3
|
| 404 |
|
| 405 |
- name: Install Java
|
| 406 |
uses: actions/setup-java@v1
|
CMakeLists.txt
CHANGED
|
@@ -256,16 +256,16 @@ else()
|
|
| 256 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
|
| 257 |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
|
| 258 |
else()
|
| 259 |
-
if(
|
| 260 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx")
|
| 261 |
endif()
|
| 262 |
-
if(
|
| 263 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2")
|
| 264 |
endif()
|
| 265 |
-
if(
|
| 266 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfma")
|
| 267 |
endif()
|
| 268 |
-
if(
|
| 269 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mf16c")
|
| 270 |
endif()
|
| 271 |
endif()
|
|
|
|
| 256 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
|
| 257 |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
|
| 258 |
else()
|
| 259 |
+
if(__AVX__)
|
| 260 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx")
|
| 261 |
endif()
|
| 262 |
+
if(__AVX2__)
|
| 263 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2")
|
| 264 |
endif()
|
| 265 |
+
if(__FMA__)
|
| 266 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfma")
|
| 267 |
endif()
|
| 268 |
+
if(__F16C__)
|
| 269 |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mf16c")
|
| 270 |
endif()
|
| 271 |
endif()
|
ggml.c
CHANGED
|
@@ -292,7 +292,7 @@ typedef double ggml_float;
|
|
| 292 |
#if defined(_MSC_VER) || defined(__MINGW32__)
|
| 293 |
#include <intrin.h>
|
| 294 |
#else
|
| 295 |
-
#if
|
| 296 |
#include <immintrin.h>
|
| 297 |
#endif
|
| 298 |
#endif
|
|
|
|
| 292 |
#if defined(_MSC_VER) || defined(__MINGW32__)
|
| 293 |
#include <intrin.h>
|
| 294 |
#else
|
| 295 |
+
#if defined(__AVX__) || defined(__AVX2__) || defined(__AVX512F__) || defined(__SSSE3__)
|
| 296 |
#include <immintrin.h>
|
| 297 |
#endif
|
| 298 |
#endif
|