Spaces:
Running
Running
whisper : reorganize source code + improve CMake (#2256)
Browse files* scripts : update sync [no ci]
* files : reorganize [no ci]
* sync : llama.cpp
* cmake : link math library
* cmake : build normal ggml library
* files : move headers to include
* objc : fix path to ggml-metal.h
* ci : fix WHISPER_CUDA -> GGML_CUDA
* scripts : sync LICENSE [no ci]
This view is limited to 50 files because it contains too many changes.
See raw diff
- .devops/cublas.Dockerfile +1 -1
- .devops/main-cuda.Dockerfile +1 -1
- .github/workflows/build.yml +11 -28
- .gitignore +1 -11
- .gitmodules +0 -3
- CMakeLists.txt +134 -771
- Makefile +904 -324
- Package.swift +6 -8
- README.md +2 -2
- bindings/ios +0 -1
- cmake/BuildTypes.cmake +0 -54
- cmake/build-info.cmake +58 -0
- cmake/{GitVars.cmake → git-vars.cmake} +0 -0
- cmake/whisper-config.cmake.in +65 -0
- cmake/whisper.pc.in +10 -0
- examples/bench/bench.cpp +2 -2
- examples/command/command.cpp +7 -7
- examples/common-sdl.cpp +1 -1
- examples/grammar-parser.cpp +18 -18
- examples/lsp/lsp.cpp +10 -8
- examples/main/main.cpp +22 -21
- examples/quantize/quantize.cpp +1 -1
- examples/stream/stream.cpp +1 -1
- examples/talk-llama/llama.cpp +518 -203
- examples/talk-llama/llama.h +5 -1
- examples/talk-llama/talk-llama.cpp +5 -5
- examples/talk-llama/unicode-data.cpp +851 -801
- examples/talk-llama/unicode.cpp +22 -8
- examples/talk/gpt-2.cpp +2 -2
- examples/talk/talk.cpp +2 -2
- examples/whisper.android.java/app/src/main/jni/whisper/CMakeLists.txt +12 -10
- examples/whisper.android/lib/src/main/jni/whisper/CMakeLists.txt +9 -5
- examples/whisper.objc/whisper.objc.xcodeproj/project.pbxproj +31 -20
- examples/whisper.swiftui/whisper.swiftui.demo/Models/WhisperState.swift +1 -1
- ggml/.gitignore +1 -0
- ggml/CMakeLists.txt +238 -0
- ggml/cmake/FindSIMD.cmake +100 -0
- ggml/ggml_vk_generate_shaders.py +220 -0
- ggml-alloc.h → ggml/include/ggml-alloc.h +0 -0
- ggml-backend.h → ggml/include/ggml-backend.h +0 -0
- ggml-blas.h → ggml/include/ggml-blas.h +0 -0
- ggml-cuda.h → ggml/include/ggml-cuda.h +0 -0
- ggml-kompute.h → ggml/include/ggml-kompute.h +0 -0
- ggml-metal.h → ggml/include/ggml-metal.h +0 -0
- ggml-rpc.h → ggml/include/ggml-rpc.h +0 -0
- ggml-sycl.h → ggml/include/ggml-sycl.h +3 -1
- ggml-vulkan.h → ggml/include/ggml-vulkan.h +0 -0
- ggml.h → ggml/include/ggml.h +8 -33
- ggml/src/CMakeLists.txt +1171 -0
- ggml-alloc.c → ggml/src/ggml-alloc.c +0 -0
.devops/cublas.Dockerfile
CHANGED
|
@@ -21,7 +21,7 @@ COPY . .
|
|
| 21 |
# Set nvcc architecture
|
| 22 |
ENV CUDA_DOCKER_ARCH=${CUDA_DOCKER_ARCH}
|
| 23 |
# Enable cuBLAS
|
| 24 |
-
ENV
|
| 25 |
|
| 26 |
RUN make
|
| 27 |
|
|
|
|
| 21 |
# Set nvcc architecture
|
| 22 |
ENV CUDA_DOCKER_ARCH=${CUDA_DOCKER_ARCH}
|
| 23 |
# Enable cuBLAS
|
| 24 |
+
ENV GGML_CUDA=1
|
| 25 |
|
| 26 |
RUN make
|
| 27 |
|
.devops/main-cuda.Dockerfile
CHANGED
|
@@ -14,7 +14,7 @@ ARG CUDA_DOCKER_ARCH=all
|
|
| 14 |
# Set nvcc architecture
|
| 15 |
ENV CUDA_DOCKER_ARCH=${CUDA_DOCKER_ARCH}
|
| 16 |
# Enable cuBLAS
|
| 17 |
-
ENV
|
| 18 |
|
| 19 |
RUN apt-get update && \
|
| 20 |
apt-get install -y build-essential \
|
|
|
|
| 14 |
# Set nvcc architecture
|
| 15 |
ENV CUDA_DOCKER_ARCH=${CUDA_DOCKER_ARCH}
|
| 16 |
# Enable cuBLAS
|
| 17 |
+
ENV GGML_CUDA=1
|
| 18 |
|
| 19 |
RUN apt-get update && \
|
| 20 |
apt-get install -y build-essential \
|
.github/workflows/build.yml
CHANGED
|
@@ -101,7 +101,10 @@ jobs:
|
|
| 101 |
fail-fast: false
|
| 102 |
matrix:
|
| 103 |
build: [Debug, Release]
|
| 104 |
-
arch: [linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le]
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
steps:
|
| 107 |
- name: Clone
|
|
@@ -197,7 +200,7 @@ jobs:
|
|
| 197 |
source /opt/intel/oneapi/setvars.sh
|
| 198 |
mkdir build
|
| 199 |
cd build
|
| 200 |
-
cmake -
|
| 201 |
cmake --build . --config Release -j $(nproc)
|
| 202 |
|
| 203 |
ubuntu-22-cmake-sycl-fp16:
|
|
@@ -247,7 +250,7 @@ jobs:
|
|
| 247 |
source /opt/intel/oneapi/setvars.sh
|
| 248 |
mkdir build
|
| 249 |
cd build
|
| 250 |
-
cmake -
|
| 251 |
cmake --build . --config Release -j $(nproc)
|
| 252 |
|
| 253 |
windows-msys2:
|
|
@@ -289,7 +292,7 @@ jobs:
|
|
| 289 |
- name: Build using make w/ OpenBLAS
|
| 290 |
shell: msys2 {0}
|
| 291 |
run: |
|
| 292 |
-
make
|
| 293 |
|
| 294 |
- name: Build using CMake
|
| 295 |
shell: msys2 {0}
|
|
@@ -305,7 +308,7 @@ jobs:
|
|
| 305 |
- name: Build using CMake w/ OpenBLAS
|
| 306 |
shell: msys2 {0}
|
| 307 |
run: |
|
| 308 |
-
cmake -B build -
|
| 309 |
cmake --build build --config ${{ matrix.build }} -j $(nproc)
|
| 310 |
|
| 311 |
windows:
|
|
@@ -381,12 +384,9 @@ jobs:
|
|
| 381 |
- arch: Win32
|
| 382 |
obzip: https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.25/OpenBLAS-0.3.25-x86.zip
|
| 383 |
s2arc: x86
|
| 384 |
-
clblast: OFF
|
| 385 |
- arch: x64
|
| 386 |
obzip: https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.25/OpenBLAS-0.3.25-x64.zip
|
| 387 |
s2arc: x64
|
| 388 |
-
clblast: ON
|
| 389 |
-
clver: 1.6.1
|
| 390 |
- sdl2: ON
|
| 391 |
s2ver: 2.28.5
|
| 392 |
|
|
@@ -413,26 +413,13 @@ jobs:
|
|
| 413 |
7z x sdl2.zip
|
| 414 |
echo "SDL2_DIR=$env:GITHUB_WORKSPACE/SDL2-${{ matrix.s2ver }}/cmake" >> $env:GITHUB_ENV
|
| 415 |
|
| 416 |
-
- name: Install OpenCL
|
| 417 |
-
if: matrix.clblast == 'ON'
|
| 418 |
-
run: vcpkg.exe --triplet=${{ matrix.arch }}-windows install opencl
|
| 419 |
-
|
| 420 |
-
- name: Fetch CLBlast and set CLBlast_DIR
|
| 421 |
-
if: matrix.clblast == 'ON'
|
| 422 |
-
run: |
|
| 423 |
-
C:/msys64/usr/bin/wget.exe -qO clblast.zip https://github.com/CNugteren/CLBlast/releases/download/${{ matrix.clver }}/CLBlast-${{ matrix.clver }}-windows-x64.zip
|
| 424 |
-
7z x clblast.zip
|
| 425 |
-
7z x CLBlast-${{ matrix.clver }}-windows-x64.7z
|
| 426 |
-
echo "CLBlast_DIR=$env:GITHUB_WORKSPACE/CLBlast-${{ matrix.clver }}-windows-x64/lib/cmake/CLBlast" >> $env:GITHUB_ENV
|
| 427 |
-
|
| 428 |
- name: Configure
|
| 429 |
run: >
|
| 430 |
cmake -S . -B ./build -A ${{ matrix.arch }}
|
| 431 |
-DCMAKE_BUILD_TYPE=${{ matrix.build }}
|
| 432 |
-
-
|
| 433 |
-DCMAKE_LIBRARY_PATH="$env:OPENBLAS_PATH/lib"
|
| 434 |
-DWHISPER_SDL2=${{ matrix.sdl2 }}
|
| 435 |
-
-DWHISPER_CLBLAST=${{ matrix.clblast }}
|
| 436 |
|
| 437 |
- name: Build
|
| 438 |
run: |
|
|
@@ -447,15 +434,11 @@ jobs:
|
|
| 447 |
if: matrix.sdl2 == 'ON'
|
| 448 |
run: copy "$env:SDL2_DIR/../lib/${{ matrix.s2arc }}/SDL2.dll" build/bin/${{ matrix.build }}
|
| 449 |
|
| 450 |
-
- name: Copy clblast.dll
|
| 451 |
-
if: matrix.clblast == 'ON'
|
| 452 |
-
run: copy "$env:CLBlast_DIR/../../clblast.dll" build/bin/${{ matrix.build }}
|
| 453 |
-
|
| 454 |
- name: Upload binaries
|
| 455 |
if: matrix.blas == 'ON' && matrix.sdl2 == 'ON'
|
| 456 |
uses: actions/upload-artifact@v4
|
| 457 |
with:
|
| 458 |
-
name: whisper-blas
|
| 459 |
path: build/bin/${{ matrix.build }}
|
| 460 |
|
| 461 |
windows-cublas:
|
|
@@ -498,7 +481,7 @@ jobs:
|
|
| 498 |
run: >
|
| 499 |
cmake -S . -B ./build -A ${{ matrix.arch }}
|
| 500 |
-DCMAKE_BUILD_TYPE=${{ matrix.build }}
|
| 501 |
-
-
|
| 502 |
-DWHISPER_SDL2=${{ matrix.sdl2 }}
|
| 503 |
|
| 504 |
- name: Build ${{ matrix.cuda-toolkit }}
|
|
|
|
| 101 |
fail-fast: false
|
| 102 |
matrix:
|
| 103 |
build: [Debug, Release]
|
| 104 |
+
#arch: [linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le]
|
| 105 |
+
# TODO: arm/v7 disabled due to clang bug
|
| 106 |
+
# https://github.com/ggerganov/whisper.cpp/actions/runs/9657764109/job/26637633042?pr=2256#step:4:1990
|
| 107 |
+
arch: [linux/amd64, linux/arm64, linux/ppc64le]
|
| 108 |
|
| 109 |
steps:
|
| 110 |
- name: Clone
|
|
|
|
| 200 |
source /opt/intel/oneapi/setvars.sh
|
| 201 |
mkdir build
|
| 202 |
cd build
|
| 203 |
+
cmake -DGGML_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx ..
|
| 204 |
cmake --build . --config Release -j $(nproc)
|
| 205 |
|
| 206 |
ubuntu-22-cmake-sycl-fp16:
|
|
|
|
| 250 |
source /opt/intel/oneapi/setvars.sh
|
| 251 |
mkdir build
|
| 252 |
cd build
|
| 253 |
+
cmake -DGGML_SYCL_F16=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx ..
|
| 254 |
cmake --build . --config Release -j $(nproc)
|
| 255 |
|
| 256 |
windows-msys2:
|
|
|
|
| 292 |
- name: Build using make w/ OpenBLAS
|
| 293 |
shell: msys2 {0}
|
| 294 |
run: |
|
| 295 |
+
make GGML_OPENBLAS=1 -j $(nproc)
|
| 296 |
|
| 297 |
- name: Build using CMake
|
| 298 |
shell: msys2 {0}
|
|
|
|
| 308 |
- name: Build using CMake w/ OpenBLAS
|
| 309 |
shell: msys2 {0}
|
| 310 |
run: |
|
| 311 |
+
cmake -B build -DGGML_OPENBLAS=ON
|
| 312 |
cmake --build build --config ${{ matrix.build }} -j $(nproc)
|
| 313 |
|
| 314 |
windows:
|
|
|
|
| 384 |
- arch: Win32
|
| 385 |
obzip: https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.25/OpenBLAS-0.3.25-x86.zip
|
| 386 |
s2arc: x86
|
|
|
|
| 387 |
- arch: x64
|
| 388 |
obzip: https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.25/OpenBLAS-0.3.25-x64.zip
|
| 389 |
s2arc: x64
|
|
|
|
|
|
|
| 390 |
- sdl2: ON
|
| 391 |
s2ver: 2.28.5
|
| 392 |
|
|
|
|
| 413 |
7z x sdl2.zip
|
| 414 |
echo "SDL2_DIR=$env:GITHUB_WORKSPACE/SDL2-${{ matrix.s2ver }}/cmake" >> $env:GITHUB_ENV
|
| 415 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 416 |
- name: Configure
|
| 417 |
run: >
|
| 418 |
cmake -S . -B ./build -A ${{ matrix.arch }}
|
| 419 |
-DCMAKE_BUILD_TYPE=${{ matrix.build }}
|
| 420 |
+
-DGGML_OPENBLAS=${{ matrix.blas }}
|
| 421 |
-DCMAKE_LIBRARY_PATH="$env:OPENBLAS_PATH/lib"
|
| 422 |
-DWHISPER_SDL2=${{ matrix.sdl2 }}
|
|
|
|
| 423 |
|
| 424 |
- name: Build
|
| 425 |
run: |
|
|
|
|
| 434 |
if: matrix.sdl2 == 'ON'
|
| 435 |
run: copy "$env:SDL2_DIR/../lib/${{ matrix.s2arc }}/SDL2.dll" build/bin/${{ matrix.build }}
|
| 436 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 437 |
- name: Upload binaries
|
| 438 |
if: matrix.blas == 'ON' && matrix.sdl2 == 'ON'
|
| 439 |
uses: actions/upload-artifact@v4
|
| 440 |
with:
|
| 441 |
+
name: whisper-blas-bin-${{ matrix.arch }}
|
| 442 |
path: build/bin/${{ matrix.build }}
|
| 443 |
|
| 444 |
windows-cublas:
|
|
|
|
| 481 |
run: >
|
| 482 |
cmake -S . -B ./build -A ${{ matrix.arch }}
|
| 483 |
-DCMAKE_BUILD_TYPE=${{ matrix.build }}
|
| 484 |
+
-DGGML_CUDA=${{ matrix.cublas }}
|
| 485 |
-DWHISPER_SDL2=${{ matrix.sdl2 }}
|
| 486 |
|
| 487 |
- name: Build ${{ matrix.cuda-toolkit }}
|
.gitignore
CHANGED
|
@@ -10,17 +10,7 @@
|
|
| 10 |
/CMakeSettings.json
|
| 11 |
|
| 12 |
build/
|
| 13 |
-
build
|
| 14 |
-
build-coreml/
|
| 15 |
-
build-em/
|
| 16 |
-
build-debug/
|
| 17 |
-
build-release/
|
| 18 |
-
build-rwdi/
|
| 19 |
-
build-static/
|
| 20 |
-
build-cublas/
|
| 21 |
-
build-no-accel/
|
| 22 |
-
build-sanitize-addr/
|
| 23 |
-
build-sanitize-thread/
|
| 24 |
|
| 25 |
# SPM
|
| 26 |
.build/
|
|
|
|
| 10 |
/CMakeSettings.json
|
| 11 |
|
| 12 |
build/
|
| 13 |
+
build-*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# SPM
|
| 16 |
.build/
|
.gitmodules
CHANGED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
[submodule "bindings/ios"]
|
| 2 |
-
path = bindings/ios
|
| 3 |
-
url = https://github.com/ggerganov/whisper.spm
|
|
|
|
|
|
|
|
|
|
|
|
CMakeLists.txt
CHANGED
|
@@ -1,25 +1,31 @@
|
|
| 1 |
-
cmake_minimum_required
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
# Allow for the creation of solution folders.
|
| 4 |
-
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
| 5 |
-
|
| 6 |
-
project(whisper.cpp VERSION 1.6.2)
|
| 7 |
set(SOVERSION 1)
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
# Add path to modules
|
| 10 |
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
| 11 |
|
| 12 |
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
| 13 |
|
| 14 |
-
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
| 15 |
set(WHISPER_STANDALONE ON)
|
| 16 |
-
|
| 17 |
-
include(
|
| 18 |
|
| 19 |
# configure project version
|
| 20 |
-
if (EXISTS "${CMAKE_SOURCE_DIR}/bindings/ios/Makefile-tmpl")
|
| 21 |
-
configure_file(${CMAKE_SOURCE_DIR}/bindings/ios/Makefile-tmpl ${CMAKE_SOURCE_DIR}/bindings/ios/Makefile @ONLY)
|
| 22 |
-
endif()
|
| 23 |
configure_file(${CMAKE_SOURCE_DIR}/bindings/javascript/package-tmpl.json ${CMAKE_SOURCE_DIR}/bindings/javascript/package.json @ONLY)
|
| 24 |
else()
|
| 25 |
set(WHISPER_STANDALONE OFF)
|
|
@@ -29,6 +35,11 @@ if (EMSCRIPTEN)
|
|
| 29 |
set(BUILD_SHARED_LIBS_DEFAULT OFF)
|
| 30 |
|
| 31 |
option(WHISPER_WASM_SINGLE_FILE "whisper: embed WASM inside the generated whisper.js" ON)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
else()
|
| 33 |
if (MINGW)
|
| 34 |
set(BUILD_SHARED_LIBS_DEFAULT OFF)
|
|
@@ -37,793 +48,145 @@ else()
|
|
| 37 |
endif()
|
| 38 |
endif()
|
| 39 |
|
| 40 |
-
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
set(WHISPER_METAL_DEFAULT OFF)
|
| 46 |
-
endif()
|
| 47 |
|
| 48 |
-
|
|
|
|
| 49 |
|
|
|
|
| 50 |
option(WHISPER_ALL_WARNINGS "whisper: enable all compiler warnings" ON)
|
| 51 |
option(WHISPER_ALL_WARNINGS_3RD_PARTY "whisper: enable all compiler warnings in 3rd party libs" OFF)
|
| 52 |
|
| 53 |
-
|
| 54 |
-
option(
|
| 55 |
-
option(WHISPER_SANITIZE_UNDEFINED "whisper: enable undefined sanitizer" OFF)
|
| 56 |
-
|
| 57 |
-
option(WHISPER_BUILD_TESTS "whisper: build tests" ${WHISPER_STANDALONE})
|
| 58 |
-
option(WHISPER_BUILD_EXAMPLES "whisper: build examples" ${WHISPER_STANDALONE})
|
| 59 |
-
|
| 60 |
-
option(WHISPER_SDL2 "whisper: support for libSDL2" OFF)
|
| 61 |
-
|
| 62 |
-
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
| 63 |
-
option(WHISPER_FFMPEG "whisper: support building and linking with ffmpeg libs (avcodec, swresample, ...)" OFF)
|
| 64 |
-
endif()
|
| 65 |
-
|
| 66 |
-
option(WHISPER_NO_AVX "whisper: disable AVX" OFF)
|
| 67 |
-
option(WHISPER_NO_AVX2 "whisper: disable AVX2" OFF)
|
| 68 |
-
option(WHISPER_NO_AVX512 "whisper: disable AVX512" ON)
|
| 69 |
-
option(WHISPER_NO_AVX512_VBMI "whisper: disable AVX512-VBMI" ON)
|
| 70 |
-
option(WHISPER_NO_AVX512_VNNI "whisper: disable AVX512-VNNI" ON)
|
| 71 |
-
option(WHISPER_NO_FMA "whisper: disable FMA" OFF)
|
| 72 |
-
option(WHISPER_NO_F16C "whisper: disable F16c" OFF)
|
| 73 |
-
|
| 74 |
-
option(WHISPER_OPENVINO "whisper: support for OpenVINO" OFF)
|
| 75 |
-
|
| 76 |
-
if (APPLE)
|
| 77 |
-
option(WHISPER_NO_ACCELERATE "whisper: disable Accelerate framework" OFF)
|
| 78 |
-
option(WHISPER_METAL "whisper: use Metal" ${WHISPER_METAL_DEFAULT})
|
| 79 |
-
option(WHISPER_METAL_NDEBUG "whisper: disable Metal debugging" OFF)
|
| 80 |
-
option(WHISPER_COREML "whisper: enable Core ML framework" OFF)
|
| 81 |
-
option(WHISPER_COREML_ALLOW_FALLBACK "whisper: allow non-CoreML fallback" OFF)
|
| 82 |
-
option(WHISPER_METAL_EMBED_LIBRARY "whisper: embed Metal library" OFF)
|
| 83 |
-
option(WHISPER_BLAS "whisper: use BLAS" ON)
|
| 84 |
-
set (WHISPER_BLAS_VENDOR "Apple" CACHE STRING
|
| 85 |
-
"whisper: BLAS library vendor")
|
| 86 |
-
else()
|
| 87 |
-
option(WHISPER_CUDA "whisper: support for CUDA" OFF)
|
| 88 |
-
option(WHISPER_CUDA_FA_ALL_QUANTS "whisper: compile all quants for FlashAttention" OFF)
|
| 89 |
-
option(WHISPER_CUBLAS "whisper: support for CUDA (deprecated)" OFF)
|
| 90 |
-
option(WHISPER_HIPBLAS "whisper: support for hipBLAS" OFF)
|
| 91 |
-
option(WHISPER_CLBLAST "whisper: use CLBlast" OFF)
|
| 92 |
-
option(WHISPER_MKL "whisper: use Intel Math Kernel Library (MKL)" OFF)
|
| 93 |
-
option(WHISPER_SYCL "whisper: use SYCL" OFF)
|
| 94 |
-
option(WHISPER_SYCL_F16 "whisper: use 16 bit floats for sycl calculations" OFF)
|
| 95 |
-
option(WHISPER_BLAS "whisper: use BLAS" OFF)
|
| 96 |
-
set (WHISPER_BLAS_VENDOR "Generic" CACHE STRING
|
| 97 |
-
"whisper: BLAS library vendor")
|
| 98 |
-
endif()
|
| 99 |
-
|
| 100 |
-
option(WHISPER_PERF "whisper: enable perf timings" OFF)
|
| 101 |
|
| 102 |
# sanitizers
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
endif()
|
| 109 |
-
|
| 110 |
-
if (WHISPER_SANITIZE_ADDRESS)
|
| 111 |
-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
| 112 |
-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
| 113 |
-
endif()
|
| 114 |
-
|
| 115 |
-
if (WHISPER_SANITIZE_UNDEFINED)
|
| 116 |
-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined")
|
| 117 |
-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
|
| 118 |
-
endif()
|
| 119 |
-
endif()
|
| 120 |
-
|
| 121 |
-
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math")
|
| 122 |
-
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
|
| 123 |
-
|
| 124 |
-
# dependencies
|
| 125 |
-
|
| 126 |
-
find_package(Threads REQUIRED)
|
| 127 |
-
|
| 128 |
-
#compile flag sycl
|
| 129 |
-
if (WHISPER_SYCL)
|
| 130 |
-
set(CMAKE_CXX_STANDARD 17)
|
| 131 |
-
else()
|
| 132 |
-
set(CMAKE_CXX_STANDARD 11)
|
| 133 |
-
endif()
|
| 134 |
-
|
| 135 |
-
if (WHISPER_FFMPEG)
|
| 136 |
-
# As of cmake 3.27, there is no official cmake support for FindFFmpeg.
|
| 137 |
-
# Consequnelty we added a FindFFmpeg.cmake script the cmake subfolder:
|
| 138 |
-
# whisper.cpp does not need the full ffmpeg libs, just AVFORMAT AVCODEC AVUTIL SWRESAMPLE
|
| 139 |
-
# libswresample performs highly optimized audio resampling, rematrixing and sample format conversion operations
|
| 140 |
-
# libavcodec provides a generic encoding/decoding framework and contains multiple decoders and encoders for audio, video and subtitle streams, and several bitstream filters.
|
| 141 |
-
# libavformat provides a generic framework for multiplexing and demultiplexing (muxing and demuxing) audio, video and subtitle streams.
|
| 142 |
-
find_package(FFmpeg REQUIRED)
|
| 143 |
-
if (NOT ${FFMPEG_FOUND})
|
| 144 |
-
message(FATAL_ERROR "Cannot find ffmpeg libs/headers")
|
| 145 |
-
endif()
|
| 146 |
-
message(STATUS "Found ffmpeg libs: ${FFMPEG_LIBRARIES}")
|
| 147 |
-
message(STATUS "Found ffmpeg headers in: ${FFMPEG_INCLUDE_DIRS}")
|
| 148 |
-
message(STATUS "ffmpeg definitions: ${FFMPEG_DEFINITIONS}")
|
| 149 |
-
message(STATUS "Found avformat ${AVFORMAT_VERSION}")
|
| 150 |
-
include_directories(${FFMPEG_INCLUDE_DIRS})
|
| 151 |
-
add_compile_definitions(WHISPER_FFMPEG)
|
| 152 |
-
set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} ${FFMPEG_LIBRARIES})
|
| 153 |
-
endif()
|
| 154 |
-
|
| 155 |
-
# on APPLE
|
| 156 |
-
if (APPLE)
|
| 157 |
-
# include Accelerate framework
|
| 158 |
-
if (NOT WHISPER_NO_ACCELERATE)
|
| 159 |
-
find_library(ACCELERATE_FRAMEWORK Accelerate)
|
| 160 |
-
|
| 161 |
-
if (ACCELERATE_FRAMEWORK)
|
| 162 |
-
message(STATUS "Accelerate framework found")
|
| 163 |
-
|
| 164 |
-
set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} ${ACCELERATE_FRAMEWORK})
|
| 165 |
-
set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DGGML_USE_ACCELERATE -DACCELERATE_NEW_LAPACK -DACCELERATE_LAPACK_ILP64)
|
| 166 |
-
else()
|
| 167 |
-
message(FATAL_ERROR "Accelerate framework not found")
|
| 168 |
-
endif()
|
| 169 |
-
endif()
|
| 170 |
-
|
| 171 |
-
if (WHISPER_METAL)
|
| 172 |
-
find_library(FOUNDATION_LIBRARY Foundation REQUIRED)
|
| 173 |
-
find_library(METAL_FRAMEWORK Metal REQUIRED)
|
| 174 |
-
find_library(METALKIT_FRAMEWORK MetalKit REQUIRED)
|
| 175 |
-
|
| 176 |
-
if (METAL_FRAMEWORK)
|
| 177 |
-
message(STATUS "Metal framework found")
|
| 178 |
-
|
| 179 |
-
set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS}
|
| 180 |
-
${FOUNDATION_LIBRARY}
|
| 181 |
-
${METAL_FRAMEWORK}
|
| 182 |
-
${METALKIT_FRAMEWORK}
|
| 183 |
-
)
|
| 184 |
-
set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DGGML_USE_METAL)
|
| 185 |
-
|
| 186 |
-
if (WHISPER_METAL_NDEBUG)
|
| 187 |
-
set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DGGML_METAL_NDEBUG)
|
| 188 |
-
endif()
|
| 189 |
-
else()
|
| 190 |
-
message(FATAL_ERROR "Metal framework not found")
|
| 191 |
-
endif()
|
| 192 |
-
|
| 193 |
-
set(GGML_SOURCES_METAL ggml-metal.m ggml-metal.h)
|
| 194 |
-
|
| 195 |
-
# copy ggml-common.h and ggml-metal.metal to bin directory
|
| 196 |
-
configure_file(ggml-common.h bin/ggml-common.h COPYONLY)
|
| 197 |
-
configure_file(ggml-metal.metal bin/ggml-metal.metal COPYONLY)
|
| 198 |
-
|
| 199 |
-
if (WHISPER_METAL_EMBED_LIBRARY)
|
| 200 |
-
enable_language(ASM)
|
| 201 |
-
set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DGGML_METAL_EMBED_LIBRARY)
|
| 202 |
-
|
| 203 |
-
set(METALLIB_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/ggml-metal.metal")
|
| 204 |
-
set(COMMON_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/ggml-common.h")
|
| 205 |
-
|
| 206 |
-
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/autogenerated")
|
| 207 |
-
set(EMBED_METALLIB_ASSEMBLY "${CMAKE_BINARY_DIR}/autogenerated/ggml-embed-metallib.s")
|
| 208 |
-
set(EMBED_METALLIB_SOURCE "${CMAKE_BINARY_DIR}/autogenerated/ggml-metal-combined.metal")
|
| 209 |
-
|
| 210 |
-
add_custom_command(
|
| 211 |
-
OUTPUT ${EMBED_METALLIB_SOURCE}
|
| 212 |
-
COMMAND sed -e "/^#include \\\"ggml-common.h\\\"/r ${COMMON_HEADER}" -e "/^#include \\\"ggml-common.h\\\"/d" ${METALLIB_SOURCE} > ${EMBED_METALLIB_SOURCE}
|
| 213 |
-
DEPENDS ${METALLIB_SOURCE} ${COMMON_HEADER}
|
| 214 |
-
COMMENT "Generating combined Metal library for embedding"
|
| 215 |
-
)
|
| 216 |
-
|
| 217 |
-
add_custom_command(
|
| 218 |
-
OUTPUT ${EMBED_METALLIB_ASSEMBLY}
|
| 219 |
-
COMMAND echo ".section __DATA,__ggml_metallib" > ${EMBED_METALLIB_ASSEMBLY}
|
| 220 |
-
COMMAND echo ".globl _ggml_metallib_start" >> ${EMBED_METALLIB_ASSEMBLY}
|
| 221 |
-
COMMAND echo "_ggml_metallib_start:" >> ${EMBED_METALLIB_ASSEMBLY}
|
| 222 |
-
COMMAND echo ".incbin \\\"${EMBED_METALLIB_SOURCE}\\\"" >> ${EMBED_METALLIB_ASSEMBLY}
|
| 223 |
-
COMMAND echo ".globl _ggml_metallib_end" >> ${EMBED_METALLIB_ASSEMBLY}
|
| 224 |
-
COMMAND echo "_ggml_metallib_end:" >> ${EMBED_METALLIB_ASSEMBLY}
|
| 225 |
-
DEPENDS ${EMBED_METALLIB_SOURCE}
|
| 226 |
-
COMMENT "Generate assembly for embedded Metal library"
|
| 227 |
-
)
|
| 228 |
-
|
| 229 |
-
set(GGML_SOURCES_METAL ${GGML_SOURCES_METAL} ${EMBED_METALLIB_ASSEMBLY})
|
| 230 |
-
endif()
|
| 231 |
-
endif()
|
| 232 |
-
|
| 233 |
-
if (WHISPER_COREML)
|
| 234 |
-
find_library(FOUNDATION_FRAMEWORK Foundation)
|
| 235 |
-
find_library(COREML_FRAMEWORK CoreML)
|
| 236 |
-
|
| 237 |
-
if (COREML_FRAMEWORK)
|
| 238 |
-
message(STATUS "CoreML framework found")
|
| 239 |
-
|
| 240 |
-
set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DWHISPER_USE_COREML)
|
| 241 |
-
else()
|
| 242 |
-
message(FATAL_ERROR "CoreML framework not found")
|
| 243 |
-
endif()
|
| 244 |
-
|
| 245 |
-
if (WHISPER_COREML_ALLOW_FALLBACK)
|
| 246 |
-
set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DWHISPER_COREML_ALLOW_FALLBACK)
|
| 247 |
-
endif()
|
| 248 |
-
endif()
|
| 249 |
-
endif()
|
| 250 |
-
|
| 251 |
-
if (WHISPER_BLAS)
|
| 252 |
-
if (WHISPER_STATIC)
|
| 253 |
-
set(BLA_STATIC ON)
|
| 254 |
-
endif()
|
| 255 |
-
#if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.22)
|
| 256 |
-
# set(BLA_SIZEOF_INTEGER 8)
|
| 257 |
-
#endif()
|
| 258 |
-
|
| 259 |
-
set(BLA_VENDOR ${WHISPER_BLAS_VENDOR})
|
| 260 |
-
find_package(BLAS)
|
| 261 |
-
|
| 262 |
-
if (BLAS_FOUND)
|
| 263 |
-
message(STATUS "BLAS found, Libraries: ${BLAS_LIBRARIES}")
|
| 264 |
-
|
| 265 |
-
if (("${BLAS_INCLUDE_DIRS}" STREQUAL "") AND NOT (${WHISPER_BLAS_VENDOR} MATCHES "Apple"))
|
| 266 |
-
# BLAS_INCLUDE_DIRS is missing in FindBLAS.cmake.
|
| 267 |
-
# see https://gitlab.kitware.com/cmake/cmake/-/issues/20268
|
| 268 |
-
find_package(PkgConfig REQUIRED)
|
| 269 |
-
if (${WHISPER_BLAS_VENDOR} MATCHES "Generic")
|
| 270 |
-
pkg_check_modules(DepBLAS REQUIRED blas)
|
| 271 |
-
elseif (${WHISPER_BLAS_VENDOR} MATCHES "OpenBLAS")
|
| 272 |
-
# As of openblas v0.3.22, the 64-bit is named openblas64.pc
|
| 273 |
-
pkg_check_modules(DepBLAS openblas64)
|
| 274 |
-
if (NOT DepBLAS_FOUND)
|
| 275 |
-
pkg_check_modules(DepBLAS REQUIRED openblas)
|
| 276 |
-
endif()
|
| 277 |
-
elseif (${WHISPER_BLAS_VENDOR} MATCHES "FLAME")
|
| 278 |
-
pkg_check_modules(DepBLAS REQUIRED blis)
|
| 279 |
-
elseif (${WHISPER_BLAS_VENDOR} MATCHES "ATLAS")
|
| 280 |
-
pkg_check_modules(DepBLAS REQUIRED blas-atlas)
|
| 281 |
-
elseif (${WHISPER_BLAS_VENDOR} MATCHES "FlexiBLAS")
|
| 282 |
-
pkg_check_modules(DepBLAS REQUIRED flexiblas_api)
|
| 283 |
-
elseif (${WHISPER_BLAS_VENDOR} MATCHES "Intel")
|
| 284 |
-
# all Intel* libraries share the same include path
|
| 285 |
-
pkg_check_modules(DepBLAS REQUIRED mkl-sdl)
|
| 286 |
-
elseif (${WHISPER_BLAS_VENDOR} MATCHES "NVHPC")
|
| 287 |
-
# this doesn't provide pkg-config
|
| 288 |
-
# suggest to assign BLAS_INCLUDE_DIRS on your own
|
| 289 |
-
if ("${NVHPC_VERSION}" STREQUAL "")
|
| 290 |
-
message(WARNING "Better to set NVHPC_VERSION")
|
| 291 |
-
else()
|
| 292 |
-
set(DepBLAS_FOUND ON)
|
| 293 |
-
set(DepBLAS_INCLUDE_DIRS "/opt/nvidia/hpc_sdk/${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}/${NVHPC_VERSION}/math_libs/include")
|
| 294 |
-
endif()
|
| 295 |
-
endif()
|
| 296 |
-
if (DepBLAS_FOUND)
|
| 297 |
-
set(BLAS_INCLUDE_DIRS ${DepBLAS_INCLUDE_DIRS})
|
| 298 |
-
else()
|
| 299 |
-
message(WARNING "BLAS_INCLUDE_DIRS neither been provided nor been automatically"
|
| 300 |
-
" detected by pkgconfig, trying to find cblas.h from possible paths...")
|
| 301 |
-
find_path(BLAS_INCLUDE_DIRS
|
| 302 |
-
NAMES cblas.h
|
| 303 |
-
HINTS
|
| 304 |
-
/usr/include
|
| 305 |
-
/usr/local/include
|
| 306 |
-
/usr/include/openblas
|
| 307 |
-
/opt/homebrew/opt/openblas/include
|
| 308 |
-
/usr/local/opt/openblas/include
|
| 309 |
-
/usr/include/x86_64-linux-gnu/openblas/include
|
| 310 |
-
)
|
| 311 |
-
endif()
|
| 312 |
-
endif()
|
| 313 |
-
|
| 314 |
-
message(STATUS "BLAS found, Includes: ${BLAS_INCLUDE_DIRS}")
|
| 315 |
-
|
| 316 |
-
add_compile_options(${BLAS_LINKER_FLAGS})
|
| 317 |
-
|
| 318 |
-
add_compile_definitions(GGML_USE_BLAS)
|
| 319 |
-
|
| 320 |
-
if (${BLAS_INCLUDE_DIRS} MATCHES "mkl" AND (${WHISPER_BLAS_VENDOR} MATCHES "Generic" OR ${WHISPER_BLAS_VENDOR} MATCHES "Intel"))
|
| 321 |
-
add_compile_definitions(GGML_BLAS_USE_MKL)
|
| 322 |
-
endif()
|
| 323 |
-
|
| 324 |
-
set(GGML_HEADERS_BLAS ggml-blas.h)
|
| 325 |
-
set(GGML_SOURCES_BLAS ggml-blas.cpp)
|
| 326 |
-
|
| 327 |
-
set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} ${BLAS_LIBRARIES})
|
| 328 |
-
set(WHISPER_EXTRA_INCLUDES ${WHISPER_EXTRA_INCLUDES} ${BLAS_INCLUDE_DIRS})
|
| 329 |
-
else()
|
| 330 |
-
message(WARNING "BLAS not found, please refer to "
|
| 331 |
-
"https://cmake.org/cmake/help/latest/module/FindBLAS.html#blas-lapack-vendors"
|
| 332 |
-
" to set correct WHISPER_BLAS_VENDOR")
|
| 333 |
-
endif()
|
| 334 |
-
endif()
|
| 335 |
-
|
| 336 |
-
if (WHISPER_MKL)
|
| 337 |
-
find_package(MKL CONFIG REQUIRED PATHS $ENV{MKLROOT})
|
| 338 |
-
message(STATUS "Imported oneMKL targets: ${MKL_IMPORTED_TARGETS}")
|
| 339 |
-
set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DGGML_USE_OPENBLAS)
|
| 340 |
-
set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DGGML_BLAS_USE_MKL)
|
| 341 |
-
endif()
|
| 342 |
-
|
| 343 |
-
if (WHISPER_CUBLAS)
|
| 344 |
-
message(WARNING "WHISPER_CUBLAS is deprecated and will be removed in the future.\nUse WHISPER_CUDA instead")
|
| 345 |
-
set(WHISPER_CUDA ON)
|
| 346 |
-
endif()
|
| 347 |
-
|
| 348 |
-
if (WHISPER_CUDA)
|
| 349 |
-
cmake_minimum_required(VERSION 3.18) # for CMAKE_CUDA_ARCHITECTURES
|
| 350 |
-
|
| 351 |
-
find_package(CUDAToolkit)
|
| 352 |
-
|
| 353 |
-
if (CUDAToolkit_FOUND)
|
| 354 |
-
message(STATUS "cuBLAS found")
|
| 355 |
-
|
| 356 |
-
if (NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
|
| 357 |
-
# 52 == lowest CUDA 12 standard
|
| 358 |
-
# 60 == f16 CUDA intrinsics
|
| 359 |
-
# 61 == integer CUDA intrinsics
|
| 360 |
-
# 70 == compute capability at which unrolling a loop in mul_mat_q kernels is faster
|
| 361 |
-
if (WHISPER_CUDA_F16 OR WHISPER_CUDA_DMMV_F16)
|
| 362 |
-
set(CMAKE_CUDA_ARCHITECTURES "60;61;70") # needed for f16 CUDA intrinsics
|
| 363 |
-
else()
|
| 364 |
-
set(CMAKE_CUDA_ARCHITECTURES "52;61;70") # lowest CUDA 12 standard + lowest for integer intrinsics
|
| 365 |
-
#set(CMAKE_CUDA_ARCHITECTURES "OFF") # use this to compile much faster, but only F16 models work
|
| 366 |
-
endif()
|
| 367 |
-
endif()
|
| 368 |
-
message(STATUS "Using CUDA architectures: ${CMAKE_CUDA_ARCHITECTURES}")
|
| 369 |
-
|
| 370 |
-
enable_language(CUDA)
|
| 371 |
-
|
| 372 |
-
file(GLOB GGML_SOURCES_CUDA "ggml-cuda/*.cu")
|
| 373 |
-
list(APPEND GGML_SOURCES_CUDA ggml-cuda.h)
|
| 374 |
-
list(APPEND GGML_SOURCES_CUDA ggml-cuda.cu)
|
| 375 |
-
|
| 376 |
-
file(GLOB SRCS "ggml-cuda/template-instances/fattn-wmma*.cu")
|
| 377 |
-
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 378 |
-
file(GLOB SRCS "ggml-cuda/template-instances/mmq*.cu")
|
| 379 |
-
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 380 |
-
|
| 381 |
-
if (WHISPER_CUDA_FA_ALL_QUANTS)
|
| 382 |
-
file(GLOB SRCS "ggml-cuda/template-instances/fattn-vec*.cu")
|
| 383 |
-
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 384 |
-
add_compile_definitions(GGML_CUDA_FA_ALL_QUANTS)
|
| 385 |
-
else()
|
| 386 |
-
file(GLOB SRCS "ggml-cuda/template-instances/fattn-vec*q4_0-q4_0.cu")
|
| 387 |
-
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 388 |
-
file(GLOB SRCS "ggml-cuda/template-instances/fattn-vec*q8_0-q8_0.cu")
|
| 389 |
-
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 390 |
-
file(GLOB SRCS "ggml-cuda/template-instances/fattn-vec*f16-f16.cu")
|
| 391 |
-
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 392 |
-
endif()
|
| 393 |
-
|
| 394 |
-
add_compile_definitions(GGML_USE_CUDA)
|
| 395 |
-
add_compile_definitions(GGML_CUDA_USE_GRAPHS)
|
| 396 |
-
|
| 397 |
-
if (WHISPER_STATIC)
|
| 398 |
-
if (WIN32)
|
| 399 |
-
# As of 12.3.1 CUDA Tookit for Windows does not offer a static cublas library
|
| 400 |
-
set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} CUDA::cudart_static CUDA::cublas CUDA::cublasLt CUDA::cufft)
|
| 401 |
-
else ()
|
| 402 |
-
set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} CUDA::cudart_static CUDA::cublas_static CUDA::cublasLt_static CUDA::cufft_static)
|
| 403 |
-
endif()
|
| 404 |
-
else()
|
| 405 |
-
set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} CUDA::cudart CUDA::cublas CUDA::cublasLt CUDA::cufft)
|
| 406 |
-
endif()
|
| 407 |
-
|
| 408 |
-
set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} CUDA::cuda_driver)
|
| 409 |
-
else()
|
| 410 |
-
message(FATAL_ERROR "cuBLAS not found")
|
| 411 |
-
endif()
|
| 412 |
-
endif()
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
if (WHISPER_HIPBLAS)
|
| 416 |
-
list(APPEND CMAKE_PREFIX_PATH /opt/rocm)
|
| 417 |
-
if (NOT ${CMAKE_C_COMPILER_ID} MATCHES "Clang")
|
| 418 |
-
message(WARNING "Only LLVM is supported for HIP, hint: CC=/opt/rocm/llvm/bin/clang")
|
| 419 |
-
endif()
|
| 420 |
-
if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
| 421 |
-
message(WARNING "Only LLVM is supported for HIP, hint: CXX=/opt/rocm/llvm/bin/clang++")
|
| 422 |
-
endif()
|
| 423 |
-
|
| 424 |
-
find_package(hip)
|
| 425 |
-
find_package(hipblas)
|
| 426 |
-
find_package(rocblas)
|
| 427 |
-
|
| 428 |
-
if (${hipblas_FOUND} AND ${hip_FOUND})
|
| 429 |
-
message(STATUS "HIP and hipBLAS found")
|
| 430 |
-
set(GGML_HEADERS_ROCM "ggml-cuda.h")
|
| 431 |
-
|
| 432 |
-
file(GLOB GGML_SOURCES_ROCM "ggml-cuda/*.cu")
|
| 433 |
-
list(APPEND GGML_SOURCES_ROCM "ggml-cuda.cu")
|
| 434 |
-
|
| 435 |
-
file(GLOB SRCS "ggml-cuda/template-instances/fattn-wmma*.cu")
|
| 436 |
-
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 437 |
-
file(GLOB SRCS "ggml-cuda/template-instances/mmq*.cu")
|
| 438 |
-
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 439 |
-
|
| 440 |
-
if (WHISPER_CUDA_FA_ALL_QUANTS)
|
| 441 |
-
file(GLOB SRCS "ggml-cuda/template-instances/fattn-vec*.cu")
|
| 442 |
-
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 443 |
-
add_compile_definitions(GGML_CUDA_FA_ALL_QUANTS)
|
| 444 |
-
else()
|
| 445 |
-
file(GLOB SRCS "ggml-cuda/template-instances/fattn-vec*q4_0-q4_0.cu")
|
| 446 |
-
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 447 |
-
file(GLOB SRCS "ggml-cuda/template-instances/fattn-vec*q8_0-q8_0.cu")
|
| 448 |
-
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 449 |
-
file(GLOB SRCS "ggml-cuda/template-instances/fattn-vec*f16-f16.cu")
|
| 450 |
-
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 451 |
-
endif()
|
| 452 |
-
|
| 453 |
-
add_compile_definitions(GGML_USE_HIPBLAS GGML_USE_CUDA)
|
| 454 |
-
|
| 455 |
-
set_source_files_properties(${GGML_SOURCES_ROCM} PROPERTIES LANGUAGE CXX)
|
| 456 |
-
if (WHISPER_STATIC)
|
| 457 |
-
message(FATAL_ERROR "Static linking not supported for HIP/ROCm")
|
| 458 |
-
endif()
|
| 459 |
-
set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} hip::device PUBLIC hip::host roc::rocblas roc::hipblas)
|
| 460 |
-
else()
|
| 461 |
-
message(FATAL_ERROR "hipBLAS or HIP not found. Try setting CMAKE_PREFIX_PATH=/opt/rocm")
|
| 462 |
-
endif()
|
| 463 |
-
endif()
|
| 464 |
-
|
| 465 |
-
if( WHISPER_OPENVINO )
|
| 466 |
-
find_package(OpenVINO REQUIRED COMPONENTS Runtime)
|
| 467 |
-
endif()
|
| 468 |
-
|
| 469 |
-
if (WHISPER_SYCL)
|
| 470 |
-
if ( NOT DEFINED ENV{ONEAPI_ROOT})
|
| 471 |
-
message(FATAL_ERROR "Not detect ENV {ONEAPI_ROOT}, please install oneAPI & source it, like: source /opt/intel/oneapi/setvars.sh")
|
| 472 |
-
endif()
|
| 473 |
-
#todo: AOT
|
| 474 |
-
|
| 475 |
-
find_package(IntelSYCL REQUIRED)
|
| 476 |
-
if (WHISPER_SYCL_F16)
|
| 477 |
-
add_compile_definitions(GGML_SYCL_F16)
|
| 478 |
-
endif()
|
| 479 |
-
add_compile_definitions(GGML_USE_SYCL)
|
| 480 |
-
|
| 481 |
-
add_compile_options(-I./) #include DPCT
|
| 482 |
-
add_compile_options(-I/${SYCL_INCLUDE_DIR})
|
| 483 |
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
|
| 488 |
-
set(GGML_HEADERS_SYCL ggml-sycl.h)
|
| 489 |
-
file(GLOB GGML_SOURCES_SYCL "ggml-sycl/*.cpp")
|
| 490 |
-
list(APPEND GGML_SOURCES_SYCL "ggml-sycl.cpp")
|
| 491 |
-
|
| 492 |
-
set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} sycl OpenCL mkl_core pthread m dl mkl_sycl_blas mkl_intel_ilp64 mkl_tbb_thread)
|
| 493 |
-
endif()
|
| 494 |
-
# compiler flags
|
| 495 |
-
|
| 496 |
-
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
| 497 |
-
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
|
| 498 |
-
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "RelWithDebInfo")
|
| 499 |
-
endif ()
|
| 500 |
-
|
| 501 |
-
if (WHISPER_ALL_WARNINGS)
|
| 502 |
-
if (NOT MSVC)
|
| 503 |
-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
|
| 504 |
-
-Wall \
|
| 505 |
-
-Wextra \
|
| 506 |
-
-Wpedantic \
|
| 507 |
-
-Wshadow \
|
| 508 |
-
-Wcast-qual \
|
| 509 |
-
-Wstrict-prototypes \
|
| 510 |
-
-Wpointer-arith \
|
| 511 |
-
-Wno-unused-function \
|
| 512 |
-
")
|
| 513 |
-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
|
| 514 |
-
-Wall \
|
| 515 |
-
-Wextra \
|
| 516 |
-
-Wpedantic \
|
| 517 |
-
-Wcast-qual \
|
| 518 |
-
")
|
| 519 |
-
else()
|
| 520 |
-
# todo : msvc
|
| 521 |
-
endif()
|
| 522 |
-
endif()
|
| 523 |
-
|
| 524 |
-
if (NOT MSVC)
|
| 525 |
-
# TODO: temporary disabled until we figure out ggml-metal.m
|
| 526 |
-
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=vla")
|
| 527 |
-
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-math-errno -ffinite-math-only -funsafe-math-optimizations")
|
| 528 |
-
endif()
|
| 529 |
-
|
| 530 |
-
message(STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
|
| 531 |
-
|
| 532 |
-
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
|
| 533 |
-
message(STATUS "ARM detected")
|
| 534 |
-
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64le")
|
| 535 |
-
message(STATUS "PowerPC detected")
|
| 536 |
-
else()
|
| 537 |
-
message(STATUS "x86 detected")
|
| 538 |
-
if (MSVC)
|
| 539 |
-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
|
| 540 |
-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /utf-8")
|
| 541 |
-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8")
|
| 542 |
-
if(NOT WHISPER_NO_AVX512)
|
| 543 |
-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX512")
|
| 544 |
-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /arch:AVX512")
|
| 545 |
-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:AVX512")
|
| 546 |
-
# MSVC has no compile-time flags enabling specific
|
| 547 |
-
# AVX512 extensions, neither it defines the
|
| 548 |
-
# macros corresponding to the extensions.
|
| 549 |
-
# Do it manually.
|
| 550 |
-
if (NOT WHISPER_NO_AVX512_VBMI)
|
| 551 |
-
add_compile_definitions($<$<COMPILE_LANGUAGE:C>:__AVX512VBMI__>)
|
| 552 |
-
add_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:__AVX512VBMI__>)
|
| 553 |
-
endif()
|
| 554 |
-
if (NOT WHISPER_NO_AVX512_VNNI)
|
| 555 |
-
add_compile_definitions($<$<COMPILE_LANGUAGE:C>:__AVX512VNNI__>)
|
| 556 |
-
add_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:__AVX512VNNI__>)
|
| 557 |
-
endif()
|
| 558 |
-
elseif(NOT WHISPER_NO_AVX2)
|
| 559 |
-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2")
|
| 560 |
-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /arch:AVX2")
|
| 561 |
-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:AVX2")
|
| 562 |
-
elseif(NOT WHISPER_NO_AVX)
|
| 563 |
-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX")
|
| 564 |
-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /arch:AVX")
|
| 565 |
-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:AVX")
|
| 566 |
-
endif()
|
| 567 |
-
else()
|
| 568 |
-
if (EMSCRIPTEN)
|
| 569 |
-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -s TOTAL_STACK=5242880")
|
| 570 |
-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -s TOTAL_STACK=5242880")
|
| 571 |
-
else()
|
| 572 |
-
if(NOT WHISPER_NO_AVX)
|
| 573 |
-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx")
|
| 574 |
-
endif()
|
| 575 |
-
if(NOT WHISPER_NO_AVX2)
|
| 576 |
-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2")
|
| 577 |
-
endif()
|
| 578 |
-
if(NOT WHISPER_NO_AVX512)
|
| 579 |
-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx512f -mavx512cd -mavx512vl -mavx512dq -mavx512bw")
|
| 580 |
-
if(NOT WHISPER_NO_AVX512_VBMI)
|
| 581 |
-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx512vbmi")
|
| 582 |
-
endif()
|
| 583 |
-
if(NOT WHISPER_NO_AVX512_VNNI)
|
| 584 |
-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx512vnni")
|
| 585 |
-
endif()
|
| 586 |
-
endif()
|
| 587 |
-
if(NOT WHISPER_NO_FMA)
|
| 588 |
-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfma")
|
| 589 |
-
endif()
|
| 590 |
-
if(NOT WHISPER_NO_F16C)
|
| 591 |
-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mf16c")
|
| 592 |
-
endif()
|
| 593 |
-
endif()
|
| 594 |
-
endif()
|
| 595 |
-
endif()
|
| 596 |
-
|
| 597 |
-
#
|
| 598 |
-
# POSIX conformance
|
| 599 |
-
#
|
| 600 |
-
|
| 601 |
-
# clock_gettime came in POSIX.1b (1993)
|
| 602 |
-
# CLOCK_MONOTONIC came in POSIX.1-2001 / SUSv3 as optional
|
| 603 |
-
# posix_memalign came in POSIX.1-2001 / SUSv3
|
| 604 |
-
# M_PI is an XSI extension since POSIX.1-2001 / SUSv3, came in XPG1 (1985)
|
| 605 |
-
add_compile_definitions(_XOPEN_SOURCE=600)
|
| 606 |
-
|
| 607 |
-
# Somehow in OpenBSD whenever POSIX conformance is specified
|
| 608 |
-
# some string functions rely on locale_t availability,
|
| 609 |
-
# which was introduced in POSIX.1-2008, forcing us to go higher
|
| 610 |
-
if (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
|
| 611 |
-
remove_definitions(-D_XOPEN_SOURCE=600)
|
| 612 |
-
add_compile_definitions(_XOPEN_SOURCE=700)
|
| 613 |
-
endif()
|
| 614 |
-
|
| 615 |
-
# Data types, macros and functions related to controlling CPU affinity
|
| 616 |
-
# are available on Linux through GNU extensions in libc
|
| 617 |
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
| 618 |
-
|
| 619 |
-
endif()
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
-
|
| 633 |
-
|
| 634 |
-
|
| 635 |
-
|
| 636 |
-
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
|
| 640 |
-
|
| 641 |
-
|
| 642 |
-
|
| 643 |
-
|
| 644 |
-
|
| 645 |
-
|
| 646 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 647 |
|
| 648 |
#
|
| 649 |
-
#
|
| 650 |
#
|
| 651 |
|
| 652 |
-
|
| 653 |
-
|
| 654 |
-
|
| 655 |
-
add_library(${TARGET}
|
| 656 |
-
coreml/whisper-encoder.h
|
| 657 |
-
coreml/whisper-encoder.mm
|
| 658 |
-
coreml/whisper-encoder-impl.h
|
| 659 |
-
coreml/whisper-encoder-impl.m
|
| 660 |
-
)
|
| 661 |
-
|
| 662 |
-
include(DefaultTargetOptions)
|
| 663 |
-
|
| 664 |
-
target_include_directories(${TARGET} PUBLIC
|
| 665 |
-
.
|
| 666 |
-
)
|
| 667 |
-
|
| 668 |
-
target_link_libraries(${TARGET} PRIVATE ${FOUNDATION_FRAMEWORK} ${COREML_FRAMEWORK})
|
| 669 |
-
|
| 670 |
-
set_target_properties(${TARGET} PROPERTIES
|
| 671 |
-
COMPILE_FLAGS "-fobjc-arc"
|
| 672 |
-
)
|
| 673 |
-
set_target_properties(${TARGET} PROPERTIES FOLDER "libs")
|
| 674 |
-
endif()
|
| 675 |
-
|
| 676 |
-
if (WHISPER_OPENVINO)
|
| 677 |
-
set(TARGET whisper.openvino)
|
| 678 |
-
|
| 679 |
-
add_library(${TARGET} OBJECT
|
| 680 |
-
openvino/whisper-openvino-encoder.h
|
| 681 |
-
openvino/whisper-openvino-encoder.cpp
|
| 682 |
-
)
|
| 683 |
-
|
| 684 |
-
target_include_directories(${TARGET} PUBLIC
|
| 685 |
-
.
|
| 686 |
-
)
|
| 687 |
-
|
| 688 |
-
set_property(TARGET ${TARGET} PROPERTY POSITION_INDEPENDENT_CODE ON)
|
| 689 |
-
set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DWHISPER_USE_OPENVINO)
|
| 690 |
-
|
| 691 |
-
target_link_libraries(${TARGET} PRIVATE openvino::runtime)
|
| 692 |
-
set_target_properties(${TARGET} PROPERTIES FOLDER "libs")
|
| 693 |
-
endif()
|
| 694 |
|
| 695 |
#
|
| 696 |
-
#
|
| 697 |
#
|
| 698 |
|
| 699 |
-
set(TARGET whisper)
|
| 700 |
-
|
| 701 |
-
add_library(${TARGET}
|
| 702 |
-
ggml.h
|
| 703 |
-
ggml.c
|
| 704 |
-
ggml-alloc.h
|
| 705 |
-
ggml-alloc.c
|
| 706 |
-
ggml-backend.h
|
| 707 |
-
ggml-backend.c
|
| 708 |
-
ggml-quants.h
|
| 709 |
-
ggml-quants.c
|
| 710 |
-
${GGML_SOURCES_METAL}
|
| 711 |
-
${GGML_SOURCES_CUDA}
|
| 712 |
-
${GGML_SOURCES_SYCL} ${GGML_HEADERS_SYCL}
|
| 713 |
-
${GGML_SOURCES_ROCM} ${GGML_HEADERS_ROCM}
|
| 714 |
-
${GGML_SOURCES_BLAS} ${GGML_HEADERS_BLAS}
|
| 715 |
-
whisper.h
|
| 716 |
-
whisper.cpp
|
| 717 |
-
)
|
| 718 |
-
|
| 719 |
-
if (WHISPER_CUDA)
|
| 720 |
-
target_sources(${TARGET} PRIVATE whisper-mel-cuda.cu)
|
| 721 |
-
endif()
|
| 722 |
-
|
| 723 |
-
include_directories (
|
| 724 |
-
.
|
| 725 |
-
)
|
| 726 |
-
# Set the version numbers
|
| 727 |
-
set_target_properties(whisper PROPERTIES
|
| 728 |
-
VERSION ${PROJECT_VERSION}
|
| 729 |
-
SOVERSION ${SOVERSION}
|
| 730 |
-
)
|
| 731 |
-
|
| 732 |
-
include(DefaultTargetOptions)
|
| 733 |
-
|
| 734 |
-
target_include_directories(${TARGET} PUBLIC
|
| 735 |
-
.
|
| 736 |
-
)
|
| 737 |
-
|
| 738 |
-
if (WHISPER_COREML)
|
| 739 |
-
target_link_libraries(${TARGET} PRIVATE whisper.coreml)
|
| 740 |
-
endif()
|
| 741 |
-
|
| 742 |
-
if (WHISPER_OPENVINO)
|
| 743 |
-
target_link_libraries(${TARGET} PRIVATE whisper.openvino)
|
| 744 |
-
endif()
|
| 745 |
-
|
| 746 |
-
if (WHISPER_MKL)
|
| 747 |
-
target_link_libraries(${TARGET} PUBLIC MKL::MKL)
|
| 748 |
-
endif()
|
| 749 |
-
|
| 750 |
-
if (MSVC)
|
| 751 |
-
target_link_libraries(${TARGET} PRIVATE ${WHISPER_EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT})
|
| 752 |
-
|
| 753 |
-
set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -D_CRT_SECURE_NO_WARNINGS)
|
| 754 |
-
else()
|
| 755 |
-
target_link_libraries(${TARGET} PRIVATE m ${WHISPER_EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT})
|
| 756 |
-
endif()
|
| 757 |
-
|
| 758 |
-
if (BUILD_SHARED_LIBS)
|
| 759 |
-
set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
| 760 |
-
target_link_libraries(${TARGET} PUBLIC
|
| 761 |
-
${CMAKE_DL_LIBS}
|
| 762 |
-
)
|
| 763 |
-
|
| 764 |
-
target_compile_definitions(${TARGET} PUBLIC
|
| 765 |
-
WHISPER_SHARED
|
| 766 |
-
GGML_SHARED
|
| 767 |
-
)
|
| 768 |
-
|
| 769 |
-
target_compile_definitions(${TARGET} PRIVATE
|
| 770 |
-
WHISPER_BUILD
|
| 771 |
-
GGML_BUILD
|
| 772 |
-
)
|
| 773 |
-
|
| 774 |
-
if (WHISPER_METAL)
|
| 775 |
-
# TODO: I think this should make ggml-metal.m "see" the ggml-metal.metal file from the "bin" directory
|
| 776 |
-
# but for some reason it does not work here like it does in llama.cpp
|
| 777 |
-
set_target_properties(${TARGET} PROPERTIES RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/ggml-metal.metal")
|
| 778 |
-
endif()
|
| 779 |
-
endif()
|
| 780 |
-
|
| 781 |
-
if (GGML_SOURCES_CUDA)
|
| 782 |
-
message(STATUS "GGML CUDA sources found, configuring CUDA architecture")
|
| 783 |
-
# Only configure gmml CUDA architectures is not globally set
|
| 784 |
-
if (NOT DEFINED GGML_CUDA_ARCHITECTURES)
|
| 785 |
-
# Not overriden by user, so set defaults
|
| 786 |
-
set(GGML_CUDA_ARCHITECTURES 52 61 70)
|
| 787 |
-
endif()
|
| 788 |
-
message(STATUS "GGML Configuring CUDA architectures ${GGML_CUDA_ARCHITECTURES}")
|
| 789 |
-
set_property(TARGET whisper PROPERTY CUDA_ARCHITECTURES ${GGML_CUDA_ARCHITECTURES})
|
| 790 |
-
set_property(TARGET whisper PROPERTY CUDA_SELECT_NVCC_ARCH_FLAGS "Auto")
|
| 791 |
-
endif()
|
| 792 |
-
|
| 793 |
-
if (EMSCRIPTEN)
|
| 794 |
-
set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS "-msimd128")
|
| 795 |
-
endif()
|
| 796 |
-
|
| 797 |
-
target_compile_definitions(${TARGET} PUBLIC
|
| 798 |
-
${WHISPER_EXTRA_FLAGS}
|
| 799 |
-
)
|
| 800 |
-
|
| 801 |
-
set_target_properties(${TARGET} PROPERTIES PUBLIC_HEADER "ggml.h;whisper.h")
|
| 802 |
-
set_target_properties(${TARGET} PROPERTIES FOLDER "libs")
|
| 803 |
-
|
| 804 |
include(GNUInstallDirs)
|
| 805 |
-
|
| 806 |
-
|
| 807 |
-
|
| 808 |
-
|
| 809 |
-
|
| 810 |
-
|
| 811 |
-
|
| 812 |
-
|
| 813 |
-
|
| 814 |
-
|
| 815 |
-
|
| 816 |
-
|
| 817 |
-
|
| 818 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 819 |
|
| 820 |
#
|
| 821 |
# programs, examples and tests
|
| 822 |
#
|
| 823 |
|
| 824 |
if (WHISPER_BUILD_TESTS AND NOT CMAKE_JS_VERSION)
|
| 825 |
-
|
| 826 |
-
add_subdirectory(tests)
|
| 827 |
endif ()
|
| 828 |
|
| 829 |
if (WHISPER_BUILD_EXAMPLES)
|
|
|
|
| 1 |
+
cmake_minimum_required(VERSION 3.5) # for add_link_options and implicit target directories.
|
| 2 |
+
project("whisper.cpp" C CXX)
|
| 3 |
+
project("whisper.cpp" VERSION 1.6.2)
|
| 4 |
+
include(CheckIncludeFileCXX)
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
set(SOVERSION 1)
|
| 7 |
|
| 8 |
+
#set(CMAKE_WARN_DEPRECATED YES)
|
| 9 |
+
set(CMAKE_WARN_UNUSED_CLI YES)
|
| 10 |
+
|
| 11 |
+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
| 12 |
+
|
| 13 |
+
if (NOT XCODE AND NOT MSVC AND NOT CMAKE_BUILD_TYPE)
|
| 14 |
+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
|
| 15 |
+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
| 16 |
+
endif()
|
| 17 |
+
|
| 18 |
# Add path to modules
|
| 19 |
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
| 20 |
|
| 21 |
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
| 22 |
|
| 23 |
+
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
| 24 |
set(WHISPER_STANDALONE ON)
|
| 25 |
+
|
| 26 |
+
include(git-vars)
|
| 27 |
|
| 28 |
# configure project version
|
|
|
|
|
|
|
|
|
|
| 29 |
configure_file(${CMAKE_SOURCE_DIR}/bindings/javascript/package-tmpl.json ${CMAKE_SOURCE_DIR}/bindings/javascript/package.json @ONLY)
|
| 30 |
else()
|
| 31 |
set(WHISPER_STANDALONE OFF)
|
|
|
|
| 35 |
set(BUILD_SHARED_LIBS_DEFAULT OFF)
|
| 36 |
|
| 37 |
option(WHISPER_WASM_SINGLE_FILE "whisper: embed WASM inside the generated whisper.js" ON)
|
| 38 |
+
|
| 39 |
+
# TODO: without these, we get the following error:
|
| 40 |
+
# wasm-ld: error: --shared-memory is disallowed by whisper.cpp.o because it was not compiled with 'atomics' or 'bulk-memory' features.
|
| 41 |
+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -s TOTAL_STACK=5242880")
|
| 42 |
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -s TOTAL_STACK=5242880")
|
| 43 |
else()
|
| 44 |
if (MINGW)
|
| 45 |
set(BUILD_SHARED_LIBS_DEFAULT OFF)
|
|
|
|
| 48 |
endif()
|
| 49 |
endif()
|
| 50 |
|
| 51 |
+
option(BUILD_SHARED_LIBS "build shared libraries" ${BUILD_SHARED_LIBS_DEFAULT})
|
| 52 |
|
| 53 |
+
#
|
| 54 |
+
# option list
|
| 55 |
+
#
|
|
|
|
|
|
|
| 56 |
|
| 57 |
+
# general
|
| 58 |
+
option(WHISPER_CCACHE "whisper: use ccache if available" ON)
|
| 59 |
|
| 60 |
+
# debug
|
| 61 |
option(WHISPER_ALL_WARNINGS "whisper: enable all compiler warnings" ON)
|
| 62 |
option(WHISPER_ALL_WARNINGS_3RD_PARTY "whisper: enable all compiler warnings in 3rd party libs" OFF)
|
| 63 |
|
| 64 |
+
# build
|
| 65 |
+
option(WHISPER_FATAL_WARNINGS "whisper: enable -Werror flag" OFF)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
# sanitizers
|
| 68 |
+
option(WHISPER_SANITIZE_THREAD "whisper: enable thread sanitizer" OFF)
|
| 69 |
+
option(WHISPER_SANITIZE_ADDRESS "whisper: enable address sanitizer" OFF)
|
| 70 |
+
option(WHISPER_SANITIZE_UNDEFINED "whisper: enable undefined sanitizer" OFF)
|
| 71 |
|
| 72 |
+
# extra artifacts
|
| 73 |
+
option(WHISPER_BUILD_TESTS "whisper: build tests" ${WHISPER_STANDALONE})
|
| 74 |
+
option(WHISPER_BUILD_EXAMPLES "whisper: build examples" ${WHISPER_STANDALONE})
|
| 75 |
+
option(WHISPER_BUILD_SERVER "whisper: build server example" ${WHISPER_STANDALONE})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
+
# 3rd party libs
|
| 78 |
+
option(WHISPER_CURL "whisper: use libcurl to download model from an URL" OFF)
|
| 79 |
+
option(WHISPER_SDL2 "whisper: support for libSDL2" OFF)
|
| 80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
| 82 |
+
option(WHISPER_FFMPEG "whisper: support building and linking with ffmpeg libs (avcodec, swresample, ...)" OFF)
|
| 83 |
+
endif()
|
| 84 |
+
|
| 85 |
+
option(WHISPER_COREML "whisper: enable Core ML framework" OFF)
|
| 86 |
+
option(WHISPER_COREML_ALLOW_FALLBACK "whisper: allow non-CoreML fallback" OFF)
|
| 87 |
+
option(WHISPER_OPENVINO "whisper: support for OpenVINO" OFF)
|
| 88 |
+
|
| 89 |
+
# Required for relocatable CMake package
|
| 90 |
+
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/build-info.cmake)
|
| 91 |
+
|
| 92 |
+
# override ggml options
|
| 93 |
+
set(GGML_CCACHE ${WHISPER_CCACHE})
|
| 94 |
+
set(GGML_SANITIZE_THREAD ${WHISPER_SANITIZE_THREAD})
|
| 95 |
+
set(GGML_SANITIZE_ADDRESS ${WHISPER_SANITIZE_ADDRESS})
|
| 96 |
+
set(GGML_SANITIZE_UNDEFINED ${WHISPER_SANITIZE_UNDEFINED})
|
| 97 |
+
set(GGML_ALL_WARNINGS ${WHISPER_ALL_WARNINGS})
|
| 98 |
+
set(GGML_FATAL_WARNINGS ${WHISPER_FATAL_WARNINGS})
|
| 99 |
+
|
| 100 |
+
# transition helpers
|
| 101 |
+
function (whisper_option_depr TYPE OLD NEW)
|
| 102 |
+
if (${OLD})
|
| 103 |
+
message(${TYPE} "${OLD} is deprecated and will be removed in the future.\nUse ${NEW} instead\n")
|
| 104 |
+
set(${NEW} ON)
|
| 105 |
+
endif()
|
| 106 |
+
endfunction()
|
| 107 |
+
|
| 108 |
+
whisper_option_depr(FATAL_ERROR WHISPER_CUBLAS GGML_CUDA)
|
| 109 |
+
whisper_option_depr(WARNING WHISPER_CUDA GGML_CUDA)
|
| 110 |
+
whisper_option_depr(WARNING WHISPER_KOMPUTE GGML_KOMPUTE)
|
| 111 |
+
whisper_option_depr(WARNING WHISPER_METAL GGML_METAL)
|
| 112 |
+
whisper_option_depr(WARNING WHISPER_METAL_EMBED_LIBRARY GGML_METAL_EMBED_LIBRARY)
|
| 113 |
+
whisper_option_depr(WARNING WHISPER_NATIVE GGML_NATIVE)
|
| 114 |
+
whisper_option_depr(WARNING WHISPER_OPENMP GGML_OPENMP)
|
| 115 |
+
whisper_option_depr(WARNING WHISPER_RPC GGML_RPC)
|
| 116 |
+
whisper_option_depr(WARNING WHISPER_SYCL GGML_SYCL)
|
| 117 |
+
whisper_option_depr(WARNING WHISPER_SYCL_F16 GGML_SYCL_F16)
|
| 118 |
|
| 119 |
#
|
| 120 |
+
# build the library
|
| 121 |
#
|
| 122 |
|
| 123 |
+
add_subdirectory(ggml)
|
| 124 |
+
add_subdirectory(src)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
#
|
| 127 |
+
# install
|
| 128 |
#
|
| 129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
include(GNUInstallDirs)
|
| 131 |
+
include(CMakePackageConfigHelpers)
|
| 132 |
+
|
| 133 |
+
set(WHISPER_BUILD_NUMBER ${BUILD_NUMBER})
|
| 134 |
+
set(WHISPER_BUILD_COMMIT ${BUILD_COMMIT})
|
| 135 |
+
set(WHISPER_INSTALL_VERSION ${CMAKE_PROJECT_VERSION})
|
| 136 |
+
|
| 137 |
+
set(WHISPER_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Location of header files")
|
| 138 |
+
set(WHISPER_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Location of library files")
|
| 139 |
+
set(WHISPER_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Location of binary files")
|
| 140 |
+
|
| 141 |
+
get_directory_property(WHISPER_TRANSIENT_DEFINES COMPILE_DEFINITIONS)
|
| 142 |
+
|
| 143 |
+
set_target_properties(whisper PROPERTIES PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/include/whisper.h)
|
| 144 |
+
install(TARGETS whisper LIBRARY PUBLIC_HEADER)
|
| 145 |
+
|
| 146 |
+
configure_package_config_file(
|
| 147 |
+
${CMAKE_CURRENT_SOURCE_DIR}/cmake/whisper-config.cmake.in
|
| 148 |
+
${CMAKE_CURRENT_BINARY_DIR}/whisper-config.cmake
|
| 149 |
+
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/whisper
|
| 150 |
+
PATH_VARS
|
| 151 |
+
WHISPER_INCLUDE_INSTALL_DIR
|
| 152 |
+
WHISPER_LIB_INSTALL_DIR
|
| 153 |
+
WHISPER_BIN_INSTALL_DIR )
|
| 154 |
+
|
| 155 |
+
write_basic_package_version_file(
|
| 156 |
+
${CMAKE_CURRENT_BINARY_DIR}/whisper-version.cmake
|
| 157 |
+
VERSION ${WHISPER_INSTALL_VERSION}
|
| 158 |
+
COMPATIBILITY SameMajorVersion)
|
| 159 |
+
|
| 160 |
+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/whisper-config.cmake
|
| 161 |
+
${CMAKE_CURRENT_BINARY_DIR}/whisper-version.cmake
|
| 162 |
+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/whisper)
|
| 163 |
+
|
| 164 |
+
install(
|
| 165 |
+
FILES convert-hf-to-gguf.py
|
| 166 |
+
PERMISSIONS
|
| 167 |
+
OWNER_READ
|
| 168 |
+
OWNER_WRITE
|
| 169 |
+
OWNER_EXECUTE
|
| 170 |
+
GROUP_READ
|
| 171 |
+
GROUP_EXECUTE
|
| 172 |
+
WORLD_READ
|
| 173 |
+
WORLD_EXECUTE
|
| 174 |
+
DESTINATION ${CMAKE_INSTALL_BINDIR})
|
| 175 |
+
|
| 176 |
+
configure_file(cmake/whisper.pc.in
|
| 177 |
+
"${CMAKE_CURRENT_BINARY_DIR}/whisper.pc"
|
| 178 |
+
@ONLY)
|
| 179 |
+
|
| 180 |
+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/whisper.pc"
|
| 181 |
+
DESTINATION lib/pkgconfig)
|
| 182 |
|
| 183 |
#
|
| 184 |
# programs, examples and tests
|
| 185 |
#
|
| 186 |
|
| 187 |
if (WHISPER_BUILD_TESTS AND NOT CMAKE_JS_VERSION)
|
| 188 |
+
#include(CTest)
|
| 189 |
+
#add_subdirectory(tests)
|
| 190 |
endif ()
|
| 191 |
|
| 192 |
if (WHISPER_BUILD_EXAMPLES)
|
Makefile
CHANGED
|
@@ -1,4 +1,89 @@
|
|
| 1 |
-
default
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
ifndef UNAME_S
|
| 4 |
UNAME_S := $(shell uname -s)
|
|
@@ -12,12 +97,6 @@ ifndef UNAME_M
|
|
| 12 |
UNAME_M := $(shell uname -m)
|
| 13 |
endif
|
| 14 |
|
| 15 |
-
ifndef NVCC_VERSION
|
| 16 |
-
ifeq ($(call,$(shell which nvcc))$(.SHELLSTATUS),0)
|
| 17 |
-
NVCC_VERSION := $(shell nvcc --version | egrep -o "V[0-9]+.[0-9]+.[0-9]+" | cut -c2-)
|
| 18 |
-
endif
|
| 19 |
-
endif
|
| 20 |
-
|
| 21 |
# In GNU make default CXX is g++ instead of c++. Let's fix that so that users
|
| 22 |
# of non-gcc compilers don't have to provide g++ alias or wrapper.
|
| 23 |
DEFCC := cc
|
|
@@ -29,16 +108,17 @@ ifeq ($(origin CXX),default)
|
|
| 29 |
CXX := $(DEFCXX)
|
| 30 |
endif
|
| 31 |
|
| 32 |
-
CCV := $(shell $(CC) --version | head -n 1)
|
| 33 |
-
CXXV := $(shell $(CXX) --version | head -n 1)
|
| 34 |
-
|
| 35 |
# Mac OS + Arm can report x86_64
|
| 36 |
# ref: https://github.com/ggerganov/whisper.cpp/issues/66#issuecomment-1282546789
|
| 37 |
ifeq ($(UNAME_S),Darwin)
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
ifneq ($(UNAME_P),arm)
|
| 41 |
-
SYSCTL_M := $(shell sysctl -n hw.optional.arm64)
|
| 42 |
ifeq ($(SYSCTL_M),1)
|
| 43 |
# UNAME_P := arm
|
| 44 |
# UNAME_M := arm64
|
|
@@ -47,75 +127,201 @@ ifeq ($(UNAME_S),Darwin)
|
|
| 47 |
endif
|
| 48 |
endif
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
#
|
| 51 |
# Compile flags
|
| 52 |
#
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
# clock_gettime came in POSIX.1b (1993)
|
| 65 |
# CLOCK_MONOTONIC came in POSIX.1-2001 / SUSv3 as optional
|
| 66 |
# posix_memalign came in POSIX.1-2001 / SUSv3
|
| 67 |
# M_PI is an XSI extension since POSIX.1-2001 / SUSv3, came in XPG1 (1985)
|
| 68 |
-
|
| 69 |
-
CXXFLAGS += -D_XOPEN_SOURCE=600
|
| 70 |
|
| 71 |
# Somehow in OpenBSD whenever POSIX conformance is specified
|
| 72 |
# some string functions rely on locale_t availability,
|
| 73 |
# which was introduced in POSIX.1-2008, forcing us to go higher
|
| 74 |
ifeq ($(UNAME_S),OpenBSD)
|
| 75 |
-
|
| 76 |
-
CXXFLAGS += -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700
|
| 77 |
endif
|
| 78 |
|
| 79 |
-
# Data types, macros and functions related to controlling CPU affinity
|
| 80 |
-
# are available on Linux through GNU extensions in libc
|
| 81 |
ifeq ($(UNAME_S),Linux)
|
| 82 |
-
|
| 83 |
-
CXXFLAGS += -D_GNU_SOURCE
|
| 84 |
endif
|
| 85 |
|
| 86 |
# RLIMIT_MEMLOCK came in BSD, is not specified in POSIX.1,
|
| 87 |
# and on macOS its availability depends on enabling Darwin extensions
|
| 88 |
# similarly on DragonFly, enabling BSD extensions is necessary
|
| 89 |
ifeq ($(UNAME_S),Darwin)
|
| 90 |
-
|
| 91 |
-
CXXFLAGS += -D_DARWIN_C_SOURCE
|
| 92 |
endif
|
| 93 |
ifeq ($(UNAME_S),DragonFly)
|
| 94 |
-
|
| 95 |
-
CXXFLAGS += -D__BSD_VISIBLE
|
| 96 |
endif
|
| 97 |
|
| 98 |
# alloca is a non-standard interface that is not visible on BSDs when
|
| 99 |
# POSIX conformance is specified, but not all of them provide a clean way
|
| 100 |
# to enable it in such cases
|
| 101 |
ifeq ($(UNAME_S),FreeBSD)
|
| 102 |
-
|
| 103 |
-
CXXFLAGS += -D__BSD_VISIBLE
|
| 104 |
endif
|
| 105 |
ifeq ($(UNAME_S),NetBSD)
|
| 106 |
-
|
| 107 |
-
CXXFLAGS += -D_NETBSD_SOURCE
|
| 108 |
endif
|
| 109 |
ifeq ($(UNAME_S),OpenBSD)
|
| 110 |
-
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
endif
|
| 113 |
|
| 114 |
# OS specific
|
| 115 |
# TODO: support Windows
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
endif
|
| 120 |
|
| 121 |
# detect Windows
|
|
@@ -123,253 +329,508 @@ ifneq ($(findstring _NT,$(UNAME_S)),)
|
|
| 123 |
_WIN32 := 1
|
| 124 |
endif
|
| 125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
# Windows Sockets 2 (Winsock) for network-capable apps
|
| 127 |
ifeq ($(_WIN32),1)
|
| 128 |
LWINSOCK2 := -lws2_32
|
| 129 |
endif
|
| 130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
# Architecture specific
|
| 132 |
# TODO: probably these flags need to be tweaked on some architectures
|
| 133 |
# feel free to update the Makefile for your architecture and send a pull request or issue
|
| 134 |
-
ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686 amd64))
|
| 135 |
-
ifeq ($(UNAME_S),Darwin)
|
| 136 |
-
CPUINFO_CMD := sysctl machdep.cpu.features machdep.cpu.leaf7_features
|
| 137 |
-
else ifeq ($(UNAME_S),Linux)
|
| 138 |
-
CPUINFO_CMD := cat /proc/cpuinfo
|
| 139 |
-
else ifneq (,$(filter MINGW32_NT% MINGW64_NT% MSYS_NT%,$(UNAME_S)))
|
| 140 |
-
CPUINFO_CMD := cat /proc/cpuinfo
|
| 141 |
-
else ifneq (,$(filter DragonFly FreeBSD,$(UNAME_S)))
|
| 142 |
-
CPUINFO_CMD := grep Features /var/run/dmesg.boot
|
| 143 |
-
else ifeq ($(UNAME_S),Haiku)
|
| 144 |
-
CPUINFO_CMD := sysinfo -cpu
|
| 145 |
-
endif
|
| 146 |
|
| 147 |
-
|
| 148 |
-
ifdef CPUINFO_CMD
|
| 149 |
-
SSE3_M := $(shell $(CPUINFO_CMD) | grep -iwE 'PNI|SSE3')
|
| 150 |
-
SSSE3_M := $(shell $(CPUINFO_CMD) | grep -iw 'SSSE3')
|
| 151 |
-
AVX_M := $(shell $(CPUINFO_CMD) | grep -iwE 'AVX|AVX1.0')
|
| 152 |
-
F16C_M := $(shell $(CPUINFO_CMD) | grep -iw 'F16C')
|
| 153 |
-
FMA_M := $(shell $(CPUINFO_CMD) | grep -iw 'FMA')
|
| 154 |
-
AVX2_M := $(shell $(CPUINFO_CMD) | grep -iw 'AVX2')
|
| 155 |
-
AVX512F_M := $(shell $(CPUINFO_CMD) | grep -iw 'AVX512F')
|
| 156 |
-
AVX512VBMI_M := $(shell $(CPUINFO_CMD) | grep -iw 'AVX512VBMI')
|
| 157 |
-
AVX512VNNI_M := $(shell $(CPUINFO_CMD) | grep -iwE 'AVX512_VNNI|AVX512VNNI')
|
| 158 |
-
|
| 159 |
-
# AVX-512 has many subsets, so let's make it easy to disable them all
|
| 160 |
-
ifneq ($(filter-out 0,$(WHISPER_NO_AVX512)),)
|
| 161 |
-
AVX512F_M :=
|
| 162 |
-
AVX512VBMI_M :=
|
| 163 |
-
AVX512VNNI_M :=
|
| 164 |
-
endif
|
| 165 |
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
endif
|
| 175 |
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
|
|
|
|
|
|
| 185 |
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
endif
|
| 190 |
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
endif
|
|
|
|
|
|
|
| 195 |
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
|
|
|
| 200 |
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
|
|
|
| 205 |
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
endif
|
| 211 |
endif
|
| 212 |
|
| 213 |
ifneq ($(filter ppc64%,$(UNAME_M)),)
|
| 214 |
POWER9_M := $(shell grep "POWER9" /proc/cpuinfo)
|
| 215 |
ifneq (,$(findstring POWER9,$(POWER9_M)))
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
# Require c++23's std::byteswap for big-endian support.
|
| 219 |
-
ifeq ($(UNAME_M),ppc64)
|
| 220 |
-
CXXFLAGS += -std=c++23 -DGGML_BIG_ENDIAN
|
| 221 |
endif
|
| 222 |
endif
|
| 223 |
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
CFLAGS += -DACCELERATE_NEW_LAPACK
|
| 229 |
-
CFLAGS += -DACCELERATE_LAPACK_ILP64
|
| 230 |
-
CXXFLAGS += -DGGML_USE_ACCELERATE -DGGML_USE_BLAS
|
| 231 |
-
CXXFLAGS += -DACCELERATE_NEW_LAPACK
|
| 232 |
-
CXXFLAGS += -DACCELERATE_LAPACK_ILP64
|
| 233 |
-
LDFLAGS += -framework Accelerate
|
| 234 |
-
WHISPER_OBJ += ggml-blas.o
|
| 235 |
-
endif
|
| 236 |
endif
|
| 237 |
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
ifdef WHISPER_COREML_ALLOW_FALLBACK
|
| 243 |
-
CXXFLAGS += -DWHISPER_COREML_ALLOW_FALLBACK
|
| 244 |
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
endif
|
| 246 |
|
| 247 |
-
ifndef
|
|
|
|
|
|
|
| 248 |
ifeq ($(UNAME_S),Darwin)
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
endif
|
| 255 |
-
endif
|
| 256 |
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
CXXFLAGS += -fopenmp
|
| 261 |
-
endif # WHISPER_NO_OPENMP
|
| 262 |
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
LDFLAGS += $(shell pkg-config --libs openblas)
|
| 267 |
-
WHISPER_OBJ += ggml-blas.o
|
| 268 |
-
endif # WHISPER_OPENBLAS
|
| 269 |
|
| 270 |
-
|
| 271 |
-
CXXFLAGS += -DGGML_USE_BLAS $(shell pkg-config --cflags-only-I openblas64)
|
| 272 |
-
CFLAGS += $(shell pkg-config --cflags-only-other openblas64)
|
| 273 |
-
LDFLAGS += $(shell pkg-config --libs openblas64)
|
| 274 |
-
WHISPER_OBJ += ggml-blas.o
|
| 275 |
-
endif # WHISPER_OPENBLAS64
|
| 276 |
|
| 277 |
-
ifdef
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
WHISPER_OBJ += ggml-blas.o
|
| 281 |
-
endif # WHISPER_BLIS
|
| 282 |
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 286 |
endif
|
| 287 |
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
ifdef WHISPER_CUDA_FA_ALL_QUANTS
|
| 291 |
-
OBJS_CUDA_TEMP_INST += $(patsubst %.cu,%.o,$(wildcard ggml-cuda/template-instances/fattn-vec*.cu))
|
| 292 |
else
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
OBJS_CUDA_TEMP_INST += $(patsubst %.cu,%.o,$(wildcard ggml-cuda/template-instances/fattn-vec*f16-f16.cu))
|
| 296 |
-
endif # WHISPER_CUDA_FA_ALL_QUANTS
|
| 297 |
|
| 298 |
-
ifdef
|
| 299 |
-
|
| 300 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 301 |
else
|
| 302 |
-
|
|
|
|
| 303 |
endif
|
| 304 |
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 338 |
$(HIPCC) $(CXXFLAGS) $(HIPFLAGS) -x hip -c -o $@ $<
|
| 339 |
|
| 340 |
-
ggml-cuda
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
$(HIPCC) $(CXXFLAGS) $(HIPFLAGS) -x hip -c -o $@ $<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
endif
|
| 343 |
|
| 344 |
-
ifdef
|
| 345 |
-
|
| 346 |
-
|
| 347 |
endif
|
|
|
|
| 348 |
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 352 |
endif
|
| 353 |
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 357 |
endif
|
|
|
|
| 358 |
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
|
|
|
|
|
|
| 363 |
|
| 364 |
-
|
| 365 |
-
CFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -funsafe-math-optimizations -mno-unaligned-access
|
| 366 |
-
CXXFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -funsafe-math-optimizations -mno-unaligned-access
|
| 367 |
endif
|
| 368 |
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 373 |
endif
|
| 374 |
|
| 375 |
#
|
|
@@ -377,133 +838,260 @@ endif
|
|
| 377 |
#
|
| 378 |
|
| 379 |
$(info I whisper.cpp build info: )
|
| 380 |
-
$(info I UNAME_S:
|
| 381 |
-
$(info I UNAME_P:
|
| 382 |
-
$(info I UNAME_M:
|
| 383 |
-
$(info I CFLAGS:
|
| 384 |
-
$(info I CXXFLAGS:
|
| 385 |
-
$(info I
|
| 386 |
-
$(info I
|
| 387 |
-
$(info I
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
$(info )
|
| 389 |
|
| 390 |
-
ifdef
|
| 391 |
-
$(info
|
| 392 |
-
$(info
|
| 393 |
-
$(info
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 394 |
$(info )
|
| 395 |
endif
|
| 396 |
|
| 397 |
#
|
| 398 |
-
# Build
|
| 399 |
#
|
| 400 |
|
| 401 |
-
|
| 402 |
-
$(CC) $(CFLAGS) -c $< -o $@
|
| 403 |
|
| 404 |
-
ggml
|
|
|
|
|
|
|
| 405 |
$(CC) $(CFLAGS) -c $< -o $@
|
| 406 |
|
| 407 |
-
ggml-
|
|
|
|
|
|
|
|
|
|
| 408 |
$(CC) $(CFLAGS) -c $< -o $@
|
| 409 |
|
| 410 |
-
ggml-
|
|
|
|
|
|
|
|
|
|
| 411 |
$(CC) $(CFLAGS) -c $< -o $@
|
| 412 |
|
| 413 |
-
ggml-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 414 |
$(CXX) $(CXXFLAGS) -c $< -o $@
|
| 415 |
|
| 416 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 417 |
|
| 418 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 419 |
$(CXX) $(CXXFLAGS) -c $< -o $@
|
| 420 |
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
$(CXX) -O3 -I . -fobjc-arc -c coreml/whisper-encoder.mm -o whisper-encoder.o
|
| 426 |
|
| 427 |
-
|
| 428 |
-
$(
|
|
|
|
| 429 |
|
| 430 |
-
|
| 431 |
-
endif
|
| 432 |
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 436 |
|
| 437 |
-
|
|
|
|
|
|
|
| 438 |
|
| 439 |
-
|
| 440 |
-
|
|
|
|
| 441 |
|
| 442 |
-
|
| 443 |
-
@echo "Embedding Metal library"
|
| 444 |
-
$(eval TEMP_ASSEMBLY=$(shell mktemp))
|
| 445 |
-
$(eval TEMP_METALLIB=$(shell mktemp))
|
| 446 |
-
@sed "/^#include \"ggml-common.h\"/{r ggml-common.h"$$'\n'"d;}" ggml-metal.metal > $(TEMP_METALLIB)
|
| 447 |
-
@echo ".section __DATA, __ggml_metallib" > $(TEMP_ASSEMBLY)
|
| 448 |
-
@echo ".globl _ggml_metallib_start" >> $(TEMP_ASSEMBLY)
|
| 449 |
-
@echo "_ggml_metallib_start:" >> $(TEMP_ASSEMBLY)
|
| 450 |
-
@echo ".incbin \"$(TEMP_METALLIB)\"" >> $(TEMP_ASSEMBLY)
|
| 451 |
-
@echo ".globl _ggml_metallib_end" >> $(TEMP_ASSEMBLY)
|
| 452 |
-
@echo "_ggml_metallib_end:" >> $(TEMP_ASSEMBLY)
|
| 453 |
-
@$(AS) $(TEMP_ASSEMBLY) -o $@
|
| 454 |
-
@rm -f $(TEMP_ASSEMBLY) $(TEMP_METALLIB)
|
| 455 |
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 459 |
|
| 460 |
-
|
| 461 |
-
$(
|
|
|
|
| 462 |
|
| 463 |
-
|
| 464 |
-
$(
|
|
|
|
| 465 |
|
| 466 |
clean:
|
| 467 |
-
rm -
|
| 468 |
-
rm -
|
| 469 |
-
rm -
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 470 |
|
| 471 |
#
|
| 472 |
# Examples
|
| 473 |
#
|
| 474 |
|
| 475 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 476 |
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
main: examples/main/main.cpp $(SRC_COMMON) $(WHISPER_OBJ)
|
| 481 |
-
$(CXX) $(CXXFLAGS) examples/main/main.cpp $(SRC_COMMON) $(WHISPER_OBJ) -o main $(LDFLAGS)
|
| 482 |
-
./main -h
|
| 483 |
-
|
| 484 |
-
bench: examples/bench/bench.cpp $(WHISPER_OBJ)
|
| 485 |
-
$(CXX) $(CXXFLAGS) examples/bench/bench.cpp $(WHISPER_OBJ) -o bench $(LDFLAGS)
|
| 486 |
-
|
| 487 |
-
quantize: examples/quantize/quantize.cpp $(WHISPER_OBJ) $(SRC_COMMON)
|
| 488 |
-
$(CXX) $(CXXFLAGS) examples/quantize/quantize.cpp $(SRC_COMMON) $(WHISPER_OBJ) -o quantize $(LDFLAGS)
|
| 489 |
-
|
| 490 |
-
server: examples/server/server.cpp $(SRC_COMMON) $(WHISPER_OBJ)
|
| 491 |
-
$(CXX) $(CXXFLAGS) examples/server/server.cpp $(SRC_COMMON) $(WHISPER_OBJ) -o server $(LDFLAGS) $(LWINSOCK2)
|
| 492 |
-
|
| 493 |
-
stream: examples/stream/stream.cpp $(SRC_COMMON) $(SRC_COMMON_SDL) $(WHISPER_OBJ)
|
| 494 |
-
$(CXX) $(CXXFLAGS) examples/stream/stream.cpp $(SRC_COMMON) $(SRC_COMMON_SDL) $(WHISPER_OBJ) -o stream $(CC_SDL) $(LDFLAGS)
|
| 495 |
-
|
| 496 |
-
command: examples/command/command.cpp $(SRC_COMMON) $(SRC_COMMON_SDL) $(WHISPER_OBJ)
|
| 497 |
-
$(CXX) $(CXXFLAGS) examples/command/command.cpp $(SRC_COMMON) $(SRC_COMMON_SDL) $(WHISPER_OBJ) -o command $(CC_SDL) $(LDFLAGS)
|
| 498 |
|
| 499 |
-
|
| 500 |
-
$(CXX) $(CXXFLAGS) examples/lsp/lsp.cpp $(SRC_COMMON) $(SRC_COMMON_SDL) $(WHISPER_OBJ) -o lsp $(CC_SDL) $(LDFLAGS)
|
| 501 |
|
| 502 |
-
|
| 503 |
-
$(
|
| 504 |
|
| 505 |
-
|
| 506 |
-
$(
|
|
|
|
|
|
|
| 507 |
|
| 508 |
#
|
| 509 |
# Audio samples
|
|
@@ -566,11 +1154,3 @@ tiny.en tiny base.en base small.en small medium.en medium large-v1 large-v2 larg
|
|
| 566 |
./main -m models/[email protected] -f $$f ; \
|
| 567 |
echo "" ; \
|
| 568 |
done
|
| 569 |
-
|
| 570 |
-
#
|
| 571 |
-
# Tests
|
| 572 |
-
#
|
| 573 |
-
|
| 574 |
-
.PHONY: tests
|
| 575 |
-
tests:
|
| 576 |
-
bash ./tests/run-tests.sh $(word 2, $(MAKECMDGOALS))
|
|
|
|
| 1 |
+
# Define the default target now so that it is always the first target
|
| 2 |
+
BUILD_TARGETS = \
|
| 3 |
+
main \
|
| 4 |
+
bench \
|
| 5 |
+
quantize \
|
| 6 |
+
server \
|
| 7 |
+
tests/test-c.o
|
| 8 |
+
|
| 9 |
+
# Binaries only useful for tests
|
| 10 |
+
TEST_TARGETS = \
|
| 11 |
+
tests/test-backend-ops
|
| 12 |
+
|
| 13 |
+
# Deprecation aliases
|
| 14 |
+
ifdef WHISPER_CUBLAS
|
| 15 |
+
$(error WHISPER_CUBLAS is removed. Use GGML_CUDA instead.)
|
| 16 |
+
endif
|
| 17 |
+
|
| 18 |
+
ifdef WHISPER_CUDA
|
| 19 |
+
GGML_CUDA := 1
|
| 20 |
+
DEPRECATE_WARNING := 1
|
| 21 |
+
endif
|
| 22 |
+
|
| 23 |
+
ifdef WHISPER_KOMPUTE
|
| 24 |
+
GGML_KOMPUTE := 1
|
| 25 |
+
DEPRECATE_WARNING := 1
|
| 26 |
+
endif
|
| 27 |
+
|
| 28 |
+
ifdef WHISPER_METAL
|
| 29 |
+
GGML_METAL := 1
|
| 30 |
+
DEPRECATE_WARNING := 1
|
| 31 |
+
endif
|
| 32 |
+
|
| 33 |
+
ifdef WHISPER_OPENMP
|
| 34 |
+
GGML_OPENMP := 1
|
| 35 |
+
DEPRECATE_WARNING := 1
|
| 36 |
+
endif
|
| 37 |
+
|
| 38 |
+
ifdef WHISPER_RPC
|
| 39 |
+
GGML_RPC := 1
|
| 40 |
+
DEPRECATE_WARNING := 1
|
| 41 |
+
endif
|
| 42 |
+
|
| 43 |
+
ifdef WHISPER_SYCL
|
| 44 |
+
GGML_SYCL := 1
|
| 45 |
+
DEPRECATE_WARNING := 1
|
| 46 |
+
endif
|
| 47 |
+
|
| 48 |
+
ifdef WHISPER_SYCL_F16
|
| 49 |
+
GGML_SYCL_F16 := 1
|
| 50 |
+
DEPRECATE_WARNING := 1
|
| 51 |
+
endif
|
| 52 |
+
|
| 53 |
+
ifdef WHISPER_OPENBLAS
|
| 54 |
+
GGML_OPENBLAS := 1
|
| 55 |
+
DEPRECATE_WARNING := 1
|
| 56 |
+
endif
|
| 57 |
+
|
| 58 |
+
ifdef WHISPER_OPENBLAS64
|
| 59 |
+
GGML_OPENBLAS64 := 1
|
| 60 |
+
DEPRECATE_WARNING := 1
|
| 61 |
+
endif
|
| 62 |
+
|
| 63 |
+
ifdef WHISPER_BLIS
|
| 64 |
+
GGML_BLIS := 1
|
| 65 |
+
DEPRECATE_WARNING := 1
|
| 66 |
+
endif
|
| 67 |
+
|
| 68 |
+
ifdef WHISPER_NO_WHISPERFILE
|
| 69 |
+
GGML_NO_WHISPERFILE := 1
|
| 70 |
+
DEPRECATE_WARNING := 1
|
| 71 |
+
endif
|
| 72 |
+
|
| 73 |
+
ifdef WHISPER_NO_ACCELERATE
|
| 74 |
+
GGML_NO_ACCELERATE := 1
|
| 75 |
+
DEPRECATE_WARNING := 1
|
| 76 |
+
endif
|
| 77 |
+
|
| 78 |
+
ifdef WHISPER_NO_OPENMP
|
| 79 |
+
GGML_NO_OPENMP := 1
|
| 80 |
+
DEPRECATE_WARNING := 1
|
| 81 |
+
endif
|
| 82 |
+
|
| 83 |
+
ifdef WHISPER_NO_METAL
|
| 84 |
+
GGML_NO_METAL := 1
|
| 85 |
+
DEPRECATE_WARNING := 1
|
| 86 |
+
endif
|
| 87 |
|
| 88 |
ifndef UNAME_S
|
| 89 |
UNAME_S := $(shell uname -s)
|
|
|
|
| 97 |
UNAME_M := $(shell uname -m)
|
| 98 |
endif
|
| 99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
# In GNU make default CXX is g++ instead of c++. Let's fix that so that users
|
| 101 |
# of non-gcc compilers don't have to provide g++ alias or wrapper.
|
| 102 |
DEFCC := cc
|
|
|
|
| 108 |
CXX := $(DEFCXX)
|
| 109 |
endif
|
| 110 |
|
|
|
|
|
|
|
|
|
|
| 111 |
# Mac OS + Arm can report x86_64
|
| 112 |
# ref: https://github.com/ggerganov/whisper.cpp/issues/66#issuecomment-1282546789
|
| 113 |
ifeq ($(UNAME_S),Darwin)
|
| 114 |
+
ifndef GGML_NO_METAL
|
| 115 |
+
GGML_METAL := 1
|
| 116 |
+
endif
|
| 117 |
+
|
| 118 |
+
GGML_NO_OPENMP := 1
|
| 119 |
|
| 120 |
ifneq ($(UNAME_P),arm)
|
| 121 |
+
SYSCTL_M := $(shell sysctl -n hw.optional.arm64 2>/dev/null)
|
| 122 |
ifeq ($(SYSCTL_M),1)
|
| 123 |
# UNAME_P := arm
|
| 124 |
# UNAME_M := arm64
|
|
|
|
| 127 |
endif
|
| 128 |
endif
|
| 129 |
|
| 130 |
+
ifdef GGML_METAL
|
| 131 |
+
GGML_METAL_EMBED_LIBRARY := 1
|
| 132 |
+
endif
|
| 133 |
+
|
| 134 |
+
ifdef GGML_RPC
|
| 135 |
+
BUILD_TARGETS += rpc-server
|
| 136 |
+
endif
|
| 137 |
+
|
| 138 |
+
ifeq ($(shell sdl2-config --cflags --libs 2>/dev/null),)
|
| 139 |
+
else
|
| 140 |
+
BUILD_TARGETS += \
|
| 141 |
+
command \
|
| 142 |
+
stream \
|
| 143 |
+
lsp \
|
| 144 |
+
talk \
|
| 145 |
+
talk-llama
|
| 146 |
+
endif
|
| 147 |
+
|
| 148 |
+
default: $(BUILD_TARGETS)
|
| 149 |
+
|
| 150 |
+
test: $(TEST_TARGETS)
|
| 151 |
+
@failures=0; \
|
| 152 |
+
for test_target in $(TEST_TARGETS); do \
|
| 153 |
+
echo "Running test $$test_target..."; \
|
| 154 |
+
./$$test_target; \
|
| 155 |
+
if [ $$? -ne 0 ]; then \
|
| 156 |
+
printf 'Test %s FAILED!\n\n' $$test_target; \
|
| 157 |
+
failures=$$(( failures + 1 )); \
|
| 158 |
+
else \
|
| 159 |
+
printf 'Test %s passed.\n\n' $$test_target; \
|
| 160 |
+
fi; \
|
| 161 |
+
done; \
|
| 162 |
+
failures=$$(( failures + $$? )); \
|
| 163 |
+
if [ $$failures -gt 0 ]; then \
|
| 164 |
+
printf '\n%s tests failed.\n' $$failures; \
|
| 165 |
+
exit 1; \
|
| 166 |
+
fi
|
| 167 |
+
@echo 'All tests passed.'
|
| 168 |
+
|
| 169 |
+
all: $(BUILD_TARGETS) $(TEST_TARGETS)
|
| 170 |
+
|
| 171 |
+
ifdef RISCV_CROSS_COMPILE
|
| 172 |
+
CC := riscv64-unknown-linux-gnu-gcc
|
| 173 |
+
CXX := riscv64-unknown-linux-gnu-g++
|
| 174 |
+
endif
|
| 175 |
+
|
| 176 |
#
|
| 177 |
# Compile flags
|
| 178 |
#
|
| 179 |
|
| 180 |
+
# keep standard at C11 and C++11
|
| 181 |
+
MK_CPPFLAGS = -Iggml/include -Iggml/src -Iinclude -Isrc -Iexamples
|
| 182 |
+
MK_CFLAGS = -std=c11 -fPIC
|
| 183 |
+
MK_CXXFLAGS = -std=c++11 -fPIC
|
| 184 |
+
MK_NVCCFLAGS = -std=c++11
|
| 185 |
+
|
| 186 |
+
ifndef WHISPER_NO_CCACHE
|
| 187 |
+
CCACHE := $(shell which ccache)
|
| 188 |
+
ifdef CCACHE
|
| 189 |
+
export CCACHE_SLOPPINESS = time_macros
|
| 190 |
+
$(info I ccache found, compilation results will be cached. Disable with WHISPER_NO_CCACHE.)
|
| 191 |
+
CC := $(CCACHE) $(CC)
|
| 192 |
+
CXX := $(CCACHE) $(CXX)
|
| 193 |
+
else
|
| 194 |
+
$(info I ccache not found. Consider installing it for faster compilation.)
|
| 195 |
+
endif # CCACHE
|
| 196 |
+
endif # WHISPER_NO_CCACHE
|
| 197 |
|
| 198 |
# clock_gettime came in POSIX.1b (1993)
|
| 199 |
# CLOCK_MONOTONIC came in POSIX.1-2001 / SUSv3 as optional
|
| 200 |
# posix_memalign came in POSIX.1-2001 / SUSv3
|
| 201 |
# M_PI is an XSI extension since POSIX.1-2001 / SUSv3, came in XPG1 (1985)
|
| 202 |
+
MK_CPPFLAGS += -D_XOPEN_SOURCE=600
|
|
|
|
| 203 |
|
| 204 |
# Somehow in OpenBSD whenever POSIX conformance is specified
|
| 205 |
# some string functions rely on locale_t availability,
|
| 206 |
# which was introduced in POSIX.1-2008, forcing us to go higher
|
| 207 |
ifeq ($(UNAME_S),OpenBSD)
|
| 208 |
+
MK_CPPFLAGS += -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700
|
|
|
|
| 209 |
endif
|
| 210 |
|
| 211 |
+
# Data types, macros and functions related to controlling CPU affinity and
|
| 212 |
+
# some memory allocation are available on Linux through GNU extensions in libc
|
| 213 |
ifeq ($(UNAME_S),Linux)
|
| 214 |
+
MK_CPPFLAGS += -D_GNU_SOURCE
|
|
|
|
| 215 |
endif
|
| 216 |
|
| 217 |
# RLIMIT_MEMLOCK came in BSD, is not specified in POSIX.1,
|
| 218 |
# and on macOS its availability depends on enabling Darwin extensions
|
| 219 |
# similarly on DragonFly, enabling BSD extensions is necessary
|
| 220 |
ifeq ($(UNAME_S),Darwin)
|
| 221 |
+
MK_CPPFLAGS += -D_DARWIN_C_SOURCE
|
|
|
|
| 222 |
endif
|
| 223 |
ifeq ($(UNAME_S),DragonFly)
|
| 224 |
+
MK_CPPFLAGS += -D__BSD_VISIBLE
|
|
|
|
| 225 |
endif
|
| 226 |
|
| 227 |
# alloca is a non-standard interface that is not visible on BSDs when
|
| 228 |
# POSIX conformance is specified, but not all of them provide a clean way
|
| 229 |
# to enable it in such cases
|
| 230 |
ifeq ($(UNAME_S),FreeBSD)
|
| 231 |
+
MK_CPPFLAGS += -D__BSD_VISIBLE
|
|
|
|
| 232 |
endif
|
| 233 |
ifeq ($(UNAME_S),NetBSD)
|
| 234 |
+
MK_CPPFLAGS += -D_NETBSD_SOURCE
|
|
|
|
| 235 |
endif
|
| 236 |
ifeq ($(UNAME_S),OpenBSD)
|
| 237 |
+
MK_CPPFLAGS += -D_BSD_SOURCE
|
| 238 |
+
endif
|
| 239 |
+
|
| 240 |
+
ifdef GGML_SCHED_MAX_COPIES
|
| 241 |
+
MK_CPPFLAGS += -DGGML_SCHED_MAX_COPIES=$(GGML_SCHED_MAX_COPIES)
|
| 242 |
+
endif
|
| 243 |
+
|
| 244 |
+
ifdef WHISPER_DEBUG
|
| 245 |
+
MK_CFLAGS += -O0 -g
|
| 246 |
+
MK_CXXFLAGS += -O0 -g
|
| 247 |
+
MK_LDFLAGS += -g
|
| 248 |
+
MK_NVCCFLAGS += -O0 -g
|
| 249 |
+
|
| 250 |
+
ifeq ($(UNAME_S),Linux)
|
| 251 |
+
MK_CPPFLAGS += -D_GLIBCXX_ASSERTIONS
|
| 252 |
+
endif
|
| 253 |
+
else
|
| 254 |
+
MK_CPPFLAGS += -DNDEBUG
|
| 255 |
+
endif
|
| 256 |
+
|
| 257 |
+
ifdef WHISPER_SANITIZE_THREAD
|
| 258 |
+
MK_CFLAGS += -fsanitize=thread -g
|
| 259 |
+
MK_CXXFLAGS += -fsanitize=thread -g
|
| 260 |
+
MK_LDFLAGS += -fsanitize=thread -g
|
| 261 |
+
endif
|
| 262 |
+
|
| 263 |
+
ifdef WHISPER_SANITIZE_ADDRESS
|
| 264 |
+
MK_CFLAGS += -fsanitize=address -fno-omit-frame-pointer -g
|
| 265 |
+
MK_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer -g
|
| 266 |
+
MK_LDFLAGS += -fsanitize=address -fno-omit-frame-pointer -g
|
| 267 |
+
endif
|
| 268 |
+
|
| 269 |
+
ifdef WHISPER_SANITIZE_UNDEFINED
|
| 270 |
+
MK_CFLAGS += -fsanitize=undefined -g
|
| 271 |
+
MK_CXXFLAGS += -fsanitize=undefined -g
|
| 272 |
+
MK_LDFLAGS += -fsanitize=undefined -g
|
| 273 |
+
endif
|
| 274 |
+
|
| 275 |
+
ifdef WHISPER_SERVER_VERBOSE
|
| 276 |
+
MK_CPPFLAGS += -DSERVER_VERBOSE=$(WHISPER_SERVER_VERBOSE)
|
| 277 |
+
endif
|
| 278 |
+
|
| 279 |
+
ifdef WHISPER_SERVER_SSL
|
| 280 |
+
MK_CPPFLAGS += -DCPPHTTPLIB_OPENSSL_SUPPORT
|
| 281 |
+
MK_LDFLAGS += -lssl -lcrypto
|
| 282 |
+
endif
|
| 283 |
+
|
| 284 |
+
ifdef WHISPER_DISABLE_LOGS
|
| 285 |
+
MK_CPPFLAGS += -DLOG_DISABLE_LOGS
|
| 286 |
+
endif # WHISPER_DISABLE_LOGS
|
| 287 |
+
|
| 288 |
+
# warnings
|
| 289 |
+
WARN_FLAGS = \
|
| 290 |
+
-Wall \
|
| 291 |
+
-Wextra \
|
| 292 |
+
-Wpedantic \
|
| 293 |
+
-Wcast-qual \
|
| 294 |
+
-Wno-unused-function
|
| 295 |
+
|
| 296 |
+
MK_CFLAGS += \
|
| 297 |
+
$(WARN_FLAGS) \
|
| 298 |
+
-Wshadow \
|
| 299 |
+
-Wstrict-prototypes \
|
| 300 |
+
-Wpointer-arith \
|
| 301 |
+
-Wmissing-prototypes \
|
| 302 |
+
-Werror=implicit-int \
|
| 303 |
+
-Werror=implicit-function-declaration
|
| 304 |
+
|
| 305 |
+
MK_CXXFLAGS += \
|
| 306 |
+
$(WARN_FLAGS) \
|
| 307 |
+
-Wmissing-declarations \
|
| 308 |
+
-Wmissing-noreturn
|
| 309 |
+
|
| 310 |
+
ifeq ($(WHISPER_FATAL_WARNINGS),1)
|
| 311 |
+
MK_CFLAGS += -Werror
|
| 312 |
+
MK_CXXFLAGS += -Werror
|
| 313 |
+
endif
|
| 314 |
+
|
| 315 |
+
# this version of Apple ld64 is buggy
|
| 316 |
+
ifneq '' '$(findstring dyld-1015.7,$(shell $(CC) $(LDFLAGS) -Wl,-v 2>&1))'
|
| 317 |
+
MK_CPPFLAGS += -DHAVE_BUGGY_APPLE_LINKER
|
| 318 |
endif
|
| 319 |
|
| 320 |
# OS specific
|
| 321 |
# TODO: support Windows
|
| 322 |
+
ifneq '' '$(filter $(UNAME_S),Linux Darwin FreeBSD NetBSD OpenBSD Haiku)'
|
| 323 |
+
MK_CFLAGS += -pthread
|
| 324 |
+
MK_CXXFLAGS += -pthread
|
| 325 |
endif
|
| 326 |
|
| 327 |
# detect Windows
|
|
|
|
| 329 |
_WIN32 := 1
|
| 330 |
endif
|
| 331 |
|
| 332 |
+
# library name prefix
|
| 333 |
+
ifneq ($(_WIN32),1)
|
| 334 |
+
LIB_PRE := lib
|
| 335 |
+
endif
|
| 336 |
+
|
| 337 |
+
# Dynamic Shared Object extension
|
| 338 |
+
ifneq ($(_WIN32),1)
|
| 339 |
+
DSO_EXT := .so
|
| 340 |
+
else
|
| 341 |
+
DSO_EXT := .dll
|
| 342 |
+
endif
|
| 343 |
+
|
| 344 |
# Windows Sockets 2 (Winsock) for network-capable apps
|
| 345 |
ifeq ($(_WIN32),1)
|
| 346 |
LWINSOCK2 := -lws2_32
|
| 347 |
endif
|
| 348 |
|
| 349 |
+
ifdef WHISPER_GPROF
|
| 350 |
+
MK_CFLAGS += -pg
|
| 351 |
+
MK_CXXFLAGS += -pg
|
| 352 |
+
endif
|
| 353 |
+
|
| 354 |
# Architecture specific
|
| 355 |
# TODO: probably these flags need to be tweaked on some architectures
|
| 356 |
# feel free to update the Makefile for your architecture and send a pull request or issue
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 357 |
|
| 358 |
+
ifndef RISCV
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
|
| 360 |
+
ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686 amd64))
|
| 361 |
+
# Use all CPU extensions that are available:
|
| 362 |
+
MK_CFLAGS += -march=native -mtune=native
|
| 363 |
+
HOST_CXXFLAGS += -march=native -mtune=native
|
| 364 |
|
| 365 |
+
# Usage AVX-only
|
| 366 |
+
#MK_CFLAGS += -mfma -mf16c -mavx
|
| 367 |
+
#MK_CXXFLAGS += -mfma -mf16c -mavx
|
|
|
|
| 368 |
|
| 369 |
+
# Usage SSSE3-only (Not is SSE3!)
|
| 370 |
+
#MK_CFLAGS += -mssse3
|
| 371 |
+
#MK_CXXFLAGS += -mssse3
|
| 372 |
+
endif
|
| 373 |
|
| 374 |
+
ifneq '' '$(findstring mingw,$(shell $(CC) -dumpmachine))'
|
| 375 |
+
# The stack is only 16-byte aligned on Windows, so don't let gcc emit aligned moves.
|
| 376 |
+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412
|
| 377 |
+
# https://github.com/ggerganov/llama.cpp/issues/2922
|
| 378 |
+
MK_CFLAGS += -Xassembler -muse-unaligned-vector-move
|
| 379 |
+
MK_CXXFLAGS += -Xassembler -muse-unaligned-vector-move
|
| 380 |
|
| 381 |
+
# Target Windows 8 for PrefetchVirtualMemory
|
| 382 |
+
MK_CPPFLAGS += -D_WIN32_WINNT=0x602
|
| 383 |
+
endif
|
|
|
|
| 384 |
|
| 385 |
+
ifneq ($(filter aarch64%,$(UNAME_M)),)
|
| 386 |
+
# Apple M1, M2, etc.
|
| 387 |
+
# Raspberry Pi 3, 4, Zero 2 (64-bit)
|
| 388 |
+
# Nvidia Jetson
|
| 389 |
+
MK_CFLAGS += -mcpu=native
|
| 390 |
+
MK_CXXFLAGS += -mcpu=native
|
| 391 |
+
JETSON_RELEASE_INFO = $(shell jetson_release)
|
| 392 |
+
ifdef JETSON_RELEASE_INFO
|
| 393 |
+
ifneq ($(filter TX2%,$(JETSON_RELEASE_INFO)),)
|
| 394 |
+
JETSON_EOL_MODULE_DETECT = 1
|
| 395 |
+
CC = aarch64-unknown-linux-gnu-gcc
|
| 396 |
+
cxx = aarch64-unknown-linux-gnu-g++
|
| 397 |
endif
|
| 398 |
+
endif
|
| 399 |
+
endif
|
| 400 |
|
| 401 |
+
ifneq ($(filter armv6%,$(UNAME_M)),)
|
| 402 |
+
# Raspberry Pi 1, Zero
|
| 403 |
+
MK_CFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access
|
| 404 |
+
MK_CXXFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access
|
| 405 |
+
endif
|
| 406 |
|
| 407 |
+
ifneq ($(filter armv7%,$(UNAME_M)),)
|
| 408 |
+
# Raspberry Pi 2
|
| 409 |
+
MK_CFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access -funsafe-math-optimizations
|
| 410 |
+
MK_CXXFLAGS += -mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access -funsafe-math-optimizations
|
| 411 |
+
endif
|
| 412 |
|
| 413 |
+
ifneq ($(filter armv8%,$(UNAME_M)),)
|
| 414 |
+
# Raspberry Pi 3, 4, Zero 2 (32-bit)
|
| 415 |
+
MK_CFLAGS += -mfp16-format=ieee -mno-unaligned-access
|
| 416 |
+
MK_CXXFLAGS += -mfp16-format=ieee -mno-unaligned-access
|
|
|
|
| 417 |
endif
|
| 418 |
|
| 419 |
ifneq ($(filter ppc64%,$(UNAME_M)),)
|
| 420 |
POWER9_M := $(shell grep "POWER9" /proc/cpuinfo)
|
| 421 |
ifneq (,$(findstring POWER9,$(POWER9_M)))
|
| 422 |
+
MK_CFLAGS += -mcpu=power9
|
| 423 |
+
MK_CXXFLAGS += -mcpu=power9
|
|
|
|
|
|
|
|
|
|
| 424 |
endif
|
| 425 |
endif
|
| 426 |
|
| 427 |
+
ifneq ($(filter ppc64le%,$(UNAME_M)),)
|
| 428 |
+
MK_CFLAGS += -mcpu=powerpc64le
|
| 429 |
+
MK_CXXFLAGS += -mcpu=powerpc64le
|
| 430 |
+
CUDA_POWER_ARCH = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 431 |
endif
|
| 432 |
|
| 433 |
+
ifneq ($(filter loongarch64%,$(UNAME_M)),)
|
| 434 |
+
MK_CFLAGS += -mlasx
|
| 435 |
+
MK_CXXFLAGS += -mlasx
|
|
|
|
|
|
|
|
|
|
| 436 |
endif
|
| 437 |
+
|
| 438 |
+
else
|
| 439 |
+
MK_CFLAGS += -march=rv64gcv -mabi=lp64d
|
| 440 |
+
MK_CXXFLAGS += -march=rv64gcv -mabi=lp64d
|
| 441 |
endif
|
| 442 |
|
| 443 |
+
ifndef GGML_NO_ACCELERATE
|
| 444 |
+
# Mac OS - include Accelerate framework.
|
| 445 |
+
# `-framework Accelerate` works both with Apple Silicon and Mac Intel
|
| 446 |
ifeq ($(UNAME_S),Darwin)
|
| 447 |
+
MK_CPPFLAGS += -DGGML_USE_ACCELERATE -DGGML_USE_BLAS
|
| 448 |
+
MK_CPPFLAGS += -DACCELERATE_NEW_LAPACK
|
| 449 |
+
MK_CPPFLAGS += -DACCELERATE_LAPACK_ILP64
|
| 450 |
+
MK_LDFLAGS += -framework Accelerate
|
| 451 |
+
OBJ_GGML += ggml/src/ggml-blas.o
|
| 452 |
+
endif
|
| 453 |
+
endif # GGML_NO_ACCELERATE
|
| 454 |
+
|
| 455 |
+
ifndef GGML_NO_OPENMP
|
| 456 |
+
MK_CPPFLAGS += -DGGML_USE_OPENMP
|
| 457 |
+
MK_CFLAGS += -fopenmp
|
| 458 |
+
MK_CXXFLAGS += -fopenmp
|
| 459 |
+
endif # GGML_NO_OPENMP
|
| 460 |
+
|
| 461 |
+
ifdef GGML_OPENBLAS
|
| 462 |
+
MK_CPPFLAGS += -DGGML_USE_BLAS $(shell pkg-config --cflags-only-I openblas)
|
| 463 |
+
MK_CFLAGS += $(shell pkg-config --cflags-only-other openblas)
|
| 464 |
+
MK_LDFLAGS += $(shell pkg-config --libs openblas)
|
| 465 |
+
OBJ_GGML += ggml/src/ggml-blas.o
|
| 466 |
+
endif # GGML_OPENBLAS
|
| 467 |
+
|
| 468 |
+
ifdef GGML_OPENBLAS64
|
| 469 |
+
MK_CPPFLAGS += -DGGML_USE_BLAS $(shell pkg-config --cflags-only-I openblas64)
|
| 470 |
+
MK_CFLAGS += $(shell pkg-config --cflags-only-other openblas64)
|
| 471 |
+
MK_LDFLAGS += $(shell pkg-config --libs openblas64)
|
| 472 |
+
OBJ_GGML += ggml/src/ggml-blas.o
|
| 473 |
+
endif # GGML_OPENBLAS64
|
| 474 |
+
|
| 475 |
+
ifdef GGML_BLIS
|
| 476 |
+
MK_CPPFLAGS += -DGGML_USE_BLAS -I/usr/local/include/blis -I/usr/include/blis
|
| 477 |
+
MK_LDFLAGS += -lblis -L/usr/local/lib
|
| 478 |
+
OBJ_GGML += ggml/src/ggml-blas.o
|
| 479 |
+
endif # GGML_BLIS
|
| 480 |
+
|
| 481 |
+
ifdef GGML_RPC
|
| 482 |
+
MK_CPPFLAGS += -DGGML_USE_RPC
|
| 483 |
+
OBJ_GGML += ggml/src/ggml-rpc.o
|
| 484 |
+
endif # GGML_RPC
|
| 485 |
+
|
| 486 |
+
OBJ_CUDA_TMPL = $(patsubst %.cu,%.o,$(wildcard ggml/src/ggml-cuda/template-instances/fattn-wmma*.cu))
|
| 487 |
+
OBJ_CUDA_TMPL += $(patsubst %.cu,%.o,$(wildcard ggml/src/ggml-cuda/template-instances/mmq*.cu))
|
| 488 |
+
|
| 489 |
+
ifdef GGML_CUDA_FA_ALL_QUANTS
|
| 490 |
+
OBJ_CUDA_TMPL += $(patsubst %.cu,%.o,$(wildcard ggml/src/ggml-cuda/template-instances/fattn-vec*.cu))
|
| 491 |
+
else
|
| 492 |
+
OBJ_CUDA_TMPL += $(patsubst %.cu,%.o,$(wildcard ggml/src/ggml-cuda/template-instances/fattn-vec*q4_0-q4_0.cu))
|
| 493 |
+
OBJ_CUDA_TMPL += $(patsubst %.cu,%.o,$(wildcard ggml/src/ggml-cuda/template-instances/fattn-vec*q8_0-q8_0.cu))
|
| 494 |
+
OBJ_CUDA_TMPL += $(patsubst %.cu,%.o,$(wildcard ggml/src/ggml-cuda/template-instances/fattn-vec*f16-f16.cu))
|
| 495 |
+
endif # GGML_CUDA_FA_ALL_QUANTS
|
| 496 |
+
|
| 497 |
+
ifdef GGML_CUDA
|
| 498 |
+
ifneq ('', '$(wildcard /opt/cuda)')
|
| 499 |
+
CUDA_PATH ?= /opt/cuda
|
| 500 |
+
else
|
| 501 |
+
CUDA_PATH ?= /usr/local/cuda
|
| 502 |
endif
|
|
|
|
| 503 |
|
| 504 |
+
MK_CPPFLAGS += -DGGML_USE_CUDA -I$(CUDA_PATH)/include -I$(CUDA_PATH)/targets/$(UNAME_M)-linux/include -DGGML_CUDA_USE_GRAPHS
|
| 505 |
+
MK_LDFLAGS += -lcuda -lcublas -lculibos -lcudart -lcufft -lcublasLt -lpthread -ldl -lrt -L$(CUDA_PATH)/lib64 -L/usr/lib64 -L$(CUDA_PATH)/targets/$(UNAME_M)-linux/lib -L$(CUDA_PATH)/lib64/stubs -L/usr/lib/wsl/lib
|
| 506 |
+
MK_NVCCFLAGS += -use_fast_math
|
|
|
|
|
|
|
| 507 |
|
| 508 |
+
OBJ_GGML += ggml/src/ggml-cuda.o
|
| 509 |
+
OBJ_GGML += $(patsubst %.cu,%.o,$(wildcard ggml/src/ggml-cuda/*.cu))
|
| 510 |
+
OBJ_GGML += $(OBJ_CUDA_TMPL)
|
|
|
|
|
|
|
|
|
|
| 511 |
|
| 512 |
+
OBJ_WHISPER += src/whisper-mel-cuda.o
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 513 |
|
| 514 |
+
ifdef WHISPER_FATAL_WARNINGS
|
| 515 |
+
MK_NVCCFLAGS += -Werror all-warnings
|
| 516 |
+
endif # WHISPER_FATAL_WARNINGS
|
|
|
|
|
|
|
| 517 |
|
| 518 |
+
ifndef JETSON_EOL_MODULE_DETECT
|
| 519 |
+
MK_NVCCFLAGS += --forward-unknown-to-host-compiler
|
| 520 |
+
endif # JETSON_EOL_MODULE_DETECT
|
| 521 |
+
|
| 522 |
+
ifdef WHISPER_DEBUG
|
| 523 |
+
MK_NVCCFLAGS += -lineinfo
|
| 524 |
+
endif # WHISPER_DEBUG
|
| 525 |
+
|
| 526 |
+
ifdef GGML_CUDA_DEBUG
|
| 527 |
+
MK_NVCCFLAGS += --device-debug
|
| 528 |
+
endif # GGML_CUDA_DEBUG
|
| 529 |
+
|
| 530 |
+
ifdef GGML_CUDA_NVCC
|
| 531 |
+
NVCC = $(CCACHE) $(GGML_CUDA_NVCC)
|
| 532 |
+
else
|
| 533 |
+
NVCC = $(CCACHE) nvcc
|
| 534 |
+
endif #GGML_CUDA_NVCC
|
| 535 |
+
|
| 536 |
+
ifdef CUDA_DOCKER_ARCH
|
| 537 |
+
MK_NVCCFLAGS += -Wno-deprecated-gpu-targets -arch=$(CUDA_DOCKER_ARCH)
|
| 538 |
+
else ifndef CUDA_POWER_ARCH
|
| 539 |
+
MK_NVCCFLAGS += -arch=native
|
| 540 |
+
endif # CUDA_DOCKER_ARCH
|
| 541 |
+
|
| 542 |
+
ifdef GGML_CUDA_FORCE_DMMV
|
| 543 |
+
MK_NVCCFLAGS += -DGGML_CUDA_FORCE_DMMV
|
| 544 |
+
endif # GGML_CUDA_FORCE_DMMV
|
| 545 |
+
|
| 546 |
+
ifdef GGML_CUDA_FORCE_MMQ
|
| 547 |
+
MK_NVCCFLAGS += -DGGML_CUDA_FORCE_MMQ
|
| 548 |
+
endif # GGML_CUDA_FORCE_MMQ
|
| 549 |
+
|
| 550 |
+
ifdef GGML_CUDA_DMMV_X
|
| 551 |
+
MK_NVCCFLAGS += -DGGML_CUDA_DMMV_X=$(GGML_CUDA_DMMV_X)
|
| 552 |
+
else
|
| 553 |
+
MK_NVCCFLAGS += -DGGML_CUDA_DMMV_X=32
|
| 554 |
+
endif # GGML_CUDA_DMMV_X
|
| 555 |
+
|
| 556 |
+
ifdef GGML_CUDA_MMV_Y
|
| 557 |
+
MK_NVCCFLAGS += -DGGML_CUDA_MMV_Y=$(GGML_CUDA_MMV_Y)
|
| 558 |
+
else ifdef GGML_CUDA_DMMV_Y
|
| 559 |
+
MK_NVCCFLAGS += -DGGML_CUDA_MMV_Y=$(GGML_CUDA_DMMV_Y) # for backwards compatibility
|
| 560 |
+
else
|
| 561 |
+
MK_NVCCFLAGS += -DGGML_CUDA_MMV_Y=1
|
| 562 |
+
endif # GGML_CUDA_MMV_Y
|
| 563 |
+
|
| 564 |
+
ifdef GGML_CUDA_F16
|
| 565 |
+
MK_NVCCFLAGS += -DGGML_CUDA_F16
|
| 566 |
+
endif # GGML_CUDA_F16
|
| 567 |
+
|
| 568 |
+
ifdef GGML_CUDA_DMMV_F16
|
| 569 |
+
MK_NVCCFLAGS += -DGGML_CUDA_F16
|
| 570 |
+
endif # GGML_CUDA_DMMV_F16
|
| 571 |
+
|
| 572 |
+
ifdef GGML_CUDA_KQUANTS_ITER
|
| 573 |
+
MK_NVCCFLAGS += -DK_QUANTS_PER_ITERATION=$(GGML_CUDA_KQUANTS_ITER)
|
| 574 |
+
else
|
| 575 |
+
MK_NVCCFLAGS += -DK_QUANTS_PER_ITERATION=2
|
| 576 |
endif
|
| 577 |
|
| 578 |
+
ifdef GGML_CUDA_PEER_MAX_BATCH_SIZE
|
| 579 |
+
MK_NVCCFLAGS += -DGGML_CUDA_PEER_MAX_BATCH_SIZE=$(GGML_CUDA_PEER_MAX_BATCH_SIZE)
|
|
|
|
|
|
|
| 580 |
else
|
| 581 |
+
MK_NVCCFLAGS += -DGGML_CUDA_PEER_MAX_BATCH_SIZE=128
|
| 582 |
+
endif # GGML_CUDA_PEER_MAX_BATCH_SIZE
|
|
|
|
|
|
|
| 583 |
|
| 584 |
+
ifdef GGML_CUDA_NO_PEER_COPY
|
| 585 |
+
MK_NVCCFLAGS += -DGGML_CUDA_NO_PEER_COPY
|
| 586 |
+
endif # GGML_CUDA_NO_PEER_COPY
|
| 587 |
+
|
| 588 |
+
ifdef GGML_CUDA_CCBIN
|
| 589 |
+
MK_NVCCFLAGS += -ccbin $(GGML_CUDA_CCBIN)
|
| 590 |
+
endif # GGML_CUDA_CCBIN
|
| 591 |
+
|
| 592 |
+
ifdef GGML_CUDA_FA_ALL_QUANTS
|
| 593 |
+
MK_NVCCFLAGS += -DGGML_CUDA_FA_ALL_QUANTS
|
| 594 |
+
endif # GGML_CUDA_FA_ALL_QUANTS
|
| 595 |
+
|
| 596 |
+
ifdef JETSON_EOL_MODULE_DETECT
|
| 597 |
+
define NVCC_COMPILE
|
| 598 |
+
$(NVCC) -I. -Icommon -D_XOPEN_SOURCE=600 -D_GNU_SOURCE -DNDEBUG -DGGML_USE_CUDA -I/usr/local/cuda/include -I/opt/cuda/include -I/usr/local/cuda/targets/aarch64-linux/include -std=c++11 -O3 $(NVCCFLAGS) $(CPPFLAGS) -Xcompiler "$(CUDA_CXXFLAGS)" -c $< -o $@
|
| 599 |
+
endef # NVCC_COMPILE
|
| 600 |
+
else
|
| 601 |
+
define NVCC_COMPILE
|
| 602 |
+
$(NVCC) $(NVCCFLAGS) $(CPPFLAGS) -Xcompiler "$(CUDA_CXXFLAGS)" -c $< -o $@
|
| 603 |
+
endef # NVCC_COMPILE
|
| 604 |
+
endif # JETSON_EOL_MODULE_DETECT
|
| 605 |
+
|
| 606 |
+
ggml/src/ggml-cuda/%.o: \
|
| 607 |
+
ggml/src/ggml-cuda/%.cu \
|
| 608 |
+
ggml/include/ggml.h \
|
| 609 |
+
ggml/src/ggml-common.h \
|
| 610 |
+
ggml/src/ggml-cuda/common.cuh
|
| 611 |
+
$(NVCC_COMPILE)
|
| 612 |
+
|
| 613 |
+
ggml/src/ggml-cuda.o: \
|
| 614 |
+
ggml/src/ggml-cuda.cu \
|
| 615 |
+
ggml/include/ggml.h \
|
| 616 |
+
ggml/include/ggml-backend.h \
|
| 617 |
+
ggml/include/ggml-cuda.h \
|
| 618 |
+
ggml/src/ggml-backend-impl.h \
|
| 619 |
+
ggml/src/ggml-common.h \
|
| 620 |
+
$(wildcard ggml/src/ggml-cuda/*.cuh)
|
| 621 |
+
$(NVCC_COMPILE)
|
| 622 |
+
|
| 623 |
+
src/whisper-mel-cuda.o: src/whisper-mel-cuda.cu src/whisper-mel-cuda.hpp
|
| 624 |
+
$(NVCC) $(NVCCFLAGS) $(CPPFLAGS) -Xcompiler "$(CUDA_CXXFLAGS)" -c $< -o $@
|
| 625 |
+
|
| 626 |
+
endif # GGML_CUDA
|
| 627 |
+
|
| 628 |
+
ifdef GGML_VULKAN
|
| 629 |
+
MK_CPPFLAGS += -DGGML_USE_VULKAN
|
| 630 |
+
MK_LDFLAGS += -lvulkan
|
| 631 |
+
OBJ_GGML += ggml/src/ggml-vulkan.o
|
| 632 |
+
|
| 633 |
+
ifdef GGML_VULKAN_CHECK_RESULTS
|
| 634 |
+
MK_CPPFLAGS += -DGGML_VULKAN_CHECK_RESULTS
|
| 635 |
+
endif
|
| 636 |
+
|
| 637 |
+
ifdef GGML_VULKAN_DEBUG
|
| 638 |
+
MK_CPPFLAGS += -DGGML_VULKAN_DEBUG
|
| 639 |
+
endif
|
| 640 |
+
|
| 641 |
+
ifdef GGML_VULKAN_MEMORY_DEBUG
|
| 642 |
+
MK_CPPFLAGS += -DGGML_VULKAN_MEMORY_DEBUG
|
| 643 |
+
endif
|
| 644 |
+
|
| 645 |
+
ifdef GGML_VULKAN_VALIDATE
|
| 646 |
+
MK_CPPFLAGS += -DGGML_VULKAN_VALIDATE
|
| 647 |
+
endif
|
| 648 |
+
|
| 649 |
+
ifdef GGML_VULKAN_RUN_TESTS
|
| 650 |
+
MK_CPPFLAGS += -DGGML_VULKAN_RUN_TESTS
|
| 651 |
+
endif
|
| 652 |
+
|
| 653 |
+
ggml/src/ggml-vulkan.o: \
|
| 654 |
+
ggml/src/ggml-vulkan.cpp \
|
| 655 |
+
ggml/include/ggml-vulkan.h
|
| 656 |
+
$(CXX) $(CXXFLAGS) -c $< -o $@
|
| 657 |
+
endif # GGML_VULKAN
|
| 658 |
+
|
| 659 |
+
ifdef GGML_HIPBLAS
|
| 660 |
+
ifeq ($(wildcard /opt/rocm),)
|
| 661 |
+
ROCM_PATH ?= /usr
|
| 662 |
+
AMDGPU_TARGETS ?= $(shell $(shell which amdgpu-arch))
|
| 663 |
else
|
| 664 |
+
ROCM_PATH ?= /opt/rocm
|
| 665 |
+
AMDGPU_TARGETS ?= $(shell $(ROCM_PATH)/llvm/bin/amdgpu-arch)
|
| 666 |
endif
|
| 667 |
|
| 668 |
+
GGML_CUDA_DMMV_X ?= 32
|
| 669 |
+
GGML_CUDA_MMV_Y ?= 1
|
| 670 |
+
GGML_CUDA_KQUANTS_ITER ?= 2
|
| 671 |
+
|
| 672 |
+
MK_CPPFLAGS += -DGGML_USE_HIPBLAS -DGGML_USE_CUDA
|
| 673 |
+
|
| 674 |
+
ifdef GGML_HIP_UMA
|
| 675 |
+
MK_CPPFLAGS += -DGGML_HIP_UMA
|
| 676 |
+
endif # GGML_HIP_UMA
|
| 677 |
+
|
| 678 |
+
MK_LDFLAGS += -L$(ROCM_PATH)/lib -Wl,-rpath=$(ROCM_PATH)/lib
|
| 679 |
+
MK_LDFLAGS += -L$(ROCM_PATH)/lib64 -Wl,-rpath=$(ROCM_PATH)/lib64
|
| 680 |
+
MK_LDFLAGS += -lhipblas -lamdhip64 -lrocblas
|
| 681 |
+
|
| 682 |
+
HIPCC ?= $(CCACHE) $(ROCM_PATH)/bin/hipcc
|
| 683 |
+
|
| 684 |
+
HIPFLAGS += $(addprefix --offload-arch=,$(AMDGPU_TARGETS))
|
| 685 |
+
HIPFLAGS += -DGGML_CUDA_DMMV_X=$(GGML_CUDA_DMMV_X)
|
| 686 |
+
HIPFLAGS += -DGGML_CUDA_MMV_Y=$(GGML_CUDA_MMV_Y)
|
| 687 |
+
HIPFLAGS += -DK_QUANTS_PER_ITERATION=$(GGML_CUDA_KQUANTS_ITER)
|
| 688 |
+
|
| 689 |
+
ifdef GGML_CUDA_FORCE_DMMV
|
| 690 |
+
HIPFLAGS += -DGGML_CUDA_FORCE_DMMV
|
| 691 |
+
endif # GGML_CUDA_FORCE_DMMV
|
| 692 |
+
|
| 693 |
+
ifdef GGML_CUDA_NO_PEER_COPY
|
| 694 |
+
HIPFLAGS += -DGGML_CUDA_NO_PEER_COPY
|
| 695 |
+
endif # GGML_CUDA_NO_PEER_COPY
|
| 696 |
+
|
| 697 |
+
OBJ_GGML += ggml/src/ggml-cuda.o
|
| 698 |
+
OBJ_GGML += $(patsubst %.cu,%.o,$(wildcard ggml/src/ggml-cuda/*.cu))
|
| 699 |
+
OBJ_GGML += $(OBJ_CUDA_TMPL)
|
| 700 |
+
|
| 701 |
+
ggml/src/ggml-cuda.o: \
|
| 702 |
+
ggml/src/ggml-cuda.cu \
|
| 703 |
+
ggml/include/ggml.h \
|
| 704 |
+
ggml/include/ggml-backend.h \
|
| 705 |
+
ggml/include/ggml-cuda.h \
|
| 706 |
+
ggml/src/ggml-backend-impl.h \
|
| 707 |
+
ggml/src/ggml-common.h \
|
| 708 |
+
$(wildcard ggml/src/ggml-cuda/*.cuh)
|
| 709 |
$(HIPCC) $(CXXFLAGS) $(HIPFLAGS) -x hip -c -o $@ $<
|
| 710 |
|
| 711 |
+
ggml/src/ggml-cuda/%.o: \
|
| 712 |
+
ggml/src/ggml-cuda/%.cu \
|
| 713 |
+
ggml/include/ggml.h \
|
| 714 |
+
ggml/src/ggml-common.h \
|
| 715 |
+
ggml/src/ggml-cuda/common.cuh
|
| 716 |
$(HIPCC) $(CXXFLAGS) $(HIPFLAGS) -x hip -c -o $@ $<
|
| 717 |
+
endif # GGML_HIPBLAS
|
| 718 |
+
|
| 719 |
+
ifdef GGML_METAL
|
| 720 |
+
MK_CPPFLAGS += -DGGML_USE_METAL
|
| 721 |
+
MK_LDFLAGS += -framework Foundation -framework Metal -framework MetalKit
|
| 722 |
+
OBJ_GGML += ggml/src/ggml-metal.o
|
| 723 |
+
ifdef GGML_METAL_NDEBUG
|
| 724 |
+
MK_CPPFLAGS += -DGGML_METAL_NDEBUG
|
| 725 |
endif
|
| 726 |
|
| 727 |
+
ifdef GGML_METAL_EMBED_LIBRARY
|
| 728 |
+
MK_CPPFLAGS += -DGGML_METAL_EMBED_LIBRARY
|
| 729 |
+
OBJ_GGML += ggml/src/ggml-metal-embed.o
|
| 730 |
endif
|
| 731 |
+
endif # GGML_METAL
|
| 732 |
|
| 733 |
+
ifdef WHISPER_COREML
|
| 734 |
+
MK_CXXFLAGS += -DWHISPER_USE_COREML
|
| 735 |
+
LDFLAGS += -framework Foundation -framework CoreML
|
| 736 |
+
|
| 737 |
+
ifdef WHISPER_COREML_ALLOW_FALLBACK
|
| 738 |
+
MK_CXXFLAGS += -DWHISPER_COREML_ALLOW_FALLBACK
|
| 739 |
+
endif
|
| 740 |
endif
|
| 741 |
|
| 742 |
+
# ===
|
| 743 |
+
|
| 744 |
+
ifdef GGML_METAL
|
| 745 |
+
ggml/src/ggml-metal.o: \
|
| 746 |
+
ggml/src/ggml-metal.m \
|
| 747 |
+
ggml/include/ggml-metal.h \
|
| 748 |
+
ggml/include/ggml.h
|
| 749 |
+
$(CC) $(CFLAGS) -c $< -o $@
|
| 750 |
+
|
| 751 |
+
ifdef GGML_METAL_EMBED_LIBRARY
|
| 752 |
+
ggml/src/ggml-metal-embed.o: \
|
| 753 |
+
ggml/src/ggml-metal.metal \
|
| 754 |
+
ggml/src/ggml-common.h
|
| 755 |
+
@echo "Embedding Metal library"
|
| 756 |
+
@sed -e '/#include "ggml-common.h"/r ggml/src/ggml-common.h' -e '/#include "ggml-common.h"/d' < ggml/src/ggml-metal.metal > ggml/src/ggml-metal-embed.metal
|
| 757 |
+
$(eval TEMP_ASSEMBLY=$(shell mktemp))
|
| 758 |
+
@echo ".section __DATA, __ggml_metallib" > $(TEMP_ASSEMBLY)
|
| 759 |
+
@echo ".globl _ggml_metallib_start" >> $(TEMP_ASSEMBLY)
|
| 760 |
+
@echo "_ggml_metallib_start:" >> $(TEMP_ASSEMBLY)
|
| 761 |
+
@echo ".incbin \"ggml/src/ggml-metal-embed.metal\"" >> $(TEMP_ASSEMBLY)
|
| 762 |
+
@echo ".globl _ggml_metallib_end" >> $(TEMP_ASSEMBLY)
|
| 763 |
+
@echo "_ggml_metallib_end:" >> $(TEMP_ASSEMBLY)
|
| 764 |
+
@$(AS) $(TEMP_ASSEMBLY) -o $@
|
| 765 |
+
@rm -f ${TEMP_ASSEMBLY}
|
| 766 |
endif
|
| 767 |
+
endif # GGML_METAL
|
| 768 |
|
| 769 |
+
ifdef WHISPER_COREML
|
| 770 |
+
src/coreml/whisper-encoder.o: src/coreml/whisper-encoder.mm src/coreml/whisper-encoder.h
|
| 771 |
+
$(CXX) -O3 -I . -fobjc-arc -c src/coreml/whisper-encoder.mm -o src/coreml/whisper-encoder.o
|
| 772 |
+
|
| 773 |
+
src/coreml/whisper-encoder-impl.o: src/coreml/whisper-encoder-impl.m src/coreml/whisper-encoder-impl.h
|
| 774 |
+
$(CXX) -O3 -I . -fobjc-arc -c src/coreml/whisper-encoder-impl.m -o src/coreml/whisper-encoder-impl.o
|
| 775 |
|
| 776 |
+
OBJ_WHISPER += src/coreml/whisper-encoder.o src/coreml/whisper-encoder-impl.o
|
|
|
|
|
|
|
| 777 |
endif
|
| 778 |
|
| 779 |
+
OBJ_GGML += \
|
| 780 |
+
ggml/src/ggml.o \
|
| 781 |
+
ggml/src/ggml-alloc.o \
|
| 782 |
+
ggml/src/ggml-backend.o \
|
| 783 |
+
ggml/src/ggml-quants.o
|
| 784 |
+
|
| 785 |
+
OBJ_WHISPER += \
|
| 786 |
+
src/whisper.o
|
| 787 |
+
|
| 788 |
+
OBJ_COMMON += \
|
| 789 |
+
examples/common.o \
|
| 790 |
+
examples/common-ggml.o \
|
| 791 |
+
examples/grammar-parser.o
|
| 792 |
+
|
| 793 |
+
OBJ_SDL += \
|
| 794 |
+
examples/common-sdl.o
|
| 795 |
+
|
| 796 |
+
OBJ_ALL = $(OBJ_GGML) $(OBJ_WHISPER) $(OBJ_COMMON) $(OBJ_SDL)
|
| 797 |
+
|
| 798 |
+
LIB_GGML = $(LIB_PRE)ggml$(DSO_EXT)
|
| 799 |
+
LIB_GGML_S = $(LIB_PRE)ggml.a
|
| 800 |
+
|
| 801 |
+
LIB_WHISPER = $(LIB_PRE)whisper$(DSO_EXT)
|
| 802 |
+
LIB_WHISPER_S = $(LIB_PRE)whisper.a
|
| 803 |
+
|
| 804 |
+
LIB_COMMON = $(LIB_PRE)common$(DSO_EXT)
|
| 805 |
+
LIB_COMMON_S = $(LIB_PRE)common.a
|
| 806 |
+
|
| 807 |
+
LIB_COMMON_SDL = $(LIB_PRE)common-sdl$(DSO_EXT)
|
| 808 |
+
LIB_COMMON_SDL_S = $(LIB_PRE)common-sdl.a
|
| 809 |
+
|
| 810 |
+
LIB_ALL = $(LIB_GGML) $(LIB_WHISPER) $(LIB_COMMON) $(LIB_COMMON_SDL)
|
| 811 |
+
LIB_ALL_S = $(LIB_GGML_S) $(LIB_WHISPER_S) $(LIB_COMMON_S) $(LIB_COMMON_SDL_S)
|
| 812 |
+
|
| 813 |
+
GF_CC := $(CC)
|
| 814 |
+
include scripts/get-flags.mk
|
| 815 |
+
|
| 816 |
+
# combine build flags with cmdline overrides
|
| 817 |
+
override CPPFLAGS := $(MK_CPPFLAGS) $(CPPFLAGS)
|
| 818 |
+
override CFLAGS := $(CPPFLAGS) $(MK_CFLAGS) $(GF_CFLAGS) $(CFLAGS)
|
| 819 |
+
BASE_CXXFLAGS := $(MK_CXXFLAGS) $(CXXFLAGS)
|
| 820 |
+
override CXXFLAGS := $(BASE_CXXFLAGS) $(HOST_CXXFLAGS) $(GF_CXXFLAGS) $(CPPFLAGS)
|
| 821 |
+
override NVCCFLAGS := $(MK_NVCCFLAGS) $(NVCCFLAGS)
|
| 822 |
+
override LDFLAGS := $(MK_LDFLAGS) $(LDFLAGS)
|
| 823 |
+
|
| 824 |
+
# identify CUDA host compiler
|
| 825 |
+
ifdef GGML_CUDA
|
| 826 |
+
GF_CC := $(NVCC) $(NVCCFLAGS) 2>/dev/null .c -Xcompiler
|
| 827 |
+
include scripts/get-flags.mk
|
| 828 |
+
CUDA_CXXFLAGS := $(BASE_CXXFLAGS) $(GF_CXXFLAGS) -Wno-pedantic
|
| 829 |
+
endif
|
| 830 |
+
|
| 831 |
+
ifdef WHISPER_CURL
|
| 832 |
+
override CXXFLAGS := $(CXXFLAGS) -DWHISPER_USE_CURL
|
| 833 |
+
override LDFLAGS := $(LDFLAGS) -lcurl
|
| 834 |
endif
|
| 835 |
|
| 836 |
#
|
|
|
|
| 838 |
#
|
| 839 |
|
| 840 |
$(info I whisper.cpp build info: )
|
| 841 |
+
$(info I UNAME_S: $(UNAME_S))
|
| 842 |
+
$(info I UNAME_P: $(UNAME_P))
|
| 843 |
+
$(info I UNAME_M: $(UNAME_M))
|
| 844 |
+
$(info I CFLAGS: $(CFLAGS))
|
| 845 |
+
$(info I CXXFLAGS: $(CXXFLAGS))
|
| 846 |
+
$(info I NVCCFLAGS: $(NVCCFLAGS))
|
| 847 |
+
$(info I LDFLAGS: $(LDFLAGS))
|
| 848 |
+
$(info I CC: $(shell $(CC) --version | head -n 1))
|
| 849 |
+
$(info I CXX: $(shell $(CXX) --version | head -n 1))
|
| 850 |
+
ifdef GGML_CUDA
|
| 851 |
+
$(info I NVCC: $(shell $(NVCC) --version | tail -n 1))
|
| 852 |
+
CUDA_VERSION := $(shell $(NVCC) --version | grep -oP 'release (\K[0-9]+\.[0-9])')
|
| 853 |
+
ifeq ($(shell awk -v "v=$(CUDA_VERSION)" 'BEGIN { print (v < 11.7) }'),1)
|
| 854 |
+
|
| 855 |
+
ifndef CUDA_DOCKER_ARCH
|
| 856 |
+
ifndef CUDA_POWER_ARCH
|
| 857 |
+
$(error I ERROR: For CUDA versions < 11.7 a target CUDA architecture must be explicitly provided via environment variable CUDA_DOCKER_ARCH, e.g. by running "export CUDA_DOCKER_ARCH=compute_XX" on Unix-like systems, where XX is the minimum compute capability that the code needs to run on. A list with compute capabilities can be found here: https://developer.nvidia.com/cuda-gpus )
|
| 858 |
+
endif # CUDA_POWER_ARCH
|
| 859 |
+
endif # CUDA_DOCKER_ARCH
|
| 860 |
+
|
| 861 |
+
endif # eq ($(shell echo "$(CUDA_VERSION) < 11.7" | bc),1)
|
| 862 |
+
endif # GGML_CUDA
|
| 863 |
$(info )
|
| 864 |
|
| 865 |
+
ifdef DEPRECATE_WARNING
|
| 866 |
+
$(info !!! DEPRECATION WARNING !!!)
|
| 867 |
+
$(info The following WHISPER_ options are deprecated and will be removed in the future. Use the GGML_ prefix instead)
|
| 868 |
+
$(info - WHISPER_CUDA)
|
| 869 |
+
$(info - WHISPER_METAL)
|
| 870 |
+
$(info - WHISPER_OPENMP)
|
| 871 |
+
$(info - WHISPER_RPC)
|
| 872 |
+
$(info - WHISPER_SYCL)
|
| 873 |
+
$(info - WHISPER_SYCL_F16)
|
| 874 |
+
$(info - WHISPER_OPENBLAS)
|
| 875 |
+
$(info - WHISPER_OPENBLAS64)
|
| 876 |
+
$(info - WHISPER_BLIS)
|
| 877 |
+
$(info - WHISPER_NO_LLAMAFILE)
|
| 878 |
+
$(info - WHISPER_NO_ACCELERATE)
|
| 879 |
+
$(info - WHISPER_NO_OPENMP)
|
| 880 |
+
$(info - WHISPER_NO_METAL)
|
| 881 |
$(info )
|
| 882 |
endif
|
| 883 |
|
| 884 |
#
|
| 885 |
+
# Build libraries
|
| 886 |
#
|
| 887 |
|
| 888 |
+
# ggml
|
|
|
|
| 889 |
|
| 890 |
+
ggml/src/ggml.o: \
|
| 891 |
+
ggml/src/ggml.c \
|
| 892 |
+
ggml/include/ggml.h
|
| 893 |
$(CC) $(CFLAGS) -c $< -o $@
|
| 894 |
|
| 895 |
+
ggml/src/ggml-alloc.o: \
|
| 896 |
+
ggml/src/ggml-alloc.c \
|
| 897 |
+
ggml/include/ggml.h \
|
| 898 |
+
ggml/include/ggml-alloc.h
|
| 899 |
$(CC) $(CFLAGS) -c $< -o $@
|
| 900 |
|
| 901 |
+
ggml/src/ggml-backend.o: \
|
| 902 |
+
ggml/src/ggml-backend.c \
|
| 903 |
+
ggml/include/ggml.h \
|
| 904 |
+
ggml/include/ggml-backend.h
|
| 905 |
$(CC) $(CFLAGS) -c $< -o $@
|
| 906 |
|
| 907 |
+
ggml/src/ggml-quants.o: \
|
| 908 |
+
ggml/src/ggml-quants.c \
|
| 909 |
+
ggml/include/ggml.h \
|
| 910 |
+
ggml/src/ggml-quants.h \
|
| 911 |
+
ggml/src/ggml-common.h
|
| 912 |
+
$(CC) $(CFLAGS) -c $< -o $@
|
| 913 |
+
|
| 914 |
+
ggml/src/ggml-blas.o: \
|
| 915 |
+
ggml/src/ggml-blas.cpp \
|
| 916 |
+
ggml/include/ggml-blas.h
|
| 917 |
$(CXX) $(CXXFLAGS) -c $< -o $@
|
| 918 |
|
| 919 |
+
ifdef GGML_LLAMAFILE
|
| 920 |
+
ggml/src/sgemm.o: \
|
| 921 |
+
ggml/src/sgemm.cpp \
|
| 922 |
+
ggml/src/sgemm.h \
|
| 923 |
+
ggml/include/ggml.h
|
| 924 |
+
$(CXX) $(CXXFLAGS) -c $< -o $@
|
| 925 |
+
endif # GGML_LLAMAFILE
|
| 926 |
|
| 927 |
+
ifdef GGML_RPC
|
| 928 |
+
ggml/src/ggml-rpc.o: \
|
| 929 |
+
ggml/src/ggml-rpc.cpp \
|
| 930 |
+
ggml/include/ggml-rpc.h
|
| 931 |
+
$(CXX) $(CXXFLAGS) -c $< -o $@
|
| 932 |
+
endif # GGML_RPC
|
| 933 |
+
|
| 934 |
+
$(LIB_GGML): \
|
| 935 |
+
$(OBJ_GGML)
|
| 936 |
+
$(CXX) $(CXXFLAGS) -shared -fPIC -o $@ $^ $(LDFLAGS)
|
| 937 |
+
|
| 938 |
+
$(LIB_GGML_S): \
|
| 939 |
+
$(OBJ_GGML)
|
| 940 |
+
ar rcs $(LIB_GGML_S) $^
|
| 941 |
+
|
| 942 |
+
# whisper
|
| 943 |
+
|
| 944 |
+
src/whisper.o: \
|
| 945 |
+
src/whisper.cpp \
|
| 946 |
+
src/whisper-mel.hpp \
|
| 947 |
+
include/whisper.h \
|
| 948 |
+
ggml/include/ggml.h \
|
| 949 |
+
ggml/include/ggml-alloc.h \
|
| 950 |
+
ggml/include/ggml-backend.h \
|
| 951 |
+
ggml/include/ggml-cuda.h \
|
| 952 |
+
ggml/include/ggml-metal.h
|
| 953 |
$(CXX) $(CXXFLAGS) -c $< -o $@
|
| 954 |
|
| 955 |
+
$(LIB_WHISPER): \
|
| 956 |
+
$(OBJ_WHISPER) \
|
| 957 |
+
$(LIB_GGML)
|
| 958 |
+
$(CXX) $(CXXFLAGS) -shared -fPIC -o $@ $^ $(LDFLAGS)
|
|
|
|
| 959 |
|
| 960 |
+
$(LIB_WHISPER_S): \
|
| 961 |
+
$(OBJ_WHISPER)
|
| 962 |
+
ar rcs $(LIB_WHISPER_S) $^
|
| 963 |
|
| 964 |
+
# common
|
|
|
|
| 965 |
|
| 966 |
+
examples/common.o: \
|
| 967 |
+
examples/common.cpp \
|
| 968 |
+
examples/common.h
|
| 969 |
+
$(CXX) $(CXXFLAGS) -c $< -o $@
|
| 970 |
+
|
| 971 |
+
examples/common-ggml.o: \
|
| 972 |
+
examples/common-ggml.cpp \
|
| 973 |
+
examples/common-ggml.h
|
| 974 |
+
$(CXX) $(CXXFLAGS) -c $< -o $@
|
| 975 |
|
| 976 |
+
$(LIB_COMMON): \
|
| 977 |
+
$(OBJ_COMMON)
|
| 978 |
+
$(CXX) $(CXXFLAGS) -shared -fPIC -o $@ $^ $(LDFLAGS)
|
| 979 |
|
| 980 |
+
$(LIB_COMMON_S): \
|
| 981 |
+
$(OBJ_COMMON)
|
| 982 |
+
ar rcs $(LIB_COMMON_S) $^
|
| 983 |
|
| 984 |
+
# common-sdl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 985 |
|
| 986 |
+
CFLAGS_SDL=$(shell sdl2-config --cflags)
|
| 987 |
+
LDFLAGS_SDL=$(shell sdl2-config --libs)
|
| 988 |
+
|
| 989 |
+
examples/common-sdl.o: \
|
| 990 |
+
examples/common-sdl.cpp \
|
| 991 |
+
examples/common-sdl.h
|
| 992 |
+
$(CXX) $(CXXFLAGS) $(CFLAGS_SDL) -c $< -o $@
|
| 993 |
|
| 994 |
+
$(LIB_COMMON_SDL): \
|
| 995 |
+
$(OBJ_SDL)
|
| 996 |
+
$(CXX) $(CXXFLAGS) -shared -fPIC -o $@ $^ $(LDFLAGS) $(LDFLAGS_SDL)
|
| 997 |
|
| 998 |
+
$(LIB_COMMON_SDL_S): \
|
| 999 |
+
$(OBJ_SDL)
|
| 1000 |
+
ar rcs $(LIB_COMMON_SDL_S) $^
|
| 1001 |
|
| 1002 |
clean:
|
| 1003 |
+
rm -vrf *.dot $(BUILD_TARGETS) $(TEST_TARGETS)
|
| 1004 |
+
rm -rvf src/*.o
|
| 1005 |
+
rm -rvf src/coreml/*.o
|
| 1006 |
+
rm -rvf tests/*.o
|
| 1007 |
+
rm -rvf examples/*.o
|
| 1008 |
+
rm -rvf *.a
|
| 1009 |
+
rm -rvf *.dll
|
| 1010 |
+
rm -rvf *.so
|
| 1011 |
+
rm -rvf *.dot
|
| 1012 |
+
rm -rvf ggml/*.a
|
| 1013 |
+
rm -rvf ggml/*.dll
|
| 1014 |
+
rm -rvf ggml/*.so
|
| 1015 |
+
rm -vrf ggml/src/*.o
|
| 1016 |
+
rm -vrf ggml/src/ggml-metal-embed.metal
|
| 1017 |
+
rm -vrf ggml/src/ggml-cuda/*.o
|
| 1018 |
+
rm -vrf ggml/src/ggml-cuda/template-instances/*.o
|
| 1019 |
+
rm -rvf $(BUILD_TARGETS)
|
| 1020 |
+
rm -rvf $(TEST_TARGETS)
|
| 1021 |
+
find examples -type f -name "*.o" -delete
|
| 1022 |
|
| 1023 |
#
|
| 1024 |
# Examples
|
| 1025 |
#
|
| 1026 |
|
| 1027 |
+
# $< is the first prerequisite, i.e. the source file.
|
| 1028 |
+
# Explicitly compile this to an object file so that it can be cached with ccache.
|
| 1029 |
+
# The source file is then filtered out from $^ (the list of all prerequisites) and the object file is added instead.
|
| 1030 |
+
|
| 1031 |
+
# Helper function that replaces .c, .cpp, and .cu file endings with .o:
|
| 1032 |
+
GET_OBJ_FILE = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(patsubst %.cu,%.o,$(1))))
|
| 1033 |
+
|
| 1034 |
+
main: examples/main/main.cpp \
|
| 1035 |
+
$(OBJ_GGML) $(OBJ_WHISPER) $(OBJ_COMMON)
|
| 1036 |
+
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)
|
| 1037 |
+
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS)
|
| 1038 |
+
@echo
|
| 1039 |
+
@echo '==== Run ./llama-cli -h for help. ===='
|
| 1040 |
+
@echo
|
| 1041 |
+
|
| 1042 |
+
bench: examples/bench/bench.cpp \
|
| 1043 |
+
$(OBJ_GGML) $(OBJ_WHISPER) $(OBJ_COMMON)
|
| 1044 |
+
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)
|
| 1045 |
+
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS)
|
| 1046 |
+
|
| 1047 |
+
quantize: examples/quantize/quantize.cpp \
|
| 1048 |
+
$(OBJ_GGML) $(OBJ_WHISPER) $(OBJ_COMMON)
|
| 1049 |
+
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)
|
| 1050 |
+
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS)
|
| 1051 |
+
|
| 1052 |
+
server: examples/server/server.cpp \
|
| 1053 |
+
$(OBJ_GGML) $(OBJ_WHISPER) $(OBJ_COMMON)
|
| 1054 |
+
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)
|
| 1055 |
+
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS) $(LWINSOCK2)
|
| 1056 |
+
|
| 1057 |
+
command: examples/command/command.cpp \
|
| 1058 |
+
$(OBJ_GGML) $(OBJ_WHISPER) $(OBJ_COMMON) $(OBJ_SDL)
|
| 1059 |
+
$(CXX) $(CXXFLAGS) $(CFLAGS_SDL) -c $< -o $(call GET_OBJ_FILE, $<)
|
| 1060 |
+
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS) $(LDFLAGS_SDL)
|
| 1061 |
+
|
| 1062 |
+
stream: examples/stream/stream.cpp \
|
| 1063 |
+
$(OBJ_GGML) $(OBJ_WHISPER) $(OBJ_COMMON) $(OBJ_SDL)
|
| 1064 |
+
$(CXX) $(CXXFLAGS) $(CFLAGS_SDL) -c $< -o $(call GET_OBJ_FILE, $<)
|
| 1065 |
+
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS) $(LDFLAGS_SDL)
|
| 1066 |
+
|
| 1067 |
+
lsp: examples/lsp/lsp.cpp \
|
| 1068 |
+
$(OBJ_GGML) $(OBJ_WHISPER) $(OBJ_COMMON) $(OBJ_SDL)
|
| 1069 |
+
$(CXX) $(CXXFLAGS) $(CFLAGS_SDL) -c $< -o $(call GET_OBJ_FILE, $<)
|
| 1070 |
+
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS) $(LDFLAGS_SDL)
|
| 1071 |
+
|
| 1072 |
+
talk: examples/talk/talk.cpp examples/talk/gpt-2.cpp \
|
| 1073 |
+
$(OBJ_GGML) $(OBJ_WHISPER) $(OBJ_COMMON) $(OBJ_SDL)
|
| 1074 |
+
$(CXX) $(CXXFLAGS) $(CFLAGS_SDL) -c $< -o $(call GET_OBJ_FILE, $<)
|
| 1075 |
+
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS) $(LDFLAGS_SDL)
|
| 1076 |
+
|
| 1077 |
+
talk-llama: examples/talk-llama/talk-llama.cpp examples/talk-llama/llama.cpp examples/talk-llama/unicode.cpp examples/talk-llama/unicode-data.cpp \
|
| 1078 |
+
$(OBJ_GGML) $(OBJ_WHISPER) $(OBJ_COMMON) $(OBJ_SDL)
|
| 1079 |
+
$(CXX) $(CXXFLAGS) $(CFLAGS_SDL) -c $< -o $(call GET_OBJ_FILE, $<)
|
| 1080 |
+
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS) $(LDFLAGS_SDL)
|
| 1081 |
|
| 1082 |
+
#
|
| 1083 |
+
# Tests
|
| 1084 |
+
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1085 |
|
| 1086 |
+
tests: $(TEST_TARGETS)
|
|
|
|
| 1087 |
|
| 1088 |
+
tests/test-c.o: tests/test-c.c include/whisper.h
|
| 1089 |
+
$(CC) $(CFLAGS) -c $(filter-out %.h,$^) -o $@
|
| 1090 |
|
| 1091 |
+
tests/test-backend-ops: tests/test-backend-ops.cpp \
|
| 1092 |
+
$(OBJ_GGML)
|
| 1093 |
+
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)
|
| 1094 |
+
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS)
|
| 1095 |
|
| 1096 |
#
|
| 1097 |
# Audio samples
|
|
|
|
| 1154 |
./main -m models/[email protected] -f $$f ; \
|
| 1155 |
echo "" ; \
|
| 1156 |
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Package.swift
CHANGED
|
@@ -27,17 +27,15 @@ let package = Package(
|
|
| 27 |
"samples",
|
| 28 |
"tests",
|
| 29 |
"CMakeLists.txt",
|
| 30 |
-
"ggml-cuda.cu",
|
| 31 |
-
"ggml-cuda.h",
|
| 32 |
"Makefile"
|
| 33 |
],
|
| 34 |
sources: [
|
| 35 |
-
"ggml.c",
|
| 36 |
-
"whisper.cpp",
|
| 37 |
-
"ggml-alloc.c",
|
| 38 |
-
"ggml-backend.c",
|
| 39 |
-
"ggml-quants.c",
|
| 40 |
-
"ggml-metal.m"
|
| 41 |
],
|
| 42 |
resources: [.process("ggml-metal.metal")],
|
| 43 |
publicHeadersPath: "spm-headers",
|
|
|
|
| 27 |
"samples",
|
| 28 |
"tests",
|
| 29 |
"CMakeLists.txt",
|
|
|
|
|
|
|
| 30 |
"Makefile"
|
| 31 |
],
|
| 32 |
sources: [
|
| 33 |
+
"ggml/src/ggml.c",
|
| 34 |
+
"src/whisper.cpp",
|
| 35 |
+
"ggml/src/ggml-alloc.c",
|
| 36 |
+
"ggml/src/ggml-backend.c",
|
| 37 |
+
"ggml/src/ggml-quants.c",
|
| 38 |
+
"ggml/src/ggml-metal.m"
|
| 39 |
],
|
| 40 |
resources: [.process("ggml-metal.metal")],
|
| 41 |
publicHeadersPath: "spm-headers",
|
README.md
CHANGED
|
@@ -418,7 +418,7 @@ Now build `whisper.cpp` with CUDA support:
|
|
| 418 |
|
| 419 |
```
|
| 420 |
make clean
|
| 421 |
-
|
| 422 |
```
|
| 423 |
|
| 424 |
## BLAS CPU support via OpenBLAS
|
|
@@ -430,7 +430,7 @@ Now build `whisper.cpp` with OpenBLAS support:
|
|
| 430 |
|
| 431 |
```
|
| 432 |
make clean
|
| 433 |
-
|
| 434 |
```
|
| 435 |
|
| 436 |
## BLAS CPU support via Intel MKL
|
|
|
|
| 418 |
|
| 419 |
```
|
| 420 |
make clean
|
| 421 |
+
GGML_CUDA=1 make -j
|
| 422 |
```
|
| 423 |
|
| 424 |
## BLAS CPU support via OpenBLAS
|
|
|
|
| 430 |
|
| 431 |
```
|
| 432 |
make clean
|
| 433 |
+
GGML_OPENBLAS=1 make -j
|
| 434 |
```
|
| 435 |
|
| 436 |
## BLAS CPU support via Intel MKL
|
bindings/ios
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
Subproject commit a2085436c2eb796af90956b62bd64731f5e5b823
|
|
|
|
|
|
cmake/BuildTypes.cmake
DELETED
|
@@ -1,54 +0,0 @@
|
|
| 1 |
-
# Add new build types
|
| 2 |
-
|
| 3 |
-
# ReleaseGG - Release with enabled asserts
|
| 4 |
-
|
| 5 |
-
SET(CMAKE_CXX_FLAGS_RELEASEGG
|
| 6 |
-
"-O3"
|
| 7 |
-
CACHE STRING "Flags used by the c++ compiler during release builds with enabled asserts."
|
| 8 |
-
FORCE )
|
| 9 |
-
SET(CMAKE_C_FLAGS_RELEASEGG
|
| 10 |
-
"-O3"
|
| 11 |
-
CACHE STRING "Flags used by the compiler during release builds with enabled asserts."
|
| 12 |
-
FORCE )
|
| 13 |
-
SET(CMAKE_EXE_LINKER_FLAGS_RELEASEGG
|
| 14 |
-
""
|
| 15 |
-
CACHE STRING "Flags used for linking binaries during release builds with enabled asserts."
|
| 16 |
-
FORCE )
|
| 17 |
-
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASEGG
|
| 18 |
-
""
|
| 19 |
-
CACHE STRING "Flags used by the shared libraries linker during release builds with enabled asserts."
|
| 20 |
-
FORCE )
|
| 21 |
-
MARK_AS_ADVANCED(
|
| 22 |
-
CMAKE_CXX_FLAGS_RELEASEGG
|
| 23 |
-
CMAKE_C_FLAGS_RELEASEGG
|
| 24 |
-
CMAKE_EXE_LINKER_FLAGS_RELEASEGG
|
| 25 |
-
CMAKE_SHARED_LINKER_FLAGS_RELEASEGG )
|
| 26 |
-
|
| 27 |
-
# RelWithDebInfoGG - RelWithDebInfo with enabled asserts
|
| 28 |
-
|
| 29 |
-
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFOGG
|
| 30 |
-
"-O2 -g"
|
| 31 |
-
CACHE STRING "Flags used by the c++ compiler during release builds with debug symbols and enabled asserts."
|
| 32 |
-
FORCE )
|
| 33 |
-
SET(CMAKE_C_FLAGS_RELWITHDEBINFOGG
|
| 34 |
-
"-O2 -g"
|
| 35 |
-
CACHE STRING "Flags used by the compiler during release builds with debug symbols and enabled asserts."
|
| 36 |
-
FORCE )
|
| 37 |
-
SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFOGG
|
| 38 |
-
""
|
| 39 |
-
CACHE STRING "Flags used for linking binaries during release builds with debug symbols and enabled asserts."
|
| 40 |
-
FORCE )
|
| 41 |
-
SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFOGG
|
| 42 |
-
""
|
| 43 |
-
CACHE STRING "Flags used by the shared libraries linker during release builds with debug symbols and enabled asserts."
|
| 44 |
-
FORCE )
|
| 45 |
-
MARK_AS_ADVANCED(
|
| 46 |
-
CMAKE_CXX_FLAGS_RELWITHDEBINFOGG
|
| 47 |
-
CMAKE_C_FLAGS_RELWITHDEBINFOGG
|
| 48 |
-
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFOGG
|
| 49 |
-
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFOGG )
|
| 50 |
-
|
| 51 |
-
if (NOT XCODE AND NOT MSVC AND NOT CMAKE_BUILD_TYPE)
|
| 52 |
-
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
|
| 53 |
-
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "ReleaseGG" "RelWithDebInfoGG")
|
| 54 |
-
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmake/build-info.cmake
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
set(BUILD_NUMBER 0)
|
| 2 |
+
set(BUILD_COMMIT "unknown")
|
| 3 |
+
set(BUILD_COMPILER "unknown")
|
| 4 |
+
set(BUILD_TARGET "unknown")
|
| 5 |
+
|
| 6 |
+
# Look for git
|
| 7 |
+
find_package(Git)
|
| 8 |
+
if(NOT Git_FOUND)
|
| 9 |
+
find_program(GIT_EXECUTABLE NAMES git git.exe)
|
| 10 |
+
if(GIT_EXECUTABLE)
|
| 11 |
+
set(Git_FOUND TRUE)
|
| 12 |
+
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
|
| 13 |
+
else()
|
| 14 |
+
message(WARNING "Git not found. Build info will not be accurate.")
|
| 15 |
+
endif()
|
| 16 |
+
endif()
|
| 17 |
+
|
| 18 |
+
# Get the commit count and hash
|
| 19 |
+
if(Git_FOUND)
|
| 20 |
+
execute_process(
|
| 21 |
+
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
| 22 |
+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
| 23 |
+
OUTPUT_VARIABLE HEAD
|
| 24 |
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
| 25 |
+
RESULT_VARIABLE RES
|
| 26 |
+
)
|
| 27 |
+
if (RES EQUAL 0)
|
| 28 |
+
set(BUILD_COMMIT ${HEAD})
|
| 29 |
+
endif()
|
| 30 |
+
execute_process(
|
| 31 |
+
COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD
|
| 32 |
+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
| 33 |
+
OUTPUT_VARIABLE COUNT
|
| 34 |
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
| 35 |
+
RESULT_VARIABLE RES
|
| 36 |
+
)
|
| 37 |
+
if (RES EQUAL 0)
|
| 38 |
+
set(BUILD_NUMBER ${COUNT})
|
| 39 |
+
endif()
|
| 40 |
+
endif()
|
| 41 |
+
|
| 42 |
+
if(MSVC)
|
| 43 |
+
set(BUILD_COMPILER "${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
|
| 44 |
+
set(BUILD_TARGET ${CMAKE_VS_PLATFORM_NAME})
|
| 45 |
+
else()
|
| 46 |
+
execute_process(
|
| 47 |
+
COMMAND sh -c "$@ --version | head -1" _ ${CMAKE_C_COMPILER}
|
| 48 |
+
OUTPUT_VARIABLE OUT
|
| 49 |
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
| 50 |
+
)
|
| 51 |
+
set(BUILD_COMPILER ${OUT})
|
| 52 |
+
execute_process(
|
| 53 |
+
COMMAND ${CMAKE_C_COMPILER} -dumpmachine
|
| 54 |
+
OUTPUT_VARIABLE OUT
|
| 55 |
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
| 56 |
+
)
|
| 57 |
+
set(BUILD_TARGET ${OUT})
|
| 58 |
+
endif()
|
cmake/{GitVars.cmake → git-vars.cmake}
RENAMED
|
File without changes
|
cmake/whisper-config.cmake.in
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
set(LLAMA_VERSION @LLAMA_INSTALL_VERSION@)
|
| 2 |
+
set(LLAMA_BUILD_COMMIT @LLAMA_BUILD_COMMIT@)
|
| 3 |
+
set(LLAMA_BUILD_NUMBER @LLAMA_BUILD_NUMBER@)
|
| 4 |
+
set(LLAMA_SHARED_LIB @BUILD_SHARED_LIBS@)
|
| 5 |
+
|
| 6 |
+
set(GGML_BLAS @GGML_BLAS@)
|
| 7 |
+
set(GGML_CUDA @GGML_CUDA@)
|
| 8 |
+
set(GGML_METAL @GGML_METAL@)
|
| 9 |
+
set(GGML_HIPBLAS @GGML_HIPBLAS@)
|
| 10 |
+
set(GGML_ACCELERATE @GGML_ACCELERATE@)
|
| 11 |
+
|
| 12 |
+
@PACKAGE_INIT@
|
| 13 |
+
|
| 14 |
+
set_and_check(LLAMA_INCLUDE_DIR "@PACKAGE_LLAMA_INCLUDE_INSTALL_DIR@")
|
| 15 |
+
set_and_check(LLAMA_LIB_DIR "@PACKAGE_LLAMA_LIB_INSTALL_DIR@")
|
| 16 |
+
set_and_check(LLAMA_BIN_DIR "@PACKAGE_LLAMA_BIN_INSTALL_DIR@")
|
| 17 |
+
|
| 18 |
+
# Ensure transient dependencies satisfied
|
| 19 |
+
|
| 20 |
+
find_package(Threads REQUIRED)
|
| 21 |
+
|
| 22 |
+
if (APPLE AND GGML_ACCELERATE)
|
| 23 |
+
find_library(ACCELERATE_FRAMEWORK Accelerate REQUIRED)
|
| 24 |
+
endif()
|
| 25 |
+
|
| 26 |
+
if (GGML_BLAS)
|
| 27 |
+
find_package(BLAS REQUIRED)
|
| 28 |
+
endif()
|
| 29 |
+
|
| 30 |
+
if (GGML_CUDA)
|
| 31 |
+
find_package(CUDAToolkit REQUIRED)
|
| 32 |
+
endif()
|
| 33 |
+
|
| 34 |
+
if (GGML_METAL)
|
| 35 |
+
find_library(FOUNDATION_LIBRARY Foundation REQUIRED)
|
| 36 |
+
find_library(METAL_FRAMEWORK Metal REQUIRED)
|
| 37 |
+
find_library(METALKIT_FRAMEWORK MetalKit REQUIRED)
|
| 38 |
+
endif()
|
| 39 |
+
|
| 40 |
+
if (GGML_HIPBLAS)
|
| 41 |
+
find_package(hip REQUIRED)
|
| 42 |
+
find_package(hipblas REQUIRED)
|
| 43 |
+
find_package(rocblas REQUIRED)
|
| 44 |
+
endif()
|
| 45 |
+
|
| 46 |
+
find_library(llama_LIBRARY llama
|
| 47 |
+
REQUIRED
|
| 48 |
+
HINTS ${LLAMA_LIB_DIR})
|
| 49 |
+
|
| 50 |
+
set(_llama_link_deps "Threads::Threads" "@LLAMA_EXTRA_LIBS@")
|
| 51 |
+
set(_llama_transient_defines "@LLAMA_TRANSIENT_DEFINES@")
|
| 52 |
+
|
| 53 |
+
add_library(llama UNKNOWN IMPORTED)
|
| 54 |
+
|
| 55 |
+
set_target_properties(llama
|
| 56 |
+
PROPERTIES
|
| 57 |
+
INTERFACE_INCLUDE_DIRECTORIES "${LLAMA_INCLUDE_DIR}"
|
| 58 |
+
INTERFACE_LINK_LIBRARIES "${_llama_link_deps}"
|
| 59 |
+
INTERFACE_COMPILE_DEFINITIONS "${_llama_transient_defines}"
|
| 60 |
+
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
| 61 |
+
IMPORTED_LOCATION "${llama_LIBRARY}"
|
| 62 |
+
INTERFACE_COMPILE_FEATURES cxx_std_11
|
| 63 |
+
POSITION_INDEPENDENT_CODE ON )
|
| 64 |
+
|
| 65 |
+
check_required_components(Llama)
|
cmake/whisper.pc.in
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
prefix=@CMAKE_INSTALL_PREFIX@
|
| 2 |
+
exec_prefix=${prefix}
|
| 3 |
+
libdir=${exec_prefix}/lib
|
| 4 |
+
includedir=${prefix}/include
|
| 5 |
+
|
| 6 |
+
Name: whisper
|
| 7 |
+
Description: Port of OpenAI's Whisper model in C/C++
|
| 8 |
+
Version: @PROJECT_VERSION@
|
| 9 |
+
Libs: -L${libdir} -lwhisper
|
| 10 |
+
Cflags: -I${includedir}
|
examples/bench/bench.cpp
CHANGED
|
@@ -18,7 +18,7 @@ struct whisper_params {
|
|
| 18 |
|
| 19 |
void whisper_print_usage(int argc, char ** argv, const whisper_params & params);
|
| 20 |
|
| 21 |
-
bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
|
| 22 |
for (int i = 1; i < argc; i++) {
|
| 23 |
std::string arg = argv[i];
|
| 24 |
|
|
@@ -58,7 +58,7 @@ void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params & para
|
|
| 58 |
fprintf(stderr, "\n");
|
| 59 |
}
|
| 60 |
|
| 61 |
-
int whisper_bench_full(const whisper_params & params) {
|
| 62 |
// whisper init
|
| 63 |
|
| 64 |
struct whisper_context_params cparams = whisper_context_default_params();
|
|
|
|
| 18 |
|
| 19 |
void whisper_print_usage(int argc, char ** argv, const whisper_params & params);
|
| 20 |
|
| 21 |
+
static bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
|
| 22 |
for (int i = 1; i < argc; i++) {
|
| 23 |
std::string arg = argv[i];
|
| 24 |
|
|
|
|
| 58 |
fprintf(stderr, "\n");
|
| 59 |
}
|
| 60 |
|
| 61 |
+
static int whisper_bench_full(const whisper_params & params) {
|
| 62 |
// whisper init
|
| 63 |
|
| 64 |
struct whisper_context_params cparams = whisper_context_default_params();
|
examples/command/command.cpp
CHANGED
|
@@ -59,7 +59,7 @@ struct whisper_params {
|
|
| 59 |
|
| 60 |
void whisper_print_usage(int argc, char ** argv, const whisper_params & params);
|
| 61 |
|
| 62 |
-
bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
|
| 63 |
for (int i = 1; i < argc; i++) {
|
| 64 |
std::string arg = argv[i];
|
| 65 |
|
|
@@ -130,7 +130,7 @@ void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params & para
|
|
| 130 |
fprintf(stderr, "\n");
|
| 131 |
}
|
| 132 |
|
| 133 |
-
std::string transcribe(
|
| 134 |
whisper_context * ctx,
|
| 135 |
const whisper_params & params,
|
| 136 |
const std::vector<float> & pcmf32,
|
|
@@ -216,7 +216,7 @@ std::string transcribe(
|
|
| 216 |
return result;
|
| 217 |
}
|
| 218 |
|
| 219 |
-
std::vector<std::string> read_allowed_commands(const std::string & fname) {
|
| 220 |
std::vector<std::string> allowed_commands;
|
| 221 |
|
| 222 |
std::ifstream ifs(fname);
|
|
@@ -238,7 +238,7 @@ std::vector<std::string> read_allowed_commands(const std::string & fname) {
|
|
| 238 |
return allowed_commands;
|
| 239 |
}
|
| 240 |
|
| 241 |
-
std::vector<std::string> get_words(const std::string &txt) {
|
| 242 |
std::vector<std::string> words;
|
| 243 |
|
| 244 |
std::istringstream iss(txt);
|
|
@@ -252,7 +252,7 @@ std::vector<std::string> get_words(const std::string &txt) {
|
|
| 252 |
|
| 253 |
// command-list mode
|
| 254 |
// guide the transcription to match the most likely command from a provided list
|
| 255 |
-
int process_command_list(struct whisper_context * ctx, audio_async &audio, const whisper_params ¶ms) {
|
| 256 |
fprintf(stderr, "\n");
|
| 257 |
fprintf(stderr, "%s: guided mode\n", __func__);
|
| 258 |
|
|
@@ -463,7 +463,7 @@ int process_command_list(struct whisper_context * ctx, audio_async &audio, const
|
|
| 463 |
|
| 464 |
// always-prompt mode
|
| 465 |
// transcribe the voice into text after valid prompt
|
| 466 |
-
int always_prompt_transcription(struct whisper_context * ctx, audio_async & audio, const whisper_params & params) {
|
| 467 |
bool is_running = true;
|
| 468 |
bool ask_prompt = true;
|
| 469 |
|
|
@@ -543,7 +543,7 @@ int always_prompt_transcription(struct whisper_context * ctx, audio_async & audi
|
|
| 543 |
|
| 544 |
// general-purpose mode
|
| 545 |
// freely transcribe the voice into text
|
| 546 |
-
int process_general_transcription(struct whisper_context * ctx, audio_async & audio, const whisper_params & params) {
|
| 547 |
bool is_running = true;
|
| 548 |
bool have_prompt = false;
|
| 549 |
bool ask_prompt = true;
|
|
|
|
| 59 |
|
| 60 |
void whisper_print_usage(int argc, char ** argv, const whisper_params & params);
|
| 61 |
|
| 62 |
+
static bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
|
| 63 |
for (int i = 1; i < argc; i++) {
|
| 64 |
std::string arg = argv[i];
|
| 65 |
|
|
|
|
| 130 |
fprintf(stderr, "\n");
|
| 131 |
}
|
| 132 |
|
| 133 |
+
static std::string transcribe(
|
| 134 |
whisper_context * ctx,
|
| 135 |
const whisper_params & params,
|
| 136 |
const std::vector<float> & pcmf32,
|
|
|
|
| 216 |
return result;
|
| 217 |
}
|
| 218 |
|
| 219 |
+
static std::vector<std::string> read_allowed_commands(const std::string & fname) {
|
| 220 |
std::vector<std::string> allowed_commands;
|
| 221 |
|
| 222 |
std::ifstream ifs(fname);
|
|
|
|
| 238 |
return allowed_commands;
|
| 239 |
}
|
| 240 |
|
| 241 |
+
static std::vector<std::string> get_words(const std::string &txt) {
|
| 242 |
std::vector<std::string> words;
|
| 243 |
|
| 244 |
std::istringstream iss(txt);
|
|
|
|
| 252 |
|
| 253 |
// command-list mode
|
| 254 |
// guide the transcription to match the most likely command from a provided list
|
| 255 |
+
static int process_command_list(struct whisper_context * ctx, audio_async &audio, const whisper_params ¶ms) {
|
| 256 |
fprintf(stderr, "\n");
|
| 257 |
fprintf(stderr, "%s: guided mode\n", __func__);
|
| 258 |
|
|
|
|
| 463 |
|
| 464 |
// always-prompt mode
|
| 465 |
// transcribe the voice into text after valid prompt
|
| 466 |
+
static int always_prompt_transcription(struct whisper_context * ctx, audio_async & audio, const whisper_params & params) {
|
| 467 |
bool is_running = true;
|
| 468 |
bool ask_prompt = true;
|
| 469 |
|
|
|
|
| 543 |
|
| 544 |
// general-purpose mode
|
| 545 |
// freely transcribe the voice into text
|
| 546 |
+
static int process_general_transcription(struct whisper_context * ctx, audio_async & audio, const whisper_params & params) {
|
| 547 |
bool is_running = true;
|
| 548 |
bool have_prompt = false;
|
| 549 |
bool ask_prompt = true;
|
examples/common-sdl.cpp
CHANGED
|
@@ -219,7 +219,7 @@ bool sdl_poll_events() {
|
|
| 219 |
case SDL_QUIT:
|
| 220 |
{
|
| 221 |
return false;
|
| 222 |
-
}
|
| 223 |
default:
|
| 224 |
break;
|
| 225 |
}
|
|
|
|
| 219 |
case SDL_QUIT:
|
| 220 |
{
|
| 221 |
return false;
|
| 222 |
+
}
|
| 223 |
default:
|
| 224 |
break;
|
| 225 |
}
|
examples/grammar-parser.cpp
CHANGED
|
@@ -9,7 +9,7 @@
|
|
| 9 |
namespace grammar_parser {
|
| 10 |
// NOTE: assumes valid utf8 (but checks for overrun)
|
| 11 |
// copied from whisper.cpp
|
| 12 |
-
std::pair<uint32_t, const char *> decode_utf8(const char * src) {
|
| 13 |
static const int lookup[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 4 };
|
| 14 |
uint8_t first_byte = static_cast<uint8_t>(*src);
|
| 15 |
uint8_t highbits = first_byte >> 4;
|
|
@@ -24,19 +24,19 @@ namespace grammar_parser {
|
|
| 24 |
return std::make_pair(value, pos);
|
| 25 |
}
|
| 26 |
|
| 27 |
-
uint32_t get_symbol_id(parse_state & state, const char * src, size_t len) {
|
| 28 |
uint32_t next_id = static_cast<uint32_t>(state.symbol_ids.size());
|
| 29 |
auto result = state.symbol_ids.insert(std::make_pair(std::string(src, len), next_id));
|
| 30 |
return result.first->second;
|
| 31 |
}
|
| 32 |
|
| 33 |
-
uint32_t generate_symbol_id(parse_state & state, const std::string & base_name) {
|
| 34 |
uint32_t next_id = static_cast<uint32_t>(state.symbol_ids.size());
|
| 35 |
state.symbol_ids[base_name + '_' + std::to_string(next_id)] = next_id;
|
| 36 |
return next_id;
|
| 37 |
}
|
| 38 |
|
| 39 |
-
void add_rule(
|
| 40 |
parse_state & state,
|
| 41 |
uint32_t rule_id,
|
| 42 |
const std::vector<whisper_grammar_element> & rule) {
|
|
@@ -46,11 +46,11 @@ namespace grammar_parser {
|
|
| 46 |
state.rules[rule_id] = rule;
|
| 47 |
}
|
| 48 |
|
| 49 |
-
bool is_word_char(char c) {
|
| 50 |
return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '-' || ('0' <= c && c <= '9');
|
| 51 |
}
|
| 52 |
|
| 53 |
-
std::pair<uint32_t, const char *> parse_hex(const char * src, int size) {
|
| 54 |
const char * pos = src;
|
| 55 |
const char * end = src + size;
|
| 56 |
uint32_t value = 0;
|
|
@@ -73,7 +73,7 @@ namespace grammar_parser {
|
|
| 73 |
return std::make_pair(value, pos);
|
| 74 |
}
|
| 75 |
|
| 76 |
-
const char * parse_space(const char * src, bool newline_ok) {
|
| 77 |
const char * pos = src;
|
| 78 |
while (*pos == ' ' || *pos == '\t' || *pos == '#' ||
|
| 79 |
(newline_ok && (*pos == '\r' || *pos == '\n'))) {
|
|
@@ -88,7 +88,7 @@ namespace grammar_parser {
|
|
| 88 |
return pos;
|
| 89 |
}
|
| 90 |
|
| 91 |
-
const char * parse_name(const char * src) {
|
| 92 |
const char * pos = src;
|
| 93 |
while (is_word_char(*pos)) {
|
| 94 |
pos++;
|
|
@@ -99,7 +99,7 @@ namespace grammar_parser {
|
|
| 99 |
return pos;
|
| 100 |
}
|
| 101 |
|
| 102 |
-
std::pair<uint32_t, const char *> parse_char(const char * src) {
|
| 103 |
if (*src == '\\') {
|
| 104 |
switch (src[1]) {
|
| 105 |
case 'x': return parse_hex(src + 2, 2);
|
|
@@ -122,14 +122,14 @@ namespace grammar_parser {
|
|
| 122 |
throw std::runtime_error("unexpected end of input");
|
| 123 |
}
|
| 124 |
|
| 125 |
-
const char * parse_alternates(
|
| 126 |
parse_state & state,
|
| 127 |
const char * src,
|
| 128 |
const std::string & rule_name,
|
| 129 |
uint32_t rule_id,
|
| 130 |
bool is_nested);
|
| 131 |
|
| 132 |
-
const char * parse_sequence(
|
| 133 |
parse_state & state,
|
| 134 |
const char * src,
|
| 135 |
const std::string & rule_name,
|
|
@@ -229,7 +229,7 @@ namespace grammar_parser {
|
|
| 229 |
return pos;
|
| 230 |
}
|
| 231 |
|
| 232 |
-
const char * parse_alternates(
|
| 233 |
parse_state & state,
|
| 234 |
const char * src,
|
| 235 |
const std::string & rule_name,
|
|
@@ -247,7 +247,7 @@ namespace grammar_parser {
|
|
| 247 |
return pos;
|
| 248 |
}
|
| 249 |
|
| 250 |
-
const char * parse_rule(parse_state & state, const char * src) {
|
| 251 |
const char * name_end = parse_name(src);
|
| 252 |
const char * pos = parse_space(name_end, false);
|
| 253 |
size_t name_len = name_end - src;
|
|
@@ -285,7 +285,7 @@ namespace grammar_parser {
|
|
| 285 |
}
|
| 286 |
}
|
| 287 |
|
| 288 |
-
void print_grammar_char(FILE * file, uint32_t c) {
|
| 289 |
if (0x20 <= c && c <= 0x7f) {
|
| 290 |
fprintf(file, "%c", static_cast<char>(c));
|
| 291 |
} else {
|
|
@@ -294,7 +294,7 @@ namespace grammar_parser {
|
|
| 294 |
}
|
| 295 |
}
|
| 296 |
|
| 297 |
-
bool is_char_element(whisper_grammar_element elem) {
|
| 298 |
switch (elem.type) {
|
| 299 |
case WHISPER_GRETYPE_CHAR: return true;
|
| 300 |
case WHISPER_GRETYPE_CHAR_NOT: return true;
|
|
@@ -304,7 +304,7 @@ namespace grammar_parser {
|
|
| 304 |
}
|
| 305 |
}
|
| 306 |
|
| 307 |
-
void print_rule_binary(FILE * file, const std::vector<whisper_grammar_element> & rule) {
|
| 308 |
for (auto elem : rule) {
|
| 309 |
switch (elem.type) {
|
| 310 |
case WHISPER_GRETYPE_END: fprintf(file, "END"); break;
|
|
@@ -334,7 +334,7 @@ namespace grammar_parser {
|
|
| 334 |
fprintf(file, "\n");
|
| 335 |
}
|
| 336 |
|
| 337 |
-
void print_rule(
|
| 338 |
FILE * file,
|
| 339 |
uint32_t rule_id,
|
| 340 |
const std::vector<whisper_grammar_element> & rule,
|
|
@@ -413,7 +413,7 @@ namespace grammar_parser {
|
|
| 413 |
}
|
| 414 |
}
|
| 415 |
|
| 416 |
-
std::vector<const whisper_grammar_element *> parse_state::c_rules() const{
|
| 417 |
std::vector<const whisper_grammar_element *> ret;
|
| 418 |
for (const auto & rule : rules) {
|
| 419 |
ret.push_back(rule.data());
|
|
|
|
| 9 |
namespace grammar_parser {
|
| 10 |
// NOTE: assumes valid utf8 (but checks for overrun)
|
| 11 |
// copied from whisper.cpp
|
| 12 |
+
static std::pair<uint32_t, const char *> decode_utf8(const char * src) {
|
| 13 |
static const int lookup[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 4 };
|
| 14 |
uint8_t first_byte = static_cast<uint8_t>(*src);
|
| 15 |
uint8_t highbits = first_byte >> 4;
|
|
|
|
| 24 |
return std::make_pair(value, pos);
|
| 25 |
}
|
| 26 |
|
| 27 |
+
static uint32_t get_symbol_id(parse_state & state, const char * src, size_t len) {
|
| 28 |
uint32_t next_id = static_cast<uint32_t>(state.symbol_ids.size());
|
| 29 |
auto result = state.symbol_ids.insert(std::make_pair(std::string(src, len), next_id));
|
| 30 |
return result.first->second;
|
| 31 |
}
|
| 32 |
|
| 33 |
+
static uint32_t generate_symbol_id(parse_state & state, const std::string & base_name) {
|
| 34 |
uint32_t next_id = static_cast<uint32_t>(state.symbol_ids.size());
|
| 35 |
state.symbol_ids[base_name + '_' + std::to_string(next_id)] = next_id;
|
| 36 |
return next_id;
|
| 37 |
}
|
| 38 |
|
| 39 |
+
static void add_rule(
|
| 40 |
parse_state & state,
|
| 41 |
uint32_t rule_id,
|
| 42 |
const std::vector<whisper_grammar_element> & rule) {
|
|
|
|
| 46 |
state.rules[rule_id] = rule;
|
| 47 |
}
|
| 48 |
|
| 49 |
+
static bool is_word_char(char c) {
|
| 50 |
return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '-' || ('0' <= c && c <= '9');
|
| 51 |
}
|
| 52 |
|
| 53 |
+
static std::pair<uint32_t, const char *> parse_hex(const char * src, int size) {
|
| 54 |
const char * pos = src;
|
| 55 |
const char * end = src + size;
|
| 56 |
uint32_t value = 0;
|
|
|
|
| 73 |
return std::make_pair(value, pos);
|
| 74 |
}
|
| 75 |
|
| 76 |
+
static const char * parse_space(const char * src, bool newline_ok) {
|
| 77 |
const char * pos = src;
|
| 78 |
while (*pos == ' ' || *pos == '\t' || *pos == '#' ||
|
| 79 |
(newline_ok && (*pos == '\r' || *pos == '\n'))) {
|
|
|
|
| 88 |
return pos;
|
| 89 |
}
|
| 90 |
|
| 91 |
+
static const char * parse_name(const char * src) {
|
| 92 |
const char * pos = src;
|
| 93 |
while (is_word_char(*pos)) {
|
| 94 |
pos++;
|
|
|
|
| 99 |
return pos;
|
| 100 |
}
|
| 101 |
|
| 102 |
+
static std::pair<uint32_t, const char *> parse_char(const char * src) {
|
| 103 |
if (*src == '\\') {
|
| 104 |
switch (src[1]) {
|
| 105 |
case 'x': return parse_hex(src + 2, 2);
|
|
|
|
| 122 |
throw std::runtime_error("unexpected end of input");
|
| 123 |
}
|
| 124 |
|
| 125 |
+
static const char * parse_alternates(
|
| 126 |
parse_state & state,
|
| 127 |
const char * src,
|
| 128 |
const std::string & rule_name,
|
| 129 |
uint32_t rule_id,
|
| 130 |
bool is_nested);
|
| 131 |
|
| 132 |
+
static const char * parse_sequence(
|
| 133 |
parse_state & state,
|
| 134 |
const char * src,
|
| 135 |
const std::string & rule_name,
|
|
|
|
| 229 |
return pos;
|
| 230 |
}
|
| 231 |
|
| 232 |
+
static const char * parse_alternates(
|
| 233 |
parse_state & state,
|
| 234 |
const char * src,
|
| 235 |
const std::string & rule_name,
|
|
|
|
| 247 |
return pos;
|
| 248 |
}
|
| 249 |
|
| 250 |
+
static const char * parse_rule(parse_state & state, const char * src) {
|
| 251 |
const char * name_end = parse_name(src);
|
| 252 |
const char * pos = parse_space(name_end, false);
|
| 253 |
size_t name_len = name_end - src;
|
|
|
|
| 285 |
}
|
| 286 |
}
|
| 287 |
|
| 288 |
+
static void print_grammar_char(FILE * file, uint32_t c) {
|
| 289 |
if (0x20 <= c && c <= 0x7f) {
|
| 290 |
fprintf(file, "%c", static_cast<char>(c));
|
| 291 |
} else {
|
|
|
|
| 294 |
}
|
| 295 |
}
|
| 296 |
|
| 297 |
+
static bool is_char_element(whisper_grammar_element elem) {
|
| 298 |
switch (elem.type) {
|
| 299 |
case WHISPER_GRETYPE_CHAR: return true;
|
| 300 |
case WHISPER_GRETYPE_CHAR_NOT: return true;
|
|
|
|
| 304 |
}
|
| 305 |
}
|
| 306 |
|
| 307 |
+
static void print_rule_binary(FILE * file, const std::vector<whisper_grammar_element> & rule) {
|
| 308 |
for (auto elem : rule) {
|
| 309 |
switch (elem.type) {
|
| 310 |
case WHISPER_GRETYPE_END: fprintf(file, "END"); break;
|
|
|
|
| 334 |
fprintf(file, "\n");
|
| 335 |
}
|
| 336 |
|
| 337 |
+
static void print_rule(
|
| 338 |
FILE * file,
|
| 339 |
uint32_t rule_id,
|
| 340 |
const std::vector<whisper_grammar_element> & rule,
|
|
|
|
| 413 |
}
|
| 414 |
}
|
| 415 |
|
| 416 |
+
std::vector<const whisper_grammar_element *> parse_state::c_rules() const {
|
| 417 |
std::vector<const whisper_grammar_element *> ret;
|
| 418 |
for (const auto & rule : rules) {
|
| 419 |
ret.push_back(rule.data());
|
examples/lsp/lsp.cpp
CHANGED
|
@@ -53,7 +53,7 @@ struct commandset {
|
|
| 53 |
|
| 54 |
void whisper_print_usage(int argc, char ** argv, const whisper_params & params);
|
| 55 |
|
| 56 |
-
bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
|
| 57 |
for (int i = 1; i < argc; i++) {
|
| 58 |
std::string arg = argv[i];
|
| 59 |
|
|
@@ -109,7 +109,7 @@ void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params & para
|
|
| 109 |
fprintf(stderr, " -m FNAME, --model FNAME [%-7s] model path\n", params.model.c_str());
|
| 110 |
fprintf(stderr, "\n");
|
| 111 |
}
|
| 112 |
-
uint64_t wait_for_vad(audio_async & audio, json jparams, const whisper_params & params, uint64_t maxlength_ms, std::vector<float> & pcmf32) {
|
| 113 |
using namespace std::chrono;
|
| 114 |
uint64_t time_now = time_point_cast<milliseconds>(system_clock::now()).time_since_epoch().count();
|
| 115 |
uint64_t start_time = time_now;
|
|
@@ -153,7 +153,7 @@ uint64_t wait_for_vad(audio_async & audio, json jparams, const whisper_params &
|
|
| 153 |
return time_now;
|
| 154 |
}
|
| 155 |
|
| 156 |
-
json unguided_transcription(struct whisper_context * ctx, audio_async &audio, json jparams, const whisper_params ¶ms) {
|
| 157 |
std::vector<whisper_token> prompt_tokens;
|
| 158 |
std::vector<float> pcmf32;
|
| 159 |
uint64_t unprocessed_audio_timestamp = wait_for_vad(audio, jparams, params, 10000U, pcmf32);
|
|
@@ -199,7 +199,7 @@ json unguided_transcription(struct whisper_context * ctx, audio_async &audio, js
|
|
| 199 |
|
| 200 |
// command-list mode
|
| 201 |
// guide the transcription to match the most likely command from a provided list
|
| 202 |
-
json guided_transcription(struct whisper_context * ctx, audio_async &audio, const whisper_params ¶ms, json jparams, std::vector<struct commandset> commandset_list) {
|
| 203 |
struct commandset cs = commandset_list[jparams.value("commandset_index", commandset_list.size()-1)];
|
| 204 |
std::vector<float> pcmf32;
|
| 205 |
uint64_t unprocessed_audio_timestamp = wait_for_vad(audio, jparams, params, 2000U, pcmf32);
|
|
@@ -285,7 +285,7 @@ json guided_transcription(struct whisper_context * ctx, audio_async &audio, cons
|
|
| 285 |
}
|
| 286 |
}
|
| 287 |
|
| 288 |
-
json register_commandset(struct whisper_context * ctx, json jparams, std::vector<struct commandset> &commandset_list) {
|
| 289 |
// TODO: check for token collision
|
| 290 |
struct commandset cs;
|
| 291 |
|
|
@@ -325,7 +325,8 @@ json register_commandset(struct whisper_context * ctx, json jparams, std::vector
|
|
| 325 |
commandset_list.push_back(cs);
|
| 326 |
return json{{"index",index}};
|
| 327 |
}
|
| 328 |
-
|
|
|
|
| 329 |
// whisper_state has the pertinent offsets, but there also seem to be a large
|
| 330 |
// number of scratch buffers that would prevent rewinding context in a manner similar to llama
|
| 331 |
// I'll give this a another pass once everything else is implemented,
|
|
@@ -335,7 +336,8 @@ json seek(struct whisper_context * /*ctx*/, audio_async & /*audio*/, json /*para
|
|
| 335 |
{"message", "Seeking is not yet supported."}
|
| 336 |
};
|
| 337 |
}
|
| 338 |
-
|
|
|
|
| 339 |
// See: https://www.jsonrpc.org/specification
|
| 340 |
json id = body.at("id");
|
| 341 |
try {
|
|
@@ -375,7 +377,7 @@ json parse_job(const json &body, struct whisper_context * ctx, audio_async &audi
|
|
| 375 |
}
|
| 376 |
}
|
| 377 |
|
| 378 |
-
void process_loop(struct whisper_context * ctx, audio_async &audio, const whisper_params ¶ms) {
|
| 379 |
std::deque<json> jobqueue;
|
| 380 |
std::vector<struct commandset> commandset_list;
|
| 381 |
while (true) {
|
|
|
|
| 53 |
|
| 54 |
void whisper_print_usage(int argc, char ** argv, const whisper_params & params);
|
| 55 |
|
| 56 |
+
static bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
|
| 57 |
for (int i = 1; i < argc; i++) {
|
| 58 |
std::string arg = argv[i];
|
| 59 |
|
|
|
|
| 109 |
fprintf(stderr, " -m FNAME, --model FNAME [%-7s] model path\n", params.model.c_str());
|
| 110 |
fprintf(stderr, "\n");
|
| 111 |
}
|
| 112 |
+
static uint64_t wait_for_vad(audio_async & audio, json jparams, const whisper_params & params, uint64_t maxlength_ms, std::vector<float> & pcmf32) {
|
| 113 |
using namespace std::chrono;
|
| 114 |
uint64_t time_now = time_point_cast<milliseconds>(system_clock::now()).time_since_epoch().count();
|
| 115 |
uint64_t start_time = time_now;
|
|
|
|
| 153 |
return time_now;
|
| 154 |
}
|
| 155 |
|
| 156 |
+
static json unguided_transcription(struct whisper_context * ctx, audio_async &audio, json jparams, const whisper_params ¶ms) {
|
| 157 |
std::vector<whisper_token> prompt_tokens;
|
| 158 |
std::vector<float> pcmf32;
|
| 159 |
uint64_t unprocessed_audio_timestamp = wait_for_vad(audio, jparams, params, 10000U, pcmf32);
|
|
|
|
| 199 |
|
| 200 |
// command-list mode
|
| 201 |
// guide the transcription to match the most likely command from a provided list
|
| 202 |
+
static json guided_transcription(struct whisper_context * ctx, audio_async &audio, const whisper_params ¶ms, json jparams, std::vector<struct commandset> commandset_list) {
|
| 203 |
struct commandset cs = commandset_list[jparams.value("commandset_index", commandset_list.size()-1)];
|
| 204 |
std::vector<float> pcmf32;
|
| 205 |
uint64_t unprocessed_audio_timestamp = wait_for_vad(audio, jparams, params, 2000U, pcmf32);
|
|
|
|
| 285 |
}
|
| 286 |
}
|
| 287 |
|
| 288 |
+
static json register_commandset(struct whisper_context * ctx, json jparams, std::vector<struct commandset> &commandset_list) {
|
| 289 |
// TODO: check for token collision
|
| 290 |
struct commandset cs;
|
| 291 |
|
|
|
|
| 325 |
commandset_list.push_back(cs);
|
| 326 |
return json{{"index",index}};
|
| 327 |
}
|
| 328 |
+
|
| 329 |
+
static json seek(struct whisper_context * /*ctx*/, audio_async & /*audio*/, json /*params*/) {
|
| 330 |
// whisper_state has the pertinent offsets, but there also seem to be a large
|
| 331 |
// number of scratch buffers that would prevent rewinding context in a manner similar to llama
|
| 332 |
// I'll give this a another pass once everything else is implemented,
|
|
|
|
| 336 |
{"message", "Seeking is not yet supported."}
|
| 337 |
};
|
| 338 |
}
|
| 339 |
+
|
| 340 |
+
static json parse_job(const json &body, struct whisper_context * ctx, audio_async &audio, const whisper_params ¶ms, std::vector<struct commandset> &commandset_list) {
|
| 341 |
// See: https://www.jsonrpc.org/specification
|
| 342 |
json id = body.at("id");
|
| 343 |
try {
|
|
|
|
| 377 |
}
|
| 378 |
}
|
| 379 |
|
| 380 |
+
static void process_loop(struct whisper_context * ctx, audio_async &audio, const whisper_params ¶ms) {
|
| 381 |
std::deque<json> jobqueue;
|
| 382 |
std::vector<struct commandset> commandset_list;
|
| 383 |
while (true) {
|
examples/main/main.cpp
CHANGED
|
@@ -17,7 +17,7 @@
|
|
| 17 |
#endif
|
| 18 |
|
| 19 |
// helper function to replace substrings
|
| 20 |
-
void replace_all(std::string & s, const std::string & search, const std::string & replace) {
|
| 21 |
for (size_t pos = 0; ; pos += replace.length()) {
|
| 22 |
pos = s.find(search, pos);
|
| 23 |
if (pos == std::string::npos) break;
|
|
@@ -94,17 +94,17 @@ struct whisper_params {
|
|
| 94 |
grammar_parser::parse_state grammar_parsed;
|
| 95 |
};
|
| 96 |
|
| 97 |
-
void whisper_print_usage(int argc, char ** argv, const whisper_params & params);
|
| 98 |
|
| 99 |
-
char* whisper_param_turn_lowercase(char* in){
|
| 100 |
int string_len = strlen(in);
|
| 101 |
-
for(int i = 0; i < string_len; i++){
|
| 102 |
*(in+i) = tolower((unsigned char)*(in+i));
|
| 103 |
}
|
| 104 |
return in;
|
| 105 |
}
|
| 106 |
|
| 107 |
-
bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
|
| 108 |
for (int i = 1; i < argc; i++) {
|
| 109 |
std::string arg = argv[i];
|
| 110 |
|
|
@@ -182,7 +182,7 @@ bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
|
|
| 182 |
return true;
|
| 183 |
}
|
| 184 |
|
| 185 |
-
void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params & params) {
|
| 186 |
fprintf(stderr, "\n");
|
| 187 |
fprintf(stderr, "usage: %s [options] file0.wav file1.wav ...\n", argv[0]);
|
| 188 |
fprintf(stderr, "\n");
|
|
@@ -248,7 +248,7 @@ struct whisper_print_user_data {
|
|
| 248 |
int progress_prev;
|
| 249 |
};
|
| 250 |
|
| 251 |
-
std::string estimate_diarization_speaker(std::vector<std::vector<float>> pcmf32s, int64_t t0, int64_t t1, bool id_only = false) {
|
| 252 |
std::string speaker = "";
|
| 253 |
const int64_t n_samples = pcmf32s[0].size();
|
| 254 |
|
|
@@ -280,7 +280,8 @@ std::string estimate_diarization_speaker(std::vector<std::vector<float>> pcmf32s
|
|
| 280 |
|
| 281 |
return speaker;
|
| 282 |
}
|
| 283 |
-
|
|
|
|
| 284 |
int progress_step = ((whisper_print_user_data *) user_data)->params->progress_step;
|
| 285 |
int * progress_prev = &(((whisper_print_user_data *) user_data)->progress_prev);
|
| 286 |
if (progress >= *progress_prev + progress_step) {
|
|
@@ -289,7 +290,7 @@ void whisper_print_progress_callback(struct whisper_context * /*ctx*/, struct wh
|
|
| 289 |
}
|
| 290 |
}
|
| 291 |
|
| 292 |
-
void whisper_print_segment_callback(struct whisper_context * ctx, struct whisper_state * /*state*/, int n_new, void * user_data) {
|
| 293 |
const auto & params = *((whisper_print_user_data *) user_data)->params;
|
| 294 |
const auto & pcmf32s = *((whisper_print_user_data *) user_data)->pcmf32s;
|
| 295 |
|
|
@@ -358,7 +359,7 @@ void whisper_print_segment_callback(struct whisper_context * ctx, struct whisper
|
|
| 358 |
}
|
| 359 |
}
|
| 360 |
|
| 361 |
-
bool output_txt(struct whisper_context * ctx, const char * fname, const whisper_params & params, std::vector<std::vector<float>> pcmf32s) {
|
| 362 |
std::ofstream fout(fname);
|
| 363 |
if (!fout.is_open()) {
|
| 364 |
fprintf(stderr, "%s: failed to open '%s' for writing\n", __func__, fname);
|
|
@@ -385,7 +386,7 @@ bool output_txt(struct whisper_context * ctx, const char * fname, const whisper_
|
|
| 385 |
return true;
|
| 386 |
}
|
| 387 |
|
| 388 |
-
bool output_vtt(struct whisper_context * ctx, const char * fname, const whisper_params & params, std::vector<std::vector<float>> pcmf32s) {
|
| 389 |
std::ofstream fout(fname);
|
| 390 |
if (!fout.is_open()) {
|
| 391 |
fprintf(stderr, "%s: failed to open '%s' for writing\n", __func__, fname);
|
|
@@ -417,7 +418,7 @@ bool output_vtt(struct whisper_context * ctx, const char * fname, const whisper_
|
|
| 417 |
return true;
|
| 418 |
}
|
| 419 |
|
| 420 |
-
bool output_srt(struct whisper_context * ctx, const char * fname, const whisper_params & params, std::vector<std::vector<float>> pcmf32s) {
|
| 421 |
std::ofstream fout(fname);
|
| 422 |
if (!fout.is_open()) {
|
| 423 |
fprintf(stderr, "%s: failed to open '%s' for writing\n", __func__, fname);
|
|
@@ -446,7 +447,7 @@ bool output_srt(struct whisper_context * ctx, const char * fname, const whisper_
|
|
| 446 |
return true;
|
| 447 |
}
|
| 448 |
|
| 449 |
-
char *escape_double_quotes_and_backslashes(const char *str) {
|
| 450 |
if (str == NULL) {
|
| 451 |
return NULL;
|
| 452 |
}
|
|
@@ -459,7 +460,7 @@ char *escape_double_quotes_and_backslashes(const char *str) {
|
|
| 459 |
}
|
| 460 |
}
|
| 461 |
|
| 462 |
-
char *escaped = (char *)calloc(escaped_length, 1); // pre-zeroed
|
| 463 |
if (escaped == NULL) {
|
| 464 |
return NULL;
|
| 465 |
}
|
|
@@ -478,7 +479,7 @@ char *escape_double_quotes_and_backslashes(const char *str) {
|
|
| 478 |
}
|
| 479 |
|
| 480 |
// double quote should be escaped by another double quote. (rfc4180)
|
| 481 |
-
char *escape_double_quotes_in_csv(const char *str) {
|
| 482 |
if (str == NULL) {
|
| 483 |
return NULL;
|
| 484 |
}
|
|
@@ -509,7 +510,7 @@ char *escape_double_quotes_in_csv(const char *str) {
|
|
| 509 |
return escaped;
|
| 510 |
}
|
| 511 |
|
| 512 |
-
bool output_csv(struct whisper_context * ctx, const char * fname, const whisper_params & params, std::vector<std::vector<float>> pcmf32s) {
|
| 513 |
std::ofstream fout(fname);
|
| 514 |
if (!fout.is_open()) {
|
| 515 |
fprintf(stderr, "%s: failed to open '%s' for writing\n", __func__, fname);
|
|
@@ -544,7 +545,7 @@ bool output_csv(struct whisper_context * ctx, const char * fname, const whisper_
|
|
| 544 |
return true;
|
| 545 |
}
|
| 546 |
|
| 547 |
-
bool output_score(struct whisper_context * ctx, const char * fname, const whisper_params & /*params*/, std::vector<std::vector<float>> /*pcmf32s*/) {
|
| 548 |
std::ofstream fout(fname);
|
| 549 |
fprintf(stderr, "%s: saving output to '%s'\n", __func__, fname);
|
| 550 |
|
|
@@ -563,7 +564,7 @@ bool output_score(struct whisper_context * ctx, const char * fname, const whispe
|
|
| 563 |
return true;
|
| 564 |
}
|
| 565 |
|
| 566 |
-
bool output_json(
|
| 567 |
struct whisper_context * ctx,
|
| 568 |
const char * fname,
|
| 569 |
const whisper_params & params,
|
|
@@ -734,7 +735,7 @@ bool output_json(
|
|
| 734 |
// karaoke video generation
|
| 735 |
// outputs a bash script that uses ffmpeg to generate a video with the subtitles
|
| 736 |
// TODO: font parameter adjustments
|
| 737 |
-
bool output_wts(struct whisper_context * ctx, const char * fname, const char * fname_inp, const whisper_params & params, float t_sec, std::vector<std::vector<float>> pcmf32s) {
|
| 738 |
std::ofstream fout(fname);
|
| 739 |
|
| 740 |
fprintf(stderr, "%s: saving output to '%s'\n", __func__, fname);
|
|
@@ -859,7 +860,7 @@ bool output_wts(struct whisper_context * ctx, const char * fname, const char * f
|
|
| 859 |
return true;
|
| 860 |
}
|
| 861 |
|
| 862 |
-
bool output_lrc(struct whisper_context * ctx, const char * fname, const whisper_params & params, std::vector<std::vector<float>> pcmf32s) {
|
| 863 |
std::ofstream fout(fname);
|
| 864 |
if (!fout.is_open()) {
|
| 865 |
fprintf(stderr, "%s: failed to open '%s' for writing\n", __func__, fname);
|
|
@@ -900,7 +901,7 @@ bool output_lrc(struct whisper_context * ctx, const char * fname, const whisper_
|
|
| 900 |
}
|
| 901 |
|
| 902 |
|
| 903 |
-
void cb_log_disable(enum ggml_log_level , const char * , void * ) { }
|
| 904 |
|
| 905 |
int main(int argc, char ** argv) {
|
| 906 |
whisper_params params;
|
|
|
|
| 17 |
#endif
|
| 18 |
|
| 19 |
// helper function to replace substrings
|
| 20 |
+
static void replace_all(std::string & s, const std::string & search, const std::string & replace) {
|
| 21 |
for (size_t pos = 0; ; pos += replace.length()) {
|
| 22 |
pos = s.find(search, pos);
|
| 23 |
if (pos == std::string::npos) break;
|
|
|
|
| 94 |
grammar_parser::parse_state grammar_parsed;
|
| 95 |
};
|
| 96 |
|
| 97 |
+
static void whisper_print_usage(int argc, char ** argv, const whisper_params & params);
|
| 98 |
|
| 99 |
+
static char * whisper_param_turn_lowercase(char * in){
|
| 100 |
int string_len = strlen(in);
|
| 101 |
+
for (int i = 0; i < string_len; i++){
|
| 102 |
*(in+i) = tolower((unsigned char)*(in+i));
|
| 103 |
}
|
| 104 |
return in;
|
| 105 |
}
|
| 106 |
|
| 107 |
+
static bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
|
| 108 |
for (int i = 1; i < argc; i++) {
|
| 109 |
std::string arg = argv[i];
|
| 110 |
|
|
|
|
| 182 |
return true;
|
| 183 |
}
|
| 184 |
|
| 185 |
+
static void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params & params) {
|
| 186 |
fprintf(stderr, "\n");
|
| 187 |
fprintf(stderr, "usage: %s [options] file0.wav file1.wav ...\n", argv[0]);
|
| 188 |
fprintf(stderr, "\n");
|
|
|
|
| 248 |
int progress_prev;
|
| 249 |
};
|
| 250 |
|
| 251 |
+
static std::string estimate_diarization_speaker(std::vector<std::vector<float>> pcmf32s, int64_t t0, int64_t t1, bool id_only = false) {
|
| 252 |
std::string speaker = "";
|
| 253 |
const int64_t n_samples = pcmf32s[0].size();
|
| 254 |
|
|
|
|
| 280 |
|
| 281 |
return speaker;
|
| 282 |
}
|
| 283 |
+
|
| 284 |
+
static void whisper_print_progress_callback(struct whisper_context * /*ctx*/, struct whisper_state * /*state*/, int progress, void * user_data) {
|
| 285 |
int progress_step = ((whisper_print_user_data *) user_data)->params->progress_step;
|
| 286 |
int * progress_prev = &(((whisper_print_user_data *) user_data)->progress_prev);
|
| 287 |
if (progress >= *progress_prev + progress_step) {
|
|
|
|
| 290 |
}
|
| 291 |
}
|
| 292 |
|
| 293 |
+
static void whisper_print_segment_callback(struct whisper_context * ctx, struct whisper_state * /*state*/, int n_new, void * user_data) {
|
| 294 |
const auto & params = *((whisper_print_user_data *) user_data)->params;
|
| 295 |
const auto & pcmf32s = *((whisper_print_user_data *) user_data)->pcmf32s;
|
| 296 |
|
|
|
|
| 359 |
}
|
| 360 |
}
|
| 361 |
|
| 362 |
+
static bool output_txt(struct whisper_context * ctx, const char * fname, const whisper_params & params, std::vector<std::vector<float>> pcmf32s) {
|
| 363 |
std::ofstream fout(fname);
|
| 364 |
if (!fout.is_open()) {
|
| 365 |
fprintf(stderr, "%s: failed to open '%s' for writing\n", __func__, fname);
|
|
|
|
| 386 |
return true;
|
| 387 |
}
|
| 388 |
|
| 389 |
+
static bool output_vtt(struct whisper_context * ctx, const char * fname, const whisper_params & params, std::vector<std::vector<float>> pcmf32s) {
|
| 390 |
std::ofstream fout(fname);
|
| 391 |
if (!fout.is_open()) {
|
| 392 |
fprintf(stderr, "%s: failed to open '%s' for writing\n", __func__, fname);
|
|
|
|
| 418 |
return true;
|
| 419 |
}
|
| 420 |
|
| 421 |
+
static bool output_srt(struct whisper_context * ctx, const char * fname, const whisper_params & params, std::vector<std::vector<float>> pcmf32s) {
|
| 422 |
std::ofstream fout(fname);
|
| 423 |
if (!fout.is_open()) {
|
| 424 |
fprintf(stderr, "%s: failed to open '%s' for writing\n", __func__, fname);
|
|
|
|
| 447 |
return true;
|
| 448 |
}
|
| 449 |
|
| 450 |
+
static char * escape_double_quotes_and_backslashes(const char * str) {
|
| 451 |
if (str == NULL) {
|
| 452 |
return NULL;
|
| 453 |
}
|
|
|
|
| 460 |
}
|
| 461 |
}
|
| 462 |
|
| 463 |
+
char * escaped = (char *)calloc(escaped_length, 1); // pre-zeroed
|
| 464 |
if (escaped == NULL) {
|
| 465 |
return NULL;
|
| 466 |
}
|
|
|
|
| 479 |
}
|
| 480 |
|
| 481 |
// double quote should be escaped by another double quote. (rfc4180)
|
| 482 |
+
static char * escape_double_quotes_in_csv(const char * str) {
|
| 483 |
if (str == NULL) {
|
| 484 |
return NULL;
|
| 485 |
}
|
|
|
|
| 510 |
return escaped;
|
| 511 |
}
|
| 512 |
|
| 513 |
+
static bool output_csv(struct whisper_context * ctx, const char * fname, const whisper_params & params, std::vector<std::vector<float>> pcmf32s) {
|
| 514 |
std::ofstream fout(fname);
|
| 515 |
if (!fout.is_open()) {
|
| 516 |
fprintf(stderr, "%s: failed to open '%s' for writing\n", __func__, fname);
|
|
|
|
| 545 |
return true;
|
| 546 |
}
|
| 547 |
|
| 548 |
+
static bool output_score(struct whisper_context * ctx, const char * fname, const whisper_params & /*params*/, std::vector<std::vector<float>> /*pcmf32s*/) {
|
| 549 |
std::ofstream fout(fname);
|
| 550 |
fprintf(stderr, "%s: saving output to '%s'\n", __func__, fname);
|
| 551 |
|
|
|
|
| 564 |
return true;
|
| 565 |
}
|
| 566 |
|
| 567 |
+
static bool output_json(
|
| 568 |
struct whisper_context * ctx,
|
| 569 |
const char * fname,
|
| 570 |
const whisper_params & params,
|
|
|
|
| 735 |
// karaoke video generation
|
| 736 |
// outputs a bash script that uses ffmpeg to generate a video with the subtitles
|
| 737 |
// TODO: font parameter adjustments
|
| 738 |
+
static bool output_wts(struct whisper_context * ctx, const char * fname, const char * fname_inp, const whisper_params & params, float t_sec, std::vector<std::vector<float>> pcmf32s) {
|
| 739 |
std::ofstream fout(fname);
|
| 740 |
|
| 741 |
fprintf(stderr, "%s: saving output to '%s'\n", __func__, fname);
|
|
|
|
| 860 |
return true;
|
| 861 |
}
|
| 862 |
|
| 863 |
+
static bool output_lrc(struct whisper_context * ctx, const char * fname, const whisper_params & params, std::vector<std::vector<float>> pcmf32s) {
|
| 864 |
std::ofstream fout(fname);
|
| 865 |
if (!fout.is_open()) {
|
| 866 |
fprintf(stderr, "%s: failed to open '%s' for writing\n", __func__, fname);
|
|
|
|
| 901 |
}
|
| 902 |
|
| 903 |
|
| 904 |
+
static void cb_log_disable(enum ggml_log_level , const char * , void * ) { }
|
| 905 |
|
| 906 |
int main(int argc, char ** argv) {
|
| 907 |
whisper_params params;
|
examples/quantize/quantize.cpp
CHANGED
|
@@ -36,7 +36,7 @@ struct whisper_filters {
|
|
| 36 |
};
|
| 37 |
|
| 38 |
// quantize a model
|
| 39 |
-
bool whisper_model_quantize(const std::string & fname_inp, const std::string & fname_out, ggml_ftype ftype) {
|
| 40 |
gpt_vocab vocab;
|
| 41 |
|
| 42 |
printf("%s: loading model from '%s'\n", __func__, fname_inp.c_str());
|
|
|
|
| 36 |
};
|
| 37 |
|
| 38 |
// quantize a model
|
| 39 |
+
static bool whisper_model_quantize(const std::string & fname_inp, const std::string & fname_out, ggml_ftype ftype) {
|
| 40 |
gpt_vocab vocab;
|
| 41 |
|
| 42 |
printf("%s: loading model from '%s'\n", __func__, fname_inp.c_str());
|
examples/stream/stream.cpp
CHANGED
|
@@ -44,7 +44,7 @@ struct whisper_params {
|
|
| 44 |
|
| 45 |
void whisper_print_usage(int argc, char ** argv, const whisper_params & params);
|
| 46 |
|
| 47 |
-
bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
|
| 48 |
for (int i = 1; i < argc; i++) {
|
| 49 |
std::string arg = argv[i];
|
| 50 |
|
|
|
|
| 44 |
|
| 45 |
void whisper_print_usage(int argc, char ** argv, const whisper_params & params);
|
| 46 |
|
| 47 |
+
static bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
|
| 48 |
for (int i = 1; i < argc; i++) {
|
| 49 |
std::string arg = argv[i];
|
| 50 |
|
examples/talk-llama/llama.cpp
CHANGED
|
@@ -225,6 +225,7 @@ enum llm_arch {
|
|
| 225 |
LLM_ARCH_OLMO,
|
| 226 |
LLM_ARCH_ARCTIC,
|
| 227 |
LLM_ARCH_DEEPSEEK2,
|
|
|
|
| 228 |
LLM_ARCH_UNKNOWN,
|
| 229 |
};
|
| 230 |
|
|
@@ -263,6 +264,7 @@ static const std::map<llm_arch, const char *> LLM_ARCH_NAMES = {
|
|
| 263 |
{ LLM_ARCH_OLMO, "olmo" },
|
| 264 |
{ LLM_ARCH_ARCTIC, "arctic" },
|
| 265 |
{ LLM_ARCH_DEEPSEEK2, "deepseek2" },
|
|
|
|
| 266 |
{ LLM_ARCH_UNKNOWN, "(unknown)" },
|
| 267 |
};
|
| 268 |
|
|
@@ -500,6 +502,8 @@ enum llm_tensor {
|
|
| 500 |
LLM_TENSOR_ATTN_KV_B,
|
| 501 |
LLM_TENSOR_ATTN_Q_A_NORM,
|
| 502 |
LLM_TENSOR_ATTN_KV_A_NORM,
|
|
|
|
|
|
|
| 503 |
};
|
| 504 |
|
| 505 |
static const std::map<llm_arch, std::map<llm_tensor, std::string>> LLM_TENSOR_NAMES = {
|
|
@@ -1113,6 +1117,24 @@ static const std::map<llm_arch, std::map<llm_tensor, std::string>> LLM_TENSOR_NA
|
|
| 1113 |
{ LLM_TENSOR_FFN_UP_SHEXP, "blk.%d.ffn_up_shexp" },
|
| 1114 |
},
|
| 1115 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1116 |
{
|
| 1117 |
LLM_ARCH_UNKNOWN,
|
| 1118 |
{
|
|
@@ -2118,6 +2140,8 @@ struct llama_layer {
|
|
| 2118 |
struct ggml_tensor * attn_out_norm_b;
|
| 2119 |
struct ggml_tensor * attn_q_a_norm;
|
| 2120 |
struct ggml_tensor * attn_kv_a_norm;
|
|
|
|
|
|
|
| 2121 |
|
| 2122 |
// attention
|
| 2123 |
struct ggml_tensor * wq;
|
|
@@ -2185,6 +2209,15 @@ struct llama_layer {
|
|
| 2185 |
// long rope factors
|
| 2186 |
struct ggml_tensor * rope_long = nullptr;
|
| 2187 |
struct ggml_tensor * rope_short = nullptr;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2188 |
};
|
| 2189 |
|
| 2190 |
struct llama_kv_cell {
|
|
@@ -2293,6 +2326,8 @@ struct llama_vocab {
|
|
| 2293 |
enum llama_vocab_type type = LLAMA_VOCAB_TYPE_SPM;
|
| 2294 |
enum llama_vocab_pre_type type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
|
| 2295 |
|
|
|
|
|
|
|
| 2296 |
std::unordered_map<token, id> token_to_id;
|
| 2297 |
std::vector<token_data> id_to_token;
|
| 2298 |
|
|
@@ -2310,16 +2345,17 @@ struct llama_vocab {
|
|
| 2310 |
id special_cls_id = -1;
|
| 2311 |
id special_mask_id = -1;
|
| 2312 |
|
| 2313 |
-
int special_add_bos = -1; // -1 unknown, 1 add, 0 don't add.
|
| 2314 |
-
int special_add_eos = -1; // -1 unknown, 1 add, 0 don't add.
|
| 2315 |
-
|
| 2316 |
id linefeed_id = 13;
|
| 2317 |
id special_prefix_id = -1;
|
| 2318 |
id special_suffix_id = -1;
|
| 2319 |
id special_middle_id = -1;
|
| 2320 |
id special_eot_id = -1; // TODO: move above after "eos_id", and here add "file separator" token
|
| 2321 |
|
| 2322 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2323 |
|
| 2324 |
int find_bpe_rank(const std::string & token_left, const std::string & token_right) const {
|
| 2325 |
GGML_ASSERT(token_left.find(' ') == std::string::npos);
|
|
@@ -4707,6 +4743,15 @@ static void llm_load_hparams(
|
|
| 4707 |
default: model.type = e_model::MODEL_UNKNOWN;
|
| 4708 |
}
|
| 4709 |
} break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4710 |
default: (void)0;
|
| 4711 |
}
|
| 4712 |
|
|
@@ -4770,7 +4815,7 @@ static void llm_load_vocab(
|
|
| 4770 |
|
| 4771 |
const int add_space_prefix_keyidx = gguf_find_key(ctx, kv(LLM_KV_TOKENIZER_ADD_PREFIX).c_str());
|
| 4772 |
if (add_space_prefix_keyidx != -1) {
|
| 4773 |
-
vocab.
|
| 4774 |
} // The default value of add_space_prefix is true.
|
| 4775 |
} else if (tokenizer_model == "bert") {
|
| 4776 |
vocab.type = LLAMA_VOCAB_TYPE_WPM;
|
|
@@ -4783,13 +4828,13 @@ static void llm_load_vocab(
|
|
| 4783 |
vocab.special_pad_id = 0;
|
| 4784 |
vocab.special_cls_id = 101;
|
| 4785 |
vocab.special_mask_id = 103;
|
| 4786 |
-
vocab.
|
| 4787 |
} else if (tokenizer_model == "gpt2") {
|
| 4788 |
vocab.type = LLAMA_VOCAB_TYPE_BPE;
|
| 4789 |
|
| 4790 |
const int add_space_prefix_keyidx = gguf_find_key(ctx, kv(LLM_KV_TOKENIZER_ADD_PREFIX).c_str());
|
| 4791 |
if (add_space_prefix_keyidx != -1) {
|
| 4792 |
-
vocab.
|
| 4793 |
}
|
| 4794 |
|
| 4795 |
// read bpe merges and populate bpe ranks
|
|
@@ -4847,6 +4892,8 @@ static void llm_load_vocab(
|
|
| 4847 |
tokenizer_pre == "llama-v3" ||
|
| 4848 |
tokenizer_pre == "llama-bpe") {
|
| 4849 |
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_LLAMA3;
|
|
|
|
|
|
|
| 4850 |
} else if (
|
| 4851 |
tokenizer_pre == "deepseek-llm") {
|
| 4852 |
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEEPSEEK_LLM;
|
|
@@ -4897,6 +4944,14 @@ static void llm_load_vocab(
|
|
| 4897 |
} else {
|
| 4898 |
throw std::runtime_error(format("unknown pre-tokenizer type: '%s'", tokenizer_pre.c_str()));
|
| 4899 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4900 |
} else {
|
| 4901 |
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
|
| 4902 |
}
|
|
@@ -4928,6 +4983,7 @@ static void llm_load_vocab(
|
|
| 4928 |
GGML_ASSERT(unicode_cpts_from_utf8(word).size() > 0);
|
| 4929 |
|
| 4930 |
vocab.token_to_id[word] = i;
|
|
|
|
| 4931 |
|
| 4932 |
auto & token_data = vocab.id_to_token[i];
|
| 4933 |
token_data.text = std::move(word);
|
|
@@ -5041,10 +5097,10 @@ static void llm_load_vocab(
|
|
| 5041 |
bool temp = true;
|
| 5042 |
|
| 5043 |
if (ml.get_key(LLM_KV_TOKENIZER_ADD_BOS, temp, false)) {
|
| 5044 |
-
vocab.
|
| 5045 |
}
|
| 5046 |
if (ml.get_key(LLM_KV_TOKENIZER_ADD_EOS, temp, false)) {
|
| 5047 |
-
vocab.
|
| 5048 |
}
|
| 5049 |
}
|
| 5050 |
|
|
@@ -5144,7 +5200,7 @@ static void llm_load_vocab(
|
|
| 5144 |
);
|
| 5145 |
|
| 5146 |
// set attributes by model/tokenizer name
|
| 5147 |
-
if (_contains_any(tokenizer_pre, {"jina-v2-es", "jina-v2-
|
| 5148 |
_set_token_attr("<mask>", LLAMA_TOKEN_ATTR_LSTRIP, true);
|
| 5149 |
} else if (_contains_any(model_name, {"phi-3", "phi3"})) {
|
| 5150 |
for (auto id : vocab.cache_special_tokens) {
|
|
@@ -5238,6 +5294,8 @@ static void llm_load_print_meta(llama_model_loader & ml, llama_model & model) {
|
|
| 5238 |
if (vocab.special_middle_id != -1) { LLAMA_LOG_INFO( "%s: MID token = %d '%s'\n", __func__, vocab.special_middle_id, vocab.id_to_token[vocab.special_middle_id].text.c_str() ); }
|
| 5239 |
if (vocab.special_eot_id != -1) { LLAMA_LOG_INFO( "%s: EOT token = %d '%s'\n", __func__, vocab.special_eot_id, vocab.id_to_token[vocab.special_eot_id].text.c_str() ); }
|
| 5240 |
|
|
|
|
|
|
|
| 5241 |
if (model.arch == LLM_ARCH_DEEPSEEK2) {
|
| 5242 |
LLAMA_LOG_INFO("%s: n_layer_dense_lead = %d\n", __func__, hparams.n_layer_dense_lead);
|
| 5243 |
LLAMA_LOG_INFO("%s: n_lora_q = %d\n", __func__, hparams.n_lora_q);
|
|
@@ -6639,6 +6697,44 @@ static bool llm_load_tensors(
|
|
| 6639 |
}
|
| 6640 |
}
|
| 6641 |
} break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6642 |
default:
|
| 6643 |
throw std::runtime_error("unknown architecture");
|
| 6644 |
}
|
|
@@ -7279,7 +7375,10 @@ static struct ggml_tensor * llm_build_kqv(
|
|
| 7279 |
|
| 7280 |
ggml_build_forward_expand(graph, cur);
|
| 7281 |
|
| 7282 |
-
|
|
|
|
|
|
|
|
|
|
| 7283 |
if (wo_b) {
|
| 7284 |
cb(cur, "kqv_wo", il);
|
| 7285 |
}
|
|
@@ -7638,6 +7737,50 @@ struct llm_build_context {
|
|
| 7638 |
return lctx.inp_s_seq;
|
| 7639 |
}
|
| 7640 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7641 |
struct ggml_cgraph * build_llama() {
|
| 7642 |
struct ggml_cgraph * gf = ggml_new_graph_custom(ctx0, LLAMA_MAX_NODES, false);
|
| 7643 |
|
|
@@ -8618,8 +8761,6 @@ struct llm_build_context {
|
|
| 8618 |
if (model.arch != LLM_ARCH_JINA_BERT_V2) {
|
| 8619 |
inp_pos = build_inp_pos();
|
| 8620 |
}
|
| 8621 |
-
struct ggml_tensor * inp_mean = build_inp_mean();
|
| 8622 |
-
struct ggml_tensor * inp_cls = build_inp_cls();
|
| 8623 |
|
| 8624 |
// construct input embeddings (token, type, position)
|
| 8625 |
inpL = llm_build_inp_embd(ctx0, lctx, hparams, batch, model.tok_embd, cb);
|
|
@@ -8794,28 +8935,6 @@ struct llm_build_context {
|
|
| 8794 |
cur = inpL;
|
| 8795 |
cb(cur, "result_embd", -1);
|
| 8796 |
|
| 8797 |
-
// pooling layer
|
| 8798 |
-
switch (pooling_type) {
|
| 8799 |
-
case LLAMA_POOLING_TYPE_NONE:
|
| 8800 |
-
{
|
| 8801 |
-
// nop
|
| 8802 |
-
} break;
|
| 8803 |
-
case LLAMA_POOLING_TYPE_MEAN:
|
| 8804 |
-
{
|
| 8805 |
-
cur = ggml_mul_mat(ctx0, ggml_cont(ctx0, ggml_transpose(ctx0, cur)), inp_mean);
|
| 8806 |
-
cb(cur, "result_embd_pooled", -1);
|
| 8807 |
-
} break;
|
| 8808 |
-
case LLAMA_POOLING_TYPE_CLS:
|
| 8809 |
-
{
|
| 8810 |
-
cur = ggml_get_rows(ctx0, cur, inp_cls);
|
| 8811 |
-
cb(cur, "result_embd_pooled", -1);
|
| 8812 |
-
} break;
|
| 8813 |
-
case LLAMA_POOLING_TYPE_UNSPECIFIED:
|
| 8814 |
-
{
|
| 8815 |
-
GGML_ASSERT(false && "Invalid pooling type");
|
| 8816 |
-
} break;
|
| 8817 |
-
}
|
| 8818 |
-
|
| 8819 |
ggml_build_forward_expand(gf, cur);
|
| 8820 |
|
| 8821 |
return gf;
|
|
@@ -11673,6 +11792,153 @@ struct llm_build_context {
|
|
| 11673 |
return gf;
|
| 11674 |
}
|
| 11675 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11676 |
};
|
| 11677 |
|
| 11678 |
static struct ggml_cgraph * llama_build_graph_defrag(llama_context & lctx, const std::vector<uint32_t> & ids) {
|
|
@@ -11896,10 +12162,19 @@ static struct ggml_cgraph * llama_build_graph(
|
|
| 11896 |
{
|
| 11897 |
result = llm.build_deepseek2();
|
| 11898 |
} break;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11899 |
default:
|
| 11900 |
GGML_ASSERT(false);
|
| 11901 |
}
|
| 11902 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11903 |
llm.free();
|
| 11904 |
|
| 11905 |
return result;
|
|
@@ -11989,7 +12264,7 @@ static void llama_set_inputs(llama_context & lctx, const llama_batch & batch) {
|
|
| 11989 |
// (!a || b) is a logical implication (a -> b)
|
| 11990 |
// !hparams.causal_attn -> !cparams.causal_attn
|
| 11991 |
(hparams.causal_attn || !cparams.causal_attn) &&
|
| 11992 |
-
"causal attention
|
| 11993 |
);
|
| 11994 |
|
| 11995 |
if (lctx.inp_KQ_mask) {
|
|
@@ -12121,6 +12396,37 @@ static void llama_set_inputs(llama_context & lctx, const llama_batch & batch) {
|
|
| 12121 |
}
|
| 12122 |
}
|
| 12123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12124 |
if (kv_self.recurrent) {
|
| 12125 |
const int64_t n_kv = kv_self.n;
|
| 12126 |
|
|
@@ -12182,8 +12488,8 @@ static size_t llama_output_reserve(llama_context & lctx, size_t n_outputs) {
|
|
| 12182 |
const auto n_embd = hparams.n_embd;
|
| 12183 |
|
| 12184 |
// TODO: use a per-batch flag for logits presence instead
|
| 12185 |
-
const bool has_logits = cparams.
|
| 12186 |
-
const bool has_embd =
|
| 12187 |
|
| 12188 |
const size_t logits_size = has_logits ? n_vocab*n_outputs_max : 0;
|
| 12189 |
const size_t embd_size = has_embd ? n_embd*n_outputs_max : 0;
|
|
@@ -12313,11 +12619,13 @@ static int llama_decode_internal(
|
|
| 12313 |
std::vector<std::vector<llama_seq_id>> seq_id;
|
| 12314 |
|
| 12315 |
// count outputs
|
| 12316 |
-
if (
|
|
|
|
|
|
|
| 12317 |
for (uint32_t i = 0; i < n_tokens_all; ++i) {
|
| 12318 |
n_outputs += batch_all.logits[i] != 0;
|
| 12319 |
}
|
| 12320 |
-
} else if (lctx.logits_all
|
| 12321 |
n_outputs = n_tokens_all;
|
| 12322 |
} else {
|
| 12323 |
// keep last output only
|
|
@@ -12448,30 +12756,13 @@ static int llama_decode_internal(
|
|
| 12448 |
// no output
|
| 12449 |
res = nullptr;
|
| 12450 |
embd = nullptr;
|
| 12451 |
-
} else if (!hparams.causal_attn) {
|
| 12452 |
-
res = nullptr; // do not extract logits for embedding models such as BERT
|
| 12453 |
-
|
| 12454 |
-
// token or sequence embeddings
|
| 12455 |
-
embd = gf->nodes[gf->n_nodes - 1];
|
| 12456 |
-
|
| 12457 |
-
GGML_ASSERT(strcmp(embd->name, "result_embd") == 0 || strcmp(embd->name, "result_embd_pooled") == 0);
|
| 12458 |
} else if (cparams.embeddings) {
|
| 12459 |
-
|
| 12460 |
-
|
| 12461 |
-
|
| 12462 |
-
|
| 12463 |
-
if (i_embd < 0) { break; }
|
| 12464 |
-
embd = gf->nodes[i_embd];
|
| 12465 |
-
}
|
| 12466 |
-
GGML_ASSERT(i_embd >= 0 && "missing result_norm tensor");
|
| 12467 |
-
|
| 12468 |
-
// TODO: use a per-batch flag to know when to skip logits while keeping embeddings
|
| 12469 |
-
if (!cparams.causal_attn) {
|
| 12470 |
-
res = nullptr; // do not extract logits when not needed
|
| 12471 |
-
// skip computing logits
|
| 12472 |
-
// TODO: is this safe?
|
| 12473 |
-
gf->n_nodes = i_embd + 1;
|
| 12474 |
}
|
|
|
|
| 12475 |
} else {
|
| 12476 |
embd = nullptr; // do not extract embeddings when not needed
|
| 12477 |
GGML_ASSERT(strcmp(res->name, "result_output") == 0 && "missing result_output tensor");
|
|
@@ -12494,12 +12785,6 @@ static int llama_decode_internal(
|
|
| 12494 |
}
|
| 12495 |
}
|
| 12496 |
|
| 12497 |
-
#ifdef GGML_PERF
|
| 12498 |
-
// print timing information per ggml operation (for debugging purposes)
|
| 12499 |
-
// requires GGML_PERF to be defined
|
| 12500 |
-
ggml_graph_print(gf);
|
| 12501 |
-
#endif
|
| 12502 |
-
|
| 12503 |
// plot the computation graph in dot format (for debugging purposes)
|
| 12504 |
//if (n_past%100 == 0) {
|
| 12505 |
// ggml_graph_dump_dot(gf, NULL, "llama.dot");
|
|
@@ -12540,11 +12825,10 @@ static int llama_decode_internal(
|
|
| 12540 |
ggml_backend_tensor_get_async(backend_embd, embd, embd_out, 0, n_outputs_new*n_embd*sizeof(float));
|
| 12541 |
}
|
| 12542 |
} break;
|
| 12543 |
-
case LLAMA_POOLING_TYPE_CLS:
|
| 12544 |
case LLAMA_POOLING_TYPE_MEAN:
|
|
|
|
|
|
|
| 12545 |
{
|
| 12546 |
-
GGML_ASSERT(strcmp(embd->name, "result_embd_pooled") == 0);
|
| 12547 |
-
|
| 12548 |
// extract sequence embeddings
|
| 12549 |
auto & embd_seq_out = lctx.embd_seq;
|
| 12550 |
embd_seq_out.clear();
|
|
@@ -13158,112 +13442,142 @@ struct llm_bigram_bpe {
|
|
| 13158 |
};
|
| 13159 |
|
| 13160 |
struct llm_tokenizer_bpe {
|
| 13161 |
-
llm_tokenizer_bpe(const llama_vocab & vocab): vocab(vocab) {
|
| 13162 |
-
|
| 13163 |
-
|
| 13164 |
-
|
| 13165 |
-
|
| 13166 |
-
|
| 13167 |
-
|
| 13168 |
-
|
| 13169 |
-
|
| 13170 |
-
|
| 13171 |
-
|
| 13172 |
-
|
| 13173 |
-
|
| 13174 |
-
|
| 13175 |
-
|
| 13176 |
-
|
| 13177 |
-
|
| 13178 |
-
|
| 13179 |
-
|
| 13180 |
-
|
| 13181 |
-
|
| 13182 |
-
|
| 13183 |
-
|
| 13184 |
-
|
| 13185 |
-
|
| 13186 |
-
|
| 13187 |
-
|
| 13188 |
-
|
| 13189 |
-
|
| 13190 |
-
|
| 13191 |
-
|
| 13192 |
-
|
| 13193 |
-
|
| 13194 |
-
|
| 13195 |
-
|
| 13196 |
-
|
| 13197 |
-
|
| 13198 |
-
|
| 13199 |
-
|
| 13200 |
-
|
| 13201 |
-
|
| 13202 |
-
|
| 13203 |
-
|
| 13204 |
-
|
| 13205 |
-
|
| 13206 |
-
|
| 13207 |
-
|
| 13208 |
-
|
| 13209 |
-
|
| 13210 |
-
|
| 13211 |
-
|
| 13212 |
-
|
| 13213 |
-
|
| 13214 |
-
|
| 13215 |
-
|
| 13216 |
-
|
| 13217 |
-
|
| 13218 |
-
|
| 13219 |
-
|
| 13220 |
-
|
| 13221 |
-
|
| 13222 |
-
|
| 13223 |
-
|
| 13224 |
-
|
| 13225 |
-
|
| 13226 |
-
|
| 13227 |
-
|
| 13228 |
-
|
| 13229 |
-
|
| 13230 |
-
|
| 13231 |
-
|
| 13232 |
-
|
| 13233 |
-
|
| 13234 |
-
|
| 13235 |
-
|
| 13236 |
-
|
| 13237 |
-
|
| 13238 |
-
|
| 13239 |
-
|
| 13240 |
-
|
| 13241 |
-
|
| 13242 |
-
|
| 13243 |
-
// "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?\\p{L}+|\\p{N}| ?[^\\s\\p{L}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+"
|
| 13244 |
-
"(?:'[sS]|'[tT]|'[rR][eE]|'[vV][eE]|'[mM]|'[lL][lL]|'[dD])|[^\\r\\n\\p{L}\\p{N}]?\\p{L}+|\\p{N}| ?[^\\s\\p{L}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
|
| 13245 |
-
});
|
| 13246 |
-
break;
|
| 13247 |
-
case LLAMA_VOCAB_PRE_TYPE_PORO:
|
| 13248 |
-
word_collection = unicode_regex_split(text, {
|
| 13249 |
-
" ?[^(\\s|.,!?…。,、।۔،)]+",
|
| 13250 |
-
});
|
| 13251 |
-
break;
|
| 13252 |
-
default:
|
| 13253 |
-
// default regex for BPE tokenization pre-processing
|
| 13254 |
-
word_collection = unicode_regex_split(text, {
|
| 13255 |
-
"[\\p{P}\\$\\+<=>\\^~\\|]+",
|
| 13256 |
-
"'s|'t|'re|'ve|'m|'ll|'d| ?\\p{L}+| ?\\p{N}+| ?[^\\s\\p{L}\\p{N}]+|\\s+(?!\\S)",
|
| 13257 |
-
"\\p{N}+",
|
| 13258 |
-
"[0-9][0-9][0-9]",
|
| 13259 |
-
});
|
| 13260 |
-
break;
|
| 13261 |
-
}
|
| 13262 |
break;
|
| 13263 |
default:
|
| 13264 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13265 |
break;
|
| 13266 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13267 |
|
| 13268 |
symbols_final.clear();
|
| 13269 |
|
|
@@ -13274,7 +13588,7 @@ struct llm_tokenizer_bpe {
|
|
| 13274 |
int index = 0;
|
| 13275 |
size_t offset = 0;
|
| 13276 |
|
| 13277 |
-
if (
|
| 13278 |
symbols.emplace_back(llm_symbol{-1, -1, word.c_str(), word.size()});
|
| 13279 |
offset = word.size();
|
| 13280 |
}
|
|
@@ -13355,10 +13669,9 @@ struct llm_tokenizer_bpe {
|
|
| 13355 |
for (auto j = str.begin(); j != str.end(); ++j) {
|
| 13356 |
std::string byte_str(1, *j);
|
| 13357 |
auto token_multibyte = vocab.token_to_id.find(byte_str);
|
| 13358 |
-
if (token_multibyte
|
| 13359 |
-
|
| 13360 |
}
|
| 13361 |
-
output.push_back((*token_multibyte).second);
|
| 13362 |
}
|
| 13363 |
} else {
|
| 13364 |
output.push_back((*token).second);
|
|
@@ -13397,6 +13710,8 @@ private:
|
|
| 13397 |
|
| 13398 |
const llama_vocab & vocab;
|
| 13399 |
|
|
|
|
|
|
|
| 13400 |
std::vector<llm_symbol> symbols;
|
| 13401 |
std::vector<llm_symbol> symbols_final;
|
| 13402 |
|
|
@@ -13406,7 +13721,7 @@ private:
|
|
| 13406 |
struct llm_tokenizer_wpm {
|
| 13407 |
llm_tokenizer_wpm(const llama_vocab & vocab): vocab(vocab) {}
|
| 13408 |
|
| 13409 |
-
void tokenize(const std::string & text, std::vector<llama_vocab::id> & output) {
|
| 13410 |
const auto & token_map = vocab.token_to_id;
|
| 13411 |
|
| 13412 |
// normalize and split by whitespace
|
|
@@ -13415,7 +13730,7 @@ struct llm_tokenizer_wpm {
|
|
| 13415 |
// bos token prepended already
|
| 13416 |
|
| 13417 |
// find the longest tokens that form the words
|
| 13418 |
-
for (const std::string &word : words) {
|
| 13419 |
// skip empty words
|
| 13420 |
if (word.size() == 0) {
|
| 13421 |
continue;
|
|
@@ -13432,7 +13747,7 @@ struct llm_tokenizer_wpm {
|
|
| 13432 |
for (int i = 0; i < n; ++i) {
|
| 13433 |
// loop through possible match length
|
| 13434 |
bool match = false;
|
| 13435 |
-
for (int j = n; j > i; j--) {
|
| 13436 |
auto it = token_map.find(word1.substr(i, j - i));
|
| 13437 |
if (it != token_map.end()) {
|
| 13438 |
output.push_back(it->second);
|
|
@@ -13455,7 +13770,8 @@ struct llm_tokenizer_wpm {
|
|
| 13455 |
}
|
| 13456 |
}
|
| 13457 |
|
| 13458 |
-
|
|
|
|
| 13459 |
const std::vector<uint32_t> cpts_nfd = unicode_cpts_normalize_nfd(unicode_cpts_from_utf8(text));
|
| 13460 |
std::vector<std::string> words(1, "");
|
| 13461 |
|
|
@@ -13677,7 +13993,7 @@ static std::vector<llama_vocab::id> llama_tokenize_internal(const llama_vocab &
|
|
| 13677 |
|
| 13678 |
bool is_prev_special = false;
|
| 13679 |
|
| 13680 |
-
if (add_special && vocab.
|
| 13681 |
GGML_ASSERT(vocab.special_bos_id != -1);
|
| 13682 |
output.push_back(vocab.special_bos_id);
|
| 13683 |
is_prev_special = true;
|
|
@@ -13687,7 +14003,7 @@ static std::vector<llama_vocab::id> llama_tokenize_internal(const llama_vocab &
|
|
| 13687 |
if (fragment.type == FRAGMENT_BUFFER_VARIANT_TYPE_RAW_TEXT) {
|
| 13688 |
auto raw_text = fragment.raw_text.substr(fragment.offset, fragment.length);
|
| 13689 |
|
| 13690 |
-
if (vocab.
|
| 13691 |
if (!output.size() || is_prev_special) { // prefix with space if first token
|
| 13692 |
raw_text = " " + raw_text;
|
| 13693 |
}
|
|
@@ -13705,23 +14021,24 @@ static std::vector<llama_vocab::id> llama_tokenize_internal(const llama_vocab &
|
|
| 13705 |
}
|
| 13706 |
}
|
| 13707 |
|
| 13708 |
-
if (add_special && vocab.
|
| 13709 |
LLAMA_LOG_WARN(
|
| 13710 |
"%s: Added a BOS token to the prompt as specified by the model but the prompt "
|
| 13711 |
"also starts with a BOS token. So now the final prompt starts with 2 BOS tokens. "
|
| 13712 |
"Are you sure this is what you want?\n", __FUNCTION__);
|
| 13713 |
}
|
| 13714 |
|
| 13715 |
-
if (add_special && vocab.
|
| 13716 |
GGML_ASSERT(vocab.special_eos_id != -1);
|
| 13717 |
output.push_back(vocab.special_eos_id);
|
| 13718 |
}
|
| 13719 |
} break;
|
| 13720 |
case LLAMA_VOCAB_TYPE_BPE:
|
| 13721 |
{
|
| 13722 |
-
|
| 13723 |
-
|
| 13724 |
-
|
|
|
|
| 13725 |
}
|
| 13726 |
|
| 13727 |
for (const auto & fragment : fragment_buffer) {
|
|
@@ -13731,23 +14048,15 @@ static std::vector<llama_vocab::id> llama_tokenize_internal(const llama_vocab &
|
|
| 13731 |
#ifdef PRETOKENIZERDEBUG
|
| 13732 |
LLAMA_LOG_WARN("TT: (%ld %ld %ld) '%s'\n", raw_text.length(), fragment.offset, fragment.length, raw_text.c_str());
|
| 13733 |
#endif
|
| 13734 |
-
llm_tokenizer_bpe tokenizer(vocab);
|
| 13735 |
tokenizer.tokenize(raw_text, output);
|
| 13736 |
} else { // if (fragment.type == FRAGMENT_BUFFER_VARIANT_TYPE_TOKEN)
|
| 13737 |
-
|
| 13738 |
}
|
| 13739 |
}
|
| 13740 |
|
| 13741 |
-
if (add_special
|
| 13742 |
-
|
| 13743 |
-
|
| 13744 |
-
"also starts with a BOS token. So now the final prompt starts with 2 BOS tokens. "
|
| 13745 |
-
"Are you sure this is what you want?\n", __FUNCTION__);
|
| 13746 |
-
}
|
| 13747 |
-
|
| 13748 |
-
if (add_special && vocab.special_add_eos == 1) {
|
| 13749 |
-
GGML_ASSERT(vocab.special_add_eos != -1);
|
| 13750 |
-
output.push_back(vocab.special_eos_id);
|
| 13751 |
}
|
| 13752 |
} break;
|
| 13753 |
case LLAMA_VOCAB_TYPE_WPM:
|
|
@@ -13757,6 +14066,8 @@ static std::vector<llama_vocab::id> llama_tokenize_internal(const llama_vocab &
|
|
| 13757 |
output.push_back(vocab.special_cls_id);
|
| 13758 |
}
|
| 13759 |
|
|
|
|
|
|
|
| 13760 |
for (const auto & fragment : fragment_buffer) {
|
| 13761 |
if (fragment.type == FRAGMENT_BUFFER_VARIANT_TYPE_RAW_TEXT) {
|
| 13762 |
auto raw_text = fragment.raw_text.substr(fragment.offset, fragment.length);
|
|
@@ -13764,7 +14075,6 @@ static std::vector<llama_vocab::id> llama_tokenize_internal(const llama_vocab &
|
|
| 13764 |
#ifdef PRETOKENIZERDEBUG
|
| 13765 |
LLAMA_LOG_WARN("TT: (%ld %ld %ld) '%s'\n", raw_text.length(), fragment.offset, fragment.length, raw_text.c_str());
|
| 13766 |
#endif
|
| 13767 |
-
llm_tokenizer_wpm tokenizer(vocab);
|
| 13768 |
tokenizer.tokenize(raw_text, output);
|
| 13769 |
} else { // if (fragment.type == FRAGMENT_BUFFER_VARIANT_TYPE_TOKEN)
|
| 13770 |
output.push_back(fragment.token);
|
|
@@ -16678,6 +16988,7 @@ enum llama_rope_type llama_rope_type(const struct llama_model * model) {
|
|
| 16678 |
case LLM_ARCH_BERT:
|
| 16679 |
case LLM_ARCH_NOMIC_BERT:
|
| 16680 |
case LLM_ARCH_STABLELM:
|
|
|
|
| 16681 |
case LLM_ARCH_QWEN:
|
| 16682 |
case LLM_ARCH_QWEN2:
|
| 16683 |
case LLM_ARCH_QWEN2MOE:
|
|
@@ -18077,6 +18388,10 @@ void llama_set_abort_callback(struct llama_context * ctx, bool (*abort_callback)
|
|
| 18077 |
ctx->abort_callback_data = abort_callback_data;
|
| 18078 |
}
|
| 18079 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18080 |
void llama_set_causal_attn(struct llama_context * ctx, bool causal_attn) {
|
| 18081 |
ctx->cparams.causal_attn = causal_attn;
|
| 18082 |
}
|
|
@@ -18320,11 +18635,11 @@ llama_token llama_token_nl(const struct llama_model * model) {
|
|
| 18320 |
}
|
| 18321 |
|
| 18322 |
int32_t llama_add_bos_token(const struct llama_model * model) {
|
| 18323 |
-
return model->vocab.
|
| 18324 |
}
|
| 18325 |
|
| 18326 |
int32_t llama_add_eos_token(const struct llama_model * model) {
|
| 18327 |
-
return model->vocab.
|
| 18328 |
}
|
| 18329 |
|
| 18330 |
llama_token llama_token_prefix(const struct llama_model * model) {
|
|
|
|
| 225 |
LLM_ARCH_OLMO,
|
| 226 |
LLM_ARCH_ARCTIC,
|
| 227 |
LLM_ARCH_DEEPSEEK2,
|
| 228 |
+
LLM_ARCH_BITNET,
|
| 229 |
LLM_ARCH_UNKNOWN,
|
| 230 |
};
|
| 231 |
|
|
|
|
| 264 |
{ LLM_ARCH_OLMO, "olmo" },
|
| 265 |
{ LLM_ARCH_ARCTIC, "arctic" },
|
| 266 |
{ LLM_ARCH_DEEPSEEK2, "deepseek2" },
|
| 267 |
+
{ LLM_ARCH_BITNET, "bitnet" },
|
| 268 |
{ LLM_ARCH_UNKNOWN, "(unknown)" },
|
| 269 |
};
|
| 270 |
|
|
|
|
| 502 |
LLM_TENSOR_ATTN_KV_B,
|
| 503 |
LLM_TENSOR_ATTN_Q_A_NORM,
|
| 504 |
LLM_TENSOR_ATTN_KV_A_NORM,
|
| 505 |
+
LLM_TENSOR_ATTN_SUB_NORM,
|
| 506 |
+
LLM_TENSOR_FFN_SUB_NORM,
|
| 507 |
};
|
| 508 |
|
| 509 |
static const std::map<llm_arch, std::map<llm_tensor, std::string>> LLM_TENSOR_NAMES = {
|
|
|
|
| 1117 |
{ LLM_TENSOR_FFN_UP_SHEXP, "blk.%d.ffn_up_shexp" },
|
| 1118 |
},
|
| 1119 |
},
|
| 1120 |
+
{
|
| 1121 |
+
LLM_ARCH_BITNET,
|
| 1122 |
+
{
|
| 1123 |
+
{ LLM_TENSOR_TOKEN_EMBD, "token_embd" },
|
| 1124 |
+
{ LLM_TENSOR_OUTPUT_NORM, "output_norm" },
|
| 1125 |
+
{ LLM_TENSOR_ATTN_Q, "blk.%d.attn_q" },
|
| 1126 |
+
{ LLM_TENSOR_ATTN_K, "blk.%d.attn_k" },
|
| 1127 |
+
{ LLM_TENSOR_ATTN_V, "blk.%d.attn_v" },
|
| 1128 |
+
{ LLM_TENSOR_ATTN_OUT, "blk.%d.attn_output" },
|
| 1129 |
+
{ LLM_TENSOR_ATTN_NORM, "blk.%d.attn_norm" },
|
| 1130 |
+
{ LLM_TENSOR_ATTN_SUB_NORM, "blk.%d.attn_sub_norm" },
|
| 1131 |
+
{ LLM_TENSOR_FFN_GATE, "blk.%d.ffn_gate" },
|
| 1132 |
+
{ LLM_TENSOR_FFN_DOWN, "blk.%d.ffn_down" },
|
| 1133 |
+
{ LLM_TENSOR_FFN_UP, "blk.%d.ffn_up" },
|
| 1134 |
+
{ LLM_TENSOR_FFN_NORM, "blk.%d.ffn_norm" },
|
| 1135 |
+
{ LLM_TENSOR_FFN_SUB_NORM, "blk.%d.ffn_sub_norm" },
|
| 1136 |
+
},
|
| 1137 |
+
},
|
| 1138 |
{
|
| 1139 |
LLM_ARCH_UNKNOWN,
|
| 1140 |
{
|
|
|
|
| 2140 |
struct ggml_tensor * attn_out_norm_b;
|
| 2141 |
struct ggml_tensor * attn_q_a_norm;
|
| 2142 |
struct ggml_tensor * attn_kv_a_norm;
|
| 2143 |
+
struct ggml_tensor * attn_sub_norm;
|
| 2144 |
+
struct ggml_tensor * ffn_sub_norm;
|
| 2145 |
|
| 2146 |
// attention
|
| 2147 |
struct ggml_tensor * wq;
|
|
|
|
| 2209 |
// long rope factors
|
| 2210 |
struct ggml_tensor * rope_long = nullptr;
|
| 2211 |
struct ggml_tensor * rope_short = nullptr;
|
| 2212 |
+
|
| 2213 |
+
// bitnet scale
|
| 2214 |
+
struct ggml_tensor * wq_scale;
|
| 2215 |
+
struct ggml_tensor * wk_scale;
|
| 2216 |
+
struct ggml_tensor * wv_scale;
|
| 2217 |
+
struct ggml_tensor * wo_scale;
|
| 2218 |
+
struct ggml_tensor * ffn_gate_scale;
|
| 2219 |
+
struct ggml_tensor * ffn_up_scale;
|
| 2220 |
+
struct ggml_tensor * ffn_down_scale;
|
| 2221 |
};
|
| 2222 |
|
| 2223 |
struct llama_kv_cell {
|
|
|
|
| 2326 |
enum llama_vocab_type type = LLAMA_VOCAB_TYPE_SPM;
|
| 2327 |
enum llama_vocab_pre_type type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
|
| 2328 |
|
| 2329 |
+
int max_token_len = 0; // used for optimizing longest token search
|
| 2330 |
+
|
| 2331 |
std::unordered_map<token, id> token_to_id;
|
| 2332 |
std::vector<token_data> id_to_token;
|
| 2333 |
|
|
|
|
| 2345 |
id special_cls_id = -1;
|
| 2346 |
id special_mask_id = -1;
|
| 2347 |
|
|
|
|
|
|
|
|
|
|
| 2348 |
id linefeed_id = 13;
|
| 2349 |
id special_prefix_id = -1;
|
| 2350 |
id special_suffix_id = -1;
|
| 2351 |
id special_middle_id = -1;
|
| 2352 |
id special_eot_id = -1; // TODO: move above after "eos_id", and here add "file separator" token
|
| 2353 |
|
| 2354 |
+
// tokenizer flags
|
| 2355 |
+
bool tokenizer_add_space_prefix = true;
|
| 2356 |
+
bool tokenizer_add_bos = false;
|
| 2357 |
+
bool tokenizer_add_eos = false;
|
| 2358 |
+
bool tokenizer_ignore_merges = false;
|
| 2359 |
|
| 2360 |
int find_bpe_rank(const std::string & token_left, const std::string & token_right) const {
|
| 2361 |
GGML_ASSERT(token_left.find(' ') == std::string::npos);
|
|
|
|
| 4743 |
default: model.type = e_model::MODEL_UNKNOWN;
|
| 4744 |
}
|
| 4745 |
} break;
|
| 4746 |
+
case LLM_ARCH_BITNET:
|
| 4747 |
+
{
|
| 4748 |
+
ml.get_key(LLM_KV_ATTENTION_LAYERNORM_RMS_EPS, hparams.f_norm_rms_eps);
|
| 4749 |
+
|
| 4750 |
+
switch (hparams.n_layer) {
|
| 4751 |
+
case 26: model.type = e_model::MODEL_3B; break;
|
| 4752 |
+
default: model.type = e_model::MODEL_UNKNOWN;
|
| 4753 |
+
}
|
| 4754 |
+
} break;
|
| 4755 |
default: (void)0;
|
| 4756 |
}
|
| 4757 |
|
|
|
|
| 4815 |
|
| 4816 |
const int add_space_prefix_keyidx = gguf_find_key(ctx, kv(LLM_KV_TOKENIZER_ADD_PREFIX).c_str());
|
| 4817 |
if (add_space_prefix_keyidx != -1) {
|
| 4818 |
+
vocab.tokenizer_add_space_prefix = gguf_get_val_bool(ctx, add_space_prefix_keyidx);
|
| 4819 |
} // The default value of add_space_prefix is true.
|
| 4820 |
} else if (tokenizer_model == "bert") {
|
| 4821 |
vocab.type = LLAMA_VOCAB_TYPE_WPM;
|
|
|
|
| 4828 |
vocab.special_pad_id = 0;
|
| 4829 |
vocab.special_cls_id = 101;
|
| 4830 |
vocab.special_mask_id = 103;
|
| 4831 |
+
vocab.tokenizer_add_space_prefix = false;
|
| 4832 |
} else if (tokenizer_model == "gpt2") {
|
| 4833 |
vocab.type = LLAMA_VOCAB_TYPE_BPE;
|
| 4834 |
|
| 4835 |
const int add_space_prefix_keyidx = gguf_find_key(ctx, kv(LLM_KV_TOKENIZER_ADD_PREFIX).c_str());
|
| 4836 |
if (add_space_prefix_keyidx != -1) {
|
| 4837 |
+
vocab.tokenizer_add_space_prefix = gguf_get_val_bool(ctx, add_space_prefix_keyidx);
|
| 4838 |
}
|
| 4839 |
|
| 4840 |
// read bpe merges and populate bpe ranks
|
|
|
|
| 4892 |
tokenizer_pre == "llama-v3" ||
|
| 4893 |
tokenizer_pre == "llama-bpe") {
|
| 4894 |
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_LLAMA3;
|
| 4895 |
+
vocab.tokenizer_ignore_merges = true;
|
| 4896 |
+
vocab.tokenizer_add_bos = true;
|
| 4897 |
} else if (
|
| 4898 |
tokenizer_pre == "deepseek-llm") {
|
| 4899 |
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEEPSEEK_LLM;
|
|
|
|
| 4944 |
} else {
|
| 4945 |
throw std::runtime_error(format("unknown pre-tokenizer type: '%s'", tokenizer_pre.c_str()));
|
| 4946 |
}
|
| 4947 |
+
} else if (vocab.type == LLAMA_VOCAB_TYPE_SPM) {
|
| 4948 |
+
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
|
| 4949 |
+
vocab.tokenizer_add_bos = true;
|
| 4950 |
+
vocab.tokenizer_add_eos = false;
|
| 4951 |
+
} else if (vocab.type == LLAMA_VOCAB_TYPE_WPM) {
|
| 4952 |
+
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
|
| 4953 |
+
vocab.tokenizer_add_bos = true;
|
| 4954 |
+
vocab.tokenizer_add_eos = false;
|
| 4955 |
} else {
|
| 4956 |
vocab.type_pre = LLAMA_VOCAB_PRE_TYPE_DEFAULT;
|
| 4957 |
}
|
|
|
|
| 4983 |
GGML_ASSERT(unicode_cpts_from_utf8(word).size() > 0);
|
| 4984 |
|
| 4985 |
vocab.token_to_id[word] = i;
|
| 4986 |
+
vocab.max_token_len = std::max(vocab.max_token_len, (int) word.size());
|
| 4987 |
|
| 4988 |
auto & token_data = vocab.id_to_token[i];
|
| 4989 |
token_data.text = std::move(word);
|
|
|
|
| 5097 |
bool temp = true;
|
| 5098 |
|
| 5099 |
if (ml.get_key(LLM_KV_TOKENIZER_ADD_BOS, temp, false)) {
|
| 5100 |
+
vocab.tokenizer_add_bos = temp;
|
| 5101 |
}
|
| 5102 |
if (ml.get_key(LLM_KV_TOKENIZER_ADD_EOS, temp, false)) {
|
| 5103 |
+
vocab.tokenizer_add_eos = temp;
|
| 5104 |
}
|
| 5105 |
}
|
| 5106 |
|
|
|
|
| 5200 |
);
|
| 5201 |
|
| 5202 |
// set attributes by model/tokenizer name
|
| 5203 |
+
if (_contains_any(tokenizer_pre, {"jina-v2-de", "jina-v2-es", "jina-v2-code"})) {
|
| 5204 |
_set_token_attr("<mask>", LLAMA_TOKEN_ATTR_LSTRIP, true);
|
| 5205 |
} else if (_contains_any(model_name, {"phi-3", "phi3"})) {
|
| 5206 |
for (auto id : vocab.cache_special_tokens) {
|
|
|
|
| 5294 |
if (vocab.special_middle_id != -1) { LLAMA_LOG_INFO( "%s: MID token = %d '%s'\n", __func__, vocab.special_middle_id, vocab.id_to_token[vocab.special_middle_id].text.c_str() ); }
|
| 5295 |
if (vocab.special_eot_id != -1) { LLAMA_LOG_INFO( "%s: EOT token = %d '%s'\n", __func__, vocab.special_eot_id, vocab.id_to_token[vocab.special_eot_id].text.c_str() ); }
|
| 5296 |
|
| 5297 |
+
LLAMA_LOG_INFO("%s: max token length = %d\n", __func__, vocab.max_token_len);
|
| 5298 |
+
|
| 5299 |
if (model.arch == LLM_ARCH_DEEPSEEK2) {
|
| 5300 |
LLAMA_LOG_INFO("%s: n_layer_dense_lead = %d\n", __func__, hparams.n_layer_dense_lead);
|
| 5301 |
LLAMA_LOG_INFO("%s: n_lora_q = %d\n", __func__, hparams.n_lora_q);
|
|
|
|
| 6697 |
}
|
| 6698 |
}
|
| 6699 |
} break;
|
| 6700 |
+
case LLM_ARCH_BITNET:
|
| 6701 |
+
{
|
| 6702 |
+
model.tok_embd = ml.create_tensor(ctx_input, tn(LLM_TENSOR_TOKEN_EMBD, "weight"), {n_embd, n_vocab});
|
| 6703 |
+
|
| 6704 |
+
// output
|
| 6705 |
+
{
|
| 6706 |
+
model.output_norm = ml.create_tensor(ctx_output, tn(LLM_TENSOR_OUTPUT_NORM, "weight"), {n_embd});
|
| 6707 |
+
}
|
| 6708 |
+
|
| 6709 |
+
for (int i = 0; i < n_layer; ++i) {
|
| 6710 |
+
ggml_context * ctx_layer = ctx_for_layer(i);
|
| 6711 |
+
ggml_context * ctx_split = ctx_for_layer_split(i);
|
| 6712 |
+
|
| 6713 |
+
auto & layer = model.layers[i];
|
| 6714 |
+
|
| 6715 |
+
layer.attn_norm = ml.create_tensor(ctx_layer, tn(LLM_TENSOR_ATTN_NORM, "weight", i), {n_embd});
|
| 6716 |
+
layer.attn_sub_norm = ml.create_tensor(ctx_layer, tn(LLM_TENSOR_ATTN_SUB_NORM, "weight", i), {n_embd});
|
| 6717 |
+
|
| 6718 |
+
layer.wq = ml.create_tensor(ctx_split, tn(LLM_TENSOR_ATTN_Q, "weight", i), {n_embd, n_embd});
|
| 6719 |
+
layer.wq_scale = ml.create_tensor(ctx_layer, tn(LLM_TENSOR_ATTN_Q, "scale", i), {1});
|
| 6720 |
+
layer.wk = ml.create_tensor(ctx_split, tn(LLM_TENSOR_ATTN_K, "weight", i), {n_embd, n_embd_gqa});
|
| 6721 |
+
layer.wk_scale = ml.create_tensor(ctx_layer, tn(LLM_TENSOR_ATTN_K, "scale", i), {1});
|
| 6722 |
+
layer.wv = ml.create_tensor(ctx_split, tn(LLM_TENSOR_ATTN_V, "weight", i), {n_embd, n_embd_gqa});
|
| 6723 |
+
layer.wv_scale = ml.create_tensor(ctx_layer, tn(LLM_TENSOR_ATTN_V, "scale", i), {1});
|
| 6724 |
+
layer.wo = ml.create_tensor(ctx_split, tn(LLM_TENSOR_ATTN_OUT, "weight", i), {n_embd, n_embd});
|
| 6725 |
+
layer.wo_scale = ml.create_tensor(ctx_layer, tn(LLM_TENSOR_ATTN_OUT, "scale", i), {1});
|
| 6726 |
+
|
| 6727 |
+
layer.ffn_norm = ml.create_tensor(ctx_layer, tn(LLM_TENSOR_FFN_NORM, "weight", i), {n_embd});
|
| 6728 |
+
layer.ffn_sub_norm = ml.create_tensor(ctx_layer, tn(LLM_TENSOR_FFN_SUB_NORM, "weight", i), {n_ff});
|
| 6729 |
+
|
| 6730 |
+
layer.ffn_gate = ml.create_tensor(ctx_split, tn(LLM_TENSOR_FFN_GATE, "weight", i), {n_embd, n_ff});
|
| 6731 |
+
layer.ffn_gate_scale = ml.create_tensor(ctx_layer, tn(LLM_TENSOR_FFN_GATE, "scale", i), {1});
|
| 6732 |
+
layer.ffn_down = ml.create_tensor(ctx_split, tn(LLM_TENSOR_FFN_DOWN, "weight", i), {n_ff, n_embd});
|
| 6733 |
+
layer.ffn_down_scale = ml.create_tensor(ctx_layer, tn(LLM_TENSOR_FFN_DOWN, "scale", i), {1});
|
| 6734 |
+
layer.ffn_up = ml.create_tensor(ctx_split, tn(LLM_TENSOR_FFN_UP, "weight", i), {n_embd, n_ff});
|
| 6735 |
+
layer.ffn_up_scale = ml.create_tensor(ctx_layer, tn(LLM_TENSOR_FFN_UP, "scale", i), {1});
|
| 6736 |
+
}
|
| 6737 |
+
} break;
|
| 6738 |
default:
|
| 6739 |
throw std::runtime_error("unknown architecture");
|
| 6740 |
}
|
|
|
|
| 7375 |
|
| 7376 |
ggml_build_forward_expand(graph, cur);
|
| 7377 |
|
| 7378 |
+
if (wo) {
|
| 7379 |
+
cur = ggml_mul_mat(ctx, wo, cur);
|
| 7380 |
+
}
|
| 7381 |
+
|
| 7382 |
if (wo_b) {
|
| 7383 |
cb(cur, "kqv_wo", il);
|
| 7384 |
}
|
|
|
|
| 7737 |
return lctx.inp_s_seq;
|
| 7738 |
}
|
| 7739 |
|
| 7740 |
+
struct ggml_cgraph * append_pooling(struct ggml_cgraph * gf) {
|
| 7741 |
+
// find result_norm tensor for input
|
| 7742 |
+
struct ggml_tensor * inp = nullptr;
|
| 7743 |
+
for (int i = gf->n_nodes - 1; i >= 0; --i) {
|
| 7744 |
+
inp = gf->nodes[i];
|
| 7745 |
+
if (strcmp(inp->name, "result_norm") == 0 || strcmp(inp->name, "result_embd") == 0) {
|
| 7746 |
+
break;
|
| 7747 |
+
} else {
|
| 7748 |
+
inp = nullptr;
|
| 7749 |
+
}
|
| 7750 |
+
}
|
| 7751 |
+
GGML_ASSERT(inp != nullptr && "missing result_norm/result_embd tensor");
|
| 7752 |
+
|
| 7753 |
+
struct ggml_tensor * cur;
|
| 7754 |
+
|
| 7755 |
+
switch (pooling_type) {
|
| 7756 |
+
case LLAMA_POOLING_TYPE_MEAN:
|
| 7757 |
+
{
|
| 7758 |
+
struct ggml_tensor * inp_mean = build_inp_mean();
|
| 7759 |
+
cur = ggml_mul_mat(ctx0, ggml_cont(ctx0, ggml_transpose(ctx0, inp)), inp_mean);
|
| 7760 |
+
} break;
|
| 7761 |
+
case LLAMA_POOLING_TYPE_CLS:
|
| 7762 |
+
case LLAMA_POOLING_TYPE_LAST:
|
| 7763 |
+
{
|
| 7764 |
+
struct ggml_tensor * inp_cls = build_inp_cls();
|
| 7765 |
+
cur = ggml_get_rows(ctx0, inp, inp_cls);
|
| 7766 |
+
} break;
|
| 7767 |
+
case LLAMA_POOLING_TYPE_NONE:
|
| 7768 |
+
{
|
| 7769 |
+
cur = inp;
|
| 7770 |
+
} break;
|
| 7771 |
+
default:
|
| 7772 |
+
{
|
| 7773 |
+
GGML_ASSERT(false && "unknown pooling type");
|
| 7774 |
+
} break;
|
| 7775 |
+
}
|
| 7776 |
+
|
| 7777 |
+
cb(cur, "result_embd_pooled", -1);
|
| 7778 |
+
|
| 7779 |
+
ggml_build_forward_expand(gf, cur);
|
| 7780 |
+
|
| 7781 |
+
return gf;
|
| 7782 |
+
}
|
| 7783 |
+
|
| 7784 |
struct ggml_cgraph * build_llama() {
|
| 7785 |
struct ggml_cgraph * gf = ggml_new_graph_custom(ctx0, LLAMA_MAX_NODES, false);
|
| 7786 |
|
|
|
|
| 8761 |
if (model.arch != LLM_ARCH_JINA_BERT_V2) {
|
| 8762 |
inp_pos = build_inp_pos();
|
| 8763 |
}
|
|
|
|
|
|
|
| 8764 |
|
| 8765 |
// construct input embeddings (token, type, position)
|
| 8766 |
inpL = llm_build_inp_embd(ctx0, lctx, hparams, batch, model.tok_embd, cb);
|
|
|
|
| 8935 |
cur = inpL;
|
| 8936 |
cb(cur, "result_embd", -1);
|
| 8937 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8938 |
ggml_build_forward_expand(gf, cur);
|
| 8939 |
|
| 8940 |
return gf;
|
|
|
|
| 11792 |
return gf;
|
| 11793 |
}
|
| 11794 |
|
| 11795 |
+
struct ggml_cgraph * build_bitnet() {
|
| 11796 |
+
struct ggml_cgraph * gf = ggml_new_graph_custom(ctx0, LLAMA_MAX_NODES, false);
|
| 11797 |
+
|
| 11798 |
+
const int64_t n_embd_head = hparams.n_embd_head_v;
|
| 11799 |
+
GGML_ASSERT(n_embd_head == hparams.n_embd_head_k);
|
| 11800 |
+
|
| 11801 |
+
struct ggml_tensor * cur;
|
| 11802 |
+
struct ggml_tensor * inpL;
|
| 11803 |
+
|
| 11804 |
+
inpL = llm_build_inp_embd(ctx0, lctx, hparams, batch, model.tok_embd, cb);
|
| 11805 |
+
|
| 11806 |
+
// inp_pos - contains the positions
|
| 11807 |
+
struct ggml_tensor * inp_pos = build_inp_pos();
|
| 11808 |
+
|
| 11809 |
+
// KQ_mask (mask for 1 head, it will be broadcasted to all heads)
|
| 11810 |
+
struct ggml_tensor * KQ_mask = build_inp_KQ_mask();
|
| 11811 |
+
|
| 11812 |
+
for (int il = 0; il < n_layer; ++il) {
|
| 11813 |
+
struct ggml_tensor * inpSA = inpL;
|
| 11814 |
+
|
| 11815 |
+
cur = llm_build_norm(ctx0, inpL, hparams,
|
| 11816 |
+
model.layers[il].attn_norm, NULL,
|
| 11817 |
+
LLM_NORM_RMS, cb, il);
|
| 11818 |
+
cb(cur, "attn_norm", il);
|
| 11819 |
+
|
| 11820 |
+
// self-attention
|
| 11821 |
+
{
|
| 11822 |
+
// compute Q and K and RoPE them
|
| 11823 |
+
struct ggml_tensor * Qcur = ggml_mul_mat(ctx0, model.layers[il].wq, cur);
|
| 11824 |
+
Qcur = ggml_mul(ctx0, Qcur, model.layers[il].wq_scale);
|
| 11825 |
+
cb(Qcur, "Qcur", il);
|
| 11826 |
+
if (model.layers[il].bq) {
|
| 11827 |
+
Qcur = ggml_add(ctx0, Qcur, model.layers[il].bq);
|
| 11828 |
+
cb(Qcur, "Qcur", il);
|
| 11829 |
+
}
|
| 11830 |
+
|
| 11831 |
+
// B1.K
|
| 11832 |
+
struct ggml_tensor * Kcur = ggml_mul_mat(ctx0, model.layers[il].wk, cur);
|
| 11833 |
+
Kcur = ggml_mul(ctx0, Kcur, model.layers[il].wk_scale);
|
| 11834 |
+
cb(Kcur, "Kcur", il);
|
| 11835 |
+
if (model.layers[il].bk) {
|
| 11836 |
+
Kcur = ggml_add(ctx0, Kcur, model.layers[il].bk);
|
| 11837 |
+
cb(Kcur, "Kcur", il);
|
| 11838 |
+
}
|
| 11839 |
+
|
| 11840 |
+
// B1.V
|
| 11841 |
+
struct ggml_tensor * Vcur = ggml_mul_mat(ctx0, model.layers[il].wv, cur);
|
| 11842 |
+
Vcur = ggml_mul(ctx0, Vcur, model.layers[il].wv_scale);
|
| 11843 |
+
cb(Vcur, "Vcur", il);
|
| 11844 |
+
if (model.layers[il].bv) {
|
| 11845 |
+
Vcur = ggml_add(ctx0, Vcur, model.layers[il].bv);
|
| 11846 |
+
cb(Vcur, "Vcur", il);
|
| 11847 |
+
}
|
| 11848 |
+
|
| 11849 |
+
Qcur = ggml_rope_ext(
|
| 11850 |
+
ctx0, ggml_reshape_3d(ctx0, Qcur, n_embd_head, n_head, n_tokens), inp_pos, nullptr,
|
| 11851 |
+
n_rot, rope_type, n_ctx_orig, freq_base, freq_scale,
|
| 11852 |
+
ext_factor, attn_factor, beta_fast, beta_slow
|
| 11853 |
+
);
|
| 11854 |
+
cb(Qcur, "Qcur", il);
|
| 11855 |
+
|
| 11856 |
+
Kcur = ggml_rope_ext(
|
| 11857 |
+
ctx0, ggml_reshape_3d(ctx0, Kcur, n_embd_head, n_head_kv, n_tokens), inp_pos, nullptr,
|
| 11858 |
+
n_rot, rope_type, n_ctx_orig, freq_base, freq_scale,
|
| 11859 |
+
ext_factor, attn_factor, beta_fast, beta_slow
|
| 11860 |
+
);
|
| 11861 |
+
cb(Kcur, "Kcur", il);
|
| 11862 |
+
|
| 11863 |
+
cur = llm_build_kv(ctx0, model, hparams, cparams, kv_self, gf,
|
| 11864 |
+
nullptr, nullptr,
|
| 11865 |
+
Kcur, Vcur, Qcur, KQ_mask, n_tokens, kv_head, n_kv, 1.0f/sqrtf(float(n_embd_head)), cb, il);
|
| 11866 |
+
|
| 11867 |
+
cur = llm_build_norm(ctx0, cur, hparams,
|
| 11868 |
+
model.layers[il].attn_sub_norm, NULL,
|
| 11869 |
+
LLM_NORM_RMS, cb, il);
|
| 11870 |
+
cb(cur, "attn_sub_norm", il);
|
| 11871 |
+
|
| 11872 |
+
cur = ggml_mul_mat(ctx0, model.layers[il].wo, cur);
|
| 11873 |
+
cur = ggml_mul(ctx0, cur, model.layers[il].wo_scale);
|
| 11874 |
+
if (model.layers[il].bo) {
|
| 11875 |
+
cur = ggml_add(ctx0, cur, model.layers[il].bo);
|
| 11876 |
+
}
|
| 11877 |
+
cb(cur, "attn_o_out", il);
|
| 11878 |
+
}
|
| 11879 |
+
|
| 11880 |
+
if (il == n_layer - 1) {
|
| 11881 |
+
// skip computing output for unused tokens
|
| 11882 |
+
struct ggml_tensor * inp_out_ids = build_inp_out_ids();
|
| 11883 |
+
cur = ggml_get_rows(ctx0, cur, inp_out_ids);
|
| 11884 |
+
inpSA = ggml_get_rows(ctx0, inpSA, inp_out_ids);
|
| 11885 |
+
}
|
| 11886 |
+
|
| 11887 |
+
struct ggml_tensor * ffn_inp = ggml_add(ctx0, cur, inpSA);
|
| 11888 |
+
cb(ffn_inp, "ffn_inp", il);
|
| 11889 |
+
|
| 11890 |
+
// feed-forward forward
|
| 11891 |
+
if (model.layers[il].ffn_gate_inp == nullptr) {
|
| 11892 |
+
cur = llm_build_norm(ctx0, ffn_inp, hparams,
|
| 11893 |
+
model.layers[il].ffn_norm, NULL,
|
| 11894 |
+
LLM_NORM_RMS, cb, il);
|
| 11895 |
+
cb(cur, "ffn_norm", il);
|
| 11896 |
+
|
| 11897 |
+
struct ggml_tensor *tmp = ggml_mul_mat(ctx0, model.layers[il].ffn_up, cur);
|
| 11898 |
+
tmp = ggml_mul(ctx0, tmp, model.layers[il].ffn_up_scale);
|
| 11899 |
+
cb(tmp, "ffn_up", il);
|
| 11900 |
+
|
| 11901 |
+
cur = ggml_mul_mat(ctx0, model.layers[il].ffn_gate, cur);
|
| 11902 |
+
cur = ggml_mul(ctx0, cur, model.layers[il].ffn_gate_scale);
|
| 11903 |
+
cb(cur, "ffn_gate", il);
|
| 11904 |
+
|
| 11905 |
+
cur = ggml_silu(ctx0, cur);
|
| 11906 |
+
cb(cur, "ffn_silu", il);
|
| 11907 |
+
|
| 11908 |
+
cur = ggml_mul(ctx0, cur, tmp);
|
| 11909 |
+
cb(cur, "ffn_gate_par", il);
|
| 11910 |
+
|
| 11911 |
+
cur = llm_build_norm(ctx0, cur, hparams,
|
| 11912 |
+
model.layers[il].ffn_sub_norm, NULL,
|
| 11913 |
+
LLM_NORM_RMS, cb, il);
|
| 11914 |
+
cb(cur, "ffn_sub_norm", il);
|
| 11915 |
+
|
| 11916 |
+
cur = ggml_mul_mat(ctx0, model.layers[il].ffn_down, cur);
|
| 11917 |
+
cur = ggml_mul(ctx0, cur, model.layers[il].ffn_down_scale);
|
| 11918 |
+
cb(cur, "ffn_down", il);
|
| 11919 |
+
}
|
| 11920 |
+
cur = ggml_add(ctx0, cur, ffn_inp);
|
| 11921 |
+
cb(cur, "l_out", il);
|
| 11922 |
+
|
| 11923 |
+
// input for next layer
|
| 11924 |
+
inpL = cur;
|
| 11925 |
+
}
|
| 11926 |
+
|
| 11927 |
+
cur = inpL;
|
| 11928 |
+
|
| 11929 |
+
cur = llm_build_norm(ctx0, cur, hparams,
|
| 11930 |
+
model.output_norm, NULL,
|
| 11931 |
+
LLM_NORM_RMS, cb, -1);
|
| 11932 |
+
cb(cur, "result_norm", -1);
|
| 11933 |
+
|
| 11934 |
+
// lm_head
|
| 11935 |
+
cur = ggml_mul_mat(ctx0, model.tok_embd, cur);
|
| 11936 |
+
cb(cur, "result_output", -1);
|
| 11937 |
+
|
| 11938 |
+
ggml_build_forward_expand(gf, cur);
|
| 11939 |
+
return gf;
|
| 11940 |
+
}
|
| 11941 |
+
|
| 11942 |
};
|
| 11943 |
|
| 11944 |
static struct ggml_cgraph * llama_build_graph_defrag(llama_context & lctx, const std::vector<uint32_t> & ids) {
|
|
|
|
| 12162 |
{
|
| 12163 |
result = llm.build_deepseek2();
|
| 12164 |
} break;
|
| 12165 |
+
case LLM_ARCH_BITNET:
|
| 12166 |
+
{
|
| 12167 |
+
result = llm.build_bitnet();
|
| 12168 |
+
} break;
|
| 12169 |
default:
|
| 12170 |
GGML_ASSERT(false);
|
| 12171 |
}
|
| 12172 |
|
| 12173 |
+
// add on pooling layer
|
| 12174 |
+
if (lctx.cparams.embeddings) {
|
| 12175 |
+
result = llm.append_pooling(result);
|
| 12176 |
+
}
|
| 12177 |
+
|
| 12178 |
llm.free();
|
| 12179 |
|
| 12180 |
return result;
|
|
|
|
| 12264 |
// (!a || b) is a logical implication (a -> b)
|
| 12265 |
// !hparams.causal_attn -> !cparams.causal_attn
|
| 12266 |
(hparams.causal_attn || !cparams.causal_attn) &&
|
| 12267 |
+
"causal attention is not supported by this model"
|
| 12268 |
);
|
| 12269 |
|
| 12270 |
if (lctx.inp_KQ_mask) {
|
|
|
|
| 12396 |
}
|
| 12397 |
}
|
| 12398 |
|
| 12399 |
+
if (cparams.pooling_type == LLAMA_POOLING_TYPE_LAST) {
|
| 12400 |
+
const int64_t n_tokens = batch.n_tokens;
|
| 12401 |
+
|
| 12402 |
+
GGML_ASSERT(lctx.inp_cls);
|
| 12403 |
+
GGML_ASSERT(ggml_backend_buffer_is_host(lctx.inp_cls->buffer));
|
| 12404 |
+
|
| 12405 |
+
uint32_t * data = (uint32_t *) lctx.inp_cls->data;
|
| 12406 |
+
memset(lctx.inp_cls->data, 0, n_tokens * ggml_element_size(lctx.inp_cls));
|
| 12407 |
+
|
| 12408 |
+
std::vector<int> last_pos(n_tokens, -1);
|
| 12409 |
+
std::vector<int> last_row(n_tokens, -1);
|
| 12410 |
+
|
| 12411 |
+
for (int i = 0; i < n_tokens; ++i) {
|
| 12412 |
+
const llama_seq_id seq_id = batch.seq_id[i][0];
|
| 12413 |
+
const llama_pos pos = batch.pos[i];
|
| 12414 |
+
|
| 12415 |
+
GGML_ASSERT(seq_id < n_tokens && "seq_id cannot be larger than n_tokens with pooling_type == LAST");
|
| 12416 |
+
|
| 12417 |
+
if (pos >= last_pos[seq_id]) {
|
| 12418 |
+
last_pos[seq_id] = pos;
|
| 12419 |
+
last_row[seq_id] = i;
|
| 12420 |
+
}
|
| 12421 |
+
}
|
| 12422 |
+
|
| 12423 |
+
for (int i = 0; i < n_tokens; ++i) {
|
| 12424 |
+
if (last_row[i] >= 0) {
|
| 12425 |
+
data[i] = last_row[i];
|
| 12426 |
+
}
|
| 12427 |
+
}
|
| 12428 |
+
}
|
| 12429 |
+
|
| 12430 |
if (kv_self.recurrent) {
|
| 12431 |
const int64_t n_kv = kv_self.n;
|
| 12432 |
|
|
|
|
| 12488 |
const auto n_embd = hparams.n_embd;
|
| 12489 |
|
| 12490 |
// TODO: use a per-batch flag for logits presence instead
|
| 12491 |
+
const bool has_logits = !cparams.embeddings;
|
| 12492 |
+
const bool has_embd = cparams.embeddings && (cparams.pooling_type == LLAMA_POOLING_TYPE_NONE);
|
| 12493 |
|
| 12494 |
const size_t logits_size = has_logits ? n_vocab*n_outputs_max : 0;
|
| 12495 |
const size_t embd_size = has_embd ? n_embd*n_outputs_max : 0;
|
|
|
|
| 12619 |
std::vector<std::vector<llama_seq_id>> seq_id;
|
| 12620 |
|
| 12621 |
// count outputs
|
| 12622 |
+
if (cparams.embeddings && cparams.pooling_type != LLAMA_POOLING_TYPE_NONE) {
|
| 12623 |
+
n_outputs = n_tokens_all;
|
| 12624 |
+
} else if (batch_all.logits) {
|
| 12625 |
for (uint32_t i = 0; i < n_tokens_all; ++i) {
|
| 12626 |
n_outputs += batch_all.logits[i] != 0;
|
| 12627 |
}
|
| 12628 |
+
} else if (lctx.logits_all) {
|
| 12629 |
n_outputs = n_tokens_all;
|
| 12630 |
} else {
|
| 12631 |
// keep last output only
|
|
|
|
| 12756 |
// no output
|
| 12757 |
res = nullptr;
|
| 12758 |
embd = nullptr;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12759 |
} else if (cparams.embeddings) {
|
| 12760 |
+
res = nullptr; // do not extract logits for embedding case
|
| 12761 |
+
embd = gf->nodes[gf->n_nodes - 1];
|
| 12762 |
+
if (strcmp(embd->name, "result_embd_pooled") != 0) {
|
| 12763 |
+
embd = gf->nodes[gf->n_nodes - 2];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12764 |
}
|
| 12765 |
+
GGML_ASSERT(strcmp(embd->name, "result_embd_pooled") == 0 && "missing embeddings tensor");
|
| 12766 |
} else {
|
| 12767 |
embd = nullptr; // do not extract embeddings when not needed
|
| 12768 |
GGML_ASSERT(strcmp(res->name, "result_output") == 0 && "missing result_output tensor");
|
|
|
|
| 12785 |
}
|
| 12786 |
}
|
| 12787 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12788 |
// plot the computation graph in dot format (for debugging purposes)
|
| 12789 |
//if (n_past%100 == 0) {
|
| 12790 |
// ggml_graph_dump_dot(gf, NULL, "llama.dot");
|
|
|
|
| 12825 |
ggml_backend_tensor_get_async(backend_embd, embd, embd_out, 0, n_outputs_new*n_embd*sizeof(float));
|
| 12826 |
}
|
| 12827 |
} break;
|
|
|
|
| 12828 |
case LLAMA_POOLING_TYPE_MEAN:
|
| 12829 |
+
case LLAMA_POOLING_TYPE_CLS:
|
| 12830 |
+
case LLAMA_POOLING_TYPE_LAST:
|
| 12831 |
{
|
|
|
|
|
|
|
| 12832 |
// extract sequence embeddings
|
| 12833 |
auto & embd_seq_out = lctx.embd_seq;
|
| 12834 |
embd_seq_out.clear();
|
|
|
|
| 13442 |
};
|
| 13443 |
|
| 13444 |
struct llm_tokenizer_bpe {
|
| 13445 |
+
llm_tokenizer_bpe(const llama_vocab & vocab): vocab(vocab) {
|
| 13446 |
+
GGML_ASSERT(vocab.type == LLAMA_VOCAB_TYPE_BPE);
|
| 13447 |
+
switch (vocab.type_pre) {
|
| 13448 |
+
case LLAMA_VOCAB_PRE_TYPE_LLAMA3:
|
| 13449 |
+
regex_exprs = {
|
| 13450 |
+
// original regex from tokenizer.json
|
| 13451 |
+
//"(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?\\p{L}+|\\p{N}{1,3}| ?[^\\s\\p{L}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
|
| 13452 |
+
|
| 13453 |
+
// adapted: https://github.com/ggerganov/llama.cpp/pull/6920#issuecomment-2080233989
|
| 13454 |
+
"(?:'[sS]|'[tT]|'[rR][eE]|'[vV][eE]|'[mM]|'[lL][lL]|'[dD])|[^\\r\\n\\p{L}\\p{N}]?\\p{L}+|\\p{N}{1,3}| ?[^\\s\\p{L}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
|
| 13455 |
+
};
|
| 13456 |
+
break;
|
| 13457 |
+
case LLAMA_VOCAB_PRE_TYPE_DBRX:
|
| 13458 |
+
case LLAMA_VOCAB_PRE_TYPE_SMAUG:
|
| 13459 |
+
regex_exprs = {
|
| 13460 |
+
// same as llama3
|
| 13461 |
+
"(?:'[sS]|'[tT]|'[rR][eE]|'[vV][eE]|'[mM]|'[lL][lL]|'[dD])|[^\\r\\n\\p{L}\\p{N}]?\\p{L}+|\\p{N}{1,3}| ?[^\\s\\p{L}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
|
| 13462 |
+
};
|
| 13463 |
+
break;
|
| 13464 |
+
case LLAMA_VOCAB_PRE_TYPE_DEEPSEEK_LLM:
|
| 13465 |
+
regex_exprs = {
|
| 13466 |
+
"[\r\n]",
|
| 13467 |
+
"\\s?[A-Za-zµÀ-ÖØ-öø-ƺƼ-ƿDŽ-ʓʕ-ʯͰ-ͳͶͷͻ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-ՖႠ-ჅᎠ-Ᏽᏸ-ᏽᲐ-ᲺᲽ-Ჿᴀ-ᴫᵫ-ᵷᵹ-ᶚḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℴℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-ⱻⱾ-ⳤⳫ-ⳮⳲⳳꙀ-ꙭꚀ-ꚛꜢ-ꝯꝱ-ꞇꞋ-ꞎꭰ-ꮿff-stﬓ-ﬗA-Za-z𐐀-𐑏𐒰-𐓓𐓘-𐓻𐲀-𐲲𐳀-𐳲𑢠-𑣟𞤀-𞥃]+",
|
| 13468 |
+
"\\s?[!-/:-~!-/:-~‘-‟ -。]+",
|
| 13469 |
+
"\\s+$",
|
| 13470 |
+
"[一-龥ࠀ-一가-]+",
|
| 13471 |
+
"\\p{N}+",
|
| 13472 |
+
};
|
| 13473 |
+
break;
|
| 13474 |
+
case LLAMA_VOCAB_PRE_TYPE_DEEPSEEK_CODER:
|
| 13475 |
+
regex_exprs = {
|
| 13476 |
+
"[\r\n]",
|
| 13477 |
+
"\\s?\\p{L}+",
|
| 13478 |
+
"\\s?\\p{P}+",
|
| 13479 |
+
"[一-龥ࠀ-一가-]+",
|
| 13480 |
+
"\\p{N}",
|
| 13481 |
+
};
|
| 13482 |
+
break;
|
| 13483 |
+
case LLAMA_VOCAB_PRE_TYPE_FALCON:
|
| 13484 |
+
regex_exprs = {
|
| 13485 |
+
"[\\p{P}\\$\\+<=>\\^~\\|`]+",
|
| 13486 |
+
"'s|'t|'re|'ve|'m|'ll|'d| ?\\p{L}+| ?\\p{N}+| ?[^\\s\\p{L}\\p{N}]+|\\s+(?!\\S)",
|
| 13487 |
+
"[0-9][0-9][0-9]",
|
| 13488 |
+
};
|
| 13489 |
+
break;
|
| 13490 |
+
case LLAMA_VOCAB_PRE_TYPE_MPT:
|
| 13491 |
+
// TODO: MPT pre-tokenization regexes are unknown
|
| 13492 |
+
// the following are close, but not exact. run the following:
|
| 13493 |
+
// ./bin/test-tokenizer-0 ../models/ggml-vocab-mpt.gguf
|
| 13494 |
+
GGML_ASSERT("MPT pre-tokenization regexes are unknown - fixes needed");
|
| 13495 |
+
regex_exprs = {
|
| 13496 |
+
"\\s?\\p{L}+",
|
| 13497 |
+
"\\s?\\p{P}+",
|
| 13498 |
+
"'s|'t|'re|'ve|'m|'ll|'d| ?\\p{L}+| ?\\p{N}+| ?[^\\s\\p{L}\\p{N}]+|\\s+(?!\\S)",
|
| 13499 |
+
};
|
| 13500 |
+
break;
|
| 13501 |
+
case LLAMA_VOCAB_PRE_TYPE_STARCODER:
|
| 13502 |
+
case LLAMA_VOCAB_PRE_TYPE_REFACT:
|
| 13503 |
+
case LLAMA_VOCAB_PRE_TYPE_COMMAND_R:
|
| 13504 |
+
regex_exprs = {
|
| 13505 |
+
"\\p{N}",
|
| 13506 |
+
"'s|'t|'re|'ve|'m|'ll|'d| ?\\p{L}+| ?\\p{N}+| ?[^\\s\\p{L}\\p{N}]+|\\s+(?!\\S)",
|
| 13507 |
+
};
|
| 13508 |
+
break;
|
| 13509 |
+
case LLAMA_VOCAB_PRE_TYPE_GPT2:
|
| 13510 |
+
case LLAMA_VOCAB_PRE_TYPE_OLMO:
|
| 13511 |
+
regex_exprs = {
|
| 13512 |
+
"'s|'t|'re|'ve|'m|'ll|'d| ?\\p{L}+| ?\\p{N}+| ?[^\\s\\p{L}\\p{N}]+|\\s+(?!\\S)",
|
| 13513 |
+
};
|
| 13514 |
+
break;
|
| 13515 |
+
case LLAMA_VOCAB_PRE_TYPE_STABLELM2:
|
| 13516 |
+
case LLAMA_VOCAB_PRE_TYPE_QWEN2:
|
| 13517 |
+
regex_exprs = {
|
| 13518 |
+
// original regex from tokenizer.json
|
| 13519 |
+
// "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?\\p{L}+|\\p{N}| ?[^\\s\\p{L}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+"
|
| 13520 |
+
"(?:'[sS]|'[tT]|'[rR][eE]|'[vV][eE]|'[mM]|'[lL][lL]|'[dD])|[^\\r\\n\\p{L}\\p{N}]?\\p{L}+|\\p{N}| ?[^\\s\\p{L}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
|
| 13521 |
+
};
|
| 13522 |
+
break;
|
| 13523 |
+
case LLAMA_VOCAB_PRE_TYPE_PORO:
|
| 13524 |
+
regex_exprs = {
|
| 13525 |
+
" ?[^(\\s|.,!?…。,、।۔،)]+",
|
| 13526 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13527 |
break;
|
| 13528 |
default:
|
| 13529 |
+
// default regex for BPE tokenization pre-processing
|
| 13530 |
+
regex_exprs = {
|
| 13531 |
+
"[\\p{P}\\$\\+<=>\\^~\\|]+",
|
| 13532 |
+
"'s|'t|'re|'ve|'m|'ll|'d| ?\\p{L}+| ?\\p{N}+| ?[^\\s\\p{L}\\p{N}]+|\\s+(?!\\S)",
|
| 13533 |
+
"\\p{N}+",
|
| 13534 |
+
"[0-9][0-9][0-9]",
|
| 13535 |
+
};
|
| 13536 |
break;
|
| 13537 |
}
|
| 13538 |
+
}
|
| 13539 |
+
|
| 13540 |
+
void append(const llama_vocab::id token_id, std::vector<llama_vocab::id> & output) const {
|
| 13541 |
+
output.push_back(token_id);
|
| 13542 |
+
}
|
| 13543 |
+
|
| 13544 |
+
bool append_bos(std::vector<llama_vocab::id> & output) const {
|
| 13545 |
+
if (vocab.tokenizer_add_bos) {
|
| 13546 |
+
GGML_ASSERT(vocab.special_bos_id != -1);
|
| 13547 |
+
output.push_back(vocab.special_bos_id);
|
| 13548 |
+
return true;
|
| 13549 |
+
}
|
| 13550 |
+
return false;
|
| 13551 |
+
}
|
| 13552 |
+
|
| 13553 |
+
bool append_eos(std::vector<llama_vocab::id> & output) const {
|
| 13554 |
+
if (vocab.tokenizer_add_eos) {
|
| 13555 |
+
GGML_ASSERT(vocab.special_eos_id != -1);
|
| 13556 |
+
output.push_back(vocab.special_eos_id);
|
| 13557 |
+
return true;
|
| 13558 |
+
}
|
| 13559 |
+
return false;
|
| 13560 |
+
}
|
| 13561 |
+
|
| 13562 |
+
void check_double_bos_eos(const std::vector<llama_vocab::id> & output) const {
|
| 13563 |
+
if (vocab.tokenizer_add_bos && output.size() >= 2 && output[1] == vocab.special_bos_id) {
|
| 13564 |
+
LLAMA_LOG_WARN(
|
| 13565 |
+
"%s: Added a BOS token to the prompt as specified by the model but the prompt "
|
| 13566 |
+
"also starts with a BOS token. So now the final prompt starts with 2 BOS tokens. "
|
| 13567 |
+
"Are you sure this is what you want?\n", __FUNCTION__);
|
| 13568 |
+
}
|
| 13569 |
+
if (vocab.tokenizer_add_eos && output.size() >= 2 && *(output.end()-2) == vocab.special_eos_id) {
|
| 13570 |
+
LLAMA_LOG_WARN(
|
| 13571 |
+
"%s: Added a EOS token to the prompt as specified by the model but the prompt "
|
| 13572 |
+
"also ends with a EOS token. So now the final prompt ends with 2 EOS tokens. "
|
| 13573 |
+
"Are you sure this is what you want?\n", __FUNCTION__);
|
| 13574 |
+
}
|
| 13575 |
+
}
|
| 13576 |
+
|
| 13577 |
+
void tokenize(const std::string & text, std::vector<llama_vocab::id> & output) {
|
| 13578 |
+
int final_prev_index = -1;
|
| 13579 |
+
|
| 13580 |
+
const auto word_collection = unicode_regex_split(text, regex_exprs);
|
| 13581 |
|
| 13582 |
symbols_final.clear();
|
| 13583 |
|
|
|
|
| 13588 |
int index = 0;
|
| 13589 |
size_t offset = 0;
|
| 13590 |
|
| 13591 |
+
if (vocab.tokenizer_ignore_merges && vocab.token_to_id.find(word) != vocab.token_to_id.end()) {
|
| 13592 |
symbols.emplace_back(llm_symbol{-1, -1, word.c_str(), word.size()});
|
| 13593 |
offset = word.size();
|
| 13594 |
}
|
|
|
|
| 13669 |
for (auto j = str.begin(); j != str.end(); ++j) {
|
| 13670 |
std::string byte_str(1, *j);
|
| 13671 |
auto token_multibyte = vocab.token_to_id.find(byte_str);
|
| 13672 |
+
if (token_multibyte != vocab.token_to_id.end()) {
|
| 13673 |
+
output.push_back(token_multibyte->second);
|
| 13674 |
}
|
|
|
|
| 13675 |
}
|
| 13676 |
} else {
|
| 13677 |
output.push_back((*token).second);
|
|
|
|
| 13710 |
|
| 13711 |
const llama_vocab & vocab;
|
| 13712 |
|
| 13713 |
+
std::vector<std::string> regex_exprs;
|
| 13714 |
+
|
| 13715 |
std::vector<llm_symbol> symbols;
|
| 13716 |
std::vector<llm_symbol> symbols_final;
|
| 13717 |
|
|
|
|
| 13721 |
struct llm_tokenizer_wpm {
|
| 13722 |
llm_tokenizer_wpm(const llama_vocab & vocab): vocab(vocab) {}
|
| 13723 |
|
| 13724 |
+
void tokenize(const std::string & text, std::vector<llama_vocab::id> & output) const {
|
| 13725 |
const auto & token_map = vocab.token_to_id;
|
| 13726 |
|
| 13727 |
// normalize and split by whitespace
|
|
|
|
| 13730 |
// bos token prepended already
|
| 13731 |
|
| 13732 |
// find the longest tokens that form the words
|
| 13733 |
+
for (const std::string & word : words) {
|
| 13734 |
// skip empty words
|
| 13735 |
if (word.size() == 0) {
|
| 13736 |
continue;
|
|
|
|
| 13747 |
for (int i = 0; i < n; ++i) {
|
| 13748 |
// loop through possible match length
|
| 13749 |
bool match = false;
|
| 13750 |
+
for (int j = std::min(n, i + vocab.max_token_len + 1); j > i; j--) {
|
| 13751 |
auto it = token_map.find(word1.substr(i, j - i));
|
| 13752 |
if (it != token_map.end()) {
|
| 13753 |
output.push_back(it->second);
|
|
|
|
| 13770 |
}
|
| 13771 |
}
|
| 13772 |
|
| 13773 |
+
// TODO: reduce string copies by using cpts_offs array
|
| 13774 |
+
std::vector<std::string> preprocess(const std::string & text) const {
|
| 13775 |
const std::vector<uint32_t> cpts_nfd = unicode_cpts_normalize_nfd(unicode_cpts_from_utf8(text));
|
| 13776 |
std::vector<std::string> words(1, "");
|
| 13777 |
|
|
|
|
| 13993 |
|
| 13994 |
bool is_prev_special = false;
|
| 13995 |
|
| 13996 |
+
if (add_special && vocab.tokenizer_add_bos) {
|
| 13997 |
GGML_ASSERT(vocab.special_bos_id != -1);
|
| 13998 |
output.push_back(vocab.special_bos_id);
|
| 13999 |
is_prev_special = true;
|
|
|
|
| 14003 |
if (fragment.type == FRAGMENT_BUFFER_VARIANT_TYPE_RAW_TEXT) {
|
| 14004 |
auto raw_text = fragment.raw_text.substr(fragment.offset, fragment.length);
|
| 14005 |
|
| 14006 |
+
if (vocab.tokenizer_add_space_prefix) {
|
| 14007 |
if (!output.size() || is_prev_special) { // prefix with space if first token
|
| 14008 |
raw_text = " " + raw_text;
|
| 14009 |
}
|
|
|
|
| 14021 |
}
|
| 14022 |
}
|
| 14023 |
|
| 14024 |
+
if (add_special && vocab.tokenizer_add_bos && output.size() >= 2 && output[1] == vocab.special_bos_id) {
|
| 14025 |
LLAMA_LOG_WARN(
|
| 14026 |
"%s: Added a BOS token to the prompt as specified by the model but the prompt "
|
| 14027 |
"also starts with a BOS token. So now the final prompt starts with 2 BOS tokens. "
|
| 14028 |
"Are you sure this is what you want?\n", __FUNCTION__);
|
| 14029 |
}
|
| 14030 |
|
| 14031 |
+
if (add_special && vocab.tokenizer_add_eos) {
|
| 14032 |
GGML_ASSERT(vocab.special_eos_id != -1);
|
| 14033 |
output.push_back(vocab.special_eos_id);
|
| 14034 |
}
|
| 14035 |
} break;
|
| 14036 |
case LLAMA_VOCAB_TYPE_BPE:
|
| 14037 |
{
|
| 14038 |
+
llm_tokenizer_bpe tokenizer(vocab);
|
| 14039 |
+
|
| 14040 |
+
if (add_special) {
|
| 14041 |
+
tokenizer.append_bos(output);
|
| 14042 |
}
|
| 14043 |
|
| 14044 |
for (const auto & fragment : fragment_buffer) {
|
|
|
|
| 14048 |
#ifdef PRETOKENIZERDEBUG
|
| 14049 |
LLAMA_LOG_WARN("TT: (%ld %ld %ld) '%s'\n", raw_text.length(), fragment.offset, fragment.length, raw_text.c_str());
|
| 14050 |
#endif
|
|
|
|
| 14051 |
tokenizer.tokenize(raw_text, output);
|
| 14052 |
} else { // if (fragment.type == FRAGMENT_BUFFER_VARIANT_TYPE_TOKEN)
|
| 14053 |
+
tokenizer.append(fragment.token, output);
|
| 14054 |
}
|
| 14055 |
}
|
| 14056 |
|
| 14057 |
+
if (add_special) {
|
| 14058 |
+
tokenizer.append_eos(output);
|
| 14059 |
+
tokenizer.check_double_bos_eos(output);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14060 |
}
|
| 14061 |
} break;
|
| 14062 |
case LLAMA_VOCAB_TYPE_WPM:
|
|
|
|
| 14066 |
output.push_back(vocab.special_cls_id);
|
| 14067 |
}
|
| 14068 |
|
| 14069 |
+
llm_tokenizer_wpm tokenizer(vocab);
|
| 14070 |
+
|
| 14071 |
for (const auto & fragment : fragment_buffer) {
|
| 14072 |
if (fragment.type == FRAGMENT_BUFFER_VARIANT_TYPE_RAW_TEXT) {
|
| 14073 |
auto raw_text = fragment.raw_text.substr(fragment.offset, fragment.length);
|
|
|
|
| 14075 |
#ifdef PRETOKENIZERDEBUG
|
| 14076 |
LLAMA_LOG_WARN("TT: (%ld %ld %ld) '%s'\n", raw_text.length(), fragment.offset, fragment.length, raw_text.c_str());
|
| 14077 |
#endif
|
|
|
|
| 14078 |
tokenizer.tokenize(raw_text, output);
|
| 14079 |
} else { // if (fragment.type == FRAGMENT_BUFFER_VARIANT_TYPE_TOKEN)
|
| 14080 |
output.push_back(fragment.token);
|
|
|
|
| 16988 |
case LLM_ARCH_BERT:
|
| 16989 |
case LLM_ARCH_NOMIC_BERT:
|
| 16990 |
case LLM_ARCH_STABLELM:
|
| 16991 |
+
case LLM_ARCH_BITNET:
|
| 16992 |
case LLM_ARCH_QWEN:
|
| 16993 |
case LLM_ARCH_QWEN2:
|
| 16994 |
case LLM_ARCH_QWEN2MOE:
|
|
|
|
| 18388 |
ctx->abort_callback_data = abort_callback_data;
|
| 18389 |
}
|
| 18390 |
|
| 18391 |
+
void llama_set_embeddings(struct llama_context * ctx, bool embeddings) {
|
| 18392 |
+
ctx->cparams.embeddings = embeddings;
|
| 18393 |
+
}
|
| 18394 |
+
|
| 18395 |
void llama_set_causal_attn(struct llama_context * ctx, bool causal_attn) {
|
| 18396 |
ctx->cparams.causal_attn = causal_attn;
|
| 18397 |
}
|
|
|
|
| 18635 |
}
|
| 18636 |
|
| 18637 |
int32_t llama_add_bos_token(const struct llama_model * model) {
|
| 18638 |
+
return model->vocab.tokenizer_add_bos;
|
| 18639 |
}
|
| 18640 |
|
| 18641 |
int32_t llama_add_eos_token(const struct llama_model * model) {
|
| 18642 |
+
return model->vocab.tokenizer_add_eos;
|
| 18643 |
}
|
| 18644 |
|
| 18645 |
llama_token llama_token_prefix(const struct llama_model * model) {
|
examples/talk-llama/llama.h
CHANGED
|
@@ -174,6 +174,7 @@ extern "C" {
|
|
| 174 |
LLAMA_POOLING_TYPE_NONE = 0,
|
| 175 |
LLAMA_POOLING_TYPE_MEAN = 1,
|
| 176 |
LLAMA_POOLING_TYPE_CLS = 2,
|
|
|
|
| 177 |
};
|
| 178 |
|
| 179 |
enum llama_split_mode {
|
|
@@ -293,7 +294,6 @@ extern "C" {
|
|
| 293 |
|
| 294 |
enum llama_rope_scaling_type rope_scaling_type; // RoPE scaling type, from `enum llama_rope_scaling_type`
|
| 295 |
enum llama_pooling_type pooling_type; // whether to pool (sum) embedding results by sequence id
|
| 296 |
-
// (ignored if no pooling layer)
|
| 297 |
|
| 298 |
// ref: https://github.com/ggerganov/llama.cpp/pull/2054
|
| 299 |
float rope_freq_base; // RoPE base frequency, 0 = from model
|
|
@@ -786,6 +786,10 @@ extern "C" {
|
|
| 786 |
// Get the number of threads used for prompt and batch processing (multiple token).
|
| 787 |
LLAMA_API uint32_t llama_n_threads_batch(struct llama_context * ctx);
|
| 788 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 789 |
// Set whether to use causal attention or not
|
| 790 |
// If set to true, the model will only attend to the past tokens
|
| 791 |
LLAMA_API void llama_set_causal_attn(struct llama_context * ctx, bool causal_attn);
|
|
|
|
| 174 |
LLAMA_POOLING_TYPE_NONE = 0,
|
| 175 |
LLAMA_POOLING_TYPE_MEAN = 1,
|
| 176 |
LLAMA_POOLING_TYPE_CLS = 2,
|
| 177 |
+
LLAMA_POOLING_TYPE_LAST = 3,
|
| 178 |
};
|
| 179 |
|
| 180 |
enum llama_split_mode {
|
|
|
|
| 294 |
|
| 295 |
enum llama_rope_scaling_type rope_scaling_type; // RoPE scaling type, from `enum llama_rope_scaling_type`
|
| 296 |
enum llama_pooling_type pooling_type; // whether to pool (sum) embedding results by sequence id
|
|
|
|
| 297 |
|
| 298 |
// ref: https://github.com/ggerganov/llama.cpp/pull/2054
|
| 299 |
float rope_freq_base; // RoPE base frequency, 0 = from model
|
|
|
|
| 786 |
// Get the number of threads used for prompt and batch processing (multiple token).
|
| 787 |
LLAMA_API uint32_t llama_n_threads_batch(struct llama_context * ctx);
|
| 788 |
|
| 789 |
+
// Set whether the model is in embeddings mode or not
|
| 790 |
+
// If true, embeddings will be returned but logits will not
|
| 791 |
+
LLAMA_API void llama_set_embeddings(struct llama_context * ctx, bool embeddings);
|
| 792 |
+
|
| 793 |
// Set whether to use causal attention or not
|
| 794 |
// If set to true, the model will only attend to the past tokens
|
| 795 |
LLAMA_API void llama_set_causal_attn(struct llama_context * ctx, bool causal_attn);
|
examples/talk-llama/talk-llama.cpp
CHANGED
|
@@ -16,7 +16,7 @@
|
|
| 16 |
#include <regex>
|
| 17 |
#include <sstream>
|
| 18 |
|
| 19 |
-
std::vector<llama_token> llama_tokenize(struct llama_context * ctx, const std::string & text, bool add_bos) {
|
| 20 |
auto * model = llama_get_model(ctx);
|
| 21 |
|
| 22 |
// upper limit for the number of tokens
|
|
@@ -33,7 +33,7 @@ std::vector<llama_token> llama_tokenize(struct llama_context * ctx, const std::s
|
|
| 33 |
return result;
|
| 34 |
}
|
| 35 |
|
| 36 |
-
std::string llama_token_to_piece(const struct llama_context * ctx, llama_token token) {
|
| 37 |
std::vector<char> result(8, 0);
|
| 38 |
const int n_tokens = llama_token_to_piece(llama_get_model(ctx), token, result.data(), result.size(), false);
|
| 39 |
if (n_tokens < 0) {
|
|
@@ -83,7 +83,7 @@ struct whisper_params {
|
|
| 83 |
|
| 84 |
void whisper_print_usage(int argc, char ** argv, const whisper_params & params);
|
| 85 |
|
| 86 |
-
bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
|
| 87 |
for (int i = 1; i < argc; i++) {
|
| 88 |
std::string arg = argv[i];
|
| 89 |
|
|
@@ -168,7 +168,7 @@ void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params & para
|
|
| 168 |
fprintf(stderr, "\n");
|
| 169 |
}
|
| 170 |
|
| 171 |
-
std::string transcribe(
|
| 172 |
whisper_context * ctx,
|
| 173 |
const whisper_params & params,
|
| 174 |
const std::vector<float> & pcmf32,
|
|
@@ -235,7 +235,7 @@ std::string transcribe(
|
|
| 235 |
return result;
|
| 236 |
}
|
| 237 |
|
| 238 |
-
std::vector<std::string> get_words(const std::string &txt) {
|
| 239 |
std::vector<std::string> words;
|
| 240 |
|
| 241 |
std::istringstream iss(txt);
|
|
|
|
| 16 |
#include <regex>
|
| 17 |
#include <sstream>
|
| 18 |
|
| 19 |
+
static std::vector<llama_token> llama_tokenize(struct llama_context * ctx, const std::string & text, bool add_bos) {
|
| 20 |
auto * model = llama_get_model(ctx);
|
| 21 |
|
| 22 |
// upper limit for the number of tokens
|
|
|
|
| 33 |
return result;
|
| 34 |
}
|
| 35 |
|
| 36 |
+
static std::string llama_token_to_piece(const struct llama_context * ctx, llama_token token) {
|
| 37 |
std::vector<char> result(8, 0);
|
| 38 |
const int n_tokens = llama_token_to_piece(llama_get_model(ctx), token, result.data(), result.size(), false);
|
| 39 |
if (n_tokens < 0) {
|
|
|
|
| 83 |
|
| 84 |
void whisper_print_usage(int argc, char ** argv, const whisper_params & params);
|
| 85 |
|
| 86 |
+
static bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
|
| 87 |
for (int i = 1; i < argc; i++) {
|
| 88 |
std::string arg = argv[i];
|
| 89 |
|
|
|
|
| 168 |
fprintf(stderr, "\n");
|
| 169 |
}
|
| 170 |
|
| 171 |
+
static std::string transcribe(
|
| 172 |
whisper_context * ctx,
|
| 173 |
const whisper_params & params,
|
| 174 |
const std::vector<float> & pcmf32,
|
|
|
|
| 235 |
return result;
|
| 236 |
}
|
| 237 |
|
| 238 |
+
static std::vector<std::string> get_words(const std::string &txt) {
|
| 239 |
std::vector<std::string> words;
|
| 240 |
|
| 241 |
std::istringstream iss(txt);
|
examples/talk-llama/unicode-data.cpp
CHANGED
|
@@ -68,36 +68,36 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 68 |
{0x000370, 0x0004},
|
| 69 |
{0x000375, 0x0040},
|
| 70 |
{0x000376, 0x0004},
|
| 71 |
-
{0x000378,
|
| 72 |
{0x00037A, 0x0004},
|
| 73 |
{0x00037E, 0x0020},
|
| 74 |
{0x00037F, 0x0004},
|
| 75 |
-
{0x000380,
|
| 76 |
{0x000384, 0x0040},
|
| 77 |
{0x000386, 0x0004},
|
| 78 |
{0x000387, 0x0020},
|
| 79 |
{0x000388, 0x0004},
|
| 80 |
-
{0x00038B,
|
| 81 |
{0x00038C, 0x0004},
|
| 82 |
-
{0x00038D,
|
| 83 |
{0x00038E, 0x0004},
|
| 84 |
-
{0x0003A2,
|
| 85 |
{0x0003A3, 0x0004},
|
| 86 |
{0x0003F6, 0x0040},
|
| 87 |
{0x0003F7, 0x0004},
|
| 88 |
{0x000482, 0x0040},
|
| 89 |
{0x000483, 0x0010},
|
| 90 |
{0x00048A, 0x0004},
|
| 91 |
-
{0x000530,
|
| 92 |
{0x000531, 0x0004},
|
| 93 |
-
{0x000557,
|
| 94 |
{0x000559, 0x0004},
|
| 95 |
{0x00055A, 0x0020},
|
| 96 |
{0x000560, 0x0004},
|
| 97 |
{0x000589, 0x0020},
|
| 98 |
-
{0x00058B,
|
| 99 |
{0x00058D, 0x0040},
|
| 100 |
-
{0x000590,
|
| 101 |
{0x000591, 0x0010},
|
| 102 |
{0x0005BE, 0x0020},
|
| 103 |
{0x0005BF, 0x0010},
|
|
@@ -107,12 +107,13 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 107 |
{0x0005C4, 0x0010},
|
| 108 |
{0x0005C6, 0x0020},
|
| 109 |
{0x0005C7, 0x0010},
|
| 110 |
-
{0x0005C8,
|
| 111 |
{0x0005D0, 0x0004},
|
| 112 |
-
{0x0005EB,
|
| 113 |
{0x0005EF, 0x0004},
|
| 114 |
{0x0005F3, 0x0020},
|
| 115 |
-
{0x0005F5,
|
|
|
|
| 116 |
{0x000606, 0x0040},
|
| 117 |
{0x000609, 0x0020},
|
| 118 |
{0x00060B, 0x0040},
|
|
@@ -145,16 +146,17 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 145 |
{0x0006FD, 0x0040},
|
| 146 |
{0x0006FF, 0x0004},
|
| 147 |
{0x000700, 0x0020},
|
| 148 |
-
{0x00070E,
|
|
|
|
| 149 |
{0x000710, 0x0004},
|
| 150 |
{0x000711, 0x0010},
|
| 151 |
{0x000712, 0x0004},
|
| 152 |
{0x000730, 0x0010},
|
| 153 |
-
{0x00074B,
|
| 154 |
{0x00074D, 0x0004},
|
| 155 |
{0x0007A6, 0x0010},
|
| 156 |
{0x0007B1, 0x0004},
|
| 157 |
-
{0x0007B2,
|
| 158 |
{0x0007C0, 0x0002},
|
| 159 |
{0x0007CA, 0x0004},
|
| 160 |
{0x0007EB, 0x0010},
|
|
@@ -162,7 +164,7 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 162 |
{0x0007F6, 0x0040},
|
| 163 |
{0x0007F7, 0x0020},
|
| 164 |
{0x0007FA, 0x0004},
|
| 165 |
-
{0x0007FB,
|
| 166 |
{0x0007FD, 0x0010},
|
| 167 |
{0x0007FE, 0x0040},
|
| 168 |
{0x000800, 0x0004},
|
|
@@ -173,20 +175,22 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 173 |
{0x000825, 0x0010},
|
| 174 |
{0x000828, 0x0004},
|
| 175 |
{0x000829, 0x0010},
|
| 176 |
-
{0x00082E,
|
| 177 |
{0x000830, 0x0020},
|
| 178 |
-
{0x00083F,
|
| 179 |
{0x000840, 0x0004},
|
| 180 |
{0x000859, 0x0010},
|
| 181 |
-
{0x00085C,
|
| 182 |
{0x00085E, 0x0020},
|
| 183 |
-
{0x00085F,
|
| 184 |
{0x000860, 0x0004},
|
| 185 |
-
{0x00086B,
|
| 186 |
{0x000870, 0x0004},
|
| 187 |
{0x000888, 0x0040},
|
| 188 |
{0x000889, 0x0004},
|
| 189 |
-
{0x00088F,
|
|
|
|
|
|
|
| 190 |
{0x000898, 0x0010},
|
| 191 |
{0x0008A0, 0x0004},
|
| 192 |
{0x0008CA, 0x0010},
|
|
@@ -205,35 +209,35 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 205 |
{0x000970, 0x0020},
|
| 206 |
{0x000971, 0x0004},
|
| 207 |
{0x000981, 0x0010},
|
| 208 |
-
{0x000984,
|
| 209 |
{0x000985, 0x0004},
|
| 210 |
-
{0x00098D,
|
| 211 |
{0x00098F, 0x0004},
|
| 212 |
-
{0x000991,
|
| 213 |
{0x000993, 0x0004},
|
| 214 |
-
{0x0009A9,
|
| 215 |
{0x0009AA, 0x0004},
|
| 216 |
-
{0x0009B1,
|
| 217 |
{0x0009B2, 0x0004},
|
| 218 |
-
{0x0009B3,
|
| 219 |
{0x0009B6, 0x0004},
|
| 220 |
-
{0x0009BA,
|
| 221 |
{0x0009BC, 0x0010},
|
| 222 |
{0x0009BD, 0x0004},
|
| 223 |
{0x0009BE, 0x0010},
|
| 224 |
-
{0x0009C5,
|
| 225 |
{0x0009C7, 0x0010},
|
| 226 |
-
{0x0009C9,
|
| 227 |
{0x0009CB, 0x0010},
|
| 228 |
{0x0009CE, 0x0004},
|
| 229 |
-
{0x0009CF,
|
| 230 |
{0x0009D7, 0x0010},
|
| 231 |
-
{0x0009D8,
|
| 232 |
{0x0009DC, 0x0004},
|
| 233 |
-
{0x0009DE,
|
| 234 |
{0x0009DF, 0x0004},
|
| 235 |
{0x0009E2, 0x0010},
|
| 236 |
-
{0x0009E4,
|
| 237 |
{0x0009E6, 0x0002},
|
| 238 |
{0x0009F0, 0x0004},
|
| 239 |
{0x0009F2, 0x0040},
|
|
@@ -242,173 +246,173 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 242 |
{0x0009FC, 0x0004},
|
| 243 |
{0x0009FD, 0x0020},
|
| 244 |
{0x0009FE, 0x0010},
|
| 245 |
-
{0x0009FF,
|
| 246 |
{0x000A01, 0x0010},
|
| 247 |
-
{0x000A04,
|
| 248 |
{0x000A05, 0x0004},
|
| 249 |
-
{0x000A0B,
|
| 250 |
{0x000A0F, 0x0004},
|
| 251 |
-
{0x000A11,
|
| 252 |
{0x000A13, 0x0004},
|
| 253 |
-
{0x000A29,
|
| 254 |
{0x000A2A, 0x0004},
|
| 255 |
-
{0x000A31,
|
| 256 |
{0x000A32, 0x0004},
|
| 257 |
-
{0x000A34,
|
| 258 |
{0x000A35, 0x0004},
|
| 259 |
-
{0x000A37,
|
| 260 |
{0x000A38, 0x0004},
|
| 261 |
-
{0x000A3A,
|
| 262 |
{0x000A3C, 0x0010},
|
| 263 |
-
{0x000A3D,
|
| 264 |
{0x000A3E, 0x0010},
|
| 265 |
-
{0x000A43,
|
| 266 |
{0x000A47, 0x0010},
|
| 267 |
-
{0x000A49,
|
| 268 |
{0x000A4B, 0x0010},
|
| 269 |
-
{0x000A4E,
|
| 270 |
{0x000A51, 0x0010},
|
| 271 |
-
{0x000A52,
|
| 272 |
{0x000A59, 0x0004},
|
| 273 |
-
{0x000A5D,
|
| 274 |
{0x000A5E, 0x0004},
|
| 275 |
-
{0x000A5F,
|
| 276 |
{0x000A66, 0x0002},
|
| 277 |
{0x000A70, 0x0010},
|
| 278 |
{0x000A72, 0x0004},
|
| 279 |
{0x000A75, 0x0010},
|
| 280 |
{0x000A76, 0x0020},
|
| 281 |
-
{0x000A77,
|
| 282 |
{0x000A81, 0x0010},
|
| 283 |
-
{0x000A84,
|
| 284 |
{0x000A85, 0x0004},
|
| 285 |
-
{0x000A8E,
|
| 286 |
{0x000A8F, 0x0004},
|
| 287 |
-
{0x000A92,
|
| 288 |
{0x000A93, 0x0004},
|
| 289 |
-
{0x000AA9,
|
| 290 |
{0x000AAA, 0x0004},
|
| 291 |
-
{0x000AB1,
|
| 292 |
{0x000AB2, 0x0004},
|
| 293 |
-
{0x000AB4,
|
| 294 |
{0x000AB5, 0x0004},
|
| 295 |
-
{0x000ABA,
|
| 296 |
{0x000ABC, 0x0010},
|
| 297 |
{0x000ABD, 0x0004},
|
| 298 |
{0x000ABE, 0x0010},
|
| 299 |
-
{0x000AC6,
|
| 300 |
{0x000AC7, 0x0010},
|
| 301 |
-
{0x000ACA,
|
| 302 |
{0x000ACB, 0x0010},
|
| 303 |
-
{0x000ACE,
|
| 304 |
{0x000AD0, 0x0004},
|
| 305 |
-
{0x000AD1,
|
| 306 |
{0x000AE0, 0x0004},
|
| 307 |
{0x000AE2, 0x0010},
|
| 308 |
-
{0x000AE4,
|
| 309 |
{0x000AE6, 0x0002},
|
| 310 |
{0x000AF0, 0x0020},
|
| 311 |
{0x000AF1, 0x0040},
|
| 312 |
-
{0x000AF2,
|
| 313 |
{0x000AF9, 0x0004},
|
| 314 |
{0x000AFA, 0x0010},
|
| 315 |
-
{0x000B00,
|
| 316 |
{0x000B01, 0x0010},
|
| 317 |
-
{0x000B04,
|
| 318 |
{0x000B05, 0x0004},
|
| 319 |
-
{0x000B0D,
|
| 320 |
{0x000B0F, 0x0004},
|
| 321 |
-
{0x000B11,
|
| 322 |
{0x000B13, 0x0004},
|
| 323 |
-
{0x000B29,
|
| 324 |
{0x000B2A, 0x0004},
|
| 325 |
-
{0x000B31,
|
| 326 |
{0x000B32, 0x0004},
|
| 327 |
-
{0x000B34,
|
| 328 |
{0x000B35, 0x0004},
|
| 329 |
-
{0x000B3A,
|
| 330 |
{0x000B3C, 0x0010},
|
| 331 |
{0x000B3D, 0x0004},
|
| 332 |
{0x000B3E, 0x0010},
|
| 333 |
-
{0x000B45,
|
| 334 |
{0x000B47, 0x0010},
|
| 335 |
-
{0x000B49,
|
| 336 |
{0x000B4B, 0x0010},
|
| 337 |
-
{0x000B4E,
|
| 338 |
{0x000B55, 0x0010},
|
| 339 |
-
{0x000B58,
|
| 340 |
{0x000B5C, 0x0004},
|
| 341 |
-
{0x000B5E,
|
| 342 |
{0x000B5F, 0x0004},
|
| 343 |
{0x000B62, 0x0010},
|
| 344 |
-
{0x000B64,
|
| 345 |
{0x000B66, 0x0002},
|
| 346 |
{0x000B70, 0x0040},
|
| 347 |
{0x000B71, 0x0004},
|
| 348 |
{0x000B72, 0x0002},
|
| 349 |
-
{0x000B78,
|
| 350 |
{0x000B82, 0x0010},
|
| 351 |
{0x000B83, 0x0004},
|
| 352 |
-
{0x000B84,
|
| 353 |
{0x000B85, 0x0004},
|
| 354 |
-
{0x000B8B,
|
| 355 |
{0x000B8E, 0x0004},
|
| 356 |
-
{0x000B91,
|
| 357 |
{0x000B92, 0x0004},
|
| 358 |
-
{0x000B96,
|
| 359 |
{0x000B99, 0x0004},
|
| 360 |
-
{0x000B9B,
|
| 361 |
{0x000B9C, 0x0004},
|
| 362 |
-
{0x000B9D,
|
| 363 |
{0x000B9E, 0x0004},
|
| 364 |
-
{0x000BA0,
|
| 365 |
{0x000BA3, 0x0004},
|
| 366 |
-
{0x000BA5,
|
| 367 |
{0x000BA8, 0x0004},
|
| 368 |
-
{0x000BAB,
|
| 369 |
{0x000BAE, 0x0004},
|
| 370 |
-
{0x000BBA,
|
| 371 |
{0x000BBE, 0x0010},
|
| 372 |
-
{0x000BC3,
|
| 373 |
{0x000BC6, 0x0010},
|
| 374 |
-
{0x000BC9,
|
| 375 |
{0x000BCA, 0x0010},
|
| 376 |
-
{0x000BCE,
|
| 377 |
{0x000BD0, 0x0004},
|
| 378 |
-
{0x000BD1,
|
| 379 |
{0x000BD7, 0x0010},
|
| 380 |
-
{0x000BD8,
|
| 381 |
{0x000BE6, 0x0002},
|
| 382 |
{0x000BF3, 0x0040},
|
| 383 |
-
{0x000BFB,
|
| 384 |
{0x000C00, 0x0010},
|
| 385 |
{0x000C05, 0x0004},
|
| 386 |
-
{0x000C0D,
|
| 387 |
{0x000C0E, 0x0004},
|
| 388 |
-
{0x000C11,
|
| 389 |
{0x000C12, 0x0004},
|
| 390 |
-
{0x000C29,
|
| 391 |
{0x000C2A, 0x0004},
|
| 392 |
-
{0x000C3A,
|
| 393 |
{0x000C3C, 0x0010},
|
| 394 |
{0x000C3D, 0x0004},
|
| 395 |
{0x000C3E, 0x0010},
|
| 396 |
-
{0x000C45,
|
| 397 |
{0x000C46, 0x0010},
|
| 398 |
-
{0x000C49,
|
| 399 |
{0x000C4A, 0x0010},
|
| 400 |
-
{0x000C4E,
|
| 401 |
{0x000C55, 0x0010},
|
| 402 |
-
{0x000C57,
|
| 403 |
{0x000C58, 0x0004},
|
| 404 |
-
{0x000C5B,
|
| 405 |
{0x000C5D, 0x0004},
|
| 406 |
-
{0x000C5E,
|
| 407 |
{0x000C60, 0x0004},
|
| 408 |
{0x000C62, 0x0010},
|
| 409 |
-
{0x000C64,
|
| 410 |
{0x000C66, 0x0002},
|
| 411 |
-
{0x000C70,
|
| 412 |
{0x000C77, 0x0020},
|
| 413 |
{0x000C78, 0x0002},
|
| 414 |
{0x000C7F, 0x0040},
|
|
@@ -416,124 +420,124 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 416 |
{0x000C81, 0x0010},
|
| 417 |
{0x000C84, 0x0020},
|
| 418 |
{0x000C85, 0x0004},
|
| 419 |
-
{0x000C8D,
|
| 420 |
{0x000C8E, 0x0004},
|
| 421 |
-
{0x000C91,
|
| 422 |
{0x000C92, 0x0004},
|
| 423 |
-
{0x000CA9,
|
| 424 |
{0x000CAA, 0x0004},
|
| 425 |
-
{0x000CB4,
|
| 426 |
{0x000CB5, 0x0004},
|
| 427 |
-
{0x000CBA,
|
| 428 |
{0x000CBC, 0x0010},
|
| 429 |
{0x000CBD, 0x0004},
|
| 430 |
{0x000CBE, 0x0010},
|
| 431 |
-
{0x000CC5,
|
| 432 |
{0x000CC6, 0x0010},
|
| 433 |
-
{0x000CC9,
|
| 434 |
{0x000CCA, 0x0010},
|
| 435 |
-
{0x000CCE,
|
| 436 |
{0x000CD5, 0x0010},
|
| 437 |
-
{0x000CD7,
|
| 438 |
{0x000CDD, 0x0004},
|
| 439 |
-
{0x000CDF,
|
| 440 |
{0x000CE0, 0x0004},
|
| 441 |
{0x000CE2, 0x0010},
|
| 442 |
-
{0x000CE4,
|
| 443 |
{0x000CE6, 0x0002},
|
| 444 |
-
{0x000CF0,
|
| 445 |
{0x000CF1, 0x0004},
|
| 446 |
{0x000CF3, 0x0010},
|
| 447 |
-
{0x000CF4,
|
| 448 |
{0x000D00, 0x0010},
|
| 449 |
{0x000D04, 0x0004},
|
| 450 |
-
{0x000D0D,
|
| 451 |
{0x000D0E, 0x0004},
|
| 452 |
-
{0x000D11,
|
| 453 |
{0x000D12, 0x0004},
|
| 454 |
{0x000D3B, 0x0010},
|
| 455 |
{0x000D3D, 0x0004},
|
| 456 |
{0x000D3E, 0x0010},
|
| 457 |
-
{0x000D45,
|
| 458 |
{0x000D46, 0x0010},
|
| 459 |
-
{0x000D49,
|
| 460 |
{0x000D4A, 0x0010},
|
| 461 |
{0x000D4E, 0x0004},
|
| 462 |
{0x000D4F, 0x0040},
|
| 463 |
-
{0x000D50,
|
| 464 |
{0x000D54, 0x0004},
|
| 465 |
{0x000D57, 0x0010},
|
| 466 |
{0x000D58, 0x0002},
|
| 467 |
{0x000D5F, 0x0004},
|
| 468 |
{0x000D62, 0x0010},
|
| 469 |
-
{0x000D64,
|
| 470 |
{0x000D66, 0x0002},
|
| 471 |
{0x000D79, 0x0040},
|
| 472 |
{0x000D7A, 0x0004},
|
| 473 |
-
{0x000D80,
|
| 474 |
{0x000D81, 0x0010},
|
| 475 |
-
{0x000D84,
|
| 476 |
{0x000D85, 0x0004},
|
| 477 |
-
{0x000D97,
|
| 478 |
{0x000D9A, 0x0004},
|
| 479 |
-
{0x000DB2,
|
| 480 |
{0x000DB3, 0x0004},
|
| 481 |
-
{0x000DBC,
|
| 482 |
{0x000DBD, 0x0004},
|
| 483 |
-
{0x000DBE,
|
| 484 |
{0x000DC0, 0x0004},
|
| 485 |
-
{0x000DC7,
|
| 486 |
{0x000DCA, 0x0010},
|
| 487 |
-
{0x000DCB,
|
| 488 |
{0x000DCF, 0x0010},
|
| 489 |
-
{0x000DD5,
|
| 490 |
{0x000DD6, 0x0010},
|
| 491 |
-
{0x000DD7,
|
| 492 |
{0x000DD8, 0x0010},
|
| 493 |
-
{0x000DE0,
|
| 494 |
{0x000DE6, 0x0002},
|
| 495 |
-
{0x000DF0,
|
| 496 |
{0x000DF2, 0x0010},
|
| 497 |
{0x000DF4, 0x0020},
|
| 498 |
-
{0x000DF5,
|
| 499 |
{0x000E01, 0x0004},
|
| 500 |
{0x000E31, 0x0010},
|
| 501 |
{0x000E32, 0x0004},
|
| 502 |
{0x000E34, 0x0010},
|
| 503 |
-
{0x000E3B,
|
| 504 |
{0x000E3F, 0x0040},
|
| 505 |
{0x000E40, 0x0004},
|
| 506 |
{0x000E47, 0x0010},
|
| 507 |
{0x000E4F, 0x0020},
|
| 508 |
{0x000E50, 0x0002},
|
| 509 |
{0x000E5A, 0x0020},
|
| 510 |
-
{0x000E5C,
|
| 511 |
{0x000E81, 0x0004},
|
| 512 |
-
{0x000E83,
|
| 513 |
{0x000E84, 0x0004},
|
| 514 |
-
{0x000E85,
|
| 515 |
{0x000E86, 0x0004},
|
| 516 |
-
{0x000E8B,
|
| 517 |
{0x000E8C, 0x0004},
|
| 518 |
-
{0x000EA4,
|
| 519 |
{0x000EA5, 0x0004},
|
| 520 |
-
{0x000EA6,
|
| 521 |
{0x000EA7, 0x0004},
|
| 522 |
{0x000EB1, 0x0010},
|
| 523 |
{0x000EB2, 0x0004},
|
| 524 |
{0x000EB4, 0x0010},
|
| 525 |
{0x000EBD, 0x0004},
|
| 526 |
-
{0x000EBE,
|
| 527 |
{0x000EC0, 0x0004},
|
| 528 |
-
{0x000EC5,
|
| 529 |
{0x000EC6, 0x0004},
|
| 530 |
-
{0x000EC7,
|
| 531 |
{0x000EC8, 0x0010},
|
| 532 |
-
{0x000ECF,
|
| 533 |
{0x000ED0, 0x0002},
|
| 534 |
-
{0x000EDA,
|
| 535 |
{0x000EDC, 0x0004},
|
| 536 |
-
{0x000EE0,
|
| 537 |
{0x000F00, 0x0004},
|
| 538 |
{0x000F01, 0x0040},
|
| 539 |
{0x000F04, 0x0020},
|
|
@@ -552,26 +556,26 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 552 |
{0x000F3A, 0x0020},
|
| 553 |
{0x000F3E, 0x0010},
|
| 554 |
{0x000F40, 0x0004},
|
| 555 |
-
{0x000F48,
|
| 556 |
{0x000F49, 0x0004},
|
| 557 |
-
{0x000F6D,
|
| 558 |
{0x000F71, 0x0010},
|
| 559 |
{0x000F85, 0x0020},
|
| 560 |
{0x000F86, 0x0010},
|
| 561 |
{0x000F88, 0x0004},
|
| 562 |
{0x000F8D, 0x0010},
|
| 563 |
-
{0x000F98,
|
| 564 |
{0x000F99, 0x0010},
|
| 565 |
-
{0x000FBD,
|
| 566 |
{0x000FBE, 0x0040},
|
| 567 |
{0x000FC6, 0x0010},
|
| 568 |
{0x000FC7, 0x0040},
|
| 569 |
-
{0x000FCD,
|
| 570 |
{0x000FCE, 0x0040},
|
| 571 |
{0x000FD0, 0x0020},
|
| 572 |
{0x000FD5, 0x0040},
|
| 573 |
{0x000FD9, 0x0020},
|
| 574 |
-
{0x000FDB,
|
| 575 |
{0x001000, 0x0004},
|
| 576 |
{0x00102B, 0x0010},
|
| 577 |
{0x00103F, 0x0004},
|
|
@@ -595,56 +599,56 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 595 |
{0x00109A, 0x0010},
|
| 596 |
{0x00109E, 0x0040},
|
| 597 |
{0x0010A0, 0x0004},
|
| 598 |
-
{0x0010C6,
|
| 599 |
{0x0010C7, 0x0004},
|
| 600 |
-
{0x0010C8,
|
| 601 |
{0x0010CD, 0x0004},
|
| 602 |
-
{0x0010CE,
|
| 603 |
{0x0010D0, 0x0004},
|
| 604 |
{0x0010FB, 0x0020},
|
| 605 |
{0x0010FC, 0x0004},
|
| 606 |
-
{0x001249,
|
| 607 |
{0x00124A, 0x0004},
|
| 608 |
-
{0x00124E,
|
| 609 |
{0x001250, 0x0004},
|
| 610 |
-
{0x001257,
|
| 611 |
{0x001258, 0x0004},
|
| 612 |
-
{0x001259,
|
| 613 |
{0x00125A, 0x0004},
|
| 614 |
-
{0x00125E,
|
| 615 |
{0x001260, 0x0004},
|
| 616 |
-
{0x001289,
|
| 617 |
{0x00128A, 0x0004},
|
| 618 |
-
{0x00128E,
|
| 619 |
{0x001290, 0x0004},
|
| 620 |
-
{0x0012B1,
|
| 621 |
{0x0012B2, 0x0004},
|
| 622 |
-
{0x0012B6,
|
| 623 |
{0x0012B8, 0x0004},
|
| 624 |
-
{0x0012BF,
|
| 625 |
{0x0012C0, 0x0004},
|
| 626 |
-
{0x0012C1,
|
| 627 |
{0x0012C2, 0x0004},
|
| 628 |
-
{0x0012C6,
|
| 629 |
{0x0012C8, 0x0004},
|
| 630 |
-
{0x0012D7,
|
| 631 |
{0x0012D8, 0x0004},
|
| 632 |
-
{0x001311,
|
| 633 |
{0x001312, 0x0004},
|
| 634 |
-
{0x001316,
|
| 635 |
{0x001318, 0x0004},
|
| 636 |
-
{0x00135B,
|
| 637 |
{0x00135D, 0x0010},
|
| 638 |
{0x001360, 0x0020},
|
| 639 |
{0x001369, 0x0002},
|
| 640 |
-
{0x00137D,
|
| 641 |
{0x001380, 0x0004},
|
| 642 |
{0x001390, 0x0040},
|
| 643 |
-
{0x00139A,
|
| 644 |
{0x0013A0, 0x0004},
|
| 645 |
-
{0x0013F6,
|
| 646 |
{0x0013F8, 0x0004},
|
| 647 |
-
{0x0013FE,
|
| 648 |
{0x001400, 0x0020},
|
| 649 |
{0x001401, 0x0004},
|
| 650 |
{0x00166D, 0x0040},
|
|
@@ -653,28 +657,28 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 653 |
{0x001680, 0x0008},
|
| 654 |
{0x001681, 0x0004},
|
| 655 |
{0x00169B, 0x0020},
|
| 656 |
-
{0x00169D,
|
| 657 |
{0x0016A0, 0x0004},
|
| 658 |
{0x0016EB, 0x0020},
|
| 659 |
{0x0016EE, 0x0002},
|
| 660 |
{0x0016F1, 0x0004},
|
| 661 |
-
{0x0016F9,
|
| 662 |
{0x001700, 0x0004},
|
| 663 |
{0x001712, 0x0010},
|
| 664 |
-
{0x001716,
|
| 665 |
{0x00171F, 0x0004},
|
| 666 |
{0x001732, 0x0010},
|
| 667 |
{0x001735, 0x0020},
|
| 668 |
-
{0x001737,
|
| 669 |
{0x001740, 0x0004},
|
| 670 |
{0x001752, 0x0010},
|
| 671 |
-
{0x001754,
|
| 672 |
{0x001760, 0x0004},
|
| 673 |
-
{0x00176D,
|
| 674 |
{0x00176E, 0x0004},
|
| 675 |
-
{0x001771,
|
| 676 |
{0x001772, 0x0010},
|
| 677 |
-
{0x001774,
|
| 678 |
{0x001780, 0x0004},
|
| 679 |
{0x0017B4, 0x0010},
|
| 680 |
{0x0017D4, 0x0020},
|
|
@@ -683,80 +687,80 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 683 |
{0x0017DB, 0x0040},
|
| 684 |
{0x0017DC, 0x0004},
|
| 685 |
{0x0017DD, 0x0010},
|
| 686 |
-
{0x0017DE,
|
| 687 |
{0x0017E0, 0x0002},
|
| 688 |
-
{0x0017EA,
|
| 689 |
{0x0017F0, 0x0002},
|
| 690 |
-
{0x0017FA,
|
| 691 |
{0x001800, 0x0020},
|
| 692 |
{0x00180B, 0x0010},
|
| 693 |
{0x00180E, 0x0080},
|
| 694 |
{0x00180F, 0x0010},
|
| 695 |
{0x001810, 0x0002},
|
| 696 |
-
{0x00181A,
|
| 697 |
{0x001820, 0x0004},
|
| 698 |
-
{0x001879,
|
| 699 |
{0x001880, 0x0004},
|
| 700 |
{0x001885, 0x0010},
|
| 701 |
{0x001887, 0x0004},
|
| 702 |
{0x0018A9, 0x0010},
|
| 703 |
{0x0018AA, 0x0004},
|
| 704 |
-
{0x0018AB,
|
| 705 |
{0x0018B0, 0x0004},
|
| 706 |
-
{0x0018F6,
|
| 707 |
{0x001900, 0x0004},
|
| 708 |
-
{0x00191F,
|
| 709 |
{0x001920, 0x0010},
|
| 710 |
-
{0x00192C,
|
| 711 |
{0x001930, 0x0010},
|
| 712 |
-
{0x00193C,
|
| 713 |
{0x001940, 0x0040},
|
| 714 |
-
{0x001941,
|
| 715 |
{0x001944, 0x0020},
|
| 716 |
{0x001946, 0x0002},
|
| 717 |
{0x001950, 0x0004},
|
| 718 |
-
{0x00196E,
|
| 719 |
{0x001970, 0x0004},
|
| 720 |
-
{0x001975,
|
| 721 |
{0x001980, 0x0004},
|
| 722 |
-
{0x0019AC,
|
| 723 |
{0x0019B0, 0x0004},
|
| 724 |
-
{0x0019CA,
|
| 725 |
{0x0019D0, 0x0002},
|
| 726 |
-
{0x0019DB,
|
| 727 |
{0x0019DE, 0x0040},
|
| 728 |
{0x001A00, 0x0004},
|
| 729 |
{0x001A17, 0x0010},
|
| 730 |
-
{0x001A1C,
|
| 731 |
{0x001A1E, 0x0020},
|
| 732 |
{0x001A20, 0x0004},
|
| 733 |
{0x001A55, 0x0010},
|
| 734 |
-
{0x001A5F,
|
| 735 |
{0x001A60, 0x0010},
|
| 736 |
-
{0x001A7D,
|
| 737 |
{0x001A7F, 0x0010},
|
| 738 |
{0x001A80, 0x0002},
|
| 739 |
-
{0x001A8A,
|
| 740 |
{0x001A90, 0x0002},
|
| 741 |
-
{0x001A9A,
|
| 742 |
{0x001AA0, 0x0020},
|
| 743 |
{0x001AA7, 0x0004},
|
| 744 |
{0x001AA8, 0x0020},
|
| 745 |
-
{0x001AAE,
|
| 746 |
{0x001AB0, 0x0010},
|
| 747 |
-
{0x001ACF,
|
| 748 |
{0x001B00, 0x0010},
|
| 749 |
{0x001B05, 0x0004},
|
| 750 |
{0x001B34, 0x0010},
|
| 751 |
{0x001B45, 0x0004},
|
| 752 |
-
{0x001B4D,
|
| 753 |
{0x001B50, 0x0002},
|
| 754 |
{0x001B5A, 0x0020},
|
| 755 |
{0x001B61, 0x0040},
|
| 756 |
{0x001B6B, 0x0010},
|
| 757 |
{0x001B74, 0x0040},
|
| 758 |
{0x001B7D, 0x0020},
|
| 759 |
-
{0x001B7F,
|
| 760 |
{0x001B80, 0x0010},
|
| 761 |
{0x001B83, 0x0004},
|
| 762 |
{0x001BA1, 0x0010},
|
|
@@ -764,25 +768,25 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 764 |
{0x001BB0, 0x0002},
|
| 765 |
{0x001BBA, 0x0004},
|
| 766 |
{0x001BE6, 0x0010},
|
| 767 |
-
{0x001BF4,
|
| 768 |
{0x001BFC, 0x0020},
|
| 769 |
{0x001C00, 0x0004},
|
| 770 |
{0x001C24, 0x0010},
|
| 771 |
-
{0x001C38,
|
| 772 |
{0x001C3B, 0x0020},
|
| 773 |
{0x001C40, 0x0002},
|
| 774 |
-
{0x001C4A,
|
| 775 |
{0x001C4D, 0x0004},
|
| 776 |
{0x001C50, 0x0002},
|
| 777 |
{0x001C5A, 0x0004},
|
| 778 |
{0x001C7E, 0x0020},
|
| 779 |
{0x001C80, 0x0004},
|
| 780 |
-
{0x001C89,
|
| 781 |
{0x001C90, 0x0004},
|
| 782 |
-
{0x001CBB,
|
| 783 |
{0x001CBD, 0x0004},
|
| 784 |
{0x001CC0, 0x0020},
|
| 785 |
-
{0x001CC8,
|
| 786 |
{0x001CD0, 0x0010},
|
| 787 |
{0x001CD3, 0x0020},
|
| 788 |
{0x001CD4, 0x0010},
|
|
@@ -793,50 +797,50 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 793 |
{0x001CF5, 0x0004},
|
| 794 |
{0x001CF7, 0x0010},
|
| 795 |
{0x001CFA, 0x0004},
|
| 796 |
-
{0x001CFB,
|
| 797 |
{0x001D00, 0x0004},
|
| 798 |
{0x001DC0, 0x0010},
|
| 799 |
{0x001E00, 0x0004},
|
| 800 |
-
{0x001F16,
|
| 801 |
{0x001F18, 0x0004},
|
| 802 |
-
{0x001F1E,
|
| 803 |
{0x001F20, 0x0004},
|
| 804 |
-
{0x001F46,
|
| 805 |
{0x001F48, 0x0004},
|
| 806 |
-
{0x001F4E,
|
| 807 |
{0x001F50, 0x0004},
|
| 808 |
-
{0x001F58,
|
| 809 |
{0x001F59, 0x0004},
|
| 810 |
-
{0x001F5A,
|
| 811 |
{0x001F5B, 0x0004},
|
| 812 |
-
{0x001F5C,
|
| 813 |
{0x001F5D, 0x0004},
|
| 814 |
-
{0x001F5E,
|
| 815 |
{0x001F5F, 0x0004},
|
| 816 |
-
{0x001F7E,
|
| 817 |
{0x001F80, 0x0004},
|
| 818 |
-
{0x001FB5,
|
| 819 |
{0x001FB6, 0x0004},
|
| 820 |
{0x001FBD, 0x0040},
|
| 821 |
{0x001FBE, 0x0004},
|
| 822 |
{0x001FBF, 0x0040},
|
| 823 |
{0x001FC2, 0x0004},
|
| 824 |
-
{0x001FC5,
|
| 825 |
{0x001FC6, 0x0004},
|
| 826 |
{0x001FCD, 0x0040},
|
| 827 |
{0x001FD0, 0x0004},
|
| 828 |
-
{0x001FD4,
|
| 829 |
{0x001FD6, 0x0004},
|
| 830 |
-
{0x001FDC,
|
| 831 |
{0x001FDD, 0x0040},
|
| 832 |
{0x001FE0, 0x0004},
|
| 833 |
{0x001FED, 0x0040},
|
| 834 |
-
{0x001FF0,
|
| 835 |
{0x001FF2, 0x0004},
|
| 836 |
-
{0x001FF5,
|
| 837 |
{0x001FF6, 0x0004},
|
| 838 |
{0x001FFD, 0x0040},
|
| 839 |
-
{0x001FFF,
|
| 840 |
{0x002000, 0x0008},
|
| 841 |
{0x00200B, 0x0080},
|
| 842 |
{0x002010, 0x0020},
|
|
@@ -850,9 +854,11 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 850 |
{0x002053, 0x0020},
|
| 851 |
{0x00205F, 0x0008},
|
| 852 |
{0x002060, 0x0080},
|
|
|
|
|
|
|
| 853 |
{0x002070, 0x0002},
|
| 854 |
{0x002071, 0x0004},
|
| 855 |
-
{0x002072,
|
| 856 |
{0x002074, 0x0002},
|
| 857 |
{0x00207A, 0x0040},
|
| 858 |
{0x00207D, 0x0020},
|
|
@@ -860,13 +866,13 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 860 |
{0x002080, 0x0002},
|
| 861 |
{0x00208A, 0x0040},
|
| 862 |
{0x00208D, 0x0020},
|
| 863 |
-
{0x00208F,
|
| 864 |
{0x002090, 0x0004},
|
| 865 |
-
{0x00209D,
|
| 866 |
{0x0020A0, 0x0040},
|
| 867 |
-
{0x0020C1,
|
| 868 |
{0x0020D0, 0x0010},
|
| 869 |
-
{0x0020F1,
|
| 870 |
{0x002100, 0x0040},
|
| 871 |
{0x002102, 0x0004},
|
| 872 |
{0x002103, 0x0040},
|
|
@@ -898,15 +904,15 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 898 |
{0x002183, 0x0004},
|
| 899 |
{0x002185, 0x0002},
|
| 900 |
{0x00218A, 0x0040},
|
| 901 |
-
{0x00218C,
|
| 902 |
{0x002190, 0x0040},
|
| 903 |
{0x002308, 0x0020},
|
| 904 |
{0x00230C, 0x0040},
|
| 905 |
{0x002329, 0x0020},
|
| 906 |
{0x00232B, 0x0040},
|
| 907 |
-
{0x002427,
|
| 908 |
{0x002440, 0x0040},
|
| 909 |
-
{0x00244B,
|
| 910 |
{0x002460, 0x0002},
|
| 911 |
{0x00249C, 0x0040},
|
| 912 |
{0x0024EA, 0x0002},
|
|
@@ -924,62 +930,62 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 924 |
{0x0029DC, 0x0040},
|
| 925 |
{0x0029FC, 0x0020},
|
| 926 |
{0x0029FE, 0x0040},
|
| 927 |
-
{0x002B74,
|
| 928 |
{0x002B76, 0x0040},
|
| 929 |
-
{0x002B96,
|
| 930 |
{0x002B97, 0x0040},
|
| 931 |
{0x002C00, 0x0004},
|
| 932 |
{0x002CE5, 0x0040},
|
| 933 |
{0x002CEB, 0x0004},
|
| 934 |
{0x002CEF, 0x0010},
|
| 935 |
{0x002CF2, 0x0004},
|
| 936 |
-
{0x002CF4,
|
| 937 |
{0x002CF9, 0x0020},
|
| 938 |
{0x002CFD, 0x0002},
|
| 939 |
{0x002CFE, 0x0020},
|
| 940 |
{0x002D00, 0x0004},
|
| 941 |
-
{0x002D26,
|
| 942 |
{0x002D27, 0x0004},
|
| 943 |
-
{0x002D28,
|
| 944 |
{0x002D2D, 0x0004},
|
| 945 |
-
{0x002D2E,
|
| 946 |
{0x002D30, 0x0004},
|
| 947 |
-
{0x002D68,
|
| 948 |
{0x002D6F, 0x0004},
|
| 949 |
{0x002D70, 0x0020},
|
| 950 |
-
{0x002D71,
|
| 951 |
{0x002D7F, 0x0010},
|
| 952 |
{0x002D80, 0x0004},
|
| 953 |
-
{0x002D97,
|
| 954 |
{0x002DA0, 0x0004},
|
| 955 |
-
{0x002DA7,
|
| 956 |
{0x002DA8, 0x0004},
|
| 957 |
-
{0x002DAF,
|
| 958 |
{0x002DB0, 0x0004},
|
| 959 |
-
{0x002DB7,
|
| 960 |
{0x002DB8, 0x0004},
|
| 961 |
-
{0x002DBF,
|
| 962 |
{0x002DC0, 0x0004},
|
| 963 |
-
{0x002DC7,
|
| 964 |
{0x002DC8, 0x0004},
|
| 965 |
-
{0x002DCF,
|
| 966 |
{0x002DD0, 0x0004},
|
| 967 |
-
{0x002DD7,
|
| 968 |
{0x002DD8, 0x0004},
|
| 969 |
-
{0x002DDF,
|
| 970 |
{0x002DE0, 0x0010},
|
| 971 |
{0x002E00, 0x0020},
|
| 972 |
{0x002E2F, 0x0004},
|
| 973 |
{0x002E30, 0x0020},
|
| 974 |
{0x002E50, 0x0040},
|
| 975 |
{0x002E52, 0x0020},
|
| 976 |
-
{0x002E5E,
|
| 977 |
{0x002E80, 0x0040},
|
| 978 |
-
{0x002E9A,
|
| 979 |
{0x002E9B, 0x0040},
|
| 980 |
-
{0x002EF4,
|
| 981 |
{0x002F00, 0x0040},
|
| 982 |
-
{0x002FD6,
|
| 983 |
{0x002FF0, 0x0040},
|
| 984 |
{0x003000, 0x0008},
|
| 985 |
{0x003001, 0x0020},
|
|
@@ -999,9 +1005,9 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 999 |
{0x00303B, 0x0004},
|
| 1000 |
{0x00303D, 0x0020},
|
| 1001 |
{0x00303E, 0x0040},
|
| 1002 |
-
{0x003040,
|
| 1003 |
{0x003041, 0x0004},
|
| 1004 |
-
{0x003097,
|
| 1005 |
{0x003099, 0x0010},
|
| 1006 |
{0x00309B, 0x0040},
|
| 1007 |
{0x00309D, 0x0004},
|
|
@@ -1009,21 +1015,21 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 1009 |
{0x0030A1, 0x0004},
|
| 1010 |
{0x0030FB, 0x0020},
|
| 1011 |
{0x0030FC, 0x0004},
|
| 1012 |
-
{0x003100,
|
| 1013 |
{0x003105, 0x0004},
|
| 1014 |
-
{0x003130,
|
| 1015 |
{0x003131, 0x0004},
|
| 1016 |
-
{0x00318F,
|
| 1017 |
{0x003190, 0x0040},
|
| 1018 |
{0x003192, 0x0002},
|
| 1019 |
{0x003196, 0x0040},
|
| 1020 |
{0x0031A0, 0x0004},
|
| 1021 |
{0x0031C0, 0x0040},
|
| 1022 |
-
{0x0031E4,
|
| 1023 |
{0x0031EF, 0x0040},
|
| 1024 |
{0x0031F0, 0x0004},
|
| 1025 |
{0x003200, 0x0040},
|
| 1026 |
-
{0x00321F,
|
| 1027 |
{0x003220, 0x0002},
|
| 1028 |
{0x00322A, 0x0040},
|
| 1029 |
{0x003248, 0x0002},
|
|
@@ -1037,9 +1043,9 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 1037 |
{0x003400, 0x0004},
|
| 1038 |
{0x004DC0, 0x0040},
|
| 1039 |
{0x004E00, 0x0004},
|
| 1040 |
-
{0x00A48D,
|
| 1041 |
{0x00A490, 0x0040},
|
| 1042 |
-
{0x00A4C7,
|
| 1043 |
{0x00A4D0, 0x0004},
|
| 1044 |
{0x00A4FE, 0x0020},
|
| 1045 |
{0x00A500, 0x0004},
|
|
@@ -1047,7 +1053,7 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 1047 |
{0x00A610, 0x0004},
|
| 1048 |
{0x00A620, 0x0002},
|
| 1049 |
{0x00A62A, 0x0004},
|
| 1050 |
-
{0x00A62C,
|
| 1051 |
{0x00A640, 0x0004},
|
| 1052 |
{0x00A66F, 0x0010},
|
| 1053 |
{0x00A673, 0x0020},
|
|
@@ -1059,20 +1065,20 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 1059 |
{0x00A6E6, 0x0002},
|
| 1060 |
{0x00A6F0, 0x0010},
|
| 1061 |
{0x00A6F2, 0x0020},
|
| 1062 |
-
{0x00A6F8,
|
| 1063 |
{0x00A700, 0x0040},
|
| 1064 |
{0x00A717, 0x0004},
|
| 1065 |
{0x00A720, 0x0040},
|
| 1066 |
{0x00A722, 0x0004},
|
| 1067 |
{0x00A789, 0x0040},
|
| 1068 |
{0x00A78B, 0x0004},
|
| 1069 |
-
{0x00A7CB,
|
| 1070 |
{0x00A7D0, 0x0004},
|
| 1071 |
-
{0x00A7D2,
|
| 1072 |
{0x00A7D3, 0x0004},
|
| 1073 |
-
{0x00A7D4,
|
| 1074 |
{0x00A7D5, 0x0004},
|
| 1075 |
-
{0x00A7DA,
|
| 1076 |
{0x00A7F2, 0x0004},
|
| 1077 |
{0x00A802, 0x0010},
|
| 1078 |
{0x00A803, 0x0004},
|
|
@@ -1083,20 +1089,20 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 1083 |
{0x00A823, 0x0010},
|
| 1084 |
{0x00A828, 0x0040},
|
| 1085 |
{0x00A82C, 0x0010},
|
| 1086 |
-
{0x00A82D,
|
| 1087 |
{0x00A830, 0x0002},
|
| 1088 |
{0x00A836, 0x0040},
|
| 1089 |
-
{0x00A83A,
|
| 1090 |
{0x00A840, 0x0004},
|
| 1091 |
{0x00A874, 0x0020},
|
| 1092 |
-
{0x00A878,
|
| 1093 |
{0x00A880, 0x0010},
|
| 1094 |
{0x00A882, 0x0004},
|
| 1095 |
{0x00A8B4, 0x0010},
|
| 1096 |
-
{0x00A8C6,
|
| 1097 |
{0x00A8CE, 0x0020},
|
| 1098 |
{0x00A8D0, 0x0002},
|
| 1099 |
-
{0x00A8DA,
|
| 1100 |
{0x00A8E0, 0x0010},
|
| 1101 |
{0x00A8F2, 0x0004},
|
| 1102 |
{0x00A8F8, 0x0020},
|
|
@@ -1110,35 +1116,35 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 1110 |
{0x00A92E, 0x0020},
|
| 1111 |
{0x00A930, 0x0004},
|
| 1112 |
{0x00A947, 0x0010},
|
| 1113 |
-
{0x00A954,
|
| 1114 |
{0x00A95F, 0x0020},
|
| 1115 |
{0x00A960, 0x0004},
|
| 1116 |
-
{0x00A97D,
|
| 1117 |
{0x00A980, 0x0010},
|
| 1118 |
{0x00A984, 0x0004},
|
| 1119 |
{0x00A9B3, 0x0010},
|
| 1120 |
{0x00A9C1, 0x0020},
|
| 1121 |
-
{0x00A9CE,
|
| 1122 |
{0x00A9CF, 0x0004},
|
| 1123 |
{0x00A9D0, 0x0002},
|
| 1124 |
-
{0x00A9DA,
|
| 1125 |
{0x00A9DE, 0x0020},
|
| 1126 |
{0x00A9E0, 0x0004},
|
| 1127 |
{0x00A9E5, 0x0010},
|
| 1128 |
{0x00A9E6, 0x0004},
|
| 1129 |
{0x00A9F0, 0x0002},
|
| 1130 |
{0x00A9FA, 0x0004},
|
| 1131 |
-
{0x00A9FF,
|
| 1132 |
{0x00AA00, 0x0004},
|
| 1133 |
{0x00AA29, 0x0010},
|
| 1134 |
-
{0x00AA37,
|
| 1135 |
{0x00AA40, 0x0004},
|
| 1136 |
{0x00AA43, 0x0010},
|
| 1137 |
{0x00AA44, 0x0004},
|
| 1138 |
{0x00AA4C, 0x0010},
|
| 1139 |
-
{0x00AA4E,
|
| 1140 |
{0x00AA50, 0x0002},
|
| 1141 |
-
{0x00AA5A,
|
| 1142 |
{0x00AA5C, 0x0020},
|
| 1143 |
{0x00AA60, 0x0004},
|
| 1144 |
{0x00AA77, 0x0040},
|
|
@@ -1155,7 +1161,7 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 1155 |
{0x00AAC0, 0x0004},
|
| 1156 |
{0x00AAC1, 0x0010},
|
| 1157 |
{0x00AAC2, 0x0004},
|
| 1158 |
-
{0x00AAC3,
|
| 1159 |
{0x00AADB, 0x0004},
|
| 1160 |
{0x00AADE, 0x0020},
|
| 1161 |
{0x00AAE0, 0x0004},
|
|
@@ -1163,90 +1169,93 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 1163 |
{0x00AAF0, 0x0020},
|
| 1164 |
{0x00AAF2, 0x0004},
|
| 1165 |
{0x00AAF5, 0x0010},
|
| 1166 |
-
{0x00AAF7,
|
| 1167 |
{0x00AB01, 0x0004},
|
| 1168 |
-
{0x00AB07,
|
| 1169 |
{0x00AB09, 0x0004},
|
| 1170 |
-
{0x00AB0F,
|
| 1171 |
{0x00AB11, 0x0004},
|
| 1172 |
-
{0x00AB17,
|
| 1173 |
{0x00AB20, 0x0004},
|
| 1174 |
-
{0x00AB27,
|
| 1175 |
{0x00AB28, 0x0004},
|
| 1176 |
-
{0x00AB2F,
|
| 1177 |
{0x00AB30, 0x0004},
|
| 1178 |
{0x00AB5B, 0x0040},
|
| 1179 |
{0x00AB5C, 0x0004},
|
| 1180 |
{0x00AB6A, 0x0040},
|
| 1181 |
-
{0x00AB6C,
|
| 1182 |
{0x00AB70, 0x0004},
|
| 1183 |
{0x00ABE3, 0x0010},
|
| 1184 |
{0x00ABEB, 0x0020},
|
| 1185 |
{0x00ABEC, 0x0010},
|
| 1186 |
-
{0x00ABEE,
|
| 1187 |
{0x00ABF0, 0x0002},
|
| 1188 |
-
{0x00ABFA,
|
| 1189 |
{0x00AC00, 0x0004},
|
| 1190 |
-
{0x00D7A4,
|
| 1191 |
{0x00D7B0, 0x0004},
|
| 1192 |
-
{0x00D7C7,
|
| 1193 |
{0x00D7CB, 0x0004},
|
| 1194 |
-
{0x00D7FC,
|
|
|
|
| 1195 |
{0x00F900, 0x0004},
|
| 1196 |
-
{0x00FA6E,
|
| 1197 |
{0x00FA70, 0x0004},
|
| 1198 |
-
{0x00FADA,
|
| 1199 |
{0x00FB00, 0x0004},
|
| 1200 |
-
{0x00FB07,
|
| 1201 |
{0x00FB13, 0x0004},
|
| 1202 |
-
{0x00FB18,
|
| 1203 |
{0x00FB1D, 0x0004},
|
| 1204 |
{0x00FB1E, 0x0010},
|
| 1205 |
{0x00FB1F, 0x0004},
|
| 1206 |
{0x00FB29, 0x0040},
|
| 1207 |
{0x00FB2A, 0x0004},
|
| 1208 |
-
{0x00FB37,
|
| 1209 |
{0x00FB38, 0x0004},
|
| 1210 |
-
{0x00FB3D,
|
| 1211 |
{0x00FB3E, 0x0004},
|
| 1212 |
-
{0x00FB3F,
|
| 1213 |
{0x00FB40, 0x0004},
|
| 1214 |
-
{0x00FB42,
|
| 1215 |
{0x00FB43, 0x0004},
|
| 1216 |
-
{0x00FB45,
|
| 1217 |
{0x00FB46, 0x0004},
|
| 1218 |
{0x00FBB2, 0x0040},
|
| 1219 |
-
{0x00FBC3,
|
| 1220 |
{0x00FBD3, 0x0004},
|
| 1221 |
{0x00FD3E, 0x0020},
|
| 1222 |
{0x00FD40, 0x0040},
|
| 1223 |
{0x00FD50, 0x0004},
|
| 1224 |
-
{0x00FD90,
|
| 1225 |
{0x00FD92, 0x0004},
|
| 1226 |
-
{0x00FDC8,
|
| 1227 |
{0x00FDCF, 0x0040},
|
| 1228 |
-
{0x00FDD0,
|
| 1229 |
{0x00FDF0, 0x0004},
|
| 1230 |
{0x00FDFC, 0x0040},
|
| 1231 |
{0x00FE00, 0x0010},
|
| 1232 |
{0x00FE10, 0x0020},
|
| 1233 |
-
{0x00FE1A,
|
| 1234 |
{0x00FE20, 0x0010},
|
| 1235 |
{0x00FE30, 0x0020},
|
| 1236 |
-
{0x00FE53,
|
| 1237 |
{0x00FE54, 0x0020},
|
| 1238 |
{0x00FE62, 0x0040},
|
| 1239 |
{0x00FE63, 0x0020},
|
| 1240 |
{0x00FE64, 0x0040},
|
| 1241 |
-
{0x00FE67,
|
| 1242 |
{0x00FE68, 0x0020},
|
| 1243 |
{0x00FE69, 0x0040},
|
| 1244 |
{0x00FE6A, 0x0020},
|
| 1245 |
-
{0x00FE6C,
|
| 1246 |
{0x00FE70, 0x0004},
|
| 1247 |
-
{0x00FE75,
|
| 1248 |
{0x00FE76, 0x0004},
|
| 1249 |
-
{0x00FEFD,
|
|
|
|
|
|
|
| 1250 |
{0x00FF01, 0x0020},
|
| 1251 |
{0x00FF04, 0x0040},
|
| 1252 |
{0x00FF05, 0x0020},
|
|
@@ -1268,260 +1277,261 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 1268 |
{0x00FF5E, 0x0040},
|
| 1269 |
{0x00FF5F, 0x0020},
|
| 1270 |
{0x00FF66, 0x0004},
|
| 1271 |
-
{0x00FFBF,
|
| 1272 |
{0x00FFC2, 0x0004},
|
| 1273 |
-
{0x00FFC8,
|
| 1274 |
{0x00FFCA, 0x0004},
|
| 1275 |
-
{0x00FFD0,
|
| 1276 |
{0x00FFD2, 0x0004},
|
| 1277 |
-
{0x00FFD8,
|
| 1278 |
{0x00FFDA, 0x0004},
|
| 1279 |
-
{0x00FFDD,
|
| 1280 |
{0x00FFE0, 0x0040},
|
| 1281 |
-
{0x00FFE7,
|
| 1282 |
{0x00FFE8, 0x0040},
|
| 1283 |
-
{0x00FFEF,
|
|
|
|
| 1284 |
{0x00FFFC, 0x0040},
|
| 1285 |
-
{0x00FFFE,
|
| 1286 |
{0x010000, 0x0004},
|
| 1287 |
-
{0x01000C,
|
| 1288 |
{0x01000D, 0x0004},
|
| 1289 |
-
{0x010027,
|
| 1290 |
{0x010028, 0x0004},
|
| 1291 |
-
{0x01003B,
|
| 1292 |
{0x01003C, 0x0004},
|
| 1293 |
-
{0x01003E,
|
| 1294 |
{0x01003F, 0x0004},
|
| 1295 |
-
{0x01004E,
|
| 1296 |
{0x010050, 0x0004},
|
| 1297 |
-
{0x01005E,
|
| 1298 |
{0x010080, 0x0004},
|
| 1299 |
-
{0x0100FB,
|
| 1300 |
{0x010100, 0x0020},
|
| 1301 |
-
{0x010103,
|
| 1302 |
{0x010107, 0x0002},
|
| 1303 |
-
{0x010134,
|
| 1304 |
{0x010137, 0x0040},
|
| 1305 |
{0x010140, 0x0002},
|
| 1306 |
{0x010179, 0x0040},
|
| 1307 |
{0x01018A, 0x0002},
|
| 1308 |
{0x01018C, 0x0040},
|
| 1309 |
-
{0x01018F,
|
| 1310 |
{0x010190, 0x0040},
|
| 1311 |
-
{0x01019D,
|
| 1312 |
{0x0101A0, 0x0040},
|
| 1313 |
-
{0x0101A1,
|
| 1314 |
{0x0101D0, 0x0040},
|
| 1315 |
{0x0101FD, 0x0010},
|
| 1316 |
-
{0x0101FE,
|
| 1317 |
{0x010280, 0x0004},
|
| 1318 |
-
{0x01029D,
|
| 1319 |
{0x0102A0, 0x0004},
|
| 1320 |
-
{0x0102D1,
|
| 1321 |
{0x0102E0, 0x0010},
|
| 1322 |
{0x0102E1, 0x0002},
|
| 1323 |
-
{0x0102FC,
|
| 1324 |
{0x010300, 0x0004},
|
| 1325 |
{0x010320, 0x0002},
|
| 1326 |
-
{0x010324,
|
| 1327 |
{0x01032D, 0x0004},
|
| 1328 |
{0x010341, 0x0002},
|
| 1329 |
{0x010342, 0x0004},
|
| 1330 |
{0x01034A, 0x0002},
|
| 1331 |
-
{0x01034B,
|
| 1332 |
{0x010350, 0x0004},
|
| 1333 |
{0x010376, 0x0010},
|
| 1334 |
-
{0x01037B,
|
| 1335 |
{0x010380, 0x0004},
|
| 1336 |
-
{0x01039E,
|
| 1337 |
{0x01039F, 0x0020},
|
| 1338 |
{0x0103A0, 0x0004},
|
| 1339 |
-
{0x0103C4,
|
| 1340 |
{0x0103C8, 0x0004},
|
| 1341 |
{0x0103D0, 0x0020},
|
| 1342 |
{0x0103D1, 0x0002},
|
| 1343 |
-
{0x0103D6,
|
| 1344 |
{0x010400, 0x0004},
|
| 1345 |
-
{0x01049E,
|
| 1346 |
{0x0104A0, 0x0002},
|
| 1347 |
-
{0x0104AA,
|
| 1348 |
{0x0104B0, 0x0004},
|
| 1349 |
-
{0x0104D4,
|
| 1350 |
{0x0104D8, 0x0004},
|
| 1351 |
-
{0x0104FC,
|
| 1352 |
{0x010500, 0x0004},
|
| 1353 |
-
{0x010528,
|
| 1354 |
{0x010530, 0x0004},
|
| 1355 |
-
{0x010564,
|
| 1356 |
{0x01056F, 0x0020},
|
| 1357 |
{0x010570, 0x0004},
|
| 1358 |
-
{0x01057B,
|
| 1359 |
{0x01057C, 0x0004},
|
| 1360 |
-
{0x01058B,
|
| 1361 |
{0x01058C, 0x0004},
|
| 1362 |
-
{0x010593,
|
| 1363 |
{0x010594, 0x0004},
|
| 1364 |
-
{0x010596,
|
| 1365 |
{0x010597, 0x0004},
|
| 1366 |
-
{0x0105A2,
|
| 1367 |
{0x0105A3, 0x0004},
|
| 1368 |
-
{0x0105B2,
|
| 1369 |
{0x0105B3, 0x0004},
|
| 1370 |
-
{0x0105BA,
|
| 1371 |
{0x0105BB, 0x0004},
|
| 1372 |
-
{0x0105BD,
|
| 1373 |
{0x010600, 0x0004},
|
| 1374 |
-
{0x010737,
|
| 1375 |
{0x010740, 0x0004},
|
| 1376 |
-
{0x010756,
|
| 1377 |
{0x010760, 0x0004},
|
| 1378 |
-
{0x010768,
|
| 1379 |
{0x010780, 0x0004},
|
| 1380 |
-
{0x010786,
|
| 1381 |
{0x010787, 0x0004},
|
| 1382 |
-
{0x0107B1,
|
| 1383 |
{0x0107B2, 0x0004},
|
| 1384 |
-
{0x0107BB,
|
| 1385 |
{0x010800, 0x0004},
|
| 1386 |
-
{0x010806,
|
| 1387 |
{0x010808, 0x0004},
|
| 1388 |
-
{0x010809,
|
| 1389 |
{0x01080A, 0x0004},
|
| 1390 |
-
{0x010836,
|
| 1391 |
{0x010837, 0x0004},
|
| 1392 |
-
{0x010839,
|
| 1393 |
{0x01083C, 0x0004},
|
| 1394 |
-
{0x01083D,
|
| 1395 |
{0x01083F, 0x0004},
|
| 1396 |
-
{0x010856,
|
| 1397 |
{0x010857, 0x0020},
|
| 1398 |
{0x010858, 0x0002},
|
| 1399 |
{0x010860, 0x0004},
|
| 1400 |
{0x010877, 0x0040},
|
| 1401 |
{0x010879, 0x0002},
|
| 1402 |
{0x010880, 0x0004},
|
| 1403 |
-
{0x01089F,
|
| 1404 |
{0x0108A7, 0x0002},
|
| 1405 |
-
{0x0108B0,
|
| 1406 |
{0x0108E0, 0x0004},
|
| 1407 |
-
{0x0108F3,
|
| 1408 |
{0x0108F4, 0x0004},
|
| 1409 |
-
{0x0108F6,
|
| 1410 |
{0x0108FB, 0x0002},
|
| 1411 |
{0x010900, 0x0004},
|
| 1412 |
{0x010916, 0x0002},
|
| 1413 |
-
{0x01091C,
|
| 1414 |
{0x01091F, 0x0020},
|
| 1415 |
{0x010920, 0x0004},
|
| 1416 |
-
{0x01093A,
|
| 1417 |
{0x01093F, 0x0020},
|
| 1418 |
-
{0x010940,
|
| 1419 |
{0x010980, 0x0004},
|
| 1420 |
-
{0x0109B8,
|
| 1421 |
{0x0109BC, 0x0002},
|
| 1422 |
{0x0109BE, 0x0004},
|
| 1423 |
{0x0109C0, 0x0002},
|
| 1424 |
-
{0x0109D0,
|
| 1425 |
{0x0109D2, 0x0002},
|
| 1426 |
{0x010A00, 0x0004},
|
| 1427 |
{0x010A01, 0x0010},
|
| 1428 |
-
{0x010A04,
|
| 1429 |
{0x010A05, 0x0010},
|
| 1430 |
-
{0x010A07,
|
| 1431 |
{0x010A0C, 0x0010},
|
| 1432 |
{0x010A10, 0x0004},
|
| 1433 |
-
{0x010A14,
|
| 1434 |
{0x010A15, 0x0004},
|
| 1435 |
-
{0x010A18,
|
| 1436 |
{0x010A19, 0x0004},
|
| 1437 |
-
{0x010A36,
|
| 1438 |
{0x010A38, 0x0010},
|
| 1439 |
-
{0x010A3B,
|
| 1440 |
{0x010A3F, 0x0010},
|
| 1441 |
{0x010A40, 0x0002},
|
| 1442 |
-
{0x010A49,
|
| 1443 |
{0x010A50, 0x0020},
|
| 1444 |
-
{0x010A59,
|
| 1445 |
{0x010A60, 0x0004},
|
| 1446 |
{0x010A7D, 0x0002},
|
| 1447 |
{0x010A7F, 0x0020},
|
| 1448 |
{0x010A80, 0x0004},
|
| 1449 |
{0x010A9D, 0x0002},
|
| 1450 |
-
{0x010AA0,
|
| 1451 |
{0x010AC0, 0x0004},
|
| 1452 |
{0x010AC8, 0x0040},
|
| 1453 |
{0x010AC9, 0x0004},
|
| 1454 |
{0x010AE5, 0x0010},
|
| 1455 |
-
{0x010AE7,
|
| 1456 |
{0x010AEB, 0x0002},
|
| 1457 |
{0x010AF0, 0x0020},
|
| 1458 |
-
{0x010AF7,
|
| 1459 |
{0x010B00, 0x0004},
|
| 1460 |
-
{0x010B36,
|
| 1461 |
{0x010B39, 0x0020},
|
| 1462 |
{0x010B40, 0x0004},
|
| 1463 |
-
{0x010B56,
|
| 1464 |
{0x010B58, 0x0002},
|
| 1465 |
{0x010B60, 0x0004},
|
| 1466 |
-
{0x010B73,
|
| 1467 |
{0x010B78, 0x0002},
|
| 1468 |
{0x010B80, 0x0004},
|
| 1469 |
-
{0x010B92,
|
| 1470 |
{0x010B99, 0x0020},
|
| 1471 |
-
{0x010B9D,
|
| 1472 |
{0x010BA9, 0x0002},
|
| 1473 |
-
{0x010BB0,
|
| 1474 |
{0x010C00, 0x0004},
|
| 1475 |
-
{0x010C49,
|
| 1476 |
{0x010C80, 0x0004},
|
| 1477 |
-
{0x010CB3,
|
| 1478 |
{0x010CC0, 0x0004},
|
| 1479 |
-
{0x010CF3,
|
| 1480 |
{0x010CFA, 0x0002},
|
| 1481 |
{0x010D00, 0x0004},
|
| 1482 |
{0x010D24, 0x0010},
|
| 1483 |
-
{0x010D28,
|
| 1484 |
{0x010D30, 0x0002},
|
| 1485 |
-
{0x010D3A,
|
| 1486 |
{0x010E60, 0x0002},
|
| 1487 |
-
{0x010E7F,
|
| 1488 |
{0x010E80, 0x0004},
|
| 1489 |
-
{0x010EAA,
|
| 1490 |
{0x010EAB, 0x0010},
|
| 1491 |
{0x010EAD, 0x0020},
|
| 1492 |
-
{0x010EAE,
|
| 1493 |
{0x010EB0, 0x0004},
|
| 1494 |
-
{0x010EB2,
|
| 1495 |
{0x010EFD, 0x0010},
|
| 1496 |
{0x010F00, 0x0004},
|
| 1497 |
{0x010F1D, 0x0002},
|
| 1498 |
{0x010F27, 0x0004},
|
| 1499 |
-
{0x010F28,
|
| 1500 |
{0x010F30, 0x0004},
|
| 1501 |
{0x010F46, 0x0010},
|
| 1502 |
{0x010F51, 0x0002},
|
| 1503 |
{0x010F55, 0x0020},
|
| 1504 |
-
{0x010F5A,
|
| 1505 |
{0x010F70, 0x0004},
|
| 1506 |
{0x010F82, 0x0010},
|
| 1507 |
{0x010F86, 0x0020},
|
| 1508 |
-
{0x010F8A,
|
| 1509 |
{0x010FB0, 0x0004},
|
| 1510 |
{0x010FC5, 0x0002},
|
| 1511 |
-
{0x010FCC,
|
| 1512 |
{0x010FE0, 0x0004},
|
| 1513 |
-
{0x010FF7,
|
| 1514 |
{0x011000, 0x0010},
|
| 1515 |
{0x011003, 0x0004},
|
| 1516 |
{0x011038, 0x0010},
|
| 1517 |
{0x011047, 0x0020},
|
| 1518 |
-
{0x01104E,
|
| 1519 |
{0x011052, 0x0002},
|
| 1520 |
{0x011070, 0x0010},
|
| 1521 |
{0x011071, 0x0004},
|
| 1522 |
{0x011073, 0x0010},
|
| 1523 |
{0x011075, 0x0004},
|
| 1524 |
-
{0x011076,
|
| 1525 |
{0x01107F, 0x0010},
|
| 1526 |
{0x011083, 0x0004},
|
| 1527 |
{0x0110B0, 0x0010},
|
|
@@ -1529,26 +1539,28 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 1529 |
{0x0110BD, 0x0080},
|
| 1530 |
{0x0110BE, 0x0020},
|
| 1531 |
{0x0110C2, 0x0010},
|
| 1532 |
-
{0x0110C3,
|
|
|
|
|
|
|
| 1533 |
{0x0110D0, 0x0004},
|
| 1534 |
-
{0x0110E9,
|
| 1535 |
{0x0110F0, 0x0002},
|
| 1536 |
-
{0x0110FA,
|
| 1537 |
{0x011100, 0x0010},
|
| 1538 |
{0x011103, 0x0004},
|
| 1539 |
{0x011127, 0x0010},
|
| 1540 |
-
{0x011135,
|
| 1541 |
{0x011136, 0x0002},
|
| 1542 |
{0x011140, 0x0020},
|
| 1543 |
{0x011144, 0x0004},
|
| 1544 |
{0x011145, 0x0010},
|
| 1545 |
{0x011147, 0x0004},
|
| 1546 |
-
{0x011148,
|
| 1547 |
{0x011150, 0x0004},
|
| 1548 |
{0x011173, 0x0010},
|
| 1549 |
{0x011174, 0x0020},
|
| 1550 |
{0x011176, 0x0004},
|
| 1551 |
-
{0x011177,
|
| 1552 |
{0x011180, 0x0010},
|
| 1553 |
{0x011183, 0x0004},
|
| 1554 |
{0x0111B3, 0x0010},
|
|
@@ -1562,159 +1574,159 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 1562 |
{0x0111DB, 0x0020},
|
| 1563 |
{0x0111DC, 0x0004},
|
| 1564 |
{0x0111DD, 0x0020},
|
| 1565 |
-
{0x0111E0,
|
| 1566 |
{0x0111E1, 0x0002},
|
| 1567 |
-
{0x0111F5,
|
| 1568 |
{0x011200, 0x0004},
|
| 1569 |
-
{0x011212,
|
| 1570 |
{0x011213, 0x0004},
|
| 1571 |
{0x01122C, 0x0010},
|
| 1572 |
{0x011238, 0x0020},
|
| 1573 |
{0x01123E, 0x0010},
|
| 1574 |
{0x01123F, 0x0004},
|
| 1575 |
{0x011241, 0x0010},
|
| 1576 |
-
{0x011242,
|
| 1577 |
{0x011280, 0x0004},
|
| 1578 |
-
{0x011287,
|
| 1579 |
{0x011288, 0x0004},
|
| 1580 |
-
{0x011289,
|
| 1581 |
{0x01128A, 0x0004},
|
| 1582 |
-
{0x01128E,
|
| 1583 |
{0x01128F, 0x0004},
|
| 1584 |
-
{0x01129E,
|
| 1585 |
{0x01129F, 0x0004},
|
| 1586 |
{0x0112A9, 0x0020},
|
| 1587 |
-
{0x0112AA,
|
| 1588 |
{0x0112B0, 0x0004},
|
| 1589 |
{0x0112DF, 0x0010},
|
| 1590 |
-
{0x0112EB,
|
| 1591 |
{0x0112F0, 0x0002},
|
| 1592 |
-
{0x0112FA,
|
| 1593 |
{0x011300, 0x0010},
|
| 1594 |
-
{0x011304,
|
| 1595 |
{0x011305, 0x0004},
|
| 1596 |
-
{0x01130D,
|
| 1597 |
{0x01130F, 0x0004},
|
| 1598 |
-
{0x011311,
|
| 1599 |
{0x011313, 0x0004},
|
| 1600 |
-
{0x011329,
|
| 1601 |
{0x01132A, 0x0004},
|
| 1602 |
-
{0x011331,
|
| 1603 |
{0x011332, 0x0004},
|
| 1604 |
-
{0x011334,
|
| 1605 |
{0x011335, 0x0004},
|
| 1606 |
-
{0x01133A,
|
| 1607 |
{0x01133B, 0x0010},
|
| 1608 |
{0x01133D, 0x0004},
|
| 1609 |
{0x01133E, 0x0010},
|
| 1610 |
-
{0x011345,
|
| 1611 |
{0x011347, 0x0010},
|
| 1612 |
-
{0x011349,
|
| 1613 |
{0x01134B, 0x0010},
|
| 1614 |
-
{0x01134E,
|
| 1615 |
{0x011350, 0x0004},
|
| 1616 |
-
{0x011351,
|
| 1617 |
{0x011357, 0x0010},
|
| 1618 |
-
{0x011358,
|
| 1619 |
{0x01135D, 0x0004},
|
| 1620 |
{0x011362, 0x0010},
|
| 1621 |
-
{0x011364,
|
| 1622 |
{0x011366, 0x0010},
|
| 1623 |
-
{0x01136D,
|
| 1624 |
{0x011370, 0x0010},
|
| 1625 |
-
{0x011375,
|
| 1626 |
{0x011400, 0x0004},
|
| 1627 |
{0x011435, 0x0010},
|
| 1628 |
{0x011447, 0x0004},
|
| 1629 |
{0x01144B, 0x0020},
|
| 1630 |
{0x011450, 0x0002},
|
| 1631 |
{0x01145A, 0x0020},
|
| 1632 |
-
{0x01145C,
|
| 1633 |
{0x01145D, 0x0020},
|
| 1634 |
{0x01145E, 0x0010},
|
| 1635 |
{0x01145F, 0x0004},
|
| 1636 |
-
{0x011462,
|
| 1637 |
{0x011480, 0x0004},
|
| 1638 |
{0x0114B0, 0x0010},
|
| 1639 |
{0x0114C4, 0x0004},
|
| 1640 |
{0x0114C6, 0x0020},
|
| 1641 |
{0x0114C7, 0x0004},
|
| 1642 |
-
{0x0114C8,
|
| 1643 |
{0x0114D0, 0x0002},
|
| 1644 |
-
{0x0114DA,
|
| 1645 |
{0x011580, 0x0004},
|
| 1646 |
{0x0115AF, 0x0010},
|
| 1647 |
-
{0x0115B6,
|
| 1648 |
{0x0115B8, 0x0010},
|
| 1649 |
{0x0115C1, 0x0020},
|
| 1650 |
{0x0115D8, 0x0004},
|
| 1651 |
{0x0115DC, 0x0010},
|
| 1652 |
-
{0x0115DE,
|
| 1653 |
{0x011600, 0x0004},
|
| 1654 |
{0x011630, 0x0010},
|
| 1655 |
{0x011641, 0x0020},
|
| 1656 |
{0x011644, 0x0004},
|
| 1657 |
-
{0x011645,
|
| 1658 |
{0x011650, 0x0002},
|
| 1659 |
-
{0x01165A,
|
| 1660 |
{0x011660, 0x0020},
|
| 1661 |
-
{0x01166D,
|
| 1662 |
{0x011680, 0x0004},
|
| 1663 |
{0x0116AB, 0x0010},
|
| 1664 |
{0x0116B8, 0x0004},
|
| 1665 |
{0x0116B9, 0x0020},
|
| 1666 |
-
{0x0116BA,
|
| 1667 |
{0x0116C0, 0x0002},
|
| 1668 |
-
{0x0116CA,
|
| 1669 |
{0x011700, 0x0004},
|
| 1670 |
-
{0x01171B,
|
| 1671 |
{0x01171D, 0x0010},
|
| 1672 |
-
{0x01172C,
|
| 1673 |
{0x011730, 0x0002},
|
| 1674 |
{0x01173C, 0x0020},
|
| 1675 |
{0x01173F, 0x0040},
|
| 1676 |
{0x011740, 0x0004},
|
| 1677 |
-
{0x011747,
|
| 1678 |
{0x011800, 0x0004},
|
| 1679 |
{0x01182C, 0x0010},
|
| 1680 |
{0x01183B, 0x0020},
|
| 1681 |
-
{0x01183C,
|
| 1682 |
{0x0118A0, 0x0004},
|
| 1683 |
{0x0118E0, 0x0002},
|
| 1684 |
-
{0x0118F3,
|
| 1685 |
{0x0118FF, 0x0004},
|
| 1686 |
-
{0x011907,
|
| 1687 |
{0x011909, 0x0004},
|
| 1688 |
-
{0x01190A,
|
| 1689 |
{0x01190C, 0x0004},
|
| 1690 |
-
{0x011914,
|
| 1691 |
{0x011915, 0x0004},
|
| 1692 |
-
{0x011917,
|
| 1693 |
{0x011918, 0x0004},
|
| 1694 |
{0x011930, 0x0010},
|
| 1695 |
-
{0x011936,
|
| 1696 |
{0x011937, 0x0010},
|
| 1697 |
-
{0x011939,
|
| 1698 |
{0x01193B, 0x0010},
|
| 1699 |
{0x01193F, 0x0004},
|
| 1700 |
{0x011940, 0x0010},
|
| 1701 |
{0x011941, 0x0004},
|
| 1702 |
{0x011942, 0x0010},
|
| 1703 |
{0x011944, 0x0020},
|
| 1704 |
-
{0x011947,
|
| 1705 |
{0x011950, 0x0002},
|
| 1706 |
-
{0x01195A,
|
| 1707 |
{0x0119A0, 0x0004},
|
| 1708 |
-
{0x0119A8,
|
| 1709 |
{0x0119AA, 0x0004},
|
| 1710 |
{0x0119D1, 0x0010},
|
| 1711 |
-
{0x0119D8,
|
| 1712 |
{0x0119DA, 0x0010},
|
| 1713 |
{0x0119E1, 0x0004},
|
| 1714 |
{0x0119E2, 0x0020},
|
| 1715 |
{0x0119E3, 0x0004},
|
| 1716 |
{0x0119E4, 0x0010},
|
| 1717 |
-
{0x0119E5,
|
| 1718 |
{0x011A00, 0x0004},
|
| 1719 |
{0x011A01, 0x0010},
|
| 1720 |
{0x011A0B, 0x0004},
|
|
@@ -1723,7 +1735,7 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 1723 |
{0x011A3B, 0x0010},
|
| 1724 |
{0x011A3F, 0x0020},
|
| 1725 |
{0x011A47, 0x0010},
|
| 1726 |
-
{0x011A48,
|
| 1727 |
{0x011A50, 0x0004},
|
| 1728 |
{0x011A51, 0x0010},
|
| 1729 |
{0x011A5C, 0x0004},
|
|
@@ -1731,117 +1743,117 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 1731 |
{0x011A9A, 0x0020},
|
| 1732 |
{0x011A9D, 0x0004},
|
| 1733 |
{0x011A9E, 0x0020},
|
| 1734 |
-
{0x011AA3,
|
| 1735 |
{0x011AB0, 0x0004},
|
| 1736 |
-
{0x011AF9,
|
| 1737 |
{0x011B00, 0x0020},
|
| 1738 |
-
{0x011B0A,
|
| 1739 |
{0x011C00, 0x0004},
|
| 1740 |
-
{0x011C09,
|
| 1741 |
{0x011C0A, 0x0004},
|
| 1742 |
{0x011C2F, 0x0010},
|
| 1743 |
-
{0x011C37,
|
| 1744 |
{0x011C38, 0x0010},
|
| 1745 |
{0x011C40, 0x0004},
|
| 1746 |
{0x011C41, 0x0020},
|
| 1747 |
-
{0x011C46,
|
| 1748 |
{0x011C50, 0x0002},
|
| 1749 |
-
{0x011C6D,
|
| 1750 |
{0x011C70, 0x0020},
|
| 1751 |
{0x011C72, 0x0004},
|
| 1752 |
-
{0x011C90,
|
| 1753 |
{0x011C92, 0x0010},
|
| 1754 |
-
{0x011CA8,
|
| 1755 |
{0x011CA9, 0x0010},
|
| 1756 |
-
{0x011CB7,
|
| 1757 |
{0x011D00, 0x0004},
|
| 1758 |
-
{0x011D07,
|
| 1759 |
{0x011D08, 0x0004},
|
| 1760 |
-
{0x011D0A,
|
| 1761 |
{0x011D0B, 0x0004},
|
| 1762 |
{0x011D31, 0x0010},
|
| 1763 |
-
{0x011D37,
|
| 1764 |
{0x011D3A, 0x0010},
|
| 1765 |
-
{0x011D3B,
|
| 1766 |
{0x011D3C, 0x0010},
|
| 1767 |
-
{0x011D3E,
|
| 1768 |
{0x011D3F, 0x0010},
|
| 1769 |
{0x011D46, 0x0004},
|
| 1770 |
{0x011D47, 0x0010},
|
| 1771 |
-
{0x011D48,
|
| 1772 |
{0x011D50, 0x0002},
|
| 1773 |
-
{0x011D5A,
|
| 1774 |
{0x011D60, 0x0004},
|
| 1775 |
-
{0x011D66,
|
| 1776 |
{0x011D67, 0x0004},
|
| 1777 |
-
{0x011D69,
|
| 1778 |
{0x011D6A, 0x0004},
|
| 1779 |
{0x011D8A, 0x0010},
|
| 1780 |
-
{0x011D8F,
|
| 1781 |
{0x011D90, 0x0010},
|
| 1782 |
-
{0x011D92,
|
| 1783 |
{0x011D93, 0x0010},
|
| 1784 |
{0x011D98, 0x0004},
|
| 1785 |
-
{0x011D99,
|
| 1786 |
{0x011DA0, 0x0002},
|
| 1787 |
-
{0x011DAA,
|
| 1788 |
{0x011EE0, 0x0004},
|
| 1789 |
{0x011EF3, 0x0010},
|
| 1790 |
{0x011EF7, 0x0020},
|
| 1791 |
-
{0x011EF9,
|
| 1792 |
{0x011F00, 0x0010},
|
| 1793 |
{0x011F02, 0x0004},
|
| 1794 |
{0x011F03, 0x0010},
|
| 1795 |
{0x011F04, 0x0004},
|
| 1796 |
-
{0x011F11,
|
| 1797 |
{0x011F12, 0x0004},
|
| 1798 |
{0x011F34, 0x0010},
|
| 1799 |
-
{0x011F3B,
|
| 1800 |
{0x011F3E, 0x0010},
|
| 1801 |
{0x011F43, 0x0020},
|
| 1802 |
{0x011F50, 0x0002},
|
| 1803 |
-
{0x011F5A,
|
| 1804 |
{0x011FB0, 0x0004},
|
| 1805 |
-
{0x011FB1,
|
| 1806 |
{0x011FC0, 0x0002},
|
| 1807 |
{0x011FD5, 0x0040},
|
| 1808 |
-
{0x011FF2,
|
| 1809 |
{0x011FFF, 0x0020},
|
| 1810 |
{0x012000, 0x0004},
|
| 1811 |
-
{0x01239A,
|
| 1812 |
{0x012400, 0x0002},
|
| 1813 |
-
{0x01246F,
|
| 1814 |
{0x012470, 0x0020},
|
| 1815 |
-
{0x012475,
|
| 1816 |
{0x012480, 0x0004},
|
| 1817 |
-
{0x012544,
|
| 1818 |
{0x012F90, 0x0004},
|
| 1819 |
{0x012FF1, 0x0020},
|
| 1820 |
-
{0x012FF3,
|
| 1821 |
{0x013000, 0x0004},
|
| 1822 |
{0x013430, 0x0080},
|
| 1823 |
{0x013440, 0x0010},
|
| 1824 |
{0x013441, 0x0004},
|
| 1825 |
{0x013447, 0x0010},
|
| 1826 |
-
{0x013456,
|
| 1827 |
{0x014400, 0x0004},
|
| 1828 |
-
{0x014647,
|
| 1829 |
{0x016800, 0x0004},
|
| 1830 |
-
{0x016A39,
|
| 1831 |
{0x016A40, 0x0004},
|
| 1832 |
-
{0x016A5F,
|
| 1833 |
{0x016A60, 0x0002},
|
| 1834 |
-
{0x016A6A,
|
| 1835 |
{0x016A6E, 0x0020},
|
| 1836 |
{0x016A70, 0x0004},
|
| 1837 |
-
{0x016ABF,
|
| 1838 |
{0x016AC0, 0x0002},
|
| 1839 |
-
{0x016ACA,
|
| 1840 |
{0x016AD0, 0x0004},
|
| 1841 |
-
{0x016AEE,
|
| 1842 |
{0x016AF0, 0x0010},
|
| 1843 |
{0x016AF5, 0x0020},
|
| 1844 |
-
{0x016AF6,
|
| 1845 |
{0x016B00, 0x0004},
|
| 1846 |
{0x016B30, 0x0010},
|
| 1847 |
{0x016B37, 0x0020},
|
|
@@ -1849,81 +1861,82 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 1849 |
{0x016B40, 0x0004},
|
| 1850 |
{0x016B44, 0x0020},
|
| 1851 |
{0x016B45, 0x0040},
|
| 1852 |
-
{0x016B46,
|
| 1853 |
{0x016B50, 0x0002},
|
| 1854 |
-
{0x016B5A,
|
| 1855 |
{0x016B5B, 0x0002},
|
| 1856 |
-
{0x016B62,
|
| 1857 |
{0x016B63, 0x0004},
|
| 1858 |
-
{0x016B78,
|
| 1859 |
{0x016B7D, 0x0004},
|
| 1860 |
-
{0x016B90,
|
| 1861 |
{0x016E40, 0x0004},
|
| 1862 |
{0x016E80, 0x0002},
|
| 1863 |
{0x016E97, 0x0020},
|
| 1864 |
-
{0x016E9B,
|
| 1865 |
{0x016F00, 0x0004},
|
| 1866 |
-
{0x016F4B,
|
| 1867 |
{0x016F4F, 0x0010},
|
| 1868 |
{0x016F50, 0x0004},
|
| 1869 |
{0x016F51, 0x0010},
|
| 1870 |
-
{0x016F88,
|
| 1871 |
{0x016F8F, 0x0010},
|
| 1872 |
{0x016F93, 0x0004},
|
| 1873 |
-
{0x016FA0,
|
| 1874 |
{0x016FE0, 0x0004},
|
| 1875 |
{0x016FE2, 0x0020},
|
| 1876 |
{0x016FE3, 0x0004},
|
| 1877 |
{0x016FE4, 0x0010},
|
| 1878 |
-
{0x016FE5,
|
| 1879 |
{0x016FF0, 0x0010},
|
| 1880 |
-
{0x016FF2,
|
| 1881 |
{0x017000, 0x0004},
|
| 1882 |
-
{0x0187F8,
|
| 1883 |
{0x018800, 0x0004},
|
| 1884 |
-
{0x018CD6,
|
| 1885 |
{0x018D00, 0x0004},
|
| 1886 |
-
{0x018D09,
|
| 1887 |
{0x01AFF0, 0x0004},
|
| 1888 |
-
{0x01AFF4,
|
| 1889 |
{0x01AFF5, 0x0004},
|
| 1890 |
-
{0x01AFFC,
|
| 1891 |
{0x01AFFD, 0x0004},
|
| 1892 |
-
{0x01AFFF,
|
| 1893 |
{0x01B000, 0x0004},
|
| 1894 |
-
{0x01B123,
|
| 1895 |
{0x01B132, 0x0004},
|
| 1896 |
-
{0x01B133,
|
| 1897 |
{0x01B150, 0x0004},
|
| 1898 |
-
{0x01B153,
|
| 1899 |
{0x01B155, 0x0004},
|
| 1900 |
-
{0x01B156,
|
| 1901 |
{0x01B164, 0x0004},
|
| 1902 |
-
{0x01B168,
|
| 1903 |
{0x01B170, 0x0004},
|
| 1904 |
-
{0x01B2FC,
|
| 1905 |
{0x01BC00, 0x0004},
|
| 1906 |
-
{0x01BC6B,
|
| 1907 |
{0x01BC70, 0x0004},
|
| 1908 |
-
{0x01BC7D,
|
| 1909 |
{0x01BC80, 0x0004},
|
| 1910 |
-
{0x01BC89,
|
| 1911 |
{0x01BC90, 0x0004},
|
| 1912 |
-
{0x01BC9A,
|
| 1913 |
{0x01BC9C, 0x0040},
|
| 1914 |
{0x01BC9D, 0x0010},
|
| 1915 |
{0x01BC9F, 0x0020},
|
| 1916 |
{0x01BCA0, 0x0080},
|
|
|
|
| 1917 |
{0x01CF00, 0x0010},
|
| 1918 |
-
{0x01CF2E,
|
| 1919 |
{0x01CF30, 0x0010},
|
| 1920 |
-
{0x01CF47,
|
| 1921 |
{0x01CF50, 0x0040},
|
| 1922 |
-
{0x01CFC4,
|
| 1923 |
{0x01D000, 0x0040},
|
| 1924 |
-
{0x01D0F6,
|
| 1925 |
{0x01D100, 0x0040},
|
| 1926 |
-
{0x01D127,
|
| 1927 |
{0x01D129, 0x0040},
|
| 1928 |
{0x01D165, 0x0010},
|
| 1929 |
{0x01D16A, 0x0040},
|
|
@@ -1935,57 +1948,57 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 1935 |
{0x01D18C, 0x0040},
|
| 1936 |
{0x01D1AA, 0x0010},
|
| 1937 |
{0x01D1AE, 0x0040},
|
| 1938 |
-
{0x01D1EB,
|
| 1939 |
{0x01D200, 0x0040},
|
| 1940 |
{0x01D242, 0x0010},
|
| 1941 |
{0x01D245, 0x0040},
|
| 1942 |
-
{0x01D246,
|
| 1943 |
{0x01D2C0, 0x0002},
|
| 1944 |
-
{0x01D2D4,
|
| 1945 |
{0x01D2E0, 0x0002},
|
| 1946 |
-
{0x01D2F4,
|
| 1947 |
{0x01D300, 0x0040},
|
| 1948 |
-
{0x01D357,
|
| 1949 |
{0x01D360, 0x0002},
|
| 1950 |
-
{0x01D379,
|
| 1951 |
{0x01D400, 0x0004},
|
| 1952 |
-
{0x01D455,
|
| 1953 |
{0x01D456, 0x0004},
|
| 1954 |
-
{0x01D49D,
|
| 1955 |
{0x01D49E, 0x0004},
|
| 1956 |
-
{0x01D4A0,
|
| 1957 |
{0x01D4A2, 0x0004},
|
| 1958 |
-
{0x01D4A3,
|
| 1959 |
{0x01D4A5, 0x0004},
|
| 1960 |
-
{0x01D4A7,
|
| 1961 |
{0x01D4A9, 0x0004},
|
| 1962 |
-
{0x01D4AD,
|
| 1963 |
{0x01D4AE, 0x0004},
|
| 1964 |
-
{0x01D4BA,
|
| 1965 |
{0x01D4BB, 0x0004},
|
| 1966 |
-
{0x01D4BC,
|
| 1967 |
{0x01D4BD, 0x0004},
|
| 1968 |
-
{0x01D4C4,
|
| 1969 |
{0x01D4C5, 0x0004},
|
| 1970 |
-
{0x01D506,
|
| 1971 |
{0x01D507, 0x0004},
|
| 1972 |
-
{0x01D50B,
|
| 1973 |
{0x01D50D, 0x0004},
|
| 1974 |
-
{0x01D515,
|
| 1975 |
{0x01D516, 0x0004},
|
| 1976 |
-
{0x01D51D,
|
| 1977 |
{0x01D51E, 0x0004},
|
| 1978 |
-
{0x01D53A,
|
| 1979 |
{0x01D53B, 0x0004},
|
| 1980 |
-
{0x01D53F,
|
| 1981 |
{0x01D540, 0x0004},
|
| 1982 |
-
{0x01D545,
|
| 1983 |
{0x01D546, 0x0004},
|
| 1984 |
-
{0x01D547,
|
| 1985 |
{0x01D54A, 0x0004},
|
| 1986 |
-
{0x01D551,
|
| 1987 |
{0x01D552, 0x0004},
|
| 1988 |
-
{0x01D6A6,
|
| 1989 |
{0x01D6A8, 0x0004},
|
| 1990 |
{0x01D6C1, 0x0040},
|
| 1991 |
{0x01D6C2, 0x0004},
|
|
@@ -2007,7 +2020,7 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 2007 |
{0x01D7AA, 0x0004},
|
| 2008 |
{0x01D7C3, 0x0040},
|
| 2009 |
{0x01D7C4, 0x0004},
|
| 2010 |
-
{0x01D7CC,
|
| 2011 |
{0x01D7CE, 0x0002},
|
| 2012 |
{0x01D800, 0x0040},
|
| 2013 |
{0x01DA00, 0x0010},
|
|
@@ -2019,251 +2032,283 @@ const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // st
|
|
| 2019 |
{0x01DA84, 0x0010},
|
| 2020 |
{0x01DA85, 0x0040},
|
| 2021 |
{0x01DA87, 0x0020},
|
| 2022 |
-
{0x01DA8C,
|
| 2023 |
{0x01DA9B, 0x0010},
|
| 2024 |
-
{0x01DAA0,
|
| 2025 |
{0x01DAA1, 0x0010},
|
| 2026 |
-
{0x01DAB0,
|
| 2027 |
{0x01DF00, 0x0004},
|
| 2028 |
-
{0x01DF1F,
|
| 2029 |
{0x01DF25, 0x0004},
|
| 2030 |
-
{0x01DF2B,
|
| 2031 |
{0x01E000, 0x0010},
|
| 2032 |
-
{0x01E007,
|
| 2033 |
{0x01E008, 0x0010},
|
| 2034 |
-
{0x01E019,
|
| 2035 |
{0x01E01B, 0x0010},
|
| 2036 |
-
{0x01E022,
|
| 2037 |
{0x01E023, 0x0010},
|
| 2038 |
-
{0x01E025,
|
| 2039 |
{0x01E026, 0x0010},
|
| 2040 |
-
{0x01E02B,
|
| 2041 |
{0x01E030, 0x0004},
|
| 2042 |
-
{0x01E06E,
|
| 2043 |
{0x01E08F, 0x0010},
|
| 2044 |
-
{0x01E090,
|
| 2045 |
{0x01E100, 0x0004},
|
| 2046 |
-
{0x01E12D,
|
| 2047 |
{0x01E130, 0x0010},
|
| 2048 |
{0x01E137, 0x0004},
|
| 2049 |
-
{0x01E13E,
|
| 2050 |
{0x01E140, 0x0002},
|
| 2051 |
-
{0x01E14A,
|
| 2052 |
{0x01E14E, 0x0004},
|
| 2053 |
{0x01E14F, 0x0040},
|
| 2054 |
-
{0x01E150,
|
| 2055 |
{0x01E290, 0x0004},
|
| 2056 |
{0x01E2AE, 0x0010},
|
| 2057 |
-
{0x01E2AF,
|
| 2058 |
{0x01E2C0, 0x0004},
|
| 2059 |
{0x01E2EC, 0x0010},
|
| 2060 |
{0x01E2F0, 0x0002},
|
| 2061 |
-
{0x01E2FA,
|
| 2062 |
{0x01E2FF, 0x0040},
|
| 2063 |
-
{0x01E300,
|
| 2064 |
{0x01E4D0, 0x0004},
|
| 2065 |
{0x01E4EC, 0x0010},
|
| 2066 |
{0x01E4F0, 0x0002},
|
| 2067 |
-
{0x01E4FA,
|
| 2068 |
{0x01E7E0, 0x0004},
|
| 2069 |
-
{0x01E7E7,
|
| 2070 |
{0x01E7E8, 0x0004},
|
| 2071 |
-
{0x01E7EC,
|
| 2072 |
{0x01E7ED, 0x0004},
|
| 2073 |
-
{0x01E7EF,
|
| 2074 |
{0x01E7F0, 0x0004},
|
| 2075 |
-
{0x01E7FF,
|
| 2076 |
{0x01E800, 0x0004},
|
| 2077 |
-
{0x01E8C5,
|
| 2078 |
{0x01E8C7, 0x0002},
|
| 2079 |
{0x01E8D0, 0x0010},
|
| 2080 |
-
{0x01E8D7,
|
| 2081 |
{0x01E900, 0x0004},
|
| 2082 |
{0x01E944, 0x0010},
|
| 2083 |
{0x01E94B, 0x0004},
|
| 2084 |
-
{0x01E94C,
|
| 2085 |
{0x01E950, 0x0002},
|
| 2086 |
-
{0x01E95A,
|
| 2087 |
{0x01E95E, 0x0020},
|
| 2088 |
-
{0x01E960,
|
| 2089 |
{0x01EC71, 0x0002},
|
| 2090 |
{0x01ECAC, 0x0040},
|
| 2091 |
{0x01ECAD, 0x0002},
|
| 2092 |
{0x01ECB0, 0x0040},
|
| 2093 |
{0x01ECB1, 0x0002},
|
| 2094 |
-
{0x01ECB5,
|
| 2095 |
{0x01ED01, 0x0002},
|
| 2096 |
{0x01ED2E, 0x0040},
|
| 2097 |
{0x01ED2F, 0x0002},
|
| 2098 |
-
{0x01ED3E,
|
| 2099 |
{0x01EE00, 0x0004},
|
| 2100 |
-
{0x01EE04,
|
| 2101 |
{0x01EE05, 0x0004},
|
| 2102 |
-
{0x01EE20,
|
| 2103 |
{0x01EE21, 0x0004},
|
| 2104 |
-
{0x01EE23,
|
| 2105 |
{0x01EE24, 0x0004},
|
| 2106 |
-
{0x01EE25,
|
| 2107 |
{0x01EE27, 0x0004},
|
| 2108 |
-
{0x01EE28,
|
| 2109 |
{0x01EE29, 0x0004},
|
| 2110 |
-
{0x01EE33,
|
| 2111 |
{0x01EE34, 0x0004},
|
| 2112 |
-
{0x01EE38,
|
| 2113 |
{0x01EE39, 0x0004},
|
| 2114 |
-
{0x01EE3A,
|
| 2115 |
{0x01EE3B, 0x0004},
|
| 2116 |
-
{0x01EE3C,
|
| 2117 |
{0x01EE42, 0x0004},
|
| 2118 |
-
{0x01EE43,
|
| 2119 |
{0x01EE47, 0x0004},
|
| 2120 |
-
{0x01EE48,
|
| 2121 |
{0x01EE49, 0x0004},
|
| 2122 |
-
{0x01EE4A,
|
| 2123 |
{0x01EE4B, 0x0004},
|
| 2124 |
-
{0x01EE4C,
|
| 2125 |
{0x01EE4D, 0x0004},
|
| 2126 |
-
{0x01EE50,
|
| 2127 |
{0x01EE51, 0x0004},
|
| 2128 |
-
{0x01EE53,
|
| 2129 |
{0x01EE54, 0x0004},
|
| 2130 |
-
{0x01EE55,
|
| 2131 |
{0x01EE57, 0x0004},
|
| 2132 |
-
{0x01EE58,
|
| 2133 |
{0x01EE59, 0x0004},
|
| 2134 |
-
{0x01EE5A,
|
| 2135 |
{0x01EE5B, 0x0004},
|
| 2136 |
-
{0x01EE5C,
|
| 2137 |
{0x01EE5D, 0x0004},
|
| 2138 |
-
{0x01EE5E,
|
| 2139 |
{0x01EE5F, 0x0004},
|
| 2140 |
-
{0x01EE60,
|
| 2141 |
{0x01EE61, 0x0004},
|
| 2142 |
-
{0x01EE63,
|
| 2143 |
{0x01EE64, 0x0004},
|
| 2144 |
-
{0x01EE65,
|
| 2145 |
{0x01EE67, 0x0004},
|
| 2146 |
-
{0x01EE6B,
|
| 2147 |
{0x01EE6C, 0x0004},
|
| 2148 |
-
{0x01EE73,
|
| 2149 |
{0x01EE74, 0x0004},
|
| 2150 |
-
{0x01EE78,
|
| 2151 |
{0x01EE79, 0x0004},
|
| 2152 |
-
{0x01EE7D,
|
| 2153 |
{0x01EE7E, 0x0004},
|
| 2154 |
-
{0x01EE7F,
|
| 2155 |
{0x01EE80, 0x0004},
|
| 2156 |
-
{0x01EE8A,
|
| 2157 |
{0x01EE8B, 0x0004},
|
| 2158 |
-
{0x01EE9C,
|
| 2159 |
{0x01EEA1, 0x0004},
|
| 2160 |
-
{0x01EEA4,
|
| 2161 |
{0x01EEA5, 0x0004},
|
| 2162 |
-
{0x01EEAA,
|
| 2163 |
{0x01EEAB, 0x0004},
|
| 2164 |
-
{0x01EEBC,
|
| 2165 |
{0x01EEF0, 0x0040},
|
| 2166 |
-
{0x01EEF2,
|
| 2167 |
{0x01F000, 0x0040},
|
| 2168 |
-
{0x01F02C,
|
| 2169 |
{0x01F030, 0x0040},
|
| 2170 |
-
{0x01F094,
|
| 2171 |
{0x01F0A0, 0x0040},
|
| 2172 |
-
{0x01F0AF,
|
| 2173 |
{0x01F0B1, 0x0040},
|
| 2174 |
-
{0x01F0C0,
|
| 2175 |
{0x01F0C1, 0x0040},
|
| 2176 |
-
{0x01F0D0,
|
| 2177 |
{0x01F0D1, 0x0040},
|
| 2178 |
-
{0x01F0F6,
|
| 2179 |
{0x01F100, 0x0002},
|
| 2180 |
{0x01F10D, 0x0040},
|
| 2181 |
-
{0x01F1AE,
|
| 2182 |
{0x01F1E6, 0x0040},
|
| 2183 |
-
{0x01F203,
|
| 2184 |
{0x01F210, 0x0040},
|
| 2185 |
-
{0x01F23C,
|
| 2186 |
{0x01F240, 0x0040},
|
| 2187 |
-
{0x01F249,
|
| 2188 |
{0x01F250, 0x0040},
|
| 2189 |
-
{0x01F252,
|
| 2190 |
{0x01F260, 0x0040},
|
| 2191 |
-
{0x01F266,
|
| 2192 |
{0x01F300, 0x0040},
|
| 2193 |
-
{0x01F6D8,
|
| 2194 |
{0x01F6DC, 0x0040},
|
| 2195 |
-
{0x01F6ED,
|
| 2196 |
{0x01F6F0, 0x0040},
|
| 2197 |
-
{0x01F6FD,
|
| 2198 |
{0x01F700, 0x0040},
|
| 2199 |
-
{0x01F777,
|
| 2200 |
{0x01F77B, 0x0040},
|
| 2201 |
-
{0x01F7DA,
|
| 2202 |
{0x01F7E0, 0x0040},
|
| 2203 |
-
{0x01F7EC,
|
| 2204 |
{0x01F7F0, 0x0040},
|
| 2205 |
-
{0x01F7F1,
|
| 2206 |
{0x01F800, 0x0040},
|
| 2207 |
-
{0x01F80C,
|
| 2208 |
{0x01F810, 0x0040},
|
| 2209 |
-
{0x01F848,
|
| 2210 |
{0x01F850, 0x0040},
|
| 2211 |
-
{0x01F85A,
|
| 2212 |
{0x01F860, 0x0040},
|
| 2213 |
-
{0x01F888,
|
| 2214 |
{0x01F890, 0x0040},
|
| 2215 |
-
{0x01F8AE,
|
| 2216 |
{0x01F8B0, 0x0040},
|
| 2217 |
-
{0x01F8B2,
|
| 2218 |
{0x01F900, 0x0040},
|
| 2219 |
-
{0x01FA54,
|
| 2220 |
{0x01FA60, 0x0040},
|
| 2221 |
-
{0x01FA6E,
|
| 2222 |
{0x01FA70, 0x0040},
|
| 2223 |
-
{0x01FA7D,
|
| 2224 |
{0x01FA80, 0x0040},
|
| 2225 |
-
{0x01FA89,
|
| 2226 |
{0x01FA90, 0x0040},
|
| 2227 |
-
{0x01FABE,
|
| 2228 |
{0x01FABF, 0x0040},
|
| 2229 |
-
{0x01FAC6,
|
| 2230 |
{0x01FACE, 0x0040},
|
| 2231 |
-
{0x01FADC,
|
| 2232 |
{0x01FAE0, 0x0040},
|
| 2233 |
-
{0x01FAE9,
|
| 2234 |
{0x01FAF0, 0x0040},
|
| 2235 |
-
{0x01FAF9,
|
| 2236 |
{0x01FB00, 0x0040},
|
| 2237 |
-
{0x01FB93,
|
| 2238 |
{0x01FB94, 0x0040},
|
| 2239 |
-
{0x01FBCB,
|
| 2240 |
{0x01FBF0, 0x0002},
|
| 2241 |
-
{0x01FBFA,
|
| 2242 |
{0x020000, 0x0004},
|
| 2243 |
-
{0x02A6E0,
|
| 2244 |
{0x02A700, 0x0004},
|
| 2245 |
-
{0x02B73A,
|
| 2246 |
{0x02B740, 0x0004},
|
| 2247 |
-
{0x02B81E,
|
| 2248 |
{0x02B820, 0x0004},
|
| 2249 |
-
{0x02CEA2,
|
| 2250 |
{0x02CEB0, 0x0004},
|
| 2251 |
-
{0x02EBE1,
|
| 2252 |
{0x02EBF0, 0x0004},
|
| 2253 |
-
{0x02EE5E,
|
| 2254 |
{0x02F800, 0x0004},
|
| 2255 |
-
{0x02FA1E,
|
| 2256 |
{0x030000, 0x0004},
|
| 2257 |
-
{0x03134B,
|
| 2258 |
{0x031350, 0x0004},
|
| 2259 |
-
{0x0323B0,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2260 |
{0x0E0100, 0x0010},
|
| 2261 |
-
{0x0E01F0,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2262 |
{0x110000, 0x0000},
|
| 2263 |
};
|
| 2264 |
|
| 2265 |
const std::unordered_set<uint32_t> unicode_set_whitespace = {
|
| 2266 |
-
0x000009,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2267 |
};
|
| 2268 |
|
| 2269 |
const std::unordered_map<uint32_t, uint32_t> unicode_map_lowercase = {
|
|
@@ -3222,6 +3267,7 @@ const std::unordered_map<uint32_t, uint32_t> unicode_map_lowercase = {
|
|
| 3222 |
{0x002C2C, 0x002C5C},
|
| 3223 |
{0x002C2D, 0x002C5D},
|
| 3224 |
{0x002C2E, 0x002C5E},
|
|
|
|
| 3225 |
{0x002C60, 0x002C61},
|
| 3226 |
{0x002C62, 0x00026B},
|
| 3227 |
{0x002C63, 0x001D7D},
|
|
@@ -3402,12 +3448,16 @@ const std::unordered_map<uint32_t, uint32_t> unicode_map_lowercase = {
|
|
| 3402 |
{0x00A7BA, 0x00A7BB},
|
| 3403 |
{0x00A7BC, 0x00A7BD},
|
| 3404 |
{0x00A7BE, 0x00A7BF},
|
|
|
|
| 3405 |
{0x00A7C2, 0x00A7C3},
|
| 3406 |
{0x00A7C4, 0x00A794},
|
| 3407 |
{0x00A7C5, 0x000282},
|
| 3408 |
{0x00A7C6, 0x001D8E},
|
| 3409 |
{0x00A7C7, 0x00A7C8},
|
| 3410 |
{0x00A7C9, 0x00A7CA},
|
|
|
|
|
|
|
|
|
|
| 3411 |
{0x00A7F5, 0x00A7F6},
|
| 3412 |
{0x00FF21, 0x00FF41},
|
| 3413 |
{0x00FF22, 0x00FF42},
|
|
@@ -3511,6 +3561,41 @@ const std::unordered_map<uint32_t, uint32_t> unicode_map_lowercase = {
|
|
| 3511 |
{0x0104D1, 0x0104F9},
|
| 3512 |
{0x0104D2, 0x0104FA},
|
| 3513 |
{0x0104D3, 0x0104FB},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3514 |
{0x010C80, 0x010CC0},
|
| 3515 |
{0x010C81, 0x010CC1},
|
| 3516 |
{0x010C82, 0x010CC2},
|
|
@@ -3690,7 +3775,6 @@ const std::unordered_map<uint32_t, uint32_t> unicode_map_uppercase = {
|
|
| 3690 |
{0x000079, 0x000059},
|
| 3691 |
{0x00007A, 0x00005A},
|
| 3692 |
{0x0000B5, 0x00039C},
|
| 3693 |
-
{0x0000DF, 0x000053},
|
| 3694 |
{0x0000E0, 0x0000C0},
|
| 3695 |
{0x0000E1, 0x0000C1},
|
| 3696 |
{0x0000E2, 0x0000C2},
|
|
@@ -3758,7 +3842,6 @@ const std::unordered_map<uint32_t, uint32_t> unicode_map_uppercase = {
|
|
| 3758 |
{0x000144, 0x000143},
|
| 3759 |
{0x000146, 0x000145},
|
| 3760 |
{0x000148, 0x000147},
|
| 3761 |
-
{0x000149, 0x0002BC},
|
| 3762 |
{0x00014B, 0x00014A},
|
| 3763 |
{0x00014D, 0x00014C},
|
| 3764 |
{0x00014F, 0x00014E},
|
|
@@ -3831,7 +3914,6 @@ const std::unordered_map<uint32_t, uint32_t> unicode_map_uppercase = {
|
|
| 3831 |
{0x0001EB, 0x0001EA},
|
| 3832 |
{0x0001ED, 0x0001EC},
|
| 3833 |
{0x0001EF, 0x0001EE},
|
| 3834 |
-
{0x0001F0, 0x00004A},
|
| 3835 |
{0x0001F2, 0x0001F1},
|
| 3836 |
{0x0001F3, 0x0001F1},
|
| 3837 |
{0x0001F5, 0x0001F4},
|
|
@@ -3917,12 +3999,10 @@ const std::unordered_map<uint32_t, uint32_t> unicode_map_uppercase = {
|
|
| 3917 |
{0x00037B, 0x0003FD},
|
| 3918 |
{0x00037C, 0x0003FE},
|
| 3919 |
{0x00037D, 0x0003FF},
|
| 3920 |
-
{0x000390, 0x000399},
|
| 3921 |
{0x0003AC, 0x000386},
|
| 3922 |
{0x0003AD, 0x000388},
|
| 3923 |
{0x0003AE, 0x000389},
|
| 3924 |
{0x0003AF, 0x00038A},
|
| 3925 |
-
{0x0003B0, 0x0003A5},
|
| 3926 |
{0x0003B1, 0x000391},
|
| 3927 |
{0x0003B2, 0x000392},
|
| 3928 |
{0x0003B3, 0x000393},
|
|
@@ -4163,7 +4243,6 @@ const std::unordered_map<uint32_t, uint32_t> unicode_map_uppercase = {
|
|
| 4163 |
{0x000584, 0x000554},
|
| 4164 |
{0x000585, 0x000555},
|
| 4165 |
{0x000586, 0x000556},
|
| 4166 |
-
{0x000587, 0x000535},
|
| 4167 |
{0x0010D0, 0x001C90},
|
| 4168 |
{0x0010D1, 0x001C91},
|
| 4169 |
{0x0010D2, 0x001C92},
|
|
@@ -4303,11 +4382,6 @@ const std::unordered_map<uint32_t, uint32_t> unicode_map_uppercase = {
|
|
| 4303 |
{0x001E91, 0x001E90},
|
| 4304 |
{0x001E93, 0x001E92},
|
| 4305 |
{0x001E95, 0x001E94},
|
| 4306 |
-
{0x001E96, 0x000048},
|
| 4307 |
-
{0x001E97, 0x000054},
|
| 4308 |
-
{0x001E98, 0x000057},
|
| 4309 |
-
{0x001E99, 0x000059},
|
| 4310 |
-
{0x001E9A, 0x000041},
|
| 4311 |
{0x001E9B, 0x001E60},
|
| 4312 |
{0x001EA1, 0x001EA0},
|
| 4313 |
{0x001EA3, 0x001EA2},
|
|
@@ -4393,13 +4467,9 @@ const std::unordered_map<uint32_t, uint32_t> unicode_map_uppercase = {
|
|
| 4393 |
{0x001F43, 0x001F4B},
|
| 4394 |
{0x001F44, 0x001F4C},
|
| 4395 |
{0x001F45, 0x001F4D},
|
| 4396 |
-
{0x001F50, 0x0003A5},
|
| 4397 |
{0x001F51, 0x001F59},
|
| 4398 |
-
{0x001F52, 0x0003A5},
|
| 4399 |
{0x001F53, 0x001F5B},
|
| 4400 |
-
{0x001F54, 0x0003A5},
|
| 4401 |
{0x001F55, 0x001F5D},
|
| 4402 |
-
{0x001F56, 0x0003A5},
|
| 4403 |
{0x001F57, 0x001F5F},
|
| 4404 |
{0x001F60, 0x001F68},
|
| 4405 |
{0x001F61, 0x001F69},
|
|
@@ -4423,89 +4493,41 @@ const std::unordered_map<uint32_t, uint32_t> unicode_map_uppercase = {
|
|
| 4423 |
{0x001F7B, 0x001FEB},
|
| 4424 |
{0x001F7C, 0x001FFA},
|
| 4425 |
{0x001F7D, 0x001FFB},
|
| 4426 |
-
{0x001F80,
|
| 4427 |
-
{0x001F81,
|
| 4428 |
-
{0x001F82,
|
| 4429 |
-
{0x001F83,
|
| 4430 |
-
{0x001F84,
|
| 4431 |
-
{0x001F85,
|
| 4432 |
-
{0x001F86,
|
| 4433 |
-
{0x001F87,
|
| 4434 |
-
{
|
| 4435 |
-
{
|
| 4436 |
-
{
|
| 4437 |
-
{
|
| 4438 |
-
{
|
| 4439 |
-
{
|
| 4440 |
-
{
|
| 4441 |
-
{
|
| 4442 |
-
{
|
| 4443 |
-
{
|
| 4444 |
-
{
|
| 4445 |
-
{
|
| 4446 |
-
{
|
| 4447 |
-
{
|
| 4448 |
-
{
|
| 4449 |
-
{
|
| 4450 |
-
{0x001F98, 0x001F28},
|
| 4451 |
-
{0x001F99, 0x001F29},
|
| 4452 |
-
{0x001F9A, 0x001F2A},
|
| 4453 |
-
{0x001F9B, 0x001F2B},
|
| 4454 |
-
{0x001F9C, 0x001F2C},
|
| 4455 |
-
{0x001F9D, 0x001F2D},
|
| 4456 |
-
{0x001F9E, 0x001F2E},
|
| 4457 |
-
{0x001F9F, 0x001F2F},
|
| 4458 |
-
{0x001FA0, 0x001F68},
|
| 4459 |
-
{0x001FA1, 0x001F69},
|
| 4460 |
-
{0x001FA2, 0x001F6A},
|
| 4461 |
-
{0x001FA3, 0x001F6B},
|
| 4462 |
-
{0x001FA4, 0x001F6C},
|
| 4463 |
-
{0x001FA5, 0x001F6D},
|
| 4464 |
-
{0x001FA6, 0x001F6E},
|
| 4465 |
-
{0x001FA7, 0x001F6F},
|
| 4466 |
-
{0x001FA8, 0x001F68},
|
| 4467 |
-
{0x001FA9, 0x001F69},
|
| 4468 |
-
{0x001FAA, 0x001F6A},
|
| 4469 |
-
{0x001FAB, 0x001F6B},
|
| 4470 |
-
{0x001FAC, 0x001F6C},
|
| 4471 |
-
{0x001FAD, 0x001F6D},
|
| 4472 |
-
{0x001FAE, 0x001F6E},
|
| 4473 |
-
{0x001FAF, 0x001F6F},
|
| 4474 |
{0x001FB0, 0x001FB8},
|
| 4475 |
{0x001FB1, 0x001FB9},
|
| 4476 |
-
{
|
| 4477 |
-
{0x001FB3, 0x000391},
|
| 4478 |
-
{0x001FB4, 0x000386},
|
| 4479 |
-
{0x001FB6, 0x000391},
|
| 4480 |
-
{0x001FB7, 0x000391},
|
| 4481 |
-
{0x001FBC, 0x000391},
|
| 4482 |
{0x001FBE, 0x000399},
|
| 4483 |
-
{
|
| 4484 |
-
{0x001FC3, 0x000397},
|
| 4485 |
-
{0x001FC4, 0x000389},
|
| 4486 |
-
{0x001FC6, 0x000397},
|
| 4487 |
-
{0x001FC7, 0x000397},
|
| 4488 |
-
{0x001FCC, 0x000397},
|
| 4489 |
{0x001FD0, 0x001FD8},
|
| 4490 |
{0x001FD1, 0x001FD9},
|
| 4491 |
-
{0x001FD2, 0x000399},
|
| 4492 |
-
{0x001FD3, 0x000399},
|
| 4493 |
-
{0x001FD6, 0x000399},
|
| 4494 |
-
{0x001FD7, 0x000399},
|
| 4495 |
{0x001FE0, 0x001FE8},
|
| 4496 |
{0x001FE1, 0x001FE9},
|
| 4497 |
-
{0x001FE2, 0x0003A5},
|
| 4498 |
-
{0x001FE3, 0x0003A5},
|
| 4499 |
-
{0x001FE4, 0x0003A1},
|
| 4500 |
{0x001FE5, 0x001FEC},
|
| 4501 |
-
{
|
| 4502 |
-
{0x001FE7, 0x0003A5},
|
| 4503 |
-
{0x001FF2, 0x001FFA},
|
| 4504 |
-
{0x001FF3, 0x0003A9},
|
| 4505 |
-
{0x001FF4, 0x00038F},
|
| 4506 |
-
{0x001FF6, 0x0003A9},
|
| 4507 |
-
{0x001FF7, 0x0003A9},
|
| 4508 |
-
{0x001FFC, 0x0003A9},
|
| 4509 |
{0x00214E, 0x002132},
|
| 4510 |
{0x002170, 0x002160},
|
| 4511 |
{0x002171, 0x002161},
|
|
@@ -4597,6 +4619,7 @@ const std::unordered_map<uint32_t, uint32_t> unicode_map_uppercase = {
|
|
| 4597 |
{0x002C5C, 0x002C2C},
|
| 4598 |
{0x002C5D, 0x002C2D},
|
| 4599 |
{0x002C5E, 0x002C2E},
|
|
|
|
| 4600 |
{0x002C61, 0x002C60},
|
| 4601 |
{0x002C65, 0x00023A},
|
| 4602 |
{0x002C66, 0x00023E},
|
|
@@ -4800,9 +4823,13 @@ const std::unordered_map<uint32_t, uint32_t> unicode_map_uppercase = {
|
|
| 4800 |
{0x00A7BB, 0x00A7BA},
|
| 4801 |
{0x00A7BD, 0x00A7BC},
|
| 4802 |
{0x00A7BF, 0x00A7BE},
|
|
|
|
| 4803 |
{0x00A7C3, 0x00A7C2},
|
| 4804 |
{0x00A7C8, 0x00A7C7},
|
| 4805 |
{0x00A7CA, 0x00A7C9},
|
|
|
|
|
|
|
|
|
|
| 4806 |
{0x00A7F6, 0x00A7F5},
|
| 4807 |
{0x00AB53, 0x00A7B3},
|
| 4808 |
{0x00AB70, 0x0013A0},
|
|
@@ -4885,18 +4912,6 @@ const std::unordered_map<uint32_t, uint32_t> unicode_map_uppercase = {
|
|
| 4885 |
{0x00ABBD, 0x0013ED},
|
| 4886 |
{0x00ABBE, 0x0013EE},
|
| 4887 |
{0x00ABBF, 0x0013EF},
|
| 4888 |
-
{0x00FB00, 0x000046},
|
| 4889 |
-
{0x00FB01, 0x000046},
|
| 4890 |
-
{0x00FB02, 0x000046},
|
| 4891 |
-
{0x00FB03, 0x000046},
|
| 4892 |
-
{0x00FB04, 0x000046},
|
| 4893 |
-
{0x00FB05, 0x000053},
|
| 4894 |
-
{0x00FB06, 0x000053},
|
| 4895 |
-
{0x00FB13, 0x000544},
|
| 4896 |
-
{0x00FB14, 0x000544},
|
| 4897 |
-
{0x00FB15, 0x000544},
|
| 4898 |
-
{0x00FB16, 0x00054E},
|
| 4899 |
-
{0x00FB17, 0x000544},
|
| 4900 |
{0x00FF41, 0x00FF21},
|
| 4901 |
{0x00FF42, 0x00FF22},
|
| 4902 |
{0x00FF43, 0x00FF23},
|
|
@@ -4999,6 +5014,41 @@ const std::unordered_map<uint32_t, uint32_t> unicode_map_uppercase = {
|
|
| 4999 |
{0x0104F9, 0x0104D1},
|
| 5000 |
{0x0104FA, 0x0104D2},
|
| 5001 |
{0x0104FB, 0x0104D3},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5002 |
{0x010CC0, 0x010C80},
|
| 5003 |
{0x010CC1, 0x010C81},
|
| 5004 |
{0x010CC2, 0x010C82},
|
|
|
|
| 68 |
{0x000370, 0x0004},
|
| 69 |
{0x000375, 0x0040},
|
| 70 |
{0x000376, 0x0004},
|
| 71 |
+
{0x000378, 0x0001},
|
| 72 |
{0x00037A, 0x0004},
|
| 73 |
{0x00037E, 0x0020},
|
| 74 |
{0x00037F, 0x0004},
|
| 75 |
+
{0x000380, 0x0001},
|
| 76 |
{0x000384, 0x0040},
|
| 77 |
{0x000386, 0x0004},
|
| 78 |
{0x000387, 0x0020},
|
| 79 |
{0x000388, 0x0004},
|
| 80 |
+
{0x00038B, 0x0001},
|
| 81 |
{0x00038C, 0x0004},
|
| 82 |
+
{0x00038D, 0x0001},
|
| 83 |
{0x00038E, 0x0004},
|
| 84 |
+
{0x0003A2, 0x0001},
|
| 85 |
{0x0003A3, 0x0004},
|
| 86 |
{0x0003F6, 0x0040},
|
| 87 |
{0x0003F7, 0x0004},
|
| 88 |
{0x000482, 0x0040},
|
| 89 |
{0x000483, 0x0010},
|
| 90 |
{0x00048A, 0x0004},
|
| 91 |
+
{0x000530, 0x0001},
|
| 92 |
{0x000531, 0x0004},
|
| 93 |
+
{0x000557, 0x0001},
|
| 94 |
{0x000559, 0x0004},
|
| 95 |
{0x00055A, 0x0020},
|
| 96 |
{0x000560, 0x0004},
|
| 97 |
{0x000589, 0x0020},
|
| 98 |
+
{0x00058B, 0x0001},
|
| 99 |
{0x00058D, 0x0040},
|
| 100 |
+
{0x000590, 0x0001},
|
| 101 |
{0x000591, 0x0010},
|
| 102 |
{0x0005BE, 0x0020},
|
| 103 |
{0x0005BF, 0x0010},
|
|
|
|
| 107 |
{0x0005C4, 0x0010},
|
| 108 |
{0x0005C6, 0x0020},
|
| 109 |
{0x0005C7, 0x0010},
|
| 110 |
+
{0x0005C8, 0x0001},
|
| 111 |
{0x0005D0, 0x0004},
|
| 112 |
+
{0x0005EB, 0x0001},
|
| 113 |
{0x0005EF, 0x0004},
|
| 114 |
{0x0005F3, 0x0020},
|
| 115 |
+
{0x0005F5, 0x0001},
|
| 116 |
+
{0x000600, 0x0080},
|
| 117 |
{0x000606, 0x0040},
|
| 118 |
{0x000609, 0x0020},
|
| 119 |
{0x00060B, 0x0040},
|
|
|
|
| 146 |
{0x0006FD, 0x0040},
|
| 147 |
{0x0006FF, 0x0004},
|
| 148 |
{0x000700, 0x0020},
|
| 149 |
+
{0x00070E, 0x0001},
|
| 150 |
+
{0x00070F, 0x0080},
|
| 151 |
{0x000710, 0x0004},
|
| 152 |
{0x000711, 0x0010},
|
| 153 |
{0x000712, 0x0004},
|
| 154 |
{0x000730, 0x0010},
|
| 155 |
+
{0x00074B, 0x0001},
|
| 156 |
{0x00074D, 0x0004},
|
| 157 |
{0x0007A6, 0x0010},
|
| 158 |
{0x0007B1, 0x0004},
|
| 159 |
+
{0x0007B2, 0x0001},
|
| 160 |
{0x0007C0, 0x0002},
|
| 161 |
{0x0007CA, 0x0004},
|
| 162 |
{0x0007EB, 0x0010},
|
|
|
|
| 164 |
{0x0007F6, 0x0040},
|
| 165 |
{0x0007F7, 0x0020},
|
| 166 |
{0x0007FA, 0x0004},
|
| 167 |
+
{0x0007FB, 0x0001},
|
| 168 |
{0x0007FD, 0x0010},
|
| 169 |
{0x0007FE, 0x0040},
|
| 170 |
{0x000800, 0x0004},
|
|
|
|
| 175 |
{0x000825, 0x0010},
|
| 176 |
{0x000828, 0x0004},
|
| 177 |
{0x000829, 0x0010},
|
| 178 |
+
{0x00082E, 0x0001},
|
| 179 |
{0x000830, 0x0020},
|
| 180 |
+
{0x00083F, 0x0001},
|
| 181 |
{0x000840, 0x0004},
|
| 182 |
{0x000859, 0x0010},
|
| 183 |
+
{0x00085C, 0x0001},
|
| 184 |
{0x00085E, 0x0020},
|
| 185 |
+
{0x00085F, 0x0001},
|
| 186 |
{0x000860, 0x0004},
|
| 187 |
+
{0x00086B, 0x0001},
|
| 188 |
{0x000870, 0x0004},
|
| 189 |
{0x000888, 0x0040},
|
| 190 |
{0x000889, 0x0004},
|
| 191 |
+
{0x00088F, 0x0001},
|
| 192 |
+
{0x000890, 0x0080},
|
| 193 |
+
{0x000892, 0x0001},
|
| 194 |
{0x000898, 0x0010},
|
| 195 |
{0x0008A0, 0x0004},
|
| 196 |
{0x0008CA, 0x0010},
|
|
|
|
| 209 |
{0x000970, 0x0020},
|
| 210 |
{0x000971, 0x0004},
|
| 211 |
{0x000981, 0x0010},
|
| 212 |
+
{0x000984, 0x0001},
|
| 213 |
{0x000985, 0x0004},
|
| 214 |
+
{0x00098D, 0x0001},
|
| 215 |
{0x00098F, 0x0004},
|
| 216 |
+
{0x000991, 0x0001},
|
| 217 |
{0x000993, 0x0004},
|
| 218 |
+
{0x0009A9, 0x0001},
|
| 219 |
{0x0009AA, 0x0004},
|
| 220 |
+
{0x0009B1, 0x0001},
|
| 221 |
{0x0009B2, 0x0004},
|
| 222 |
+
{0x0009B3, 0x0001},
|
| 223 |
{0x0009B6, 0x0004},
|
| 224 |
+
{0x0009BA, 0x0001},
|
| 225 |
{0x0009BC, 0x0010},
|
| 226 |
{0x0009BD, 0x0004},
|
| 227 |
{0x0009BE, 0x0010},
|
| 228 |
+
{0x0009C5, 0x0001},
|
| 229 |
{0x0009C7, 0x0010},
|
| 230 |
+
{0x0009C9, 0x0001},
|
| 231 |
{0x0009CB, 0x0010},
|
| 232 |
{0x0009CE, 0x0004},
|
| 233 |
+
{0x0009CF, 0x0001},
|
| 234 |
{0x0009D7, 0x0010},
|
| 235 |
+
{0x0009D8, 0x0001},
|
| 236 |
{0x0009DC, 0x0004},
|
| 237 |
+
{0x0009DE, 0x0001},
|
| 238 |
{0x0009DF, 0x0004},
|
| 239 |
{0x0009E2, 0x0010},
|
| 240 |
+
{0x0009E4, 0x0001},
|
| 241 |
{0x0009E6, 0x0002},
|
| 242 |
{0x0009F0, 0x0004},
|
| 243 |
{0x0009F2, 0x0040},
|
|
|
|
| 246 |
{0x0009FC, 0x0004},
|
| 247 |
{0x0009FD, 0x0020},
|
| 248 |
{0x0009FE, 0x0010},
|
| 249 |
+
{0x0009FF, 0x0001},
|
| 250 |
{0x000A01, 0x0010},
|
| 251 |
+
{0x000A04, 0x0001},
|
| 252 |
{0x000A05, 0x0004},
|
| 253 |
+
{0x000A0B, 0x0001},
|
| 254 |
{0x000A0F, 0x0004},
|
| 255 |
+
{0x000A11, 0x0001},
|
| 256 |
{0x000A13, 0x0004},
|
| 257 |
+
{0x000A29, 0x0001},
|
| 258 |
{0x000A2A, 0x0004},
|
| 259 |
+
{0x000A31, 0x0001},
|
| 260 |
{0x000A32, 0x0004},
|
| 261 |
+
{0x000A34, 0x0001},
|
| 262 |
{0x000A35, 0x0004},
|
| 263 |
+
{0x000A37, 0x0001},
|
| 264 |
{0x000A38, 0x0004},
|
| 265 |
+
{0x000A3A, 0x0001},
|
| 266 |
{0x000A3C, 0x0010},
|
| 267 |
+
{0x000A3D, 0x0001},
|
| 268 |
{0x000A3E, 0x0010},
|
| 269 |
+
{0x000A43, 0x0001},
|
| 270 |
{0x000A47, 0x0010},
|
| 271 |
+
{0x000A49, 0x0001},
|
| 272 |
{0x000A4B, 0x0010},
|
| 273 |
+
{0x000A4E, 0x0001},
|
| 274 |
{0x000A51, 0x0010},
|
| 275 |
+
{0x000A52, 0x0001},
|
| 276 |
{0x000A59, 0x0004},
|
| 277 |
+
{0x000A5D, 0x0001},
|
| 278 |
{0x000A5E, 0x0004},
|
| 279 |
+
{0x000A5F, 0x0001},
|
| 280 |
{0x000A66, 0x0002},
|
| 281 |
{0x000A70, 0x0010},
|
| 282 |
{0x000A72, 0x0004},
|
| 283 |
{0x000A75, 0x0010},
|
| 284 |
{0x000A76, 0x0020},
|
| 285 |
+
{0x000A77, 0x0001},
|
| 286 |
{0x000A81, 0x0010},
|
| 287 |
+
{0x000A84, 0x0001},
|
| 288 |
{0x000A85, 0x0004},
|
| 289 |
+
{0x000A8E, 0x0001},
|
| 290 |
{0x000A8F, 0x0004},
|
| 291 |
+
{0x000A92, 0x0001},
|
| 292 |
{0x000A93, 0x0004},
|
| 293 |
+
{0x000AA9, 0x0001},
|
| 294 |
{0x000AAA, 0x0004},
|
| 295 |
+
{0x000AB1, 0x0001},
|
| 296 |
{0x000AB2, 0x0004},
|
| 297 |
+
{0x000AB4, 0x0001},
|
| 298 |
{0x000AB5, 0x0004},
|
| 299 |
+
{0x000ABA, 0x0001},
|
| 300 |
{0x000ABC, 0x0010},
|
| 301 |
{0x000ABD, 0x0004},
|
| 302 |
{0x000ABE, 0x0010},
|
| 303 |
+
{0x000AC6, 0x0001},
|
| 304 |
{0x000AC7, 0x0010},
|
| 305 |
+
{0x000ACA, 0x0001},
|
| 306 |
{0x000ACB, 0x0010},
|
| 307 |
+
{0x000ACE, 0x0001},
|
| 308 |
{0x000AD0, 0x0004},
|
| 309 |
+
{0x000AD1, 0x0001},
|
| 310 |
{0x000AE0, 0x0004},
|
| 311 |
{0x000AE2, 0x0010},
|
| 312 |
+
{0x000AE4, 0x0001},
|
| 313 |
{0x000AE6, 0x0002},
|
| 314 |
{0x000AF0, 0x0020},
|
| 315 |
{0x000AF1, 0x0040},
|
| 316 |
+
{0x000AF2, 0x0001},
|
| 317 |
{0x000AF9, 0x0004},
|
| 318 |
{0x000AFA, 0x0010},
|
| 319 |
+
{0x000B00, 0x0001},
|
| 320 |
{0x000B01, 0x0010},
|
| 321 |
+
{0x000B04, 0x0001},
|
| 322 |
{0x000B05, 0x0004},
|
| 323 |
+
{0x000B0D, 0x0001},
|
| 324 |
{0x000B0F, 0x0004},
|
| 325 |
+
{0x000B11, 0x0001},
|
| 326 |
{0x000B13, 0x0004},
|
| 327 |
+
{0x000B29, 0x0001},
|
| 328 |
{0x000B2A, 0x0004},
|
| 329 |
+
{0x000B31, 0x0001},
|
| 330 |
{0x000B32, 0x0004},
|
| 331 |
+
{0x000B34, 0x0001},
|
| 332 |
{0x000B35, 0x0004},
|
| 333 |
+
{0x000B3A, 0x0001},
|
| 334 |
{0x000B3C, 0x0010},
|
| 335 |
{0x000B3D, 0x0004},
|
| 336 |
{0x000B3E, 0x0010},
|
| 337 |
+
{0x000B45, 0x0001},
|
| 338 |
{0x000B47, 0x0010},
|
| 339 |
+
{0x000B49, 0x0001},
|
| 340 |
{0x000B4B, 0x0010},
|
| 341 |
+
{0x000B4E, 0x0001},
|
| 342 |
{0x000B55, 0x0010},
|
| 343 |
+
{0x000B58, 0x0001},
|
| 344 |
{0x000B5C, 0x0004},
|
| 345 |
+
{0x000B5E, 0x0001},
|
| 346 |
{0x000B5F, 0x0004},
|
| 347 |
{0x000B62, 0x0010},
|
| 348 |
+
{0x000B64, 0x0001},
|
| 349 |
{0x000B66, 0x0002},
|
| 350 |
{0x000B70, 0x0040},
|
| 351 |
{0x000B71, 0x0004},
|
| 352 |
{0x000B72, 0x0002},
|
| 353 |
+
{0x000B78, 0x0001},
|
| 354 |
{0x000B82, 0x0010},
|
| 355 |
{0x000B83, 0x0004},
|
| 356 |
+
{0x000B84, 0x0001},
|
| 357 |
{0x000B85, 0x0004},
|
| 358 |
+
{0x000B8B, 0x0001},
|
| 359 |
{0x000B8E, 0x0004},
|
| 360 |
+
{0x000B91, 0x0001},
|
| 361 |
{0x000B92, 0x0004},
|
| 362 |
+
{0x000B96, 0x0001},
|
| 363 |
{0x000B99, 0x0004},
|
| 364 |
+
{0x000B9B, 0x0001},
|
| 365 |
{0x000B9C, 0x0004},
|
| 366 |
+
{0x000B9D, 0x0001},
|
| 367 |
{0x000B9E, 0x0004},
|
| 368 |
+
{0x000BA0, 0x0001},
|
| 369 |
{0x000BA3, 0x0004},
|
| 370 |
+
{0x000BA5, 0x0001},
|
| 371 |
{0x000BA8, 0x0004},
|
| 372 |
+
{0x000BAB, 0x0001},
|
| 373 |
{0x000BAE, 0x0004},
|
| 374 |
+
{0x000BBA, 0x0001},
|
| 375 |
{0x000BBE, 0x0010},
|
| 376 |
+
{0x000BC3, 0x0001},
|
| 377 |
{0x000BC6, 0x0010},
|
| 378 |
+
{0x000BC9, 0x0001},
|
| 379 |
{0x000BCA, 0x0010},
|
| 380 |
+
{0x000BCE, 0x0001},
|
| 381 |
{0x000BD0, 0x0004},
|
| 382 |
+
{0x000BD1, 0x0001},
|
| 383 |
{0x000BD7, 0x0010},
|
| 384 |
+
{0x000BD8, 0x0001},
|
| 385 |
{0x000BE6, 0x0002},
|
| 386 |
{0x000BF3, 0x0040},
|
| 387 |
+
{0x000BFB, 0x0001},
|
| 388 |
{0x000C00, 0x0010},
|
| 389 |
{0x000C05, 0x0004},
|
| 390 |
+
{0x000C0D, 0x0001},
|
| 391 |
{0x000C0E, 0x0004},
|
| 392 |
+
{0x000C11, 0x0001},
|
| 393 |
{0x000C12, 0x0004},
|
| 394 |
+
{0x000C29, 0x0001},
|
| 395 |
{0x000C2A, 0x0004},
|
| 396 |
+
{0x000C3A, 0x0001},
|
| 397 |
{0x000C3C, 0x0010},
|
| 398 |
{0x000C3D, 0x0004},
|
| 399 |
{0x000C3E, 0x0010},
|
| 400 |
+
{0x000C45, 0x0001},
|
| 401 |
{0x000C46, 0x0010},
|
| 402 |
+
{0x000C49, 0x0001},
|
| 403 |
{0x000C4A, 0x0010},
|
| 404 |
+
{0x000C4E, 0x0001},
|
| 405 |
{0x000C55, 0x0010},
|
| 406 |
+
{0x000C57, 0x0001},
|
| 407 |
{0x000C58, 0x0004},
|
| 408 |
+
{0x000C5B, 0x0001},
|
| 409 |
{0x000C5D, 0x0004},
|
| 410 |
+
{0x000C5E, 0x0001},
|
| 411 |
{0x000C60, 0x0004},
|
| 412 |
{0x000C62, 0x0010},
|
| 413 |
+
{0x000C64, 0x0001},
|
| 414 |
{0x000C66, 0x0002},
|
| 415 |
+
{0x000C70, 0x0001},
|
| 416 |
{0x000C77, 0x0020},
|
| 417 |
{0x000C78, 0x0002},
|
| 418 |
{0x000C7F, 0x0040},
|
|
|
|
| 420 |
{0x000C81, 0x0010},
|
| 421 |
{0x000C84, 0x0020},
|
| 422 |
{0x000C85, 0x0004},
|
| 423 |
+
{0x000C8D, 0x0001},
|
| 424 |
{0x000C8E, 0x0004},
|
| 425 |
+
{0x000C91, 0x0001},
|
| 426 |
{0x000C92, 0x0004},
|
| 427 |
+
{0x000CA9, 0x0001},
|
| 428 |
{0x000CAA, 0x0004},
|
| 429 |
+
{0x000CB4, 0x0001},
|
| 430 |
{0x000CB5, 0x0004},
|
| 431 |
+
{0x000CBA, 0x0001},
|
| 432 |
{0x000CBC, 0x0010},
|
| 433 |
{0x000CBD, 0x0004},
|
| 434 |
{0x000CBE, 0x0010},
|
| 435 |
+
{0x000CC5, 0x0001},
|
| 436 |
{0x000CC6, 0x0010},
|
| 437 |
+
{0x000CC9, 0x0001},
|
| 438 |
{0x000CCA, 0x0010},
|
| 439 |
+
{0x000CCE, 0x0001},
|
| 440 |
{0x000CD5, 0x0010},
|
| 441 |
+
{0x000CD7, 0x0001},
|
| 442 |
{0x000CDD, 0x0004},
|
| 443 |
+
{0x000CDF, 0x0001},
|
| 444 |
{0x000CE0, 0x0004},
|
| 445 |
{0x000CE2, 0x0010},
|
| 446 |
+
{0x000CE4, 0x0001},
|
| 447 |
{0x000CE6, 0x0002},
|
| 448 |
+
{0x000CF0, 0x0001},
|
| 449 |
{0x000CF1, 0x0004},
|
| 450 |
{0x000CF3, 0x0010},
|
| 451 |
+
{0x000CF4, 0x0001},
|
| 452 |
{0x000D00, 0x0010},
|
| 453 |
{0x000D04, 0x0004},
|
| 454 |
+
{0x000D0D, 0x0001},
|
| 455 |
{0x000D0E, 0x0004},
|
| 456 |
+
{0x000D11, 0x0001},
|
| 457 |
{0x000D12, 0x0004},
|
| 458 |
{0x000D3B, 0x0010},
|
| 459 |
{0x000D3D, 0x0004},
|
| 460 |
{0x000D3E, 0x0010},
|
| 461 |
+
{0x000D45, 0x0001},
|
| 462 |
{0x000D46, 0x0010},
|
| 463 |
+
{0x000D49, 0x0001},
|
| 464 |
{0x000D4A, 0x0010},
|
| 465 |
{0x000D4E, 0x0004},
|
| 466 |
{0x000D4F, 0x0040},
|
| 467 |
+
{0x000D50, 0x0001},
|
| 468 |
{0x000D54, 0x0004},
|
| 469 |
{0x000D57, 0x0010},
|
| 470 |
{0x000D58, 0x0002},
|
| 471 |
{0x000D5F, 0x0004},
|
| 472 |
{0x000D62, 0x0010},
|
| 473 |
+
{0x000D64, 0x0001},
|
| 474 |
{0x000D66, 0x0002},
|
| 475 |
{0x000D79, 0x0040},
|
| 476 |
{0x000D7A, 0x0004},
|
| 477 |
+
{0x000D80, 0x0001},
|
| 478 |
{0x000D81, 0x0010},
|
| 479 |
+
{0x000D84, 0x0001},
|
| 480 |
{0x000D85, 0x0004},
|
| 481 |
+
{0x000D97, 0x0001},
|
| 482 |
{0x000D9A, 0x0004},
|
| 483 |
+
{0x000DB2, 0x0001},
|
| 484 |
{0x000DB3, 0x0004},
|
| 485 |
+
{0x000DBC, 0x0001},
|
| 486 |
{0x000DBD, 0x0004},
|
| 487 |
+
{0x000DBE, 0x0001},
|
| 488 |
{0x000DC0, 0x0004},
|
| 489 |
+
{0x000DC7, 0x0001},
|
| 490 |
{0x000DCA, 0x0010},
|
| 491 |
+
{0x000DCB, 0x0001},
|
| 492 |
{0x000DCF, 0x0010},
|
| 493 |
+
{0x000DD5, 0x0001},
|
| 494 |
{0x000DD6, 0x0010},
|
| 495 |
+
{0x000DD7, 0x0001},
|
| 496 |
{0x000DD8, 0x0010},
|
| 497 |
+
{0x000DE0, 0x0001},
|
| 498 |
{0x000DE6, 0x0002},
|
| 499 |
+
{0x000DF0, 0x0001},
|
| 500 |
{0x000DF2, 0x0010},
|
| 501 |
{0x000DF4, 0x0020},
|
| 502 |
+
{0x000DF5, 0x0001},
|
| 503 |
{0x000E01, 0x0004},
|
| 504 |
{0x000E31, 0x0010},
|
| 505 |
{0x000E32, 0x0004},
|
| 506 |
{0x000E34, 0x0010},
|
| 507 |
+
{0x000E3B, 0x0001},
|
| 508 |
{0x000E3F, 0x0040},
|
| 509 |
{0x000E40, 0x0004},
|
| 510 |
{0x000E47, 0x0010},
|
| 511 |
{0x000E4F, 0x0020},
|
| 512 |
{0x000E50, 0x0002},
|
| 513 |
{0x000E5A, 0x0020},
|
| 514 |
+
{0x000E5C, 0x0001},
|
| 515 |
{0x000E81, 0x0004},
|
| 516 |
+
{0x000E83, 0x0001},
|
| 517 |
{0x000E84, 0x0004},
|
| 518 |
+
{0x000E85, 0x0001},
|
| 519 |
{0x000E86, 0x0004},
|
| 520 |
+
{0x000E8B, 0x0001},
|
| 521 |
{0x000E8C, 0x0004},
|
| 522 |
+
{0x000EA4, 0x0001},
|
| 523 |
{0x000EA5, 0x0004},
|
| 524 |
+
{0x000EA6, 0x0001},
|
| 525 |
{0x000EA7, 0x0004},
|
| 526 |
{0x000EB1, 0x0010},
|
| 527 |
{0x000EB2, 0x0004},
|
| 528 |
{0x000EB4, 0x0010},
|
| 529 |
{0x000EBD, 0x0004},
|
| 530 |
+
{0x000EBE, 0x0001},
|
| 531 |
{0x000EC0, 0x0004},
|
| 532 |
+
{0x000EC5, 0x0001},
|
| 533 |
{0x000EC6, 0x0004},
|
| 534 |
+
{0x000EC7, 0x0001},
|
| 535 |
{0x000EC8, 0x0010},
|
| 536 |
+
{0x000ECF, 0x0001},
|
| 537 |
{0x000ED0, 0x0002},
|
| 538 |
+
{0x000EDA, 0x0001},
|
| 539 |
{0x000EDC, 0x0004},
|
| 540 |
+
{0x000EE0, 0x0001},
|
| 541 |
{0x000F00, 0x0004},
|
| 542 |
{0x000F01, 0x0040},
|
| 543 |
{0x000F04, 0x0020},
|
|
|
|
| 556 |
{0x000F3A, 0x0020},
|
| 557 |
{0x000F3E, 0x0010},
|
| 558 |
{0x000F40, 0x0004},
|
| 559 |
+
{0x000F48, 0x0001},
|
| 560 |
{0x000F49, 0x0004},
|
| 561 |
+
{0x000F6D, 0x0001},
|
| 562 |
{0x000F71, 0x0010},
|
| 563 |
{0x000F85, 0x0020},
|
| 564 |
{0x000F86, 0x0010},
|
| 565 |
{0x000F88, 0x0004},
|
| 566 |
{0x000F8D, 0x0010},
|
| 567 |
+
{0x000F98, 0x0001},
|
| 568 |
{0x000F99, 0x0010},
|
| 569 |
+
{0x000FBD, 0x0001},
|
| 570 |
{0x000FBE, 0x0040},
|
| 571 |
{0x000FC6, 0x0010},
|
| 572 |
{0x000FC7, 0x0040},
|
| 573 |
+
{0x000FCD, 0x0001},
|
| 574 |
{0x000FCE, 0x0040},
|
| 575 |
{0x000FD0, 0x0020},
|
| 576 |
{0x000FD5, 0x0040},
|
| 577 |
{0x000FD9, 0x0020},
|
| 578 |
+
{0x000FDB, 0x0001},
|
| 579 |
{0x001000, 0x0004},
|
| 580 |
{0x00102B, 0x0010},
|
| 581 |
{0x00103F, 0x0004},
|
|
|
|
| 599 |
{0x00109A, 0x0010},
|
| 600 |
{0x00109E, 0x0040},
|
| 601 |
{0x0010A0, 0x0004},
|
| 602 |
+
{0x0010C6, 0x0001},
|
| 603 |
{0x0010C7, 0x0004},
|
| 604 |
+
{0x0010C8, 0x0001},
|
| 605 |
{0x0010CD, 0x0004},
|
| 606 |
+
{0x0010CE, 0x0001},
|
| 607 |
{0x0010D0, 0x0004},
|
| 608 |
{0x0010FB, 0x0020},
|
| 609 |
{0x0010FC, 0x0004},
|
| 610 |
+
{0x001249, 0x0001},
|
| 611 |
{0x00124A, 0x0004},
|
| 612 |
+
{0x00124E, 0x0001},
|
| 613 |
{0x001250, 0x0004},
|
| 614 |
+
{0x001257, 0x0001},
|
| 615 |
{0x001258, 0x0004},
|
| 616 |
+
{0x001259, 0x0001},
|
| 617 |
{0x00125A, 0x0004},
|
| 618 |
+
{0x00125E, 0x0001},
|
| 619 |
{0x001260, 0x0004},
|
| 620 |
+
{0x001289, 0x0001},
|
| 621 |
{0x00128A, 0x0004},
|
| 622 |
+
{0x00128E, 0x0001},
|
| 623 |
{0x001290, 0x0004},
|
| 624 |
+
{0x0012B1, 0x0001},
|
| 625 |
{0x0012B2, 0x0004},
|
| 626 |
+
{0x0012B6, 0x0001},
|
| 627 |
{0x0012B8, 0x0004},
|
| 628 |
+
{0x0012BF, 0x0001},
|
| 629 |
{0x0012C0, 0x0004},
|
| 630 |
+
{0x0012C1, 0x0001},
|
| 631 |
{0x0012C2, 0x0004},
|
| 632 |
+
{0x0012C6, 0x0001},
|
| 633 |
{0x0012C8, 0x0004},
|
| 634 |
+
{0x0012D7, 0x0001},
|
| 635 |
{0x0012D8, 0x0004},
|
| 636 |
+
{0x001311, 0x0001},
|
| 637 |
{0x001312, 0x0004},
|
| 638 |
+
{0x001316, 0x0001},
|
| 639 |
{0x001318, 0x0004},
|
| 640 |
+
{0x00135B, 0x0001},
|
| 641 |
{0x00135D, 0x0010},
|
| 642 |
{0x001360, 0x0020},
|
| 643 |
{0x001369, 0x0002},
|
| 644 |
+
{0x00137D, 0x0001},
|
| 645 |
{0x001380, 0x0004},
|
| 646 |
{0x001390, 0x0040},
|
| 647 |
+
{0x00139A, 0x0001},
|
| 648 |
{0x0013A0, 0x0004},
|
| 649 |
+
{0x0013F6, 0x0001},
|
| 650 |
{0x0013F8, 0x0004},
|
| 651 |
+
{0x0013FE, 0x0001},
|
| 652 |
{0x001400, 0x0020},
|
| 653 |
{0x001401, 0x0004},
|
| 654 |
{0x00166D, 0x0040},
|
|
|
|
| 657 |
{0x001680, 0x0008},
|
| 658 |
{0x001681, 0x0004},
|
| 659 |
{0x00169B, 0x0020},
|
| 660 |
+
{0x00169D, 0x0001},
|
| 661 |
{0x0016A0, 0x0004},
|
| 662 |
{0x0016EB, 0x0020},
|
| 663 |
{0x0016EE, 0x0002},
|
| 664 |
{0x0016F1, 0x0004},
|
| 665 |
+
{0x0016F9, 0x0001},
|
| 666 |
{0x001700, 0x0004},
|
| 667 |
{0x001712, 0x0010},
|
| 668 |
+
{0x001716, 0x0001},
|
| 669 |
{0x00171F, 0x0004},
|
| 670 |
{0x001732, 0x0010},
|
| 671 |
{0x001735, 0x0020},
|
| 672 |
+
{0x001737, 0x0001},
|
| 673 |
{0x001740, 0x0004},
|
| 674 |
{0x001752, 0x0010},
|
| 675 |
+
{0x001754, 0x0001},
|
| 676 |
{0x001760, 0x0004},
|
| 677 |
+
{0x00176D, 0x0001},
|
| 678 |
{0x00176E, 0x0004},
|
| 679 |
+
{0x001771, 0x0001},
|
| 680 |
{0x001772, 0x0010},
|
| 681 |
+
{0x001774, 0x0001},
|
| 682 |
{0x001780, 0x0004},
|
| 683 |
{0x0017B4, 0x0010},
|
| 684 |
{0x0017D4, 0x0020},
|
|
|
|
| 687 |
{0x0017DB, 0x0040},
|
| 688 |
{0x0017DC, 0x0004},
|
| 689 |
{0x0017DD, 0x0010},
|
| 690 |
+
{0x0017DE, 0x0001},
|
| 691 |
{0x0017E0, 0x0002},
|
| 692 |
+
{0x0017EA, 0x0001},
|
| 693 |
{0x0017F0, 0x0002},
|
| 694 |
+
{0x0017FA, 0x0001},
|
| 695 |
{0x001800, 0x0020},
|
| 696 |
{0x00180B, 0x0010},
|
| 697 |
{0x00180E, 0x0080},
|
| 698 |
{0x00180F, 0x0010},
|
| 699 |
{0x001810, 0x0002},
|
| 700 |
+
{0x00181A, 0x0001},
|
| 701 |
{0x001820, 0x0004},
|
| 702 |
+
{0x001879, 0x0001},
|
| 703 |
{0x001880, 0x0004},
|
| 704 |
{0x001885, 0x0010},
|
| 705 |
{0x001887, 0x0004},
|
| 706 |
{0x0018A9, 0x0010},
|
| 707 |
{0x0018AA, 0x0004},
|
| 708 |
+
{0x0018AB, 0x0001},
|
| 709 |
{0x0018B0, 0x0004},
|
| 710 |
+
{0x0018F6, 0x0001},
|
| 711 |
{0x001900, 0x0004},
|
| 712 |
+
{0x00191F, 0x0001},
|
| 713 |
{0x001920, 0x0010},
|
| 714 |
+
{0x00192C, 0x0001},
|
| 715 |
{0x001930, 0x0010},
|
| 716 |
+
{0x00193C, 0x0001},
|
| 717 |
{0x001940, 0x0040},
|
| 718 |
+
{0x001941, 0x0001},
|
| 719 |
{0x001944, 0x0020},
|
| 720 |
{0x001946, 0x0002},
|
| 721 |
{0x001950, 0x0004},
|
| 722 |
+
{0x00196E, 0x0001},
|
| 723 |
{0x001970, 0x0004},
|
| 724 |
+
{0x001975, 0x0001},
|
| 725 |
{0x001980, 0x0004},
|
| 726 |
+
{0x0019AC, 0x0001},
|
| 727 |
{0x0019B0, 0x0004},
|
| 728 |
+
{0x0019CA, 0x0001},
|
| 729 |
{0x0019D0, 0x0002},
|
| 730 |
+
{0x0019DB, 0x0001},
|
| 731 |
{0x0019DE, 0x0040},
|
| 732 |
{0x001A00, 0x0004},
|
| 733 |
{0x001A17, 0x0010},
|
| 734 |
+
{0x001A1C, 0x0001},
|
| 735 |
{0x001A1E, 0x0020},
|
| 736 |
{0x001A20, 0x0004},
|
| 737 |
{0x001A55, 0x0010},
|
| 738 |
+
{0x001A5F, 0x0001},
|
| 739 |
{0x001A60, 0x0010},
|
| 740 |
+
{0x001A7D, 0x0001},
|
| 741 |
{0x001A7F, 0x0010},
|
| 742 |
{0x001A80, 0x0002},
|
| 743 |
+
{0x001A8A, 0x0001},
|
| 744 |
{0x001A90, 0x0002},
|
| 745 |
+
{0x001A9A, 0x0001},
|
| 746 |
{0x001AA0, 0x0020},
|
| 747 |
{0x001AA7, 0x0004},
|
| 748 |
{0x001AA8, 0x0020},
|
| 749 |
+
{0x001AAE, 0x0001},
|
| 750 |
{0x001AB0, 0x0010},
|
| 751 |
+
{0x001ACF, 0x0001},
|
| 752 |
{0x001B00, 0x0010},
|
| 753 |
{0x001B05, 0x0004},
|
| 754 |
{0x001B34, 0x0010},
|
| 755 |
{0x001B45, 0x0004},
|
| 756 |
+
{0x001B4D, 0x0001},
|
| 757 |
{0x001B50, 0x0002},
|
| 758 |
{0x001B5A, 0x0020},
|
| 759 |
{0x001B61, 0x0040},
|
| 760 |
{0x001B6B, 0x0010},
|
| 761 |
{0x001B74, 0x0040},
|
| 762 |
{0x001B7D, 0x0020},
|
| 763 |
+
{0x001B7F, 0x0001},
|
| 764 |
{0x001B80, 0x0010},
|
| 765 |
{0x001B83, 0x0004},
|
| 766 |
{0x001BA1, 0x0010},
|
|
|
|
| 768 |
{0x001BB0, 0x0002},
|
| 769 |
{0x001BBA, 0x0004},
|
| 770 |
{0x001BE6, 0x0010},
|
| 771 |
+
{0x001BF4, 0x0001},
|
| 772 |
{0x001BFC, 0x0020},
|
| 773 |
{0x001C00, 0x0004},
|
| 774 |
{0x001C24, 0x0010},
|
| 775 |
+
{0x001C38, 0x0001},
|
| 776 |
{0x001C3B, 0x0020},
|
| 777 |
{0x001C40, 0x0002},
|
| 778 |
+
{0x001C4A, 0x0001},
|
| 779 |
{0x001C4D, 0x0004},
|
| 780 |
{0x001C50, 0x0002},
|
| 781 |
{0x001C5A, 0x0004},
|
| 782 |
{0x001C7E, 0x0020},
|
| 783 |
{0x001C80, 0x0004},
|
| 784 |
+
{0x001C89, 0x0001},
|
| 785 |
{0x001C90, 0x0004},
|
| 786 |
+
{0x001CBB, 0x0001},
|
| 787 |
{0x001CBD, 0x0004},
|
| 788 |
{0x001CC0, 0x0020},
|
| 789 |
+
{0x001CC8, 0x0001},
|
| 790 |
{0x001CD0, 0x0010},
|
| 791 |
{0x001CD3, 0x0020},
|
| 792 |
{0x001CD4, 0x0010},
|
|
|
|
| 797 |
{0x001CF5, 0x0004},
|
| 798 |
{0x001CF7, 0x0010},
|
| 799 |
{0x001CFA, 0x0004},
|
| 800 |
+
{0x001CFB, 0x0001},
|
| 801 |
{0x001D00, 0x0004},
|
| 802 |
{0x001DC0, 0x0010},
|
| 803 |
{0x001E00, 0x0004},
|
| 804 |
+
{0x001F16, 0x0001},
|
| 805 |
{0x001F18, 0x0004},
|
| 806 |
+
{0x001F1E, 0x0001},
|
| 807 |
{0x001F20, 0x0004},
|
| 808 |
+
{0x001F46, 0x0001},
|
| 809 |
{0x001F48, 0x0004},
|
| 810 |
+
{0x001F4E, 0x0001},
|
| 811 |
{0x001F50, 0x0004},
|
| 812 |
+
{0x001F58, 0x0001},
|
| 813 |
{0x001F59, 0x0004},
|
| 814 |
+
{0x001F5A, 0x0001},
|
| 815 |
{0x001F5B, 0x0004},
|
| 816 |
+
{0x001F5C, 0x0001},
|
| 817 |
{0x001F5D, 0x0004},
|
| 818 |
+
{0x001F5E, 0x0001},
|
| 819 |
{0x001F5F, 0x0004},
|
| 820 |
+
{0x001F7E, 0x0001},
|
| 821 |
{0x001F80, 0x0004},
|
| 822 |
+
{0x001FB5, 0x0001},
|
| 823 |
{0x001FB6, 0x0004},
|
| 824 |
{0x001FBD, 0x0040},
|
| 825 |
{0x001FBE, 0x0004},
|
| 826 |
{0x001FBF, 0x0040},
|
| 827 |
{0x001FC2, 0x0004},
|
| 828 |
+
{0x001FC5, 0x0001},
|
| 829 |
{0x001FC6, 0x0004},
|
| 830 |
{0x001FCD, 0x0040},
|
| 831 |
{0x001FD0, 0x0004},
|
| 832 |
+
{0x001FD4, 0x0001},
|
| 833 |
{0x001FD6, 0x0004},
|
| 834 |
+
{0x001FDC, 0x0001},
|
| 835 |
{0x001FDD, 0x0040},
|
| 836 |
{0x001FE0, 0x0004},
|
| 837 |
{0x001FED, 0x0040},
|
| 838 |
+
{0x001FF0, 0x0001},
|
| 839 |
{0x001FF2, 0x0004},
|
| 840 |
+
{0x001FF5, 0x0001},
|
| 841 |
{0x001FF6, 0x0004},
|
| 842 |
{0x001FFD, 0x0040},
|
| 843 |
+
{0x001FFF, 0x0001},
|
| 844 |
{0x002000, 0x0008},
|
| 845 |
{0x00200B, 0x0080},
|
| 846 |
{0x002010, 0x0020},
|
|
|
|
| 854 |
{0x002053, 0x0020},
|
| 855 |
{0x00205F, 0x0008},
|
| 856 |
{0x002060, 0x0080},
|
| 857 |
+
{0x002065, 0x0001},
|
| 858 |
+
{0x002066, 0x0080},
|
| 859 |
{0x002070, 0x0002},
|
| 860 |
{0x002071, 0x0004},
|
| 861 |
+
{0x002072, 0x0001},
|
| 862 |
{0x002074, 0x0002},
|
| 863 |
{0x00207A, 0x0040},
|
| 864 |
{0x00207D, 0x0020},
|
|
|
|
| 866 |
{0x002080, 0x0002},
|
| 867 |
{0x00208A, 0x0040},
|
| 868 |
{0x00208D, 0x0020},
|
| 869 |
+
{0x00208F, 0x0001},
|
| 870 |
{0x002090, 0x0004},
|
| 871 |
+
{0x00209D, 0x0001},
|
| 872 |
{0x0020A0, 0x0040},
|
| 873 |
+
{0x0020C1, 0x0001},
|
| 874 |
{0x0020D0, 0x0010},
|
| 875 |
+
{0x0020F1, 0x0001},
|
| 876 |
{0x002100, 0x0040},
|
| 877 |
{0x002102, 0x0004},
|
| 878 |
{0x002103, 0x0040},
|
|
|
|
| 904 |
{0x002183, 0x0004},
|
| 905 |
{0x002185, 0x0002},
|
| 906 |
{0x00218A, 0x0040},
|
| 907 |
+
{0x00218C, 0x0001},
|
| 908 |
{0x002190, 0x0040},
|
| 909 |
{0x002308, 0x0020},
|
| 910 |
{0x00230C, 0x0040},
|
| 911 |
{0x002329, 0x0020},
|
| 912 |
{0x00232B, 0x0040},
|
| 913 |
+
{0x002427, 0x0001},
|
| 914 |
{0x002440, 0x0040},
|
| 915 |
+
{0x00244B, 0x0001},
|
| 916 |
{0x002460, 0x0002},
|
| 917 |
{0x00249C, 0x0040},
|
| 918 |
{0x0024EA, 0x0002},
|
|
|
|
| 930 |
{0x0029DC, 0x0040},
|
| 931 |
{0x0029FC, 0x0020},
|
| 932 |
{0x0029FE, 0x0040},
|
| 933 |
+
{0x002B74, 0x0001},
|
| 934 |
{0x002B76, 0x0040},
|
| 935 |
+
{0x002B96, 0x0001},
|
| 936 |
{0x002B97, 0x0040},
|
| 937 |
{0x002C00, 0x0004},
|
| 938 |
{0x002CE5, 0x0040},
|
| 939 |
{0x002CEB, 0x0004},
|
| 940 |
{0x002CEF, 0x0010},
|
| 941 |
{0x002CF2, 0x0004},
|
| 942 |
+
{0x002CF4, 0x0001},
|
| 943 |
{0x002CF9, 0x0020},
|
| 944 |
{0x002CFD, 0x0002},
|
| 945 |
{0x002CFE, 0x0020},
|
| 946 |
{0x002D00, 0x0004},
|
| 947 |
+
{0x002D26, 0x0001},
|
| 948 |
{0x002D27, 0x0004},
|
| 949 |
+
{0x002D28, 0x0001},
|
| 950 |
{0x002D2D, 0x0004},
|
| 951 |
+
{0x002D2E, 0x0001},
|
| 952 |
{0x002D30, 0x0004},
|
| 953 |
+
{0x002D68, 0x0001},
|
| 954 |
{0x002D6F, 0x0004},
|
| 955 |
{0x002D70, 0x0020},
|
| 956 |
+
{0x002D71, 0x0001},
|
| 957 |
{0x002D7F, 0x0010},
|
| 958 |
{0x002D80, 0x0004},
|
| 959 |
+
{0x002D97, 0x0001},
|
| 960 |
{0x002DA0, 0x0004},
|
| 961 |
+
{0x002DA7, 0x0001},
|
| 962 |
{0x002DA8, 0x0004},
|
| 963 |
+
{0x002DAF, 0x0001},
|
| 964 |
{0x002DB0, 0x0004},
|
| 965 |
+
{0x002DB7, 0x0001},
|
| 966 |
{0x002DB8, 0x0004},
|
| 967 |
+
{0x002DBF, 0x0001},
|
| 968 |
{0x002DC0, 0x0004},
|
| 969 |
+
{0x002DC7, 0x0001},
|
| 970 |
{0x002DC8, 0x0004},
|
| 971 |
+
{0x002DCF, 0x0001},
|
| 972 |
{0x002DD0, 0x0004},
|
| 973 |
+
{0x002DD7, 0x0001},
|
| 974 |
{0x002DD8, 0x0004},
|
| 975 |
+
{0x002DDF, 0x0001},
|
| 976 |
{0x002DE0, 0x0010},
|
| 977 |
{0x002E00, 0x0020},
|
| 978 |
{0x002E2F, 0x0004},
|
| 979 |
{0x002E30, 0x0020},
|
| 980 |
{0x002E50, 0x0040},
|
| 981 |
{0x002E52, 0x0020},
|
| 982 |
+
{0x002E5E, 0x0001},
|
| 983 |
{0x002E80, 0x0040},
|
| 984 |
+
{0x002E9A, 0x0001},
|
| 985 |
{0x002E9B, 0x0040},
|
| 986 |
+
{0x002EF4, 0x0001},
|
| 987 |
{0x002F00, 0x0040},
|
| 988 |
+
{0x002FD6, 0x0001},
|
| 989 |
{0x002FF0, 0x0040},
|
| 990 |
{0x003000, 0x0008},
|
| 991 |
{0x003001, 0x0020},
|
|
|
|
| 1005 |
{0x00303B, 0x0004},
|
| 1006 |
{0x00303D, 0x0020},
|
| 1007 |
{0x00303E, 0x0040},
|
| 1008 |
+
{0x003040, 0x0001},
|
| 1009 |
{0x003041, 0x0004},
|
| 1010 |
+
{0x003097, 0x0001},
|
| 1011 |
{0x003099, 0x0010},
|
| 1012 |
{0x00309B, 0x0040},
|
| 1013 |
{0x00309D, 0x0004},
|
|
|
|
| 1015 |
{0x0030A1, 0x0004},
|
| 1016 |
{0x0030FB, 0x0020},
|
| 1017 |
{0x0030FC, 0x0004},
|
| 1018 |
+
{0x003100, 0x0001},
|
| 1019 |
{0x003105, 0x0004},
|
| 1020 |
+
{0x003130, 0x0001},
|
| 1021 |
{0x003131, 0x0004},
|
| 1022 |
+
{0x00318F, 0x0001},
|
| 1023 |
{0x003190, 0x0040},
|
| 1024 |
{0x003192, 0x0002},
|
| 1025 |
{0x003196, 0x0040},
|
| 1026 |
{0x0031A0, 0x0004},
|
| 1027 |
{0x0031C0, 0x0040},
|
| 1028 |
+
{0x0031E4, 0x0001},
|
| 1029 |
{0x0031EF, 0x0040},
|
| 1030 |
{0x0031F0, 0x0004},
|
| 1031 |
{0x003200, 0x0040},
|
| 1032 |
+
{0x00321F, 0x0001},
|
| 1033 |
{0x003220, 0x0002},
|
| 1034 |
{0x00322A, 0x0040},
|
| 1035 |
{0x003248, 0x0002},
|
|
|
|
| 1043 |
{0x003400, 0x0004},
|
| 1044 |
{0x004DC0, 0x0040},
|
| 1045 |
{0x004E00, 0x0004},
|
| 1046 |
+
{0x00A48D, 0x0001},
|
| 1047 |
{0x00A490, 0x0040},
|
| 1048 |
+
{0x00A4C7, 0x0001},
|
| 1049 |
{0x00A4D0, 0x0004},
|
| 1050 |
{0x00A4FE, 0x0020},
|
| 1051 |
{0x00A500, 0x0004},
|
|
|
|
| 1053 |
{0x00A610, 0x0004},
|
| 1054 |
{0x00A620, 0x0002},
|
| 1055 |
{0x00A62A, 0x0004},
|
| 1056 |
+
{0x00A62C, 0x0001},
|
| 1057 |
{0x00A640, 0x0004},
|
| 1058 |
{0x00A66F, 0x0010},
|
| 1059 |
{0x00A673, 0x0020},
|
|
|
|
| 1065 |
{0x00A6E6, 0x0002},
|
| 1066 |
{0x00A6F0, 0x0010},
|
| 1067 |
{0x00A6F2, 0x0020},
|
| 1068 |
+
{0x00A6F8, 0x0001},
|
| 1069 |
{0x00A700, 0x0040},
|
| 1070 |
{0x00A717, 0x0004},
|
| 1071 |
{0x00A720, 0x0040},
|
| 1072 |
{0x00A722, 0x0004},
|
| 1073 |
{0x00A789, 0x0040},
|
| 1074 |
{0x00A78B, 0x0004},
|
| 1075 |
+
{0x00A7CB, 0x0001},
|
| 1076 |
{0x00A7D0, 0x0004},
|
| 1077 |
+
{0x00A7D2, 0x0001},
|
| 1078 |
{0x00A7D3, 0x0004},
|
| 1079 |
+
{0x00A7D4, 0x0001},
|
| 1080 |
{0x00A7D5, 0x0004},
|
| 1081 |
+
{0x00A7DA, 0x0001},
|
| 1082 |
{0x00A7F2, 0x0004},
|
| 1083 |
{0x00A802, 0x0010},
|
| 1084 |
{0x00A803, 0x0004},
|
|
|
|
| 1089 |
{0x00A823, 0x0010},
|
| 1090 |
{0x00A828, 0x0040},
|
| 1091 |
{0x00A82C, 0x0010},
|
| 1092 |
+
{0x00A82D, 0x0001},
|
| 1093 |
{0x00A830, 0x0002},
|
| 1094 |
{0x00A836, 0x0040},
|
| 1095 |
+
{0x00A83A, 0x0001},
|
| 1096 |
{0x00A840, 0x0004},
|
| 1097 |
{0x00A874, 0x0020},
|
| 1098 |
+
{0x00A878, 0x0001},
|
| 1099 |
{0x00A880, 0x0010},
|
| 1100 |
{0x00A882, 0x0004},
|
| 1101 |
{0x00A8B4, 0x0010},
|
| 1102 |
+
{0x00A8C6, 0x0001},
|
| 1103 |
{0x00A8CE, 0x0020},
|
| 1104 |
{0x00A8D0, 0x0002},
|
| 1105 |
+
{0x00A8DA, 0x0001},
|
| 1106 |
{0x00A8E0, 0x0010},
|
| 1107 |
{0x00A8F2, 0x0004},
|
| 1108 |
{0x00A8F8, 0x0020},
|
|
|
|
| 1116 |
{0x00A92E, 0x0020},
|
| 1117 |
{0x00A930, 0x0004},
|
| 1118 |
{0x00A947, 0x0010},
|
| 1119 |
+
{0x00A954, 0x0001},
|
| 1120 |
{0x00A95F, 0x0020},
|
| 1121 |
{0x00A960, 0x0004},
|
| 1122 |
+
{0x00A97D, 0x0001},
|
| 1123 |
{0x00A980, 0x0010},
|
| 1124 |
{0x00A984, 0x0004},
|
| 1125 |
{0x00A9B3, 0x0010},
|
| 1126 |
{0x00A9C1, 0x0020},
|
| 1127 |
+
{0x00A9CE, 0x0001},
|
| 1128 |
{0x00A9CF, 0x0004},
|
| 1129 |
{0x00A9D0, 0x0002},
|
| 1130 |
+
{0x00A9DA, 0x0001},
|
| 1131 |
{0x00A9DE, 0x0020},
|
| 1132 |
{0x00A9E0, 0x0004},
|
| 1133 |
{0x00A9E5, 0x0010},
|
| 1134 |
{0x00A9E6, 0x0004},
|
| 1135 |
{0x00A9F0, 0x0002},
|
| 1136 |
{0x00A9FA, 0x0004},
|
| 1137 |
+
{0x00A9FF, 0x0001},
|
| 1138 |
{0x00AA00, 0x0004},
|
| 1139 |
{0x00AA29, 0x0010},
|
| 1140 |
+
{0x00AA37, 0x0001},
|
| 1141 |
{0x00AA40, 0x0004},
|
| 1142 |
{0x00AA43, 0x0010},
|
| 1143 |
{0x00AA44, 0x0004},
|
| 1144 |
{0x00AA4C, 0x0010},
|
| 1145 |
+
{0x00AA4E, 0x0001},
|
| 1146 |
{0x00AA50, 0x0002},
|
| 1147 |
+
{0x00AA5A, 0x0001},
|
| 1148 |
{0x00AA5C, 0x0020},
|
| 1149 |
{0x00AA60, 0x0004},
|
| 1150 |
{0x00AA77, 0x0040},
|
|
|
|
| 1161 |
{0x00AAC0, 0x0004},
|
| 1162 |
{0x00AAC1, 0x0010},
|
| 1163 |
{0x00AAC2, 0x0004},
|
| 1164 |
+
{0x00AAC3, 0x0001},
|
| 1165 |
{0x00AADB, 0x0004},
|
| 1166 |
{0x00AADE, 0x0020},
|
| 1167 |
{0x00AAE0, 0x0004},
|
|
|
|
| 1169 |
{0x00AAF0, 0x0020},
|
| 1170 |
{0x00AAF2, 0x0004},
|
| 1171 |
{0x00AAF5, 0x0010},
|
| 1172 |
+
{0x00AAF7, 0x0001},
|
| 1173 |
{0x00AB01, 0x0004},
|
| 1174 |
+
{0x00AB07, 0x0001},
|
| 1175 |
{0x00AB09, 0x0004},
|
| 1176 |
+
{0x00AB0F, 0x0001},
|
| 1177 |
{0x00AB11, 0x0004},
|
| 1178 |
+
{0x00AB17, 0x0001},
|
| 1179 |
{0x00AB20, 0x0004},
|
| 1180 |
+
{0x00AB27, 0x0001},
|
| 1181 |
{0x00AB28, 0x0004},
|
| 1182 |
+
{0x00AB2F, 0x0001},
|
| 1183 |
{0x00AB30, 0x0004},
|
| 1184 |
{0x00AB5B, 0x0040},
|
| 1185 |
{0x00AB5C, 0x0004},
|
| 1186 |
{0x00AB6A, 0x0040},
|
| 1187 |
+
{0x00AB6C, 0x0001},
|
| 1188 |
{0x00AB70, 0x0004},
|
| 1189 |
{0x00ABE3, 0x0010},
|
| 1190 |
{0x00ABEB, 0x0020},
|
| 1191 |
{0x00ABEC, 0x0010},
|
| 1192 |
+
{0x00ABEE, 0x0001},
|
| 1193 |
{0x00ABF0, 0x0002},
|
| 1194 |
+
{0x00ABFA, 0x0001},
|
| 1195 |
{0x00AC00, 0x0004},
|
| 1196 |
+
{0x00D7A4, 0x0001},
|
| 1197 |
{0x00D7B0, 0x0004},
|
| 1198 |
+
{0x00D7C7, 0x0001},
|
| 1199 |
{0x00D7CB, 0x0004},
|
| 1200 |
+
{0x00D7FC, 0x0001},
|
| 1201 |
+
{0x00D800, 0x0080},
|
| 1202 |
{0x00F900, 0x0004},
|
| 1203 |
+
{0x00FA6E, 0x0001},
|
| 1204 |
{0x00FA70, 0x0004},
|
| 1205 |
+
{0x00FADA, 0x0001},
|
| 1206 |
{0x00FB00, 0x0004},
|
| 1207 |
+
{0x00FB07, 0x0001},
|
| 1208 |
{0x00FB13, 0x0004},
|
| 1209 |
+
{0x00FB18, 0x0001},
|
| 1210 |
{0x00FB1D, 0x0004},
|
| 1211 |
{0x00FB1E, 0x0010},
|
| 1212 |
{0x00FB1F, 0x0004},
|
| 1213 |
{0x00FB29, 0x0040},
|
| 1214 |
{0x00FB2A, 0x0004},
|
| 1215 |
+
{0x00FB37, 0x0001},
|
| 1216 |
{0x00FB38, 0x0004},
|
| 1217 |
+
{0x00FB3D, 0x0001},
|
| 1218 |
{0x00FB3E, 0x0004},
|
| 1219 |
+
{0x00FB3F, 0x0001},
|
| 1220 |
{0x00FB40, 0x0004},
|
| 1221 |
+
{0x00FB42, 0x0001},
|
| 1222 |
{0x00FB43, 0x0004},
|
| 1223 |
+
{0x00FB45, 0x0001},
|
| 1224 |
{0x00FB46, 0x0004},
|
| 1225 |
{0x00FBB2, 0x0040},
|
| 1226 |
+
{0x00FBC3, 0x0001},
|
| 1227 |
{0x00FBD3, 0x0004},
|
| 1228 |
{0x00FD3E, 0x0020},
|
| 1229 |
{0x00FD40, 0x0040},
|
| 1230 |
{0x00FD50, 0x0004},
|
| 1231 |
+
{0x00FD90, 0x0001},
|
| 1232 |
{0x00FD92, 0x0004},
|
| 1233 |
+
{0x00FDC8, 0x0001},
|
| 1234 |
{0x00FDCF, 0x0040},
|
| 1235 |
+
{0x00FDD0, 0x0001},
|
| 1236 |
{0x00FDF0, 0x0004},
|
| 1237 |
{0x00FDFC, 0x0040},
|
| 1238 |
{0x00FE00, 0x0010},
|
| 1239 |
{0x00FE10, 0x0020},
|
| 1240 |
+
{0x00FE1A, 0x0001},
|
| 1241 |
{0x00FE20, 0x0010},
|
| 1242 |
{0x00FE30, 0x0020},
|
| 1243 |
+
{0x00FE53, 0x0001},
|
| 1244 |
{0x00FE54, 0x0020},
|
| 1245 |
{0x00FE62, 0x0040},
|
| 1246 |
{0x00FE63, 0x0020},
|
| 1247 |
{0x00FE64, 0x0040},
|
| 1248 |
+
{0x00FE67, 0x0001},
|
| 1249 |
{0x00FE68, 0x0020},
|
| 1250 |
{0x00FE69, 0x0040},
|
| 1251 |
{0x00FE6A, 0x0020},
|
| 1252 |
+
{0x00FE6C, 0x0001},
|
| 1253 |
{0x00FE70, 0x0004},
|
| 1254 |
+
{0x00FE75, 0x0001},
|
| 1255 |
{0x00FE76, 0x0004},
|
| 1256 |
+
{0x00FEFD, 0x0001},
|
| 1257 |
+
{0x00FEFF, 0x0080},
|
| 1258 |
+
{0x00FF00, 0x0001},
|
| 1259 |
{0x00FF01, 0x0020},
|
| 1260 |
{0x00FF04, 0x0040},
|
| 1261 |
{0x00FF05, 0x0020},
|
|
|
|
| 1277 |
{0x00FF5E, 0x0040},
|
| 1278 |
{0x00FF5F, 0x0020},
|
| 1279 |
{0x00FF66, 0x0004},
|
| 1280 |
+
{0x00FFBF, 0x0001},
|
| 1281 |
{0x00FFC2, 0x0004},
|
| 1282 |
+
{0x00FFC8, 0x0001},
|
| 1283 |
{0x00FFCA, 0x0004},
|
| 1284 |
+
{0x00FFD0, 0x0001},
|
| 1285 |
{0x00FFD2, 0x0004},
|
| 1286 |
+
{0x00FFD8, 0x0001},
|
| 1287 |
{0x00FFDA, 0x0004},
|
| 1288 |
+
{0x00FFDD, 0x0001},
|
| 1289 |
{0x00FFE0, 0x0040},
|
| 1290 |
+
{0x00FFE7, 0x0001},
|
| 1291 |
{0x00FFE8, 0x0040},
|
| 1292 |
+
{0x00FFEF, 0x0001},
|
| 1293 |
+
{0x00FFF9, 0x0080},
|
| 1294 |
{0x00FFFC, 0x0040},
|
| 1295 |
+
{0x00FFFE, 0x0001},
|
| 1296 |
{0x010000, 0x0004},
|
| 1297 |
+
{0x01000C, 0x0001},
|
| 1298 |
{0x01000D, 0x0004},
|
| 1299 |
+
{0x010027, 0x0001},
|
| 1300 |
{0x010028, 0x0004},
|
| 1301 |
+
{0x01003B, 0x0001},
|
| 1302 |
{0x01003C, 0x0004},
|
| 1303 |
+
{0x01003E, 0x0001},
|
| 1304 |
{0x01003F, 0x0004},
|
| 1305 |
+
{0x01004E, 0x0001},
|
| 1306 |
{0x010050, 0x0004},
|
| 1307 |
+
{0x01005E, 0x0001},
|
| 1308 |
{0x010080, 0x0004},
|
| 1309 |
+
{0x0100FB, 0x0001},
|
| 1310 |
{0x010100, 0x0020},
|
| 1311 |
+
{0x010103, 0x0001},
|
| 1312 |
{0x010107, 0x0002},
|
| 1313 |
+
{0x010134, 0x0001},
|
| 1314 |
{0x010137, 0x0040},
|
| 1315 |
{0x010140, 0x0002},
|
| 1316 |
{0x010179, 0x0040},
|
| 1317 |
{0x01018A, 0x0002},
|
| 1318 |
{0x01018C, 0x0040},
|
| 1319 |
+
{0x01018F, 0x0001},
|
| 1320 |
{0x010190, 0x0040},
|
| 1321 |
+
{0x01019D, 0x0001},
|
| 1322 |
{0x0101A0, 0x0040},
|
| 1323 |
+
{0x0101A1, 0x0001},
|
| 1324 |
{0x0101D0, 0x0040},
|
| 1325 |
{0x0101FD, 0x0010},
|
| 1326 |
+
{0x0101FE, 0x0001},
|
| 1327 |
{0x010280, 0x0004},
|
| 1328 |
+
{0x01029D, 0x0001},
|
| 1329 |
{0x0102A0, 0x0004},
|
| 1330 |
+
{0x0102D1, 0x0001},
|
| 1331 |
{0x0102E0, 0x0010},
|
| 1332 |
{0x0102E1, 0x0002},
|
| 1333 |
+
{0x0102FC, 0x0001},
|
| 1334 |
{0x010300, 0x0004},
|
| 1335 |
{0x010320, 0x0002},
|
| 1336 |
+
{0x010324, 0x0001},
|
| 1337 |
{0x01032D, 0x0004},
|
| 1338 |
{0x010341, 0x0002},
|
| 1339 |
{0x010342, 0x0004},
|
| 1340 |
{0x01034A, 0x0002},
|
| 1341 |
+
{0x01034B, 0x0001},
|
| 1342 |
{0x010350, 0x0004},
|
| 1343 |
{0x010376, 0x0010},
|
| 1344 |
+
{0x01037B, 0x0001},
|
| 1345 |
{0x010380, 0x0004},
|
| 1346 |
+
{0x01039E, 0x0001},
|
| 1347 |
{0x01039F, 0x0020},
|
| 1348 |
{0x0103A0, 0x0004},
|
| 1349 |
+
{0x0103C4, 0x0001},
|
| 1350 |
{0x0103C8, 0x0004},
|
| 1351 |
{0x0103D0, 0x0020},
|
| 1352 |
{0x0103D1, 0x0002},
|
| 1353 |
+
{0x0103D6, 0x0001},
|
| 1354 |
{0x010400, 0x0004},
|
| 1355 |
+
{0x01049E, 0x0001},
|
| 1356 |
{0x0104A0, 0x0002},
|
| 1357 |
+
{0x0104AA, 0x0001},
|
| 1358 |
{0x0104B0, 0x0004},
|
| 1359 |
+
{0x0104D4, 0x0001},
|
| 1360 |
{0x0104D8, 0x0004},
|
| 1361 |
+
{0x0104FC, 0x0001},
|
| 1362 |
{0x010500, 0x0004},
|
| 1363 |
+
{0x010528, 0x0001},
|
| 1364 |
{0x010530, 0x0004},
|
| 1365 |
+
{0x010564, 0x0001},
|
| 1366 |
{0x01056F, 0x0020},
|
| 1367 |
{0x010570, 0x0004},
|
| 1368 |
+
{0x01057B, 0x0001},
|
| 1369 |
{0x01057C, 0x0004},
|
| 1370 |
+
{0x01058B, 0x0001},
|
| 1371 |
{0x01058C, 0x0004},
|
| 1372 |
+
{0x010593, 0x0001},
|
| 1373 |
{0x010594, 0x0004},
|
| 1374 |
+
{0x010596, 0x0001},
|
| 1375 |
{0x010597, 0x0004},
|
| 1376 |
+
{0x0105A2, 0x0001},
|
| 1377 |
{0x0105A3, 0x0004},
|
| 1378 |
+
{0x0105B2, 0x0001},
|
| 1379 |
{0x0105B3, 0x0004},
|
| 1380 |
+
{0x0105BA, 0x0001},
|
| 1381 |
{0x0105BB, 0x0004},
|
| 1382 |
+
{0x0105BD, 0x0001},
|
| 1383 |
{0x010600, 0x0004},
|
| 1384 |
+
{0x010737, 0x0001},
|
| 1385 |
{0x010740, 0x0004},
|
| 1386 |
+
{0x010756, 0x0001},
|
| 1387 |
{0x010760, 0x0004},
|
| 1388 |
+
{0x010768, 0x0001},
|
| 1389 |
{0x010780, 0x0004},
|
| 1390 |
+
{0x010786, 0x0001},
|
| 1391 |
{0x010787, 0x0004},
|
| 1392 |
+
{0x0107B1, 0x0001},
|
| 1393 |
{0x0107B2, 0x0004},
|
| 1394 |
+
{0x0107BB, 0x0001},
|
| 1395 |
{0x010800, 0x0004},
|
| 1396 |
+
{0x010806, 0x0001},
|
| 1397 |
{0x010808, 0x0004},
|
| 1398 |
+
{0x010809, 0x0001},
|
| 1399 |
{0x01080A, 0x0004},
|
| 1400 |
+
{0x010836, 0x0001},
|
| 1401 |
{0x010837, 0x0004},
|
| 1402 |
+
{0x010839, 0x0001},
|
| 1403 |
{0x01083C, 0x0004},
|
| 1404 |
+
{0x01083D, 0x0001},
|
| 1405 |
{0x01083F, 0x0004},
|
| 1406 |
+
{0x010856, 0x0001},
|
| 1407 |
{0x010857, 0x0020},
|
| 1408 |
{0x010858, 0x0002},
|
| 1409 |
{0x010860, 0x0004},
|
| 1410 |
{0x010877, 0x0040},
|
| 1411 |
{0x010879, 0x0002},
|
| 1412 |
{0x010880, 0x0004},
|
| 1413 |
+
{0x01089F, 0x0001},
|
| 1414 |
{0x0108A7, 0x0002},
|
| 1415 |
+
{0x0108B0, 0x0001},
|
| 1416 |
{0x0108E0, 0x0004},
|
| 1417 |
+
{0x0108F3, 0x0001},
|
| 1418 |
{0x0108F4, 0x0004},
|
| 1419 |
+
{0x0108F6, 0x0001},
|
| 1420 |
{0x0108FB, 0x0002},
|
| 1421 |
{0x010900, 0x0004},
|
| 1422 |
{0x010916, 0x0002},
|
| 1423 |
+
{0x01091C, 0x0001},
|
| 1424 |
{0x01091F, 0x0020},
|
| 1425 |
{0x010920, 0x0004},
|
| 1426 |
+
{0x01093A, 0x0001},
|
| 1427 |
{0x01093F, 0x0020},
|
| 1428 |
+
{0x010940, 0x0001},
|
| 1429 |
{0x010980, 0x0004},
|
| 1430 |
+
{0x0109B8, 0x0001},
|
| 1431 |
{0x0109BC, 0x0002},
|
| 1432 |
{0x0109BE, 0x0004},
|
| 1433 |
{0x0109C0, 0x0002},
|
| 1434 |
+
{0x0109D0, 0x0001},
|
| 1435 |
{0x0109D2, 0x0002},
|
| 1436 |
{0x010A00, 0x0004},
|
| 1437 |
{0x010A01, 0x0010},
|
| 1438 |
+
{0x010A04, 0x0001},
|
| 1439 |
{0x010A05, 0x0010},
|
| 1440 |
+
{0x010A07, 0x0001},
|
| 1441 |
{0x010A0C, 0x0010},
|
| 1442 |
{0x010A10, 0x0004},
|
| 1443 |
+
{0x010A14, 0x0001},
|
| 1444 |
{0x010A15, 0x0004},
|
| 1445 |
+
{0x010A18, 0x0001},
|
| 1446 |
{0x010A19, 0x0004},
|
| 1447 |
+
{0x010A36, 0x0001},
|
| 1448 |
{0x010A38, 0x0010},
|
| 1449 |
+
{0x010A3B, 0x0001},
|
| 1450 |
{0x010A3F, 0x0010},
|
| 1451 |
{0x010A40, 0x0002},
|
| 1452 |
+
{0x010A49, 0x0001},
|
| 1453 |
{0x010A50, 0x0020},
|
| 1454 |
+
{0x010A59, 0x0001},
|
| 1455 |
{0x010A60, 0x0004},
|
| 1456 |
{0x010A7D, 0x0002},
|
| 1457 |
{0x010A7F, 0x0020},
|
| 1458 |
{0x010A80, 0x0004},
|
| 1459 |
{0x010A9D, 0x0002},
|
| 1460 |
+
{0x010AA0, 0x0001},
|
| 1461 |
{0x010AC0, 0x0004},
|
| 1462 |
{0x010AC8, 0x0040},
|
| 1463 |
{0x010AC9, 0x0004},
|
| 1464 |
{0x010AE5, 0x0010},
|
| 1465 |
+
{0x010AE7, 0x0001},
|
| 1466 |
{0x010AEB, 0x0002},
|
| 1467 |
{0x010AF0, 0x0020},
|
| 1468 |
+
{0x010AF7, 0x0001},
|
| 1469 |
{0x010B00, 0x0004},
|
| 1470 |
+
{0x010B36, 0x0001},
|
| 1471 |
{0x010B39, 0x0020},
|
| 1472 |
{0x010B40, 0x0004},
|
| 1473 |
+
{0x010B56, 0x0001},
|
| 1474 |
{0x010B58, 0x0002},
|
| 1475 |
{0x010B60, 0x0004},
|
| 1476 |
+
{0x010B73, 0x0001},
|
| 1477 |
{0x010B78, 0x0002},
|
| 1478 |
{0x010B80, 0x0004},
|
| 1479 |
+
{0x010B92, 0x0001},
|
| 1480 |
{0x010B99, 0x0020},
|
| 1481 |
+
{0x010B9D, 0x0001},
|
| 1482 |
{0x010BA9, 0x0002},
|
| 1483 |
+
{0x010BB0, 0x0001},
|
| 1484 |
{0x010C00, 0x0004},
|
| 1485 |
+
{0x010C49, 0x0001},
|
| 1486 |
{0x010C80, 0x0004},
|
| 1487 |
+
{0x010CB3, 0x0001},
|
| 1488 |
{0x010CC0, 0x0004},
|
| 1489 |
+
{0x010CF3, 0x0001},
|
| 1490 |
{0x010CFA, 0x0002},
|
| 1491 |
{0x010D00, 0x0004},
|
| 1492 |
{0x010D24, 0x0010},
|
| 1493 |
+
{0x010D28, 0x0001},
|
| 1494 |
{0x010D30, 0x0002},
|
| 1495 |
+
{0x010D3A, 0x0001},
|
| 1496 |
{0x010E60, 0x0002},
|
| 1497 |
+
{0x010E7F, 0x0001},
|
| 1498 |
{0x010E80, 0x0004},
|
| 1499 |
+
{0x010EAA, 0x0001},
|
| 1500 |
{0x010EAB, 0x0010},
|
| 1501 |
{0x010EAD, 0x0020},
|
| 1502 |
+
{0x010EAE, 0x0001},
|
| 1503 |
{0x010EB0, 0x0004},
|
| 1504 |
+
{0x010EB2, 0x0001},
|
| 1505 |
{0x010EFD, 0x0010},
|
| 1506 |
{0x010F00, 0x0004},
|
| 1507 |
{0x010F1D, 0x0002},
|
| 1508 |
{0x010F27, 0x0004},
|
| 1509 |
+
{0x010F28, 0x0001},
|
| 1510 |
{0x010F30, 0x0004},
|
| 1511 |
{0x010F46, 0x0010},
|
| 1512 |
{0x010F51, 0x0002},
|
| 1513 |
{0x010F55, 0x0020},
|
| 1514 |
+
{0x010F5A, 0x0001},
|
| 1515 |
{0x010F70, 0x0004},
|
| 1516 |
{0x010F82, 0x0010},
|
| 1517 |
{0x010F86, 0x0020},
|
| 1518 |
+
{0x010F8A, 0x0001},
|
| 1519 |
{0x010FB0, 0x0004},
|
| 1520 |
{0x010FC5, 0x0002},
|
| 1521 |
+
{0x010FCC, 0x0001},
|
| 1522 |
{0x010FE0, 0x0004},
|
| 1523 |
+
{0x010FF7, 0x0001},
|
| 1524 |
{0x011000, 0x0010},
|
| 1525 |
{0x011003, 0x0004},
|
| 1526 |
{0x011038, 0x0010},
|
| 1527 |
{0x011047, 0x0020},
|
| 1528 |
+
{0x01104E, 0x0001},
|
| 1529 |
{0x011052, 0x0002},
|
| 1530 |
{0x011070, 0x0010},
|
| 1531 |
{0x011071, 0x0004},
|
| 1532 |
{0x011073, 0x0010},
|
| 1533 |
{0x011075, 0x0004},
|
| 1534 |
+
{0x011076, 0x0001},
|
| 1535 |
{0x01107F, 0x0010},
|
| 1536 |
{0x011083, 0x0004},
|
| 1537 |
{0x0110B0, 0x0010},
|
|
|
|
| 1539 |
{0x0110BD, 0x0080},
|
| 1540 |
{0x0110BE, 0x0020},
|
| 1541 |
{0x0110C2, 0x0010},
|
| 1542 |
+
{0x0110C3, 0x0001},
|
| 1543 |
+
{0x0110CD, 0x0080},
|
| 1544 |
+
{0x0110CE, 0x0001},
|
| 1545 |
{0x0110D0, 0x0004},
|
| 1546 |
+
{0x0110E9, 0x0001},
|
| 1547 |
{0x0110F0, 0x0002},
|
| 1548 |
+
{0x0110FA, 0x0001},
|
| 1549 |
{0x011100, 0x0010},
|
| 1550 |
{0x011103, 0x0004},
|
| 1551 |
{0x011127, 0x0010},
|
| 1552 |
+
{0x011135, 0x0001},
|
| 1553 |
{0x011136, 0x0002},
|
| 1554 |
{0x011140, 0x0020},
|
| 1555 |
{0x011144, 0x0004},
|
| 1556 |
{0x011145, 0x0010},
|
| 1557 |
{0x011147, 0x0004},
|
| 1558 |
+
{0x011148, 0x0001},
|
| 1559 |
{0x011150, 0x0004},
|
| 1560 |
{0x011173, 0x0010},
|
| 1561 |
{0x011174, 0x0020},
|
| 1562 |
{0x011176, 0x0004},
|
| 1563 |
+
{0x011177, 0x0001},
|
| 1564 |
{0x011180, 0x0010},
|
| 1565 |
{0x011183, 0x0004},
|
| 1566 |
{0x0111B3, 0x0010},
|
|
|
|
| 1574 |
{0x0111DB, 0x0020},
|
| 1575 |
{0x0111DC, 0x0004},
|
| 1576 |
{0x0111DD, 0x0020},
|
| 1577 |
+
{0x0111E0, 0x0001},
|
| 1578 |
{0x0111E1, 0x0002},
|
| 1579 |
+
{0x0111F5, 0x0001},
|
| 1580 |
{0x011200, 0x0004},
|
| 1581 |
+
{0x011212, 0x0001},
|
| 1582 |
{0x011213, 0x0004},
|
| 1583 |
{0x01122C, 0x0010},
|
| 1584 |
{0x011238, 0x0020},
|
| 1585 |
{0x01123E, 0x0010},
|
| 1586 |
{0x01123F, 0x0004},
|
| 1587 |
{0x011241, 0x0010},
|
| 1588 |
+
{0x011242, 0x0001},
|
| 1589 |
{0x011280, 0x0004},
|
| 1590 |
+
{0x011287, 0x0001},
|
| 1591 |
{0x011288, 0x0004},
|
| 1592 |
+
{0x011289, 0x0001},
|
| 1593 |
{0x01128A, 0x0004},
|
| 1594 |
+
{0x01128E, 0x0001},
|
| 1595 |
{0x01128F, 0x0004},
|
| 1596 |
+
{0x01129E, 0x0001},
|
| 1597 |
{0x01129F, 0x0004},
|
| 1598 |
{0x0112A9, 0x0020},
|
| 1599 |
+
{0x0112AA, 0x0001},
|
| 1600 |
{0x0112B0, 0x0004},
|
| 1601 |
{0x0112DF, 0x0010},
|
| 1602 |
+
{0x0112EB, 0x0001},
|
| 1603 |
{0x0112F0, 0x0002},
|
| 1604 |
+
{0x0112FA, 0x0001},
|
| 1605 |
{0x011300, 0x0010},
|
| 1606 |
+
{0x011304, 0x0001},
|
| 1607 |
{0x011305, 0x0004},
|
| 1608 |
+
{0x01130D, 0x0001},
|
| 1609 |
{0x01130F, 0x0004},
|
| 1610 |
+
{0x011311, 0x0001},
|
| 1611 |
{0x011313, 0x0004},
|
| 1612 |
+
{0x011329, 0x0001},
|
| 1613 |
{0x01132A, 0x0004},
|
| 1614 |
+
{0x011331, 0x0001},
|
| 1615 |
{0x011332, 0x0004},
|
| 1616 |
+
{0x011334, 0x0001},
|
| 1617 |
{0x011335, 0x0004},
|
| 1618 |
+
{0x01133A, 0x0001},
|
| 1619 |
{0x01133B, 0x0010},
|
| 1620 |
{0x01133D, 0x0004},
|
| 1621 |
{0x01133E, 0x0010},
|
| 1622 |
+
{0x011345, 0x0001},
|
| 1623 |
{0x011347, 0x0010},
|
| 1624 |
+
{0x011349, 0x0001},
|
| 1625 |
{0x01134B, 0x0010},
|
| 1626 |
+
{0x01134E, 0x0001},
|
| 1627 |
{0x011350, 0x0004},
|
| 1628 |
+
{0x011351, 0x0001},
|
| 1629 |
{0x011357, 0x0010},
|
| 1630 |
+
{0x011358, 0x0001},
|
| 1631 |
{0x01135D, 0x0004},
|
| 1632 |
{0x011362, 0x0010},
|
| 1633 |
+
{0x011364, 0x0001},
|
| 1634 |
{0x011366, 0x0010},
|
| 1635 |
+
{0x01136D, 0x0001},
|
| 1636 |
{0x011370, 0x0010},
|
| 1637 |
+
{0x011375, 0x0001},
|
| 1638 |
{0x011400, 0x0004},
|
| 1639 |
{0x011435, 0x0010},
|
| 1640 |
{0x011447, 0x0004},
|
| 1641 |
{0x01144B, 0x0020},
|
| 1642 |
{0x011450, 0x0002},
|
| 1643 |
{0x01145A, 0x0020},
|
| 1644 |
+
{0x01145C, 0x0001},
|
| 1645 |
{0x01145D, 0x0020},
|
| 1646 |
{0x01145E, 0x0010},
|
| 1647 |
{0x01145F, 0x0004},
|
| 1648 |
+
{0x011462, 0x0001},
|
| 1649 |
{0x011480, 0x0004},
|
| 1650 |
{0x0114B0, 0x0010},
|
| 1651 |
{0x0114C4, 0x0004},
|
| 1652 |
{0x0114C6, 0x0020},
|
| 1653 |
{0x0114C7, 0x0004},
|
| 1654 |
+
{0x0114C8, 0x0001},
|
| 1655 |
{0x0114D0, 0x0002},
|
| 1656 |
+
{0x0114DA, 0x0001},
|
| 1657 |
{0x011580, 0x0004},
|
| 1658 |
{0x0115AF, 0x0010},
|
| 1659 |
+
{0x0115B6, 0x0001},
|
| 1660 |
{0x0115B8, 0x0010},
|
| 1661 |
{0x0115C1, 0x0020},
|
| 1662 |
{0x0115D8, 0x0004},
|
| 1663 |
{0x0115DC, 0x0010},
|
| 1664 |
+
{0x0115DE, 0x0001},
|
| 1665 |
{0x011600, 0x0004},
|
| 1666 |
{0x011630, 0x0010},
|
| 1667 |
{0x011641, 0x0020},
|
| 1668 |
{0x011644, 0x0004},
|
| 1669 |
+
{0x011645, 0x0001},
|
| 1670 |
{0x011650, 0x0002},
|
| 1671 |
+
{0x01165A, 0x0001},
|
| 1672 |
{0x011660, 0x0020},
|
| 1673 |
+
{0x01166D, 0x0001},
|
| 1674 |
{0x011680, 0x0004},
|
| 1675 |
{0x0116AB, 0x0010},
|
| 1676 |
{0x0116B8, 0x0004},
|
| 1677 |
{0x0116B9, 0x0020},
|
| 1678 |
+
{0x0116BA, 0x0001},
|
| 1679 |
{0x0116C0, 0x0002},
|
| 1680 |
+
{0x0116CA, 0x0001},
|
| 1681 |
{0x011700, 0x0004},
|
| 1682 |
+
{0x01171B, 0x0001},
|
| 1683 |
{0x01171D, 0x0010},
|
| 1684 |
+
{0x01172C, 0x0001},
|
| 1685 |
{0x011730, 0x0002},
|
| 1686 |
{0x01173C, 0x0020},
|
| 1687 |
{0x01173F, 0x0040},
|
| 1688 |
{0x011740, 0x0004},
|
| 1689 |
+
{0x011747, 0x0001},
|
| 1690 |
{0x011800, 0x0004},
|
| 1691 |
{0x01182C, 0x0010},
|
| 1692 |
{0x01183B, 0x0020},
|
| 1693 |
+
{0x01183C, 0x0001},
|
| 1694 |
{0x0118A0, 0x0004},
|
| 1695 |
{0x0118E0, 0x0002},
|
| 1696 |
+
{0x0118F3, 0x0001},
|
| 1697 |
{0x0118FF, 0x0004},
|
| 1698 |
+
{0x011907, 0x0001},
|
| 1699 |
{0x011909, 0x0004},
|
| 1700 |
+
{0x01190A, 0x0001},
|
| 1701 |
{0x01190C, 0x0004},
|
| 1702 |
+
{0x011914, 0x0001},
|
| 1703 |
{0x011915, 0x0004},
|
| 1704 |
+
{0x011917, 0x0001},
|
| 1705 |
{0x011918, 0x0004},
|
| 1706 |
{0x011930, 0x0010},
|
| 1707 |
+
{0x011936, 0x0001},
|
| 1708 |
{0x011937, 0x0010},
|
| 1709 |
+
{0x011939, 0x0001},
|
| 1710 |
{0x01193B, 0x0010},
|
| 1711 |
{0x01193F, 0x0004},
|
| 1712 |
{0x011940, 0x0010},
|
| 1713 |
{0x011941, 0x0004},
|
| 1714 |
{0x011942, 0x0010},
|
| 1715 |
{0x011944, 0x0020},
|
| 1716 |
+
{0x011947, 0x0001},
|
| 1717 |
{0x011950, 0x0002},
|
| 1718 |
+
{0x01195A, 0x0001},
|
| 1719 |
{0x0119A0, 0x0004},
|
| 1720 |
+
{0x0119A8, 0x0001},
|
| 1721 |
{0x0119AA, 0x0004},
|
| 1722 |
{0x0119D1, 0x0010},
|
| 1723 |
+
{0x0119D8, 0x0001},
|
| 1724 |
{0x0119DA, 0x0010},
|
| 1725 |
{0x0119E1, 0x0004},
|
| 1726 |
{0x0119E2, 0x0020},
|
| 1727 |
{0x0119E3, 0x0004},
|
| 1728 |
{0x0119E4, 0x0010},
|
| 1729 |
+
{0x0119E5, 0x0001},
|
| 1730 |
{0x011A00, 0x0004},
|
| 1731 |
{0x011A01, 0x0010},
|
| 1732 |
{0x011A0B, 0x0004},
|
|
|
|
| 1735 |
{0x011A3B, 0x0010},
|
| 1736 |
{0x011A3F, 0x0020},
|
| 1737 |
{0x011A47, 0x0010},
|
| 1738 |
+
{0x011A48, 0x0001},
|
| 1739 |
{0x011A50, 0x0004},
|
| 1740 |
{0x011A51, 0x0010},
|
| 1741 |
{0x011A5C, 0x0004},
|
|
|
|
| 1743 |
{0x011A9A, 0x0020},
|
| 1744 |
{0x011A9D, 0x0004},
|
| 1745 |
{0x011A9E, 0x0020},
|
| 1746 |
+
{0x011AA3, 0x0001},
|
| 1747 |
{0x011AB0, 0x0004},
|
| 1748 |
+
{0x011AF9, 0x0001},
|
| 1749 |
{0x011B00, 0x0020},
|
| 1750 |
+
{0x011B0A, 0x0001},
|
| 1751 |
{0x011C00, 0x0004},
|
| 1752 |
+
{0x011C09, 0x0001},
|
| 1753 |
{0x011C0A, 0x0004},
|
| 1754 |
{0x011C2F, 0x0010},
|
| 1755 |
+
{0x011C37, 0x0001},
|
| 1756 |
{0x011C38, 0x0010},
|
| 1757 |
{0x011C40, 0x0004},
|
| 1758 |
{0x011C41, 0x0020},
|
| 1759 |
+
{0x011C46, 0x0001},
|
| 1760 |
{0x011C50, 0x0002},
|
| 1761 |
+
{0x011C6D, 0x0001},
|
| 1762 |
{0x011C70, 0x0020},
|
| 1763 |
{0x011C72, 0x0004},
|
| 1764 |
+
{0x011C90, 0x0001},
|
| 1765 |
{0x011C92, 0x0010},
|
| 1766 |
+
{0x011CA8, 0x0001},
|
| 1767 |
{0x011CA9, 0x0010},
|
| 1768 |
+
{0x011CB7, 0x0001},
|
| 1769 |
{0x011D00, 0x0004},
|
| 1770 |
+
{0x011D07, 0x0001},
|
| 1771 |
{0x011D08, 0x0004},
|
| 1772 |
+
{0x011D0A, 0x0001},
|
| 1773 |
{0x011D0B, 0x0004},
|
| 1774 |
{0x011D31, 0x0010},
|
| 1775 |
+
{0x011D37, 0x0001},
|
| 1776 |
{0x011D3A, 0x0010},
|
| 1777 |
+
{0x011D3B, 0x0001},
|
| 1778 |
{0x011D3C, 0x0010},
|
| 1779 |
+
{0x011D3E, 0x0001},
|
| 1780 |
{0x011D3F, 0x0010},
|
| 1781 |
{0x011D46, 0x0004},
|
| 1782 |
{0x011D47, 0x0010},
|
| 1783 |
+
{0x011D48, 0x0001},
|
| 1784 |
{0x011D50, 0x0002},
|
| 1785 |
+
{0x011D5A, 0x0001},
|
| 1786 |
{0x011D60, 0x0004},
|
| 1787 |
+
{0x011D66, 0x0001},
|
| 1788 |
{0x011D67, 0x0004},
|
| 1789 |
+
{0x011D69, 0x0001},
|
| 1790 |
{0x011D6A, 0x0004},
|
| 1791 |
{0x011D8A, 0x0010},
|
| 1792 |
+
{0x011D8F, 0x0001},
|
| 1793 |
{0x011D90, 0x0010},
|
| 1794 |
+
{0x011D92, 0x0001},
|
| 1795 |
{0x011D93, 0x0010},
|
| 1796 |
{0x011D98, 0x0004},
|
| 1797 |
+
{0x011D99, 0x0001},
|
| 1798 |
{0x011DA0, 0x0002},
|
| 1799 |
+
{0x011DAA, 0x0001},
|
| 1800 |
{0x011EE0, 0x0004},
|
| 1801 |
{0x011EF3, 0x0010},
|
| 1802 |
{0x011EF7, 0x0020},
|
| 1803 |
+
{0x011EF9, 0x0001},
|
| 1804 |
{0x011F00, 0x0010},
|
| 1805 |
{0x011F02, 0x0004},
|
| 1806 |
{0x011F03, 0x0010},
|
| 1807 |
{0x011F04, 0x0004},
|
| 1808 |
+
{0x011F11, 0x0001},
|
| 1809 |
{0x011F12, 0x0004},
|
| 1810 |
{0x011F34, 0x0010},
|
| 1811 |
+
{0x011F3B, 0x0001},
|
| 1812 |
{0x011F3E, 0x0010},
|
| 1813 |
{0x011F43, 0x0020},
|
| 1814 |
{0x011F50, 0x0002},
|
| 1815 |
+
{0x011F5A, 0x0001},
|
| 1816 |
{0x011FB0, 0x0004},
|
| 1817 |
+
{0x011FB1, 0x0001},
|
| 1818 |
{0x011FC0, 0x0002},
|
| 1819 |
{0x011FD5, 0x0040},
|
| 1820 |
+
{0x011FF2, 0x0001},
|
| 1821 |
{0x011FFF, 0x0020},
|
| 1822 |
{0x012000, 0x0004},
|
| 1823 |
+
{0x01239A, 0x0001},
|
| 1824 |
{0x012400, 0x0002},
|
| 1825 |
+
{0x01246F, 0x0001},
|
| 1826 |
{0x012470, 0x0020},
|
| 1827 |
+
{0x012475, 0x0001},
|
| 1828 |
{0x012480, 0x0004},
|
| 1829 |
+
{0x012544, 0x0001},
|
| 1830 |
{0x012F90, 0x0004},
|
| 1831 |
{0x012FF1, 0x0020},
|
| 1832 |
+
{0x012FF3, 0x0001},
|
| 1833 |
{0x013000, 0x0004},
|
| 1834 |
{0x013430, 0x0080},
|
| 1835 |
{0x013440, 0x0010},
|
| 1836 |
{0x013441, 0x0004},
|
| 1837 |
{0x013447, 0x0010},
|
| 1838 |
+
{0x013456, 0x0001},
|
| 1839 |
{0x014400, 0x0004},
|
| 1840 |
+
{0x014647, 0x0001},
|
| 1841 |
{0x016800, 0x0004},
|
| 1842 |
+
{0x016A39, 0x0001},
|
| 1843 |
{0x016A40, 0x0004},
|
| 1844 |
+
{0x016A5F, 0x0001},
|
| 1845 |
{0x016A60, 0x0002},
|
| 1846 |
+
{0x016A6A, 0x0001},
|
| 1847 |
{0x016A6E, 0x0020},
|
| 1848 |
{0x016A70, 0x0004},
|
| 1849 |
+
{0x016ABF, 0x0001},
|
| 1850 |
{0x016AC0, 0x0002},
|
| 1851 |
+
{0x016ACA, 0x0001},
|
| 1852 |
{0x016AD0, 0x0004},
|
| 1853 |
+
{0x016AEE, 0x0001},
|
| 1854 |
{0x016AF0, 0x0010},
|
| 1855 |
{0x016AF5, 0x0020},
|
| 1856 |
+
{0x016AF6, 0x0001},
|
| 1857 |
{0x016B00, 0x0004},
|
| 1858 |
{0x016B30, 0x0010},
|
| 1859 |
{0x016B37, 0x0020},
|
|
|
|
| 1861 |
{0x016B40, 0x0004},
|
| 1862 |
{0x016B44, 0x0020},
|
| 1863 |
{0x016B45, 0x0040},
|
| 1864 |
+
{0x016B46, 0x0001},
|
| 1865 |
{0x016B50, 0x0002},
|
| 1866 |
+
{0x016B5A, 0x0001},
|
| 1867 |
{0x016B5B, 0x0002},
|
| 1868 |
+
{0x016B62, 0x0001},
|
| 1869 |
{0x016B63, 0x0004},
|
| 1870 |
+
{0x016B78, 0x0001},
|
| 1871 |
{0x016B7D, 0x0004},
|
| 1872 |
+
{0x016B90, 0x0001},
|
| 1873 |
{0x016E40, 0x0004},
|
| 1874 |
{0x016E80, 0x0002},
|
| 1875 |
{0x016E97, 0x0020},
|
| 1876 |
+
{0x016E9B, 0x0001},
|
| 1877 |
{0x016F00, 0x0004},
|
| 1878 |
+
{0x016F4B, 0x0001},
|
| 1879 |
{0x016F4F, 0x0010},
|
| 1880 |
{0x016F50, 0x0004},
|
| 1881 |
{0x016F51, 0x0010},
|
| 1882 |
+
{0x016F88, 0x0001},
|
| 1883 |
{0x016F8F, 0x0010},
|
| 1884 |
{0x016F93, 0x0004},
|
| 1885 |
+
{0x016FA0, 0x0001},
|
| 1886 |
{0x016FE0, 0x0004},
|
| 1887 |
{0x016FE2, 0x0020},
|
| 1888 |
{0x016FE3, 0x0004},
|
| 1889 |
{0x016FE4, 0x0010},
|
| 1890 |
+
{0x016FE5, 0x0001},
|
| 1891 |
{0x016FF0, 0x0010},
|
| 1892 |
+
{0x016FF2, 0x0001},
|
| 1893 |
{0x017000, 0x0004},
|
| 1894 |
+
{0x0187F8, 0x0001},
|
| 1895 |
{0x018800, 0x0004},
|
| 1896 |
+
{0x018CD6, 0x0001},
|
| 1897 |
{0x018D00, 0x0004},
|
| 1898 |
+
{0x018D09, 0x0001},
|
| 1899 |
{0x01AFF0, 0x0004},
|
| 1900 |
+
{0x01AFF4, 0x0001},
|
| 1901 |
{0x01AFF5, 0x0004},
|
| 1902 |
+
{0x01AFFC, 0x0001},
|
| 1903 |
{0x01AFFD, 0x0004},
|
| 1904 |
+
{0x01AFFF, 0x0001},
|
| 1905 |
{0x01B000, 0x0004},
|
| 1906 |
+
{0x01B123, 0x0001},
|
| 1907 |
{0x01B132, 0x0004},
|
| 1908 |
+
{0x01B133, 0x0001},
|
| 1909 |
{0x01B150, 0x0004},
|
| 1910 |
+
{0x01B153, 0x0001},
|
| 1911 |
{0x01B155, 0x0004},
|
| 1912 |
+
{0x01B156, 0x0001},
|
| 1913 |
{0x01B164, 0x0004},
|
| 1914 |
+
{0x01B168, 0x0001},
|
| 1915 |
{0x01B170, 0x0004},
|
| 1916 |
+
{0x01B2FC, 0x0001},
|
| 1917 |
{0x01BC00, 0x0004},
|
| 1918 |
+
{0x01BC6B, 0x0001},
|
| 1919 |
{0x01BC70, 0x0004},
|
| 1920 |
+
{0x01BC7D, 0x0001},
|
| 1921 |
{0x01BC80, 0x0004},
|
| 1922 |
+
{0x01BC89, 0x0001},
|
| 1923 |
{0x01BC90, 0x0004},
|
| 1924 |
+
{0x01BC9A, 0x0001},
|
| 1925 |
{0x01BC9C, 0x0040},
|
| 1926 |
{0x01BC9D, 0x0010},
|
| 1927 |
{0x01BC9F, 0x0020},
|
| 1928 |
{0x01BCA0, 0x0080},
|
| 1929 |
+
{0x01BCA4, 0x0001},
|
| 1930 |
{0x01CF00, 0x0010},
|
| 1931 |
+
{0x01CF2E, 0x0001},
|
| 1932 |
{0x01CF30, 0x0010},
|
| 1933 |
+
{0x01CF47, 0x0001},
|
| 1934 |
{0x01CF50, 0x0040},
|
| 1935 |
+
{0x01CFC4, 0x0001},
|
| 1936 |
{0x01D000, 0x0040},
|
| 1937 |
+
{0x01D0F6, 0x0001},
|
| 1938 |
{0x01D100, 0x0040},
|
| 1939 |
+
{0x01D127, 0x0001},
|
| 1940 |
{0x01D129, 0x0040},
|
| 1941 |
{0x01D165, 0x0010},
|
| 1942 |
{0x01D16A, 0x0040},
|
|
|
|
| 1948 |
{0x01D18C, 0x0040},
|
| 1949 |
{0x01D1AA, 0x0010},
|
| 1950 |
{0x01D1AE, 0x0040},
|
| 1951 |
+
{0x01D1EB, 0x0001},
|
| 1952 |
{0x01D200, 0x0040},
|
| 1953 |
{0x01D242, 0x0010},
|
| 1954 |
{0x01D245, 0x0040},
|
| 1955 |
+
{0x01D246, 0x0001},
|
| 1956 |
{0x01D2C0, 0x0002},
|
| 1957 |
+
{0x01D2D4, 0x0001},
|
| 1958 |
{0x01D2E0, 0x0002},
|
| 1959 |
+
{0x01D2F4, 0x0001},
|
| 1960 |
{0x01D300, 0x0040},
|
| 1961 |
+
{0x01D357, 0x0001},
|
| 1962 |
{0x01D360, 0x0002},
|
| 1963 |
+
{0x01D379, 0x0001},
|
| 1964 |
{0x01D400, 0x0004},
|
| 1965 |
+
{0x01D455, 0x0001},
|
| 1966 |
{0x01D456, 0x0004},
|
| 1967 |
+
{0x01D49D, 0x0001},
|
| 1968 |
{0x01D49E, 0x0004},
|
| 1969 |
+
{0x01D4A0, 0x0001},
|
| 1970 |
{0x01D4A2, 0x0004},
|
| 1971 |
+
{0x01D4A3, 0x0001},
|
| 1972 |
{0x01D4A5, 0x0004},
|
| 1973 |
+
{0x01D4A7, 0x0001},
|
| 1974 |
{0x01D4A9, 0x0004},
|
| 1975 |
+
{0x01D4AD, 0x0001},
|
| 1976 |
{0x01D4AE, 0x0004},
|
| 1977 |
+
{0x01D4BA, 0x0001},
|
| 1978 |
{0x01D4BB, 0x0004},
|
| 1979 |
+
{0x01D4BC, 0x0001},
|
| 1980 |
{0x01D4BD, 0x0004},
|
| 1981 |
+
{0x01D4C4, 0x0001},
|
| 1982 |
{0x01D4C5, 0x0004},
|
| 1983 |
+
{0x01D506, 0x0001},
|
| 1984 |
{0x01D507, 0x0004},
|
| 1985 |
+
{0x01D50B, 0x0001},
|
| 1986 |
{0x01D50D, 0x0004},
|
| 1987 |
+
{0x01D515, 0x0001},
|
| 1988 |
{0x01D516, 0x0004},
|
| 1989 |
+
{0x01D51D, 0x0001},
|
| 1990 |
{0x01D51E, 0x0004},
|
| 1991 |
+
{0x01D53A, 0x0001},
|
| 1992 |
{0x01D53B, 0x0004},
|
| 1993 |
+
{0x01D53F, 0x0001},
|
| 1994 |
{0x01D540, 0x0004},
|
| 1995 |
+
{0x01D545, 0x0001},
|
| 1996 |
{0x01D546, 0x0004},
|
| 1997 |
+
{0x01D547, 0x0001},
|
| 1998 |
{0x01D54A, 0x0004},
|
| 1999 |
+
{0x01D551, 0x0001},
|
| 2000 |
{0x01D552, 0x0004},
|
| 2001 |
+
{0x01D6A6, 0x0001},
|
| 2002 |
{0x01D6A8, 0x0004},
|
| 2003 |
{0x01D6C1, 0x0040},
|
| 2004 |
{0x01D6C2, 0x0004},
|
|
|
|
| 2020 |
{0x01D7AA, 0x0004},
|
| 2021 |
{0x01D7C3, 0x0040},
|
| 2022 |
{0x01D7C4, 0x0004},
|
| 2023 |
+
{0x01D7CC, 0x0001},
|
| 2024 |
{0x01D7CE, 0x0002},
|
| 2025 |
{0x01D800, 0x0040},
|
| 2026 |
{0x01DA00, 0x0010},
|
|
|
|
| 2032 |
{0x01DA84, 0x0010},
|
| 2033 |
{0x01DA85, 0x0040},
|
| 2034 |
{0x01DA87, 0x0020},
|
| 2035 |
+
{0x01DA8C, 0x0001},
|
| 2036 |
{0x01DA9B, 0x0010},
|
| 2037 |
+
{0x01DAA0, 0x0001},
|
| 2038 |
{0x01DAA1, 0x0010},
|
| 2039 |
+
{0x01DAB0, 0x0001},
|
| 2040 |
{0x01DF00, 0x0004},
|
| 2041 |
+
{0x01DF1F, 0x0001},
|
| 2042 |
{0x01DF25, 0x0004},
|
| 2043 |
+
{0x01DF2B, 0x0001},
|
| 2044 |
{0x01E000, 0x0010},
|
| 2045 |
+
{0x01E007, 0x0001},
|
| 2046 |
{0x01E008, 0x0010},
|
| 2047 |
+
{0x01E019, 0x0001},
|
| 2048 |
{0x01E01B, 0x0010},
|
| 2049 |
+
{0x01E022, 0x0001},
|
| 2050 |
{0x01E023, 0x0010},
|
| 2051 |
+
{0x01E025, 0x0001},
|
| 2052 |
{0x01E026, 0x0010},
|
| 2053 |
+
{0x01E02B, 0x0001},
|
| 2054 |
{0x01E030, 0x0004},
|
| 2055 |
+
{0x01E06E, 0x0001},
|
| 2056 |
{0x01E08F, 0x0010},
|
| 2057 |
+
{0x01E090, 0x0001},
|
| 2058 |
{0x01E100, 0x0004},
|
| 2059 |
+
{0x01E12D, 0x0001},
|
| 2060 |
{0x01E130, 0x0010},
|
| 2061 |
{0x01E137, 0x0004},
|
| 2062 |
+
{0x01E13E, 0x0001},
|
| 2063 |
{0x01E140, 0x0002},
|
| 2064 |
+
{0x01E14A, 0x0001},
|
| 2065 |
{0x01E14E, 0x0004},
|
| 2066 |
{0x01E14F, 0x0040},
|
| 2067 |
+
{0x01E150, 0x0001},
|
| 2068 |
{0x01E290, 0x0004},
|
| 2069 |
{0x01E2AE, 0x0010},
|
| 2070 |
+
{0x01E2AF, 0x0001},
|
| 2071 |
{0x01E2C0, 0x0004},
|
| 2072 |
{0x01E2EC, 0x0010},
|
| 2073 |
{0x01E2F0, 0x0002},
|
| 2074 |
+
{0x01E2FA, 0x0001},
|
| 2075 |
{0x01E2FF, 0x0040},
|
| 2076 |
+
{0x01E300, 0x0001},
|
| 2077 |
{0x01E4D0, 0x0004},
|
| 2078 |
{0x01E4EC, 0x0010},
|
| 2079 |
{0x01E4F0, 0x0002},
|
| 2080 |
+
{0x01E4FA, 0x0001},
|
| 2081 |
{0x01E7E0, 0x0004},
|
| 2082 |
+
{0x01E7E7, 0x0001},
|
| 2083 |
{0x01E7E8, 0x0004},
|
| 2084 |
+
{0x01E7EC, 0x0001},
|
| 2085 |
{0x01E7ED, 0x0004},
|
| 2086 |
+
{0x01E7EF, 0x0001},
|
| 2087 |
{0x01E7F0, 0x0004},
|
| 2088 |
+
{0x01E7FF, 0x0001},
|
| 2089 |
{0x01E800, 0x0004},
|
| 2090 |
+
{0x01E8C5, 0x0001},
|
| 2091 |
{0x01E8C7, 0x0002},
|
| 2092 |
{0x01E8D0, 0x0010},
|
| 2093 |
+
{0x01E8D7, 0x0001},
|
| 2094 |
{0x01E900, 0x0004},
|
| 2095 |
{0x01E944, 0x0010},
|
| 2096 |
{0x01E94B, 0x0004},
|
| 2097 |
+
{0x01E94C, 0x0001},
|
| 2098 |
{0x01E950, 0x0002},
|
| 2099 |
+
{0x01E95A, 0x0001},
|
| 2100 |
{0x01E95E, 0x0020},
|
| 2101 |
+
{0x01E960, 0x0001},
|
| 2102 |
{0x01EC71, 0x0002},
|
| 2103 |
{0x01ECAC, 0x0040},
|
| 2104 |
{0x01ECAD, 0x0002},
|
| 2105 |
{0x01ECB0, 0x0040},
|
| 2106 |
{0x01ECB1, 0x0002},
|
| 2107 |
+
{0x01ECB5, 0x0001},
|
| 2108 |
{0x01ED01, 0x0002},
|
| 2109 |
{0x01ED2E, 0x0040},
|
| 2110 |
{0x01ED2F, 0x0002},
|
| 2111 |
+
{0x01ED3E, 0x0001},
|
| 2112 |
{0x01EE00, 0x0004},
|
| 2113 |
+
{0x01EE04, 0x0001},
|
| 2114 |
{0x01EE05, 0x0004},
|
| 2115 |
+
{0x01EE20, 0x0001},
|
| 2116 |
{0x01EE21, 0x0004},
|
| 2117 |
+
{0x01EE23, 0x0001},
|
| 2118 |
{0x01EE24, 0x0004},
|
| 2119 |
+
{0x01EE25, 0x0001},
|
| 2120 |
{0x01EE27, 0x0004},
|
| 2121 |
+
{0x01EE28, 0x0001},
|
| 2122 |
{0x01EE29, 0x0004},
|
| 2123 |
+
{0x01EE33, 0x0001},
|
| 2124 |
{0x01EE34, 0x0004},
|
| 2125 |
+
{0x01EE38, 0x0001},
|
| 2126 |
{0x01EE39, 0x0004},
|
| 2127 |
+
{0x01EE3A, 0x0001},
|
| 2128 |
{0x01EE3B, 0x0004},
|
| 2129 |
+
{0x01EE3C, 0x0001},
|
| 2130 |
{0x01EE42, 0x0004},
|
| 2131 |
+
{0x01EE43, 0x0001},
|
| 2132 |
{0x01EE47, 0x0004},
|
| 2133 |
+
{0x01EE48, 0x0001},
|
| 2134 |
{0x01EE49, 0x0004},
|
| 2135 |
+
{0x01EE4A, 0x0001},
|
| 2136 |
{0x01EE4B, 0x0004},
|
| 2137 |
+
{0x01EE4C, 0x0001},
|
| 2138 |
{0x01EE4D, 0x0004},
|
| 2139 |
+
{0x01EE50, 0x0001},
|
| 2140 |
{0x01EE51, 0x0004},
|
| 2141 |
+
{0x01EE53, 0x0001},
|
| 2142 |
{0x01EE54, 0x0004},
|
| 2143 |
+
{0x01EE55, 0x0001},
|
| 2144 |
{0x01EE57, 0x0004},
|
| 2145 |
+
{0x01EE58, 0x0001},
|
| 2146 |
{0x01EE59, 0x0004},
|
| 2147 |
+
{0x01EE5A, 0x0001},
|
| 2148 |
{0x01EE5B, 0x0004},
|
| 2149 |
+
{0x01EE5C, 0x0001},
|
| 2150 |
{0x01EE5D, 0x0004},
|
| 2151 |
+
{0x01EE5E, 0x0001},
|
| 2152 |
{0x01EE5F, 0x0004},
|
| 2153 |
+
{0x01EE60, 0x0001},
|
| 2154 |
{0x01EE61, 0x0004},
|
| 2155 |
+
{0x01EE63, 0x0001},
|
| 2156 |
{0x01EE64, 0x0004},
|
| 2157 |
+
{0x01EE65, 0x0001},
|
| 2158 |
{0x01EE67, 0x0004},
|
| 2159 |
+
{0x01EE6B, 0x0001},
|
| 2160 |
{0x01EE6C, 0x0004},
|
| 2161 |
+
{0x01EE73, 0x0001},
|
| 2162 |
{0x01EE74, 0x0004},
|
| 2163 |
+
{0x01EE78, 0x0001},
|
| 2164 |
{0x01EE79, 0x0004},
|
| 2165 |
+
{0x01EE7D, 0x0001},
|
| 2166 |
{0x01EE7E, 0x0004},
|
| 2167 |
+
{0x01EE7F, 0x0001},
|
| 2168 |
{0x01EE80, 0x0004},
|
| 2169 |
+
{0x01EE8A, 0x0001},
|
| 2170 |
{0x01EE8B, 0x0004},
|
| 2171 |
+
{0x01EE9C, 0x0001},
|
| 2172 |
{0x01EEA1, 0x0004},
|
| 2173 |
+
{0x01EEA4, 0x0001},
|
| 2174 |
{0x01EEA5, 0x0004},
|
| 2175 |
+
{0x01EEAA, 0x0001},
|
| 2176 |
{0x01EEAB, 0x0004},
|
| 2177 |
+
{0x01EEBC, 0x0001},
|
| 2178 |
{0x01EEF0, 0x0040},
|
| 2179 |
+
{0x01EEF2, 0x0001},
|
| 2180 |
{0x01F000, 0x0040},
|
| 2181 |
+
{0x01F02C, 0x0001},
|
| 2182 |
{0x01F030, 0x0040},
|
| 2183 |
+
{0x01F094, 0x0001},
|
| 2184 |
{0x01F0A0, 0x0040},
|
| 2185 |
+
{0x01F0AF, 0x0001},
|
| 2186 |
{0x01F0B1, 0x0040},
|
| 2187 |
+
{0x01F0C0, 0x0001},
|
| 2188 |
{0x01F0C1, 0x0040},
|
| 2189 |
+
{0x01F0D0, 0x0001},
|
| 2190 |
{0x01F0D1, 0x0040},
|
| 2191 |
+
{0x01F0F6, 0x0001},
|
| 2192 |
{0x01F100, 0x0002},
|
| 2193 |
{0x01F10D, 0x0040},
|
| 2194 |
+
{0x01F1AE, 0x0001},
|
| 2195 |
{0x01F1E6, 0x0040},
|
| 2196 |
+
{0x01F203, 0x0001},
|
| 2197 |
{0x01F210, 0x0040},
|
| 2198 |
+
{0x01F23C, 0x0001},
|
| 2199 |
{0x01F240, 0x0040},
|
| 2200 |
+
{0x01F249, 0x0001},
|
| 2201 |
{0x01F250, 0x0040},
|
| 2202 |
+
{0x01F252, 0x0001},
|
| 2203 |
{0x01F260, 0x0040},
|
| 2204 |
+
{0x01F266, 0x0001},
|
| 2205 |
{0x01F300, 0x0040},
|
| 2206 |
+
{0x01F6D8, 0x0001},
|
| 2207 |
{0x01F6DC, 0x0040},
|
| 2208 |
+
{0x01F6ED, 0x0001},
|
| 2209 |
{0x01F6F0, 0x0040},
|
| 2210 |
+
{0x01F6FD, 0x0001},
|
| 2211 |
{0x01F700, 0x0040},
|
| 2212 |
+
{0x01F777, 0x0001},
|
| 2213 |
{0x01F77B, 0x0040},
|
| 2214 |
+
{0x01F7DA, 0x0001},
|
| 2215 |
{0x01F7E0, 0x0040},
|
| 2216 |
+
{0x01F7EC, 0x0001},
|
| 2217 |
{0x01F7F0, 0x0040},
|
| 2218 |
+
{0x01F7F1, 0x0001},
|
| 2219 |
{0x01F800, 0x0040},
|
| 2220 |
+
{0x01F80C, 0x0001},
|
| 2221 |
{0x01F810, 0x0040},
|
| 2222 |
+
{0x01F848, 0x0001},
|
| 2223 |
{0x01F850, 0x0040},
|
| 2224 |
+
{0x01F85A, 0x0001},
|
| 2225 |
{0x01F860, 0x0040},
|
| 2226 |
+
{0x01F888, 0x0001},
|
| 2227 |
{0x01F890, 0x0040},
|
| 2228 |
+
{0x01F8AE, 0x0001},
|
| 2229 |
{0x01F8B0, 0x0040},
|
| 2230 |
+
{0x01F8B2, 0x0001},
|
| 2231 |
{0x01F900, 0x0040},
|
| 2232 |
+
{0x01FA54, 0x0001},
|
| 2233 |
{0x01FA60, 0x0040},
|
| 2234 |
+
{0x01FA6E, 0x0001},
|
| 2235 |
{0x01FA70, 0x0040},
|
| 2236 |
+
{0x01FA7D, 0x0001},
|
| 2237 |
{0x01FA80, 0x0040},
|
| 2238 |
+
{0x01FA89, 0x0001},
|
| 2239 |
{0x01FA90, 0x0040},
|
| 2240 |
+
{0x01FABE, 0x0001},
|
| 2241 |
{0x01FABF, 0x0040},
|
| 2242 |
+
{0x01FAC6, 0x0001},
|
| 2243 |
{0x01FACE, 0x0040},
|
| 2244 |
+
{0x01FADC, 0x0001},
|
| 2245 |
{0x01FAE0, 0x0040},
|
| 2246 |
+
{0x01FAE9, 0x0001},
|
| 2247 |
{0x01FAF0, 0x0040},
|
| 2248 |
+
{0x01FAF9, 0x0001},
|
| 2249 |
{0x01FB00, 0x0040},
|
| 2250 |
+
{0x01FB93, 0x0001},
|
| 2251 |
{0x01FB94, 0x0040},
|
| 2252 |
+
{0x01FBCB, 0x0001},
|
| 2253 |
{0x01FBF0, 0x0002},
|
| 2254 |
+
{0x01FBFA, 0x0001},
|
| 2255 |
{0x020000, 0x0004},
|
| 2256 |
+
{0x02A6E0, 0x0001},
|
| 2257 |
{0x02A700, 0x0004},
|
| 2258 |
+
{0x02B73A, 0x0001},
|
| 2259 |
{0x02B740, 0x0004},
|
| 2260 |
+
{0x02B81E, 0x0001},
|
| 2261 |
{0x02B820, 0x0004},
|
| 2262 |
+
{0x02CEA2, 0x0001},
|
| 2263 |
{0x02CEB0, 0x0004},
|
| 2264 |
+
{0x02EBE1, 0x0001},
|
| 2265 |
{0x02EBF0, 0x0004},
|
| 2266 |
+
{0x02EE5E, 0x0001},
|
| 2267 |
{0x02F800, 0x0004},
|
| 2268 |
+
{0x02FA1E, 0x0001},
|
| 2269 |
{0x030000, 0x0004},
|
| 2270 |
+
{0x03134B, 0x0001},
|
| 2271 |
{0x031350, 0x0004},
|
| 2272 |
+
{0x0323B0, 0x0001},
|
| 2273 |
+
{0x0E0001, 0x0080},
|
| 2274 |
+
{0x0E0002, 0x0001},
|
| 2275 |
+
{0x0E0020, 0x0080},
|
| 2276 |
+
{0x0E0080, 0x0001},
|
| 2277 |
{0x0E0100, 0x0010},
|
| 2278 |
+
{0x0E01F0, 0x0001},
|
| 2279 |
+
{0x0F0000, 0x0080},
|
| 2280 |
+
{0x0FFFFE, 0x0001},
|
| 2281 |
+
{0x100000, 0x0080},
|
| 2282 |
+
{0x10FFFE, 0x0001},
|
| 2283 |
{0x110000, 0x0000},
|
| 2284 |
};
|
| 2285 |
|
| 2286 |
const std::unordered_set<uint32_t> unicode_set_whitespace = {
|
| 2287 |
+
0x000009,
|
| 2288 |
+
0x00000A,
|
| 2289 |
+
0x00000B,
|
| 2290 |
+
0x00000C,
|
| 2291 |
+
0x00000D,
|
| 2292 |
+
0x000020,
|
| 2293 |
+
0x000085,
|
| 2294 |
+
0x0000A0,
|
| 2295 |
+
0x001680,
|
| 2296 |
+
0x002000,
|
| 2297 |
+
0x002001,
|
| 2298 |
+
0x002002,
|
| 2299 |
+
0x002003,
|
| 2300 |
+
0x002004,
|
| 2301 |
+
0x002005,
|
| 2302 |
+
0x002006,
|
| 2303 |
+
0x002007,
|
| 2304 |
+
0x002008,
|
| 2305 |
+
0x002009,
|
| 2306 |
+
0x00200A,
|
| 2307 |
+
0x002028,
|
| 2308 |
+
0x002029,
|
| 2309 |
+
0x00202F,
|
| 2310 |
+
0x00205F,
|
| 2311 |
+
0x003000,
|
| 2312 |
};
|
| 2313 |
|
| 2314 |
const std::unordered_map<uint32_t, uint32_t> unicode_map_lowercase = {
|
|
|
|
| 3267 |
{0x002C2C, 0x002C5C},
|
| 3268 |
{0x002C2D, 0x002C5D},
|
| 3269 |
{0x002C2E, 0x002C5E},
|
| 3270 |
+
{0x002C2F, 0x002C5F},
|
| 3271 |
{0x002C60, 0x002C61},
|
| 3272 |
{0x002C62, 0x00026B},
|
| 3273 |
{0x002C63, 0x001D7D},
|
|
|
|
| 3448 |
{0x00A7BA, 0x00A7BB},
|
| 3449 |
{0x00A7BC, 0x00A7BD},
|
| 3450 |
{0x00A7BE, 0x00A7BF},
|
| 3451 |
+
{0x00A7C0, 0x00A7C1},
|
| 3452 |
{0x00A7C2, 0x00A7C3},
|
| 3453 |
{0x00A7C4, 0x00A794},
|
| 3454 |
{0x00A7C5, 0x000282},
|
| 3455 |
{0x00A7C6, 0x001D8E},
|
| 3456 |
{0x00A7C7, 0x00A7C8},
|
| 3457 |
{0x00A7C9, 0x00A7CA},
|
| 3458 |
+
{0x00A7D0, 0x00A7D1},
|
| 3459 |
+
{0x00A7D6, 0x00A7D7},
|
| 3460 |
+
{0x00A7D8, 0x00A7D9},
|
| 3461 |
{0x00A7F5, 0x00A7F6},
|
| 3462 |
{0x00FF21, 0x00FF41},
|
| 3463 |
{0x00FF22, 0x00FF42},
|
|
|
|
| 3561 |
{0x0104D1, 0x0104F9},
|
| 3562 |
{0x0104D2, 0x0104FA},
|
| 3563 |
{0x0104D3, 0x0104FB},
|
| 3564 |
+
{0x010570, 0x010597},
|
| 3565 |
+
{0x010571, 0x010598},
|
| 3566 |
+
{0x010572, 0x010599},
|
| 3567 |
+
{0x010573, 0x01059A},
|
| 3568 |
+
{0x010574, 0x01059B},
|
| 3569 |
+
{0x010575, 0x01059C},
|
| 3570 |
+
{0x010576, 0x01059D},
|
| 3571 |
+
{0x010577, 0x01059E},
|
| 3572 |
+
{0x010578, 0x01059F},
|
| 3573 |
+
{0x010579, 0x0105A0},
|
| 3574 |
+
{0x01057A, 0x0105A1},
|
| 3575 |
+
{0x01057C, 0x0105A3},
|
| 3576 |
+
{0x01057D, 0x0105A4},
|
| 3577 |
+
{0x01057E, 0x0105A5},
|
| 3578 |
+
{0x01057F, 0x0105A6},
|
| 3579 |
+
{0x010580, 0x0105A7},
|
| 3580 |
+
{0x010581, 0x0105A8},
|
| 3581 |
+
{0x010582, 0x0105A9},
|
| 3582 |
+
{0x010583, 0x0105AA},
|
| 3583 |
+
{0x010584, 0x0105AB},
|
| 3584 |
+
{0x010585, 0x0105AC},
|
| 3585 |
+
{0x010586, 0x0105AD},
|
| 3586 |
+
{0x010587, 0x0105AE},
|
| 3587 |
+
{0x010588, 0x0105AF},
|
| 3588 |
+
{0x010589, 0x0105B0},
|
| 3589 |
+
{0x01058A, 0x0105B1},
|
| 3590 |
+
{0x01058C, 0x0105B3},
|
| 3591 |
+
{0x01058D, 0x0105B4},
|
| 3592 |
+
{0x01058E, 0x0105B5},
|
| 3593 |
+
{0x01058F, 0x0105B6},
|
| 3594 |
+
{0x010590, 0x0105B7},
|
| 3595 |
+
{0x010591, 0x0105B8},
|
| 3596 |
+
{0x010592, 0x0105B9},
|
| 3597 |
+
{0x010594, 0x0105BB},
|
| 3598 |
+
{0x010595, 0x0105BC},
|
| 3599 |
{0x010C80, 0x010CC0},
|
| 3600 |
{0x010C81, 0x010CC1},
|
| 3601 |
{0x010C82, 0x010CC2},
|
|
|
|
| 3775 |
{0x000079, 0x000059},
|
| 3776 |
{0x00007A, 0x00005A},
|
| 3777 |
{0x0000B5, 0x00039C},
|
|
|
|
| 3778 |
{0x0000E0, 0x0000C0},
|
| 3779 |
{0x0000E1, 0x0000C1},
|
| 3780 |
{0x0000E2, 0x0000C2},
|
|
|
|
| 3842 |
{0x000144, 0x000143},
|
| 3843 |
{0x000146, 0x000145},
|
| 3844 |
{0x000148, 0x000147},
|
|
|
|
| 3845 |
{0x00014B, 0x00014A},
|
| 3846 |
{0x00014D, 0x00014C},
|
| 3847 |
{0x00014F, 0x00014E},
|
|
|
|
| 3914 |
{0x0001EB, 0x0001EA},
|
| 3915 |
{0x0001ED, 0x0001EC},
|
| 3916 |
{0x0001EF, 0x0001EE},
|
|
|
|
| 3917 |
{0x0001F2, 0x0001F1},
|
| 3918 |
{0x0001F3, 0x0001F1},
|
| 3919 |
{0x0001F5, 0x0001F4},
|
|
|
|
| 3999 |
{0x00037B, 0x0003FD},
|
| 4000 |
{0x00037C, 0x0003FE},
|
| 4001 |
{0x00037D, 0x0003FF},
|
|
|
|
| 4002 |
{0x0003AC, 0x000386},
|
| 4003 |
{0x0003AD, 0x000388},
|
| 4004 |
{0x0003AE, 0x000389},
|
| 4005 |
{0x0003AF, 0x00038A},
|
|
|
|
| 4006 |
{0x0003B1, 0x000391},
|
| 4007 |
{0x0003B2, 0x000392},
|
| 4008 |
{0x0003B3, 0x000393},
|
|
|
|
| 4243 |
{0x000584, 0x000554},
|
| 4244 |
{0x000585, 0x000555},
|
| 4245 |
{0x000586, 0x000556},
|
|
|
|
| 4246 |
{0x0010D0, 0x001C90},
|
| 4247 |
{0x0010D1, 0x001C91},
|
| 4248 |
{0x0010D2, 0x001C92},
|
|
|
|
| 4382 |
{0x001E91, 0x001E90},
|
| 4383 |
{0x001E93, 0x001E92},
|
| 4384 |
{0x001E95, 0x001E94},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4385 |
{0x001E9B, 0x001E60},
|
| 4386 |
{0x001EA1, 0x001EA0},
|
| 4387 |
{0x001EA3, 0x001EA2},
|
|
|
|
| 4467 |
{0x001F43, 0x001F4B},
|
| 4468 |
{0x001F44, 0x001F4C},
|
| 4469 |
{0x001F45, 0x001F4D},
|
|
|
|
| 4470 |
{0x001F51, 0x001F59},
|
|
|
|
| 4471 |
{0x001F53, 0x001F5B},
|
|
|
|
| 4472 |
{0x001F55, 0x001F5D},
|
|
|
|
| 4473 |
{0x001F57, 0x001F5F},
|
| 4474 |
{0x001F60, 0x001F68},
|
| 4475 |
{0x001F61, 0x001F69},
|
|
|
|
| 4493 |
{0x001F7B, 0x001FEB},
|
| 4494 |
{0x001F7C, 0x001FFA},
|
| 4495 |
{0x001F7D, 0x001FFB},
|
| 4496 |
+
{0x001F80, 0x001F88},
|
| 4497 |
+
{0x001F81, 0x001F89},
|
| 4498 |
+
{0x001F82, 0x001F8A},
|
| 4499 |
+
{0x001F83, 0x001F8B},
|
| 4500 |
+
{0x001F84, 0x001F8C},
|
| 4501 |
+
{0x001F85, 0x001F8D},
|
| 4502 |
+
{0x001F86, 0x001F8E},
|
| 4503 |
+
{0x001F87, 0x001F8F},
|
| 4504 |
+
{0x001F90, 0x001F98},
|
| 4505 |
+
{0x001F91, 0x001F99},
|
| 4506 |
+
{0x001F92, 0x001F9A},
|
| 4507 |
+
{0x001F93, 0x001F9B},
|
| 4508 |
+
{0x001F94, 0x001F9C},
|
| 4509 |
+
{0x001F95, 0x001F9D},
|
| 4510 |
+
{0x001F96, 0x001F9E},
|
| 4511 |
+
{0x001F97, 0x001F9F},
|
| 4512 |
+
{0x001FA0, 0x001FA8},
|
| 4513 |
+
{0x001FA1, 0x001FA9},
|
| 4514 |
+
{0x001FA2, 0x001FAA},
|
| 4515 |
+
{0x001FA3, 0x001FAB},
|
| 4516 |
+
{0x001FA4, 0x001FAC},
|
| 4517 |
+
{0x001FA5, 0x001FAD},
|
| 4518 |
+
{0x001FA6, 0x001FAE},
|
| 4519 |
+
{0x001FA7, 0x001FAF},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4520 |
{0x001FB0, 0x001FB8},
|
| 4521 |
{0x001FB1, 0x001FB9},
|
| 4522 |
+
{0x001FB3, 0x001FBC},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4523 |
{0x001FBE, 0x000399},
|
| 4524 |
+
{0x001FC3, 0x001FCC},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4525 |
{0x001FD0, 0x001FD8},
|
| 4526 |
{0x001FD1, 0x001FD9},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4527 |
{0x001FE0, 0x001FE8},
|
| 4528 |
{0x001FE1, 0x001FE9},
|
|
|
|
|
|
|
|
|
|
| 4529 |
{0x001FE5, 0x001FEC},
|
| 4530 |
+
{0x001FF3, 0x001FFC},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4531 |
{0x00214E, 0x002132},
|
| 4532 |
{0x002170, 0x002160},
|
| 4533 |
{0x002171, 0x002161},
|
|
|
|
| 4619 |
{0x002C5C, 0x002C2C},
|
| 4620 |
{0x002C5D, 0x002C2D},
|
| 4621 |
{0x002C5E, 0x002C2E},
|
| 4622 |
+
{0x002C5F, 0x002C2F},
|
| 4623 |
{0x002C61, 0x002C60},
|
| 4624 |
{0x002C65, 0x00023A},
|
| 4625 |
{0x002C66, 0x00023E},
|
|
|
|
| 4823 |
{0x00A7BB, 0x00A7BA},
|
| 4824 |
{0x00A7BD, 0x00A7BC},
|
| 4825 |
{0x00A7BF, 0x00A7BE},
|
| 4826 |
+
{0x00A7C1, 0x00A7C0},
|
| 4827 |
{0x00A7C3, 0x00A7C2},
|
| 4828 |
{0x00A7C8, 0x00A7C7},
|
| 4829 |
{0x00A7CA, 0x00A7C9},
|
| 4830 |
+
{0x00A7D1, 0x00A7D0},
|
| 4831 |
+
{0x00A7D7, 0x00A7D6},
|
| 4832 |
+
{0x00A7D9, 0x00A7D8},
|
| 4833 |
{0x00A7F6, 0x00A7F5},
|
| 4834 |
{0x00AB53, 0x00A7B3},
|
| 4835 |
{0x00AB70, 0x0013A0},
|
|
|
|
| 4912 |
{0x00ABBD, 0x0013ED},
|
| 4913 |
{0x00ABBE, 0x0013EE},
|
| 4914 |
{0x00ABBF, 0x0013EF},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4915 |
{0x00FF41, 0x00FF21},
|
| 4916 |
{0x00FF42, 0x00FF22},
|
| 4917 |
{0x00FF43, 0x00FF23},
|
|
|
|
| 5014 |
{0x0104F9, 0x0104D1},
|
| 5015 |
{0x0104FA, 0x0104D2},
|
| 5016 |
{0x0104FB, 0x0104D3},
|
| 5017 |
+
{0x010597, 0x010570},
|
| 5018 |
+
{0x010598, 0x010571},
|
| 5019 |
+
{0x010599, 0x010572},
|
| 5020 |
+
{0x01059A, 0x010573},
|
| 5021 |
+
{0x01059B, 0x010574},
|
| 5022 |
+
{0x01059C, 0x010575},
|
| 5023 |
+
{0x01059D, 0x010576},
|
| 5024 |
+
{0x01059E, 0x010577},
|
| 5025 |
+
{0x01059F, 0x010578},
|
| 5026 |
+
{0x0105A0, 0x010579},
|
| 5027 |
+
{0x0105A1, 0x01057A},
|
| 5028 |
+
{0x0105A3, 0x01057C},
|
| 5029 |
+
{0x0105A4, 0x01057D},
|
| 5030 |
+
{0x0105A5, 0x01057E},
|
| 5031 |
+
{0x0105A6, 0x01057F},
|
| 5032 |
+
{0x0105A7, 0x010580},
|
| 5033 |
+
{0x0105A8, 0x010581},
|
| 5034 |
+
{0x0105A9, 0x010582},
|
| 5035 |
+
{0x0105AA, 0x010583},
|
| 5036 |
+
{0x0105AB, 0x010584},
|
| 5037 |
+
{0x0105AC, 0x010585},
|
| 5038 |
+
{0x0105AD, 0x010586},
|
| 5039 |
+
{0x0105AE, 0x010587},
|
| 5040 |
+
{0x0105AF, 0x010588},
|
| 5041 |
+
{0x0105B0, 0x010589},
|
| 5042 |
+
{0x0105B1, 0x01058A},
|
| 5043 |
+
{0x0105B3, 0x01058C},
|
| 5044 |
+
{0x0105B4, 0x01058D},
|
| 5045 |
+
{0x0105B5, 0x01058E},
|
| 5046 |
+
{0x0105B6, 0x01058F},
|
| 5047 |
+
{0x0105B7, 0x010590},
|
| 5048 |
+
{0x0105B8, 0x010591},
|
| 5049 |
+
{0x0105B9, 0x010592},
|
| 5050 |
+
{0x0105BB, 0x010594},
|
| 5051 |
+
{0x0105BC, 0x010595},
|
| 5052 |
{0x010CC0, 0x010C80},
|
| 5053 |
{0x010CC1, 0x010C81},
|
| 5054 |
{0x010CC2, 0x010C82},
|
examples/talk-llama/unicode.cpp
CHANGED
|
@@ -226,8 +226,9 @@ static std::vector<size_t> unicode_regex_split_custom_gpt2(const std::string & t
|
|
| 226 |
assert(offset_end <= cpts.size());
|
| 227 |
start = offset_end;
|
| 228 |
|
|
|
|
| 229 |
auto _get_cpt = [&] (const size_t pos) -> uint32_t {
|
| 230 |
-
return (offset_ini <= pos && pos < offset_end) ? cpts[pos] :
|
| 231 |
};
|
| 232 |
|
| 233 |
auto _get_flags = [&] (const size_t pos) -> codepoint_flags {
|
|
@@ -309,7 +310,7 @@ static std::vector<size_t> unicode_regex_split_custom_gpt2(const std::string & t
|
|
| 309 |
}
|
| 310 |
|
| 311 |
// regex: \s+(?!\S)
|
| 312 |
-
if (num_whitespaces > 1 && _get_cpt(pos+num_whitespaces) !=
|
| 313 |
pos += num_whitespaces - 1;
|
| 314 |
_add_token(pos);
|
| 315 |
continue;
|
|
@@ -344,8 +345,9 @@ static std::vector<size_t> unicode_regex_split_custom_llama3(const std::string &
|
|
| 344 |
assert(offset_end <= cpts.size());
|
| 345 |
start = offset_end;
|
| 346 |
|
|
|
|
| 347 |
auto _get_cpt = [&] (const size_t pos) -> uint32_t {
|
| 348 |
-
return (offset_ini <= pos && pos < offset_end) ? cpts[pos] :
|
| 349 |
};
|
| 350 |
|
| 351 |
auto _get_flags = [&] (const size_t pos) -> codepoint_flags {
|
|
@@ -450,7 +452,7 @@ static std::vector<size_t> unicode_regex_split_custom_llama3(const std::string &
|
|
| 450 |
}
|
| 451 |
|
| 452 |
// regex: \s+(?!\S)
|
| 453 |
-
if (num_whitespaces > 1 && _get_cpt(pos+num_whitespaces) !=
|
| 454 |
pos += num_whitespaces - 1;
|
| 455 |
_add_token(pos);
|
| 456 |
continue;
|
|
@@ -594,6 +596,7 @@ std::vector<uint32_t> unicode_cpts_normalize_nfd(const std::vector<uint32_t> & c
|
|
| 594 |
|
| 595 |
std::vector<uint32_t> unicode_cpts_from_utf8(const std::string & utf8) {
|
| 596 |
std::vector<uint32_t> result;
|
|
|
|
| 597 |
size_t offset = 0;
|
| 598 |
while (offset < utf8.size()) {
|
| 599 |
result.push_back(unicode_cpt_from_utf8(utf8, offset));
|
|
@@ -679,10 +682,14 @@ std::vector<std::string> unicode_regex_split(const std::string & text, const std
|
|
| 679 |
continue;
|
| 680 |
}
|
| 681 |
|
| 682 |
-
const
|
| 683 |
|
| 684 |
-
if (
|
| 685 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 686 |
} else {
|
| 687 |
text_collapsed[i] = (char) 0xD0; // fallback
|
| 688 |
}
|
|
@@ -766,9 +773,16 @@ std::vector<std::string> unicode_regex_split(const std::string & text, const std
|
|
| 766 |
bpe_offsets = unicode_regex_split_stl(text_collapsed, regex_expr_collapsed, bpe_offsets);
|
| 767 |
} else {
|
| 768 |
// no unicode category used, we can use std::wregex directly
|
| 769 |
-
const std::wstring wtext = unicode_wstring_from_utf8(text);
|
| 770 |
const std::wstring wregex_expr = unicode_wstring_from_utf8(regex_expr);
|
| 771 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 772 |
//printf("text: %s\n", text.c_str());
|
| 773 |
//printf("regex_expr: %s\n", regex_expr.c_str());
|
| 774 |
bpe_offsets = unicode_regex_split_stl(wtext, wregex_expr, bpe_offsets);
|
|
|
|
| 226 |
assert(offset_end <= cpts.size());
|
| 227 |
start = offset_end;
|
| 228 |
|
| 229 |
+
static const uint32_t OUT_OF_RANGE = 0xFFFFFFFF;
|
| 230 |
auto _get_cpt = [&] (const size_t pos) -> uint32_t {
|
| 231 |
+
return (offset_ini <= pos && pos < offset_end) ? cpts[pos] : OUT_OF_RANGE;
|
| 232 |
};
|
| 233 |
|
| 234 |
auto _get_flags = [&] (const size_t pos) -> codepoint_flags {
|
|
|
|
| 310 |
}
|
| 311 |
|
| 312 |
// regex: \s+(?!\S)
|
| 313 |
+
if (num_whitespaces > 1 && _get_cpt(pos+num_whitespaces) != OUT_OF_RANGE) {
|
| 314 |
pos += num_whitespaces - 1;
|
| 315 |
_add_token(pos);
|
| 316 |
continue;
|
|
|
|
| 345 |
assert(offset_end <= cpts.size());
|
| 346 |
start = offset_end;
|
| 347 |
|
| 348 |
+
static const uint32_t OUT_OF_RANGE = 0xFFFFFFFF;
|
| 349 |
auto _get_cpt = [&] (const size_t pos) -> uint32_t {
|
| 350 |
+
return (offset_ini <= pos && pos < offset_end) ? cpts[pos] : OUT_OF_RANGE;
|
| 351 |
};
|
| 352 |
|
| 353 |
auto _get_flags = [&] (const size_t pos) -> codepoint_flags {
|
|
|
|
| 452 |
}
|
| 453 |
|
| 454 |
// regex: \s+(?!\S)
|
| 455 |
+
if (num_whitespaces > 1 && _get_cpt(pos+num_whitespaces) != OUT_OF_RANGE) {
|
| 456 |
pos += num_whitespaces - 1;
|
| 457 |
_add_token(pos);
|
| 458 |
continue;
|
|
|
|
| 596 |
|
| 597 |
std::vector<uint32_t> unicode_cpts_from_utf8(const std::string & utf8) {
|
| 598 |
std::vector<uint32_t> result;
|
| 599 |
+
result.reserve(utf8.size());
|
| 600 |
size_t offset = 0;
|
| 601 |
while (offset < utf8.size()) {
|
| 602 |
result.push_back(unicode_cpt_from_utf8(utf8, offset));
|
|
|
|
| 682 |
continue;
|
| 683 |
}
|
| 684 |
|
| 685 |
+
const auto flags = unicode_cpt_flags(cpts[i]);
|
| 686 |
|
| 687 |
+
if (flags.is_whitespace) {
|
| 688 |
+
//NOTE: C++ std::regex \s does not mach 0x85, Rust and Python regex does.
|
| 689 |
+
//text_collapsed[i] = (char) 0x85; // <Next Line> as whitespace fallback
|
| 690 |
+
text_collapsed[i] = (char) 0x0B; // <vertical tab> as whitespace fallback
|
| 691 |
+
} else if (k_ucat_cpt.find(flags.category_flag()) != k_ucat_cpt.end()) {
|
| 692 |
+
text_collapsed[i] = k_ucat_cpt.at(flags.category_flag());
|
| 693 |
} else {
|
| 694 |
text_collapsed[i] = (char) 0xD0; // fallback
|
| 695 |
}
|
|
|
|
| 773 |
bpe_offsets = unicode_regex_split_stl(text_collapsed, regex_expr_collapsed, bpe_offsets);
|
| 774 |
} else {
|
| 775 |
// no unicode category used, we can use std::wregex directly
|
|
|
|
| 776 |
const std::wstring wregex_expr = unicode_wstring_from_utf8(regex_expr);
|
| 777 |
|
| 778 |
+
// std::wregex \s does not mach non-ASCII whitespaces, using 0x0B as fallback
|
| 779 |
+
std::wstring wtext(cpts.begin(), cpts.end());
|
| 780 |
+
for (size_t i = 0; i < wtext.size(); ++i) {
|
| 781 |
+
if (wtext[i] > 0x7F && unicode_cpt_flags(wtext[i]).is_whitespace) {
|
| 782 |
+
wtext[i] = 0x0B;
|
| 783 |
+
}
|
| 784 |
+
}
|
| 785 |
+
|
| 786 |
//printf("text: %s\n", text.c_str());
|
| 787 |
//printf("regex_expr: %s\n", regex_expr.c_str());
|
| 788 |
bpe_offsets = unicode_regex_split_stl(wtext, wregex_expr, bpe_offsets);
|
examples/talk/gpt-2.cpp
CHANGED
|
@@ -72,7 +72,7 @@ struct gpt2_model {
|
|
| 72 |
};
|
| 73 |
|
| 74 |
// load the model's weights from a file
|
| 75 |
-
bool gpt2_model_load(const std::string & fname, gpt2_model & model, gpt_vocab & vocab) {
|
| 76 |
printf("%s: loading model from '%s'\n", __func__, fname.c_str());
|
| 77 |
|
| 78 |
auto fin = std::ifstream(fname, std::ios::binary);
|
|
@@ -380,7 +380,7 @@ bool gpt2_model_load(const std::string & fname, gpt2_model & model, gpt_vocab &
|
|
| 380 |
// - embd_w: the predicted logits for the next token
|
| 381 |
//
|
| 382 |
// TODO: sync latest version from ggml repo
|
| 383 |
-
bool gpt2_eval(
|
| 384 |
const gpt2_model & model,
|
| 385 |
const int n_threads,
|
| 386 |
const int n_past,
|
|
|
|
| 72 |
};
|
| 73 |
|
| 74 |
// load the model's weights from a file
|
| 75 |
+
static bool gpt2_model_load(const std::string & fname, gpt2_model & model, gpt_vocab & vocab) {
|
| 76 |
printf("%s: loading model from '%s'\n", __func__, fname.c_str());
|
| 77 |
|
| 78 |
auto fin = std::ifstream(fname, std::ios::binary);
|
|
|
|
| 380 |
// - embd_w: the predicted logits for the next token
|
| 381 |
//
|
| 382 |
// TODO: sync latest version from ggml repo
|
| 383 |
+
static bool gpt2_eval(
|
| 384 |
const gpt2_model & model,
|
| 385 |
const int n_threads,
|
| 386 |
const int n_past,
|
examples/talk/talk.cpp
CHANGED
|
@@ -44,7 +44,7 @@ struct whisper_params {
|
|
| 44 |
|
| 45 |
void whisper_print_usage(int argc, char ** argv, const whisper_params & params);
|
| 46 |
|
| 47 |
-
bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
|
| 48 |
for (int i = 1; i < argc; i++) {
|
| 49 |
std::string arg = argv[i];
|
| 50 |
|
|
@@ -109,7 +109,7 @@ void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params & para
|
|
| 109 |
fprintf(stderr, "\n");
|
| 110 |
}
|
| 111 |
|
| 112 |
-
std::string transcribe(whisper_context * ctx, const whisper_params & params, const std::vector<float> & pcmf32, float & prob, int64_t & t_ms) {
|
| 113 |
const auto t_start = std::chrono::high_resolution_clock::now();
|
| 114 |
|
| 115 |
prob = 0.0f;
|
|
|
|
| 44 |
|
| 45 |
void whisper_print_usage(int argc, char ** argv, const whisper_params & params);
|
| 46 |
|
| 47 |
+
static bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
|
| 48 |
for (int i = 1; i < argc; i++) {
|
| 49 |
std::string arg = argv[i];
|
| 50 |
|
|
|
|
| 109 |
fprintf(stderr, "\n");
|
| 110 |
}
|
| 111 |
|
| 112 |
+
static std::string transcribe(whisper_context * ctx, const whisper_params & params, const std::vector<float> & pcmf32, float & prob, int64_t & t_ms) {
|
| 113 |
const auto t_start = std::chrono::high_resolution_clock::now();
|
| 114 |
|
| 115 |
prob = 0.0f;
|
examples/whisper.android.java/app/src/main/jni/whisper/CMakeLists.txt
CHANGED
|
@@ -5,15 +5,14 @@ project(whisper.cpp)
|
|
| 5 |
set(CMAKE_CXX_STANDARD 11)
|
| 6 |
set(WHISPER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../../../../../../)
|
| 7 |
|
| 8 |
-
set(
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
)
|
| 17 |
|
| 18 |
find_library(LOG_LIB log)
|
| 19 |
|
|
@@ -41,7 +40,6 @@ function(build_library target_name)
|
|
| 41 |
#target_link_options(${target_name} PRIVATE -Wl,--gc-sections)
|
| 42 |
#target_link_options(${target_name} PRIVATE -Wl,--exclude-libs,ALL)
|
| 43 |
#target_link_options(${target_name} PRIVATE -flto)
|
| 44 |
-
|
| 45 |
endif ()
|
| 46 |
endfunction()
|
| 47 |
|
|
@@ -54,3 +52,7 @@ elseif (${ANDROID_ABI} STREQUAL "armeabi-v7a")
|
|
| 54 |
endif ()
|
| 55 |
|
| 56 |
include_directories(${WHISPER_LIB_DIR})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
set(CMAKE_CXX_STANDARD 11)
|
| 6 |
set(WHISPER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../../../../../../)
|
| 7 |
|
| 8 |
+
set(SOURCE_FILES
|
| 9 |
+
${WHISPER_LIB_DIR}/ggml/src/ggml.c
|
| 10 |
+
${WHISPER_LIB_DIR}/ggml/src/ggml-alloc.c
|
| 11 |
+
${WHISPER_LIB_DIR}/ggml/src/ggml-backend.c
|
| 12 |
+
${WHISPER_LIB_DIR}/ggml/src/ggml-quants.c
|
| 13 |
+
${WHISPER_LIB_DIR}/src/whisper.cpp
|
| 14 |
+
${CMAKE_SOURCE_DIR}/jni.c
|
| 15 |
+
)
|
|
|
|
| 16 |
|
| 17 |
find_library(LOG_LIB log)
|
| 18 |
|
|
|
|
| 40 |
#target_link_options(${target_name} PRIVATE -Wl,--gc-sections)
|
| 41 |
#target_link_options(${target_name} PRIVATE -Wl,--exclude-libs,ALL)
|
| 42 |
#target_link_options(${target_name} PRIVATE -flto)
|
|
|
|
| 43 |
endif ()
|
| 44 |
endfunction()
|
| 45 |
|
|
|
|
| 52 |
endif ()
|
| 53 |
|
| 54 |
include_directories(${WHISPER_LIB_DIR})
|
| 55 |
+
include_directories(${WHISPER_LIB_DIR}/src)
|
| 56 |
+
include_directories(${WHISPER_LIB_DIR}/include)
|
| 57 |
+
include_directories(${WHISPER_LIB_DIR}/ggml/include)
|
| 58 |
+
include_directories(${WHISPER_LIB_DIR}/ggml/src)
|
examples/whisper.android/lib/src/main/jni/whisper/CMakeLists.txt
CHANGED
|
@@ -10,7 +10,7 @@ option(GGML_HOME "whisper: Path to external GGML source" OFF)
|
|
| 10 |
|
| 11 |
set(
|
| 12 |
SOURCE_FILES
|
| 13 |
-
${WHISPER_LIB_DIR}/whisper.cpp
|
| 14 |
${CMAKE_SOURCE_DIR}/jni.c
|
| 15 |
)
|
| 16 |
|
|
@@ -18,10 +18,10 @@ if (NOT GGML_HOME)
|
|
| 18 |
set(
|
| 19 |
SOURCE_FILES
|
| 20 |
${SOURCE_FILES}
|
| 21 |
-
${WHISPER_LIB_DIR}/ggml.c
|
| 22 |
-
${WHISPER_LIB_DIR}/ggml-alloc.c
|
| 23 |
-
${WHISPER_LIB_DIR}/ggml-backend.c
|
| 24 |
-
${WHISPER_LIB_DIR}/ggml-quants.c
|
| 25 |
)
|
| 26 |
endif()
|
| 27 |
|
|
@@ -75,3 +75,7 @@ endif ()
|
|
| 75 |
build_library("whisper") # Default target
|
| 76 |
|
| 77 |
include_directories(${WHISPER_LIB_DIR})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
set(
|
| 12 |
SOURCE_FILES
|
| 13 |
+
${WHISPER_LIB_DIR}/src/whisper.cpp
|
| 14 |
${CMAKE_SOURCE_DIR}/jni.c
|
| 15 |
)
|
| 16 |
|
|
|
|
| 18 |
set(
|
| 19 |
SOURCE_FILES
|
| 20 |
${SOURCE_FILES}
|
| 21 |
+
${WHISPER_LIB_DIR}/ggml/src/ggml.c
|
| 22 |
+
${WHISPER_LIB_DIR}/ggml/src/ggml-alloc.c
|
| 23 |
+
${WHISPER_LIB_DIR}/ggml/src/ggml-backend.c
|
| 24 |
+
${WHISPER_LIB_DIR}/ggml/src/ggml-quants.c
|
| 25 |
)
|
| 26 |
endif()
|
| 27 |
|
|
|
|
| 75 |
build_library("whisper") # Default target
|
| 76 |
|
| 77 |
include_directories(${WHISPER_LIB_DIR})
|
| 78 |
+
include_directories(${WHISPER_LIB_DIR}/src)
|
| 79 |
+
include_directories(${WHISPER_LIB_DIR}/include)
|
| 80 |
+
include_directories(${WHISPER_LIB_DIR}/ggml/include)
|
| 81 |
+
include_directories(${WHISPER_LIB_DIR}/ggml/src)
|
examples/whisper.objc/whisper.objc.xcodeproj/project.pbxproj
CHANGED
|
@@ -9,7 +9,6 @@
|
|
| 9 |
/* Begin PBXBuildFile section */
|
| 10 |
1844471A2AB211A2007D6BFE /* ggml-alloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 184447182AB211A2007D6BFE /* ggml-alloc.c */; };
|
| 11 |
1844471C2AB21655007D6BFE /* ggml-metal.m in Sources */ = {isa = PBXBuildFile; fileRef = 1844471B2AB21655007D6BFE /* ggml-metal.m */; settings = {COMPILER_FLAGS = "-framework Foundation -framework Metal -framework MetalKit -fno-objc-arc"; }; };
|
| 12 |
-
184447212AB21B43007D6BFE /* ggml-metal.metal in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1844471D2AB2195F007D6BFE /* ggml-metal.metal */; };
|
| 13 |
18627C7B29052BDF00BD2A04 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 18627C7A29052BDF00BD2A04 /* AppDelegate.m */; };
|
| 14 |
18627C7E29052BDF00BD2A04 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 18627C7D29052BDF00BD2A04 /* SceneDelegate.m */; };
|
| 15 |
18627C8129052BDF00BD2A04 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18627C8029052BDF00BD2A04 /* ViewController.m */; };
|
|
@@ -20,6 +19,8 @@
|
|
| 20 |
18627C9429052C4900BD2A04 /* whisper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18627C9329052C4900BD2A04 /* whisper.cpp */; settings = {COMPILER_FLAGS = "-DWHISPER_USE_COREML -DWHISPER_COREML_ALLOW_FALLBACK -DGGML_USE_METAL"; }; };
|
| 21 |
18627C9629052C5800BD2A04 /* ggml.c in Sources */ = {isa = PBXBuildFile; fileRef = 18627C9529052C5800BD2A04 /* ggml.c */; settings = {COMPILER_FLAGS = "-DGGML_USE_ACCELERATE -DGGML_USE_METAL"; }; };
|
| 22 |
18627C9B29052CFF00BD2A04 /* ggml-base.en.bin in Resources */ = {isa = PBXBuildFile; fileRef = 18627C9A29052CFF00BD2A04 /* ggml-base.en.bin */; };
|
|
|
|
|
|
|
| 23 |
18ABE15A2AF556340044A204 /* ggml-backend.c in Sources */ = {isa = PBXBuildFile; fileRef = 18ABE1572AF556340044A204 /* ggml-backend.c */; };
|
| 24 |
18ABE15B2AF556340044A204 /* ggml-quants.c in Sources */ = {isa = PBXBuildFile; fileRef = 18ABE1592AF556340044A204 /* ggml-quants.c */; };
|
| 25 |
7FE3424B2A0C3FA20015A058 /* whisper-encoder-impl.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FE342452A0C3FA20015A058 /* whisper-encoder-impl.m */; };
|
|
@@ -29,23 +30,24 @@
|
|
| 29 |
/* End PBXBuildFile section */
|
| 30 |
|
| 31 |
/* Begin PBXCopyFilesBuildPhase section */
|
| 32 |
-
184447202AB21B25007D6BFE /*
|
| 33 |
isa = PBXCopyFilesBuildPhase;
|
| 34 |
buildActionMask = 2147483647;
|
| 35 |
dstPath = "";
|
| 36 |
dstSubfolderSpec = 7;
|
| 37 |
files = (
|
| 38 |
-
|
| 39 |
);
|
|
|
|
| 40 |
runOnlyForDeploymentPostprocessing = 0;
|
| 41 |
};
|
| 42 |
/* End PBXCopyFilesBuildPhase section */
|
| 43 |
|
| 44 |
/* Begin PBXFileReference section */
|
| 45 |
-
184447182AB211A2007D6BFE /* ggml-alloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "ggml-alloc.c"; path = "../../../ggml-alloc.c"; sourceTree = "<group>"; };
|
| 46 |
-
184447192AB211A2007D6BFE /* ggml-alloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ggml-alloc.h"; path = "../../../ggml-alloc.h"; sourceTree = "<group>"; };
|
| 47 |
-
1844471B2AB21655007D6BFE /* ggml-metal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "ggml-metal.m"; path = "../../../ggml-metal.m"; sourceTree = "<group>"; };
|
| 48 |
-
1844471D2AB2195F007D6BFE /* ggml-metal.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; name = "ggml-metal.metal"; path = "../../../ggml-metal.metal"; sourceTree = "<group>"; };
|
| 49 |
18627C7629052BDF00BD2A04 /* whisper.objc.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = whisper.objc.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
| 50 |
18627C7929052BDF00BD2A04 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
| 51 |
18627C7A29052BDF00BD2A04 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
|
@@ -58,17 +60,19 @@
|
|
| 58 |
18627C8829052BE000BD2A04 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
| 59 |
18627C8A29052BE000BD2A04 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
| 60 |
18627C8B29052BE000BD2A04 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
| 61 |
-
18627C9229052C2B00BD2A04 /* whisper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = whisper.h; path = ../../../whisper.h; sourceTree = "<group>"; };
|
| 62 |
-
18627C9329052C4900BD2A04 /* whisper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = whisper.cpp; path = ../../../whisper.cpp; sourceTree = "<group>"; };
|
| 63 |
-
18627C9529052C5800BD2A04 /* ggml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ggml.c; path = ../../../ggml.c; sourceTree = "<group>"; };
|
| 64 |
-
18627C9729052C6600BD2A04 /* ggml.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ggml.h; path = ../../../ggml.h; sourceTree = "<group>"; };
|
| 65 |
18627C9A29052CFF00BD2A04 /* ggml-base.en.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = "ggml-base.en.bin"; path = "../../../models/ggml-base.en.bin"; sourceTree = "<group>"; };
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
|
|
|
|
|
|
| 72 |
7FE342452A0C3FA20015A058 /* whisper-encoder-impl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "whisper-encoder-impl.m"; sourceTree = "<group>"; };
|
| 73 |
7FE342462A0C3FA20015A058 /* whisper-encoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "whisper-encoder.h"; sourceTree = "<group>"; };
|
| 74 |
7FE342472A0C3FA20015A058 /* whisper-encoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "whisper-encoder.mm"; sourceTree = "<group>"; };
|
|
@@ -108,6 +112,8 @@
|
|
| 108 |
18627C7829052BDF00BD2A04 /* whisper.objc */ = {
|
| 109 |
isa = PBXGroup;
|
| 110 |
children = (
|
|
|
|
|
|
|
| 111 |
18ABE1562AF556340044A204 /* ggml-backend-impl.h */,
|
| 112 |
18ABE1572AF556340044A204 /* ggml-backend.c */,
|
| 113 |
18ABE1552AF556340044A204 /* ggml-backend.h */,
|
|
@@ -151,7 +157,7 @@
|
|
| 151 |
7FE3424A2A0C3FA20015A058 /* whisper-decoder-impl.m */,
|
| 152 |
);
|
| 153 |
name = coreml;
|
| 154 |
-
path = ../../../coreml;
|
| 155 |
sourceTree = "<group>";
|
| 156 |
};
|
| 157 |
/* End PBXGroup section */
|
|
@@ -164,7 +170,7 @@
|
|
| 164 |
18627C7229052BDF00BD2A04 /* Sources */,
|
| 165 |
18627C7329052BDF00BD2A04 /* Frameworks */,
|
| 166 |
18627C7429052BDF00BD2A04 /* Resources */,
|
| 167 |
-
184447202AB21B25007D6BFE /*
|
| 168 |
);
|
| 169 |
buildRules = (
|
| 170 |
);
|
|
@@ -182,7 +188,7 @@
|
|
| 182 |
isa = PBXProject;
|
| 183 |
attributes = {
|
| 184 |
BuildIndependentTargetsInParallel = 1;
|
| 185 |
-
LastUpgradeCheck =
|
| 186 |
TargetAttributes = {
|
| 187 |
18627C7529052BDF00BD2A04 = {
|
| 188 |
CreatedOnToolsVersion = 14.0.1;
|
|
@@ -212,6 +218,7 @@
|
|
| 212 |
isa = PBXResourcesBuildPhase;
|
| 213 |
buildActionMask = 2147483647;
|
| 214 |
files = (
|
|
|
|
| 215 |
18627C8929052BE000BD2A04 /* LaunchScreen.storyboard in Resources */,
|
| 216 |
7FE3424F2A0C418A0015A058 /* ggml-base.en-encoder.mlmodelc in Resources */,
|
| 217 |
18627C8629052BE000BD2A04 /* Assets.xcassets in Resources */,
|
|
@@ -301,6 +308,7 @@
|
|
| 301 |
DEBUG_INFORMATION_FORMAT = dwarf;
|
| 302 |
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
| 303 |
ENABLE_TESTABILITY = YES;
|
|
|
|
| 304 |
GCC_C_LANGUAGE_STANDARD = gnu11;
|
| 305 |
GCC_DYNAMIC_NO_PIC = NO;
|
| 306 |
GCC_NO_COMMON_BLOCKS = YES;
|
|
@@ -359,6 +367,7 @@
|
|
| 359 |
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
| 360 |
ENABLE_NS_ASSERTIONS = NO;
|
| 361 |
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
|
|
| 362 |
GCC_C_LANGUAGE_STANDARD = gnu11;
|
| 363 |
GCC_NO_COMMON_BLOCKS = YES;
|
| 364 |
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
@@ -400,6 +409,7 @@
|
|
| 400 |
"@executable_path/Frameworks",
|
| 401 |
);
|
| 402 |
MARKETING_VERSION = 1.0;
|
|
|
|
| 403 |
PRODUCT_BUNDLE_IDENTIFIER = "com.ggerganov.whisper-objc";
|
| 404 |
PRODUCT_NAME = "$(TARGET_NAME)";
|
| 405 |
SWIFT_EMIT_LOC_STRINGS = YES;
|
|
@@ -428,6 +438,7 @@
|
|
| 428 |
"@executable_path/Frameworks",
|
| 429 |
);
|
| 430 |
MARKETING_VERSION = 1.0;
|
|
|
|
| 431 |
PRODUCT_BUNDLE_IDENTIFIER = "com.ggerganov.whisper-objc";
|
| 432 |
PRODUCT_NAME = "$(TARGET_NAME)";
|
| 433 |
SWIFT_EMIT_LOC_STRINGS = YES;
|
|
|
|
| 9 |
/* Begin PBXBuildFile section */
|
| 10 |
1844471A2AB211A2007D6BFE /* ggml-alloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 184447182AB211A2007D6BFE /* ggml-alloc.c */; };
|
| 11 |
1844471C2AB21655007D6BFE /* ggml-metal.m in Sources */ = {isa = PBXBuildFile; fileRef = 1844471B2AB21655007D6BFE /* ggml-metal.m */; settings = {COMPILER_FLAGS = "-framework Foundation -framework Metal -framework MetalKit -fno-objc-arc"; }; };
|
|
|
|
| 12 |
18627C7B29052BDF00BD2A04 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 18627C7A29052BDF00BD2A04 /* AppDelegate.m */; };
|
| 13 |
18627C7E29052BDF00BD2A04 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 18627C7D29052BDF00BD2A04 /* SceneDelegate.m */; };
|
| 14 |
18627C8129052BDF00BD2A04 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18627C8029052BDF00BD2A04 /* ViewController.m */; };
|
|
|
|
| 19 |
18627C9429052C4900BD2A04 /* whisper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18627C9329052C4900BD2A04 /* whisper.cpp */; settings = {COMPILER_FLAGS = "-DWHISPER_USE_COREML -DWHISPER_COREML_ALLOW_FALLBACK -DGGML_USE_METAL"; }; };
|
| 20 |
18627C9629052C5800BD2A04 /* ggml.c in Sources */ = {isa = PBXBuildFile; fileRef = 18627C9529052C5800BD2A04 /* ggml.c */; settings = {COMPILER_FLAGS = "-DGGML_USE_ACCELERATE -DGGML_USE_METAL"; }; };
|
| 21 |
18627C9B29052CFF00BD2A04 /* ggml-base.en.bin in Resources */ = {isa = PBXBuildFile; fileRef = 18627C9A29052CFF00BD2A04 /* ggml-base.en.bin */; };
|
| 22 |
+
18A276062C2A98A5001C8D37 /* ggml-metal.metal in Copy Files */ = {isa = PBXBuildFile; fileRef = 1844471D2AB2195F007D6BFE /* ggml-metal.metal */; };
|
| 23 |
+
18A2760B2C2A9B43001C8D37 /* ggml-metal.metal in Resources */ = {isa = PBXBuildFile; fileRef = 1844471D2AB2195F007D6BFE /* ggml-metal.metal */; };
|
| 24 |
18ABE15A2AF556340044A204 /* ggml-backend.c in Sources */ = {isa = PBXBuildFile; fileRef = 18ABE1572AF556340044A204 /* ggml-backend.c */; };
|
| 25 |
18ABE15B2AF556340044A204 /* ggml-quants.c in Sources */ = {isa = PBXBuildFile; fileRef = 18ABE1592AF556340044A204 /* ggml-quants.c */; };
|
| 26 |
7FE3424B2A0C3FA20015A058 /* whisper-encoder-impl.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FE342452A0C3FA20015A058 /* whisper-encoder-impl.m */; };
|
|
|
|
| 30 |
/* End PBXBuildFile section */
|
| 31 |
|
| 32 |
/* Begin PBXCopyFilesBuildPhase section */
|
| 33 |
+
184447202AB21B25007D6BFE /* Copy Files */ = {
|
| 34 |
isa = PBXCopyFilesBuildPhase;
|
| 35 |
buildActionMask = 2147483647;
|
| 36 |
dstPath = "";
|
| 37 |
dstSubfolderSpec = 7;
|
| 38 |
files = (
|
| 39 |
+
18A276062C2A98A5001C8D37 /* ggml-metal.metal in Copy Files */,
|
| 40 |
);
|
| 41 |
+
name = "Copy Files";
|
| 42 |
runOnlyForDeploymentPostprocessing = 0;
|
| 43 |
};
|
| 44 |
/* End PBXCopyFilesBuildPhase section */
|
| 45 |
|
| 46 |
/* Begin PBXFileReference section */
|
| 47 |
+
184447182AB211A2007D6BFE /* ggml-alloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "ggml-alloc.c"; path = "../../../ggml/src/ggml-alloc.c"; sourceTree = "<group>"; };
|
| 48 |
+
184447192AB211A2007D6BFE /* ggml-alloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ggml-alloc.h"; path = "../../../ggml/include/ggml-alloc.h"; sourceTree = "<group>"; };
|
| 49 |
+
1844471B2AB21655007D6BFE /* ggml-metal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "ggml-metal.m"; path = "../../../ggml/src/ggml-metal.m"; sourceTree = "<group>"; };
|
| 50 |
+
1844471D2AB2195F007D6BFE /* ggml-metal.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; name = "ggml-metal.metal"; path = "../../../ggml/src/ggml-metal.metal"; sourceTree = "<group>"; };
|
| 51 |
18627C7629052BDF00BD2A04 /* whisper.objc.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = whisper.objc.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
| 52 |
18627C7929052BDF00BD2A04 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
| 53 |
18627C7A29052BDF00BD2A04 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
|
|
|
| 60 |
18627C8829052BE000BD2A04 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
| 61 |
18627C8A29052BE000BD2A04 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
| 62 |
18627C8B29052BE000BD2A04 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
| 63 |
+
18627C9229052C2B00BD2A04 /* whisper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = whisper.h; path = ../../../include/whisper.h; sourceTree = "<group>"; };
|
| 64 |
+
18627C9329052C4900BD2A04 /* whisper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = whisper.cpp; path = ../../../src/whisper.cpp; sourceTree = "<group>"; };
|
| 65 |
+
18627C9529052C5800BD2A04 /* ggml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ggml.c; path = ../../../ggml/src/ggml.c; sourceTree = "<group>"; };
|
| 66 |
+
18627C9729052C6600BD2A04 /* ggml.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ggml.h; path = ../../../ggml/include/ggml.h; sourceTree = "<group>"; };
|
| 67 |
18627C9A29052CFF00BD2A04 /* ggml-base.en.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = "ggml-base.en.bin"; path = "../../../models/ggml-base.en.bin"; sourceTree = "<group>"; };
|
| 68 |
+
18A275FE2C2A94DE001C8D37 /* ggml-metal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ggml-metal.h"; path = "../../../ggml/include/ggml-metal.h"; sourceTree = "<group>"; };
|
| 69 |
+
18A275FF2C2A9563001C8D37 /* ggml-common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ggml-common.h"; path = "../../../ggml/src/ggml-common.h"; sourceTree = "<group>"; };
|
| 70 |
+
18ABE1542AF556340044A204 /* ggml-quants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ggml-quants.h"; path = "../../../ggml/src/ggml-quants.h"; sourceTree = "<group>"; };
|
| 71 |
+
18ABE1552AF556340044A204 /* ggml-backend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ggml-backend.h"; path = "../../../ggml/include/ggml-backend.h"; sourceTree = "<group>"; };
|
| 72 |
+
18ABE1562AF556340044A204 /* ggml-backend-impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ggml-backend-impl.h"; path = "../../../ggml/src/ggml-backend-impl.h"; sourceTree = "<group>"; };
|
| 73 |
+
18ABE1572AF556340044A204 /* ggml-backend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "ggml-backend.c"; path = "../../../ggml/src/ggml-backend.c"; sourceTree = "<group>"; };
|
| 74 |
+
18ABE1582AF556340044A204 /* ggml-impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ggml-impl.h"; path = "../../../ggml/src/ggml-impl.h"; sourceTree = "<group>"; };
|
| 75 |
+
18ABE1592AF556340044A204 /* ggml-quants.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "ggml-quants.c"; path = "../../../ggml/src/ggml-quants.c"; sourceTree = "<group>"; };
|
| 76 |
7FE342452A0C3FA20015A058 /* whisper-encoder-impl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "whisper-encoder-impl.m"; sourceTree = "<group>"; };
|
| 77 |
7FE342462A0C3FA20015A058 /* whisper-encoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "whisper-encoder.h"; sourceTree = "<group>"; };
|
| 78 |
7FE342472A0C3FA20015A058 /* whisper-encoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "whisper-encoder.mm"; sourceTree = "<group>"; };
|
|
|
|
| 112 |
18627C7829052BDF00BD2A04 /* whisper.objc */ = {
|
| 113 |
isa = PBXGroup;
|
| 114 |
children = (
|
| 115 |
+
18A275FF2C2A9563001C8D37 /* ggml-common.h */,
|
| 116 |
+
18A275FE2C2A94DE001C8D37 /* ggml-metal.h */,
|
| 117 |
18ABE1562AF556340044A204 /* ggml-backend-impl.h */,
|
| 118 |
18ABE1572AF556340044A204 /* ggml-backend.c */,
|
| 119 |
18ABE1552AF556340044A204 /* ggml-backend.h */,
|
|
|
|
| 157 |
7FE3424A2A0C3FA20015A058 /* whisper-decoder-impl.m */,
|
| 158 |
);
|
| 159 |
name = coreml;
|
| 160 |
+
path = ../../../src/coreml;
|
| 161 |
sourceTree = "<group>";
|
| 162 |
};
|
| 163 |
/* End PBXGroup section */
|
|
|
|
| 170 |
18627C7229052BDF00BD2A04 /* Sources */,
|
| 171 |
18627C7329052BDF00BD2A04 /* Frameworks */,
|
| 172 |
18627C7429052BDF00BD2A04 /* Resources */,
|
| 173 |
+
184447202AB21B25007D6BFE /* Copy Files */,
|
| 174 |
);
|
| 175 |
buildRules = (
|
| 176 |
);
|
|
|
|
| 188 |
isa = PBXProject;
|
| 189 |
attributes = {
|
| 190 |
BuildIndependentTargetsInParallel = 1;
|
| 191 |
+
LastUpgradeCheck = 1540;
|
| 192 |
TargetAttributes = {
|
| 193 |
18627C7529052BDF00BD2A04 = {
|
| 194 |
CreatedOnToolsVersion = 14.0.1;
|
|
|
|
| 218 |
isa = PBXResourcesBuildPhase;
|
| 219 |
buildActionMask = 2147483647;
|
| 220 |
files = (
|
| 221 |
+
18A2760B2C2A9B43001C8D37 /* ggml-metal.metal in Resources */,
|
| 222 |
18627C8929052BE000BD2A04 /* LaunchScreen.storyboard in Resources */,
|
| 223 |
7FE3424F2A0C418A0015A058 /* ggml-base.en-encoder.mlmodelc in Resources */,
|
| 224 |
18627C8629052BE000BD2A04 /* Assets.xcassets in Resources */,
|
|
|
|
| 308 |
DEBUG_INFORMATION_FORMAT = dwarf;
|
| 309 |
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
| 310 |
ENABLE_TESTABILITY = YES;
|
| 311 |
+
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
| 312 |
GCC_C_LANGUAGE_STANDARD = gnu11;
|
| 313 |
GCC_DYNAMIC_NO_PIC = NO;
|
| 314 |
GCC_NO_COMMON_BLOCKS = YES;
|
|
|
|
| 367 |
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
| 368 |
ENABLE_NS_ASSERTIONS = NO;
|
| 369 |
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
| 370 |
+
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
| 371 |
GCC_C_LANGUAGE_STANDARD = gnu11;
|
| 372 |
GCC_NO_COMMON_BLOCKS = YES;
|
| 373 |
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
|
|
| 409 |
"@executable_path/Frameworks",
|
| 410 |
);
|
| 411 |
MARKETING_VERSION = 1.0;
|
| 412 |
+
MTL_HEADER_SEARCH_PATHS = "";
|
| 413 |
PRODUCT_BUNDLE_IDENTIFIER = "com.ggerganov.whisper-objc";
|
| 414 |
PRODUCT_NAME = "$(TARGET_NAME)";
|
| 415 |
SWIFT_EMIT_LOC_STRINGS = YES;
|
|
|
|
| 438 |
"@executable_path/Frameworks",
|
| 439 |
);
|
| 440 |
MARKETING_VERSION = 1.0;
|
| 441 |
+
MTL_HEADER_SEARCH_PATHS = "";
|
| 442 |
PRODUCT_BUNDLE_IDENTIFIER = "com.ggerganov.whisper-objc";
|
| 443 |
PRODUCT_NAME = "$(TARGET_NAME)";
|
| 444 |
SWIFT_EMIT_LOC_STRINGS = YES;
|
examples/whisper.swiftui/whisper.swiftui.demo/Models/WhisperState.swift
CHANGED
|
@@ -15,7 +15,7 @@ class WhisperState: NSObject, ObservableObject, AVAudioRecorderDelegate {
|
|
| 15 |
private var audioPlayer: AVAudioPlayer?
|
| 16 |
|
| 17 |
private var modelUrl: URL? {
|
| 18 |
-
Bundle.main.url(forResource: "ggml-
|
| 19 |
}
|
| 20 |
|
| 21 |
private var sampleUrl: URL? {
|
|
|
|
| 15 |
private var audioPlayer: AVAudioPlayer?
|
| 16 |
|
| 17 |
private var modelUrl: URL? {
|
| 18 |
+
Bundle.main.url(forResource: "ggml-base.en", withExtension: "bin", subdirectory: "models")
|
| 19 |
}
|
| 20 |
|
| 21 |
private var sampleUrl: URL? {
|
ggml/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
src/ggml-metal-embed.metal
|
ggml/CMakeLists.txt
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cmake_minimum_required(VERSION 3.14) # for add_link_options and implicit target directories.
|
| 2 |
+
project("ggml" C CXX)
|
| 3 |
+
include(CheckIncludeFileCXX)
|
| 4 |
+
|
| 5 |
+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
| 6 |
+
|
| 7 |
+
if (NOT XCODE AND NOT MSVC AND NOT CMAKE_BUILD_TYPE)
|
| 8 |
+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
|
| 9 |
+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
| 10 |
+
endif()
|
| 11 |
+
|
| 12 |
+
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
| 13 |
+
set(GGML_STANDALONE ON)
|
| 14 |
+
|
| 15 |
+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
| 16 |
+
|
| 17 |
+
# configure project version
|
| 18 |
+
# TODO
|
| 19 |
+
else()
|
| 20 |
+
set(GGML_STANDALONE OFF)
|
| 21 |
+
endif()
|
| 22 |
+
|
| 23 |
+
if (EMSCRIPTEN)
|
| 24 |
+
set(BUILD_SHARED_LIBS_DEFAULT OFF)
|
| 25 |
+
|
| 26 |
+
option(GGML_WASM_SINGLE_FILE "ggml: embed WASM inside the generated ggml.js" ON)
|
| 27 |
+
else()
|
| 28 |
+
if (MINGW)
|
| 29 |
+
set(BUILD_SHARED_LIBS_DEFAULT OFF)
|
| 30 |
+
else()
|
| 31 |
+
set(BUILD_SHARED_LIBS_DEFAULT ON)
|
| 32 |
+
endif()
|
| 33 |
+
endif()
|
| 34 |
+
|
| 35 |
+
option(BUILD_SHARED_LIBS "ggml: build shared libraries" ${BUILD_SHARED_LIBS_DEFAULT})
|
| 36 |
+
|
| 37 |
+
#
|
| 38 |
+
# option list
|
| 39 |
+
#
|
| 40 |
+
|
| 41 |
+
# TODO: mark all options as advanced when not GGML_STANDALONE
|
| 42 |
+
|
| 43 |
+
if (APPLE)
|
| 44 |
+
set(GGML_METAL_DEFAULT ON)
|
| 45 |
+
set(GGML_BLAS_DEFAULT ON)
|
| 46 |
+
set(GGML_BLAS_VENDOR_DEFAULT "Apple")
|
| 47 |
+
else()
|
| 48 |
+
set(GGML_METAL_DEFAULT OFF)
|
| 49 |
+
set(GGML_BLAS_DEFAULT OFF)
|
| 50 |
+
set(GGML_BLAS_VENDOR_DEFAULT "Generic")
|
| 51 |
+
endif()
|
| 52 |
+
|
| 53 |
+
# general
|
| 54 |
+
option(GGML_STATIC "ggml: static link libraries" OFF)
|
| 55 |
+
option(GGML_NATIVE "ggml: enable -march=native flag" ON)
|
| 56 |
+
option(GGML_LTO "ggml: enable link time optimization" OFF)
|
| 57 |
+
option(GGML_CCACHE "ggml: use ccache if available" ON)
|
| 58 |
+
|
| 59 |
+
# debug
|
| 60 |
+
option(GGML_ALL_WARNINGS "ggml: enable all compiler warnings" ON)
|
| 61 |
+
option(GGML_ALL_WARNINGS_3RD_PARTY "ggml: enable all compiler warnings in 3rd party libs" OFF)
|
| 62 |
+
option(GGML_GPROF "ggml: enable gprof" OFF)
|
| 63 |
+
|
| 64 |
+
# build
|
| 65 |
+
option(GGML_FATAL_WARNINGS "ggml: enable -Werror flag" OFF)
|
| 66 |
+
|
| 67 |
+
# sanitizers
|
| 68 |
+
option(GGML_SANITIZE_THREAD "ggml: enable thread sanitizer" OFF)
|
| 69 |
+
option(GGML_SANITIZE_ADDRESS "ggml: enable address sanitizer" OFF)
|
| 70 |
+
option(GGML_SANITIZE_UNDEFINED "ggml: enable undefined sanitizer" OFF)
|
| 71 |
+
|
| 72 |
+
# instruction set specific
|
| 73 |
+
if (GGML_NATIVE)
|
| 74 |
+
set(INS_ENB OFF)
|
| 75 |
+
else()
|
| 76 |
+
set(INS_ENB ON)
|
| 77 |
+
endif()
|
| 78 |
+
|
| 79 |
+
option(GGML_CPU_HBM "ggml: use memkind for CPU HBM" OFF)
|
| 80 |
+
|
| 81 |
+
option(GGML_AVX "ggml: enable AVX" ${INS_ENB})
|
| 82 |
+
option(GGML_AVX2 "ggml: enable AVX2" ${INS_ENB})
|
| 83 |
+
option(GGML_AVX512 "ggml: enable AVX512" OFF)
|
| 84 |
+
option(GGML_AVX512_VBMI "ggml: enable AVX512-VBMI" OFF)
|
| 85 |
+
option(GGML_AVX512_VNNI "ggml: enable AVX512-VNNI" OFF)
|
| 86 |
+
option(GGML_AVX512_BF16 "ggml: enable AVX512-BF16" OFF)
|
| 87 |
+
option(GGML_FMA "ggml: enable FMA" ${INS_ENB})
|
| 88 |
+
if (NOT MSVC)
|
| 89 |
+
option(GGML_F16C "ggml: enable F16C" ${INS_ENB}) # in MSVC F16C is implied with AVX2/AVX512
|
| 90 |
+
endif()
|
| 91 |
+
option(GGML_LASX "ggml: enable lasx" ON)
|
| 92 |
+
option(GGML_LSX "ggml: enable lsx" ON)
|
| 93 |
+
option(GGML_SVE "ggml: enable SVE" OFF)
|
| 94 |
+
|
| 95 |
+
if (WIN32)
|
| 96 |
+
set(GGML_WIN_VER "0x602" CACHE STRING "ggml: Windows Version")
|
| 97 |
+
endif()
|
| 98 |
+
|
| 99 |
+
# ggml core
|
| 100 |
+
set(GGML_SCHED_MAX_COPIES "4" CACHE STRING "ggml: max input copies for pipeline parallelism")
|
| 101 |
+
|
| 102 |
+
# 3rd party libs / backends
|
| 103 |
+
option(GGML_ACCELERATE "ggml: enable Accelerate framework" ON)
|
| 104 |
+
option(GGML_BLAS "ggml: use BLAS" ${GGML_BLAS_DEFAULT})
|
| 105 |
+
set(GGML_BLAS_VENDOR ${GGML_BLAS_VENDOR_DEFAULT} CACHE STRING
|
| 106 |
+
"ggml: BLAS library vendor")
|
| 107 |
+
option(GGML_LLAMAFILE "ggml: use ggml SGEMM" OFF)
|
| 108 |
+
|
| 109 |
+
option(GGML_CUDA "ggml: use CUDA" OFF)
|
| 110 |
+
option(GGML_CUDA_FORCE_DMMV "ggml: use dmmv instead of mmvq CUDA kernels" OFF)
|
| 111 |
+
option(GGML_CUDA_FORCE_MMQ "ggml: use mmq kernels instead of cuBLAS" OFF)
|
| 112 |
+
set (GGML_CUDA_DMMV_X "32" CACHE STRING "ggml: x stride for dmmv CUDA kernels")
|
| 113 |
+
set (GGML_CUDA_MMV_Y "1" CACHE STRING "ggml: y block size for mmv CUDA kernels")
|
| 114 |
+
option(GGML_CUDA_F16 "ggml: use 16 bit floats for some calculations" OFF)
|
| 115 |
+
set (GGML_CUDA_KQUANTS_ITER "2" CACHE STRING
|
| 116 |
+
"ggml: iters./thread per block for Q2_K/Q6_K")
|
| 117 |
+
set (GGML_CUDA_PEER_MAX_BATCH_SIZE "128" CACHE STRING
|
| 118 |
+
"ggml: max. batch size for using peer access")
|
| 119 |
+
option(GGML_CUDA_NO_PEER_COPY "ggml: do not use peer to peer copies" OFF)
|
| 120 |
+
option(GGML_CUDA_NO_VMM "ggml: do not try to use CUDA VMM" OFF)
|
| 121 |
+
option(GGML_CUDA_FA_ALL_QUANTS "ggml: compile all quants for FlashAttention" OFF)
|
| 122 |
+
|
| 123 |
+
option(GGML_CURL "ggml: use libcurl to download model from an URL" OFF)
|
| 124 |
+
option(GGML_HIPBLAS "ggml: use hipBLAS" OFF)
|
| 125 |
+
option(GGML_HIP_UMA "ggml: use HIP unified memory architecture" OFF)
|
| 126 |
+
option(GGML_VULKAN "ggml: use Vulkan" OFF)
|
| 127 |
+
option(GGML_VULKAN_CHECK_RESULTS "ggml: run Vulkan op checks" OFF)
|
| 128 |
+
option(GGML_VULKAN_DEBUG "ggml: enable Vulkan debug output" OFF)
|
| 129 |
+
option(GGML_VULKAN_MEMORY_DEBUG "ggml: enable Vulkan memory debug output" OFF)
|
| 130 |
+
option(GGML_VULKAN_VALIDATE "ggml: enable Vulkan validation" OFF)
|
| 131 |
+
option(GGML_VULKAN_RUN_TESTS "ggml: run Vulkan tests" OFF)
|
| 132 |
+
option(GGML_KOMPUTE "ggml: use Kompute" OFF)
|
| 133 |
+
option(GGML_METAL "ggml: use Metal" ${GGML_METAL_DEFAULT})
|
| 134 |
+
option(GGML_METAL_NDEBUG "ggml: disable Metal debugging" OFF)
|
| 135 |
+
option(GGML_METAL_SHADER_DEBUG "ggml: compile Metal with -fno-fast-math" OFF)
|
| 136 |
+
option(GGML_METAL_EMBED_LIBRARY "ggml: embed Metal library" ${GGML_METAL})
|
| 137 |
+
set (GGML_METAL_MACOSX_VERSION_MIN "" CACHE STRING
|
| 138 |
+
"ggml: metal minimum macOS version")
|
| 139 |
+
set (GGML_METAL_STD "" CACHE STRING "ggml: metal standard version (-std flag)")
|
| 140 |
+
option(GGML_OPENMP "ggml: use OpenMP" ON)
|
| 141 |
+
option(GGML_RPC "ggml: use RPC" OFF)
|
| 142 |
+
option(GGML_SYCL "ggml: use SYCL" OFF)
|
| 143 |
+
option(GGML_SYCL_F16 "ggml: use 16 bit floats for sycl calculations" OFF)
|
| 144 |
+
set (GGML_SYCL_TARGET "INTEL" CACHE STRING
|
| 145 |
+
"ggml: sycl target device")
|
| 146 |
+
|
| 147 |
+
# extra artifacts
|
| 148 |
+
option(GGML_BUILD_TESTS "ggml: build tests" ${GGML_STANDALONE})
|
| 149 |
+
option(GGML_BUILD_EXAMPLES "ggml: build examples" ${GGML_STANDALONE})
|
| 150 |
+
|
| 151 |
+
#
|
| 152 |
+
# dependencies
|
| 153 |
+
#
|
| 154 |
+
|
| 155 |
+
set(CMAKE_C_STANDARD 11)
|
| 156 |
+
set(CMAKE_C_STANDARD_REQUIRED true)
|
| 157 |
+
|
| 158 |
+
if (GGML_SYCL)
|
| 159 |
+
set(CMAKE_CXX_STANDARD 17)
|
| 160 |
+
else()
|
| 161 |
+
set(CMAKE_CXX_STANDARD 11)
|
| 162 |
+
endif()
|
| 163 |
+
set(CMAKE_CXX_STANDARD_REQUIRED true)
|
| 164 |
+
|
| 165 |
+
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
| 166 |
+
|
| 167 |
+
find_package(Threads REQUIRED)
|
| 168 |
+
|
| 169 |
+
#
|
| 170 |
+
# build the library
|
| 171 |
+
#
|
| 172 |
+
|
| 173 |
+
add_subdirectory(src)
|
| 174 |
+
|
| 175 |
+
#
|
| 176 |
+
# tests and examples
|
| 177 |
+
#
|
| 178 |
+
|
| 179 |
+
if (GGML_BUILD_TESTS)
|
| 180 |
+
enable_testing()
|
| 181 |
+
add_subdirectory(tests)
|
| 182 |
+
endif ()
|
| 183 |
+
|
| 184 |
+
if (GGML_BUILD_EXAMPLES)
|
| 185 |
+
add_subdirectory(examples)
|
| 186 |
+
endif ()
|
| 187 |
+
|
| 188 |
+
#
|
| 189 |
+
# install
|
| 190 |
+
#
|
| 191 |
+
|
| 192 |
+
include(GNUInstallDirs)
|
| 193 |
+
include(CMakePackageConfigHelpers)
|
| 194 |
+
|
| 195 |
+
set(GGML_PUBLIC_HEADERS
|
| 196 |
+
include/ggml.h
|
| 197 |
+
include/ggml-alloc.h
|
| 198 |
+
include/ggml-backend.h
|
| 199 |
+
"${GGML_HEADERS_CUDA}"
|
| 200 |
+
"${GGML_HEADERS_METAL}"
|
| 201 |
+
"${GGML_HEADERS_EXTRA}")
|
| 202 |
+
|
| 203 |
+
set_target_properties(ggml PROPERTIES PUBLIC_HEADER "${GGML_PUBLIC_HEADERS}")
|
| 204 |
+
#if (GGML_METAL)
|
| 205 |
+
# set_target_properties(ggml PROPERTIES RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/src/ggml-metal.metal")
|
| 206 |
+
#endif()
|
| 207 |
+
install(TARGETS ggml PUBLIC_HEADER)
|
| 208 |
+
|
| 209 |
+
if (BUILD_SHARED_LIBS)
|
| 210 |
+
install(TARGETS ggml LIBRARY)
|
| 211 |
+
endif()
|
| 212 |
+
|
| 213 |
+
if (GGML_METAL)
|
| 214 |
+
install(
|
| 215 |
+
FILES src/ggml-metal.metal
|
| 216 |
+
PERMISSIONS
|
| 217 |
+
OWNER_READ
|
| 218 |
+
OWNER_WRITE
|
| 219 |
+
GROUP_READ
|
| 220 |
+
WORLD_READ
|
| 221 |
+
DESTINATION ${CMAKE_INSTALL_BINDIR})
|
| 222 |
+
|
| 223 |
+
if (NOT GGML_METAL_EMBED_LIBRARY)
|
| 224 |
+
install(
|
| 225 |
+
FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/default.metallib
|
| 226 |
+
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
| 227 |
+
)
|
| 228 |
+
endif()
|
| 229 |
+
endif()
|
| 230 |
+
|
| 231 |
+
if (GGML_STANDALONE)
|
| 232 |
+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ggml.pc.in
|
| 233 |
+
${CMAKE_CURRENT_BINARY_DIR}/ggml.pc
|
| 234 |
+
@ONLY)
|
| 235 |
+
|
| 236 |
+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ggml.pc
|
| 237 |
+
DESTINATION share/pkgconfig)
|
| 238 |
+
endif()
|
ggml/cmake/FindSIMD.cmake
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
include(CheckCSourceRuns)
|
| 2 |
+
|
| 3 |
+
set(AVX_CODE "
|
| 4 |
+
#include <immintrin.h>
|
| 5 |
+
int main()
|
| 6 |
+
{
|
| 7 |
+
__m256 a;
|
| 8 |
+
a = _mm256_set1_ps(0);
|
| 9 |
+
return 0;
|
| 10 |
+
}
|
| 11 |
+
")
|
| 12 |
+
|
| 13 |
+
set(AVX512_CODE "
|
| 14 |
+
#include <immintrin.h>
|
| 15 |
+
int main()
|
| 16 |
+
{
|
| 17 |
+
__m512i a = _mm512_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
|
| 18 |
+
0, 0, 0, 0, 0, 0, 0, 0,
|
| 19 |
+
0, 0, 0, 0, 0, 0, 0, 0,
|
| 20 |
+
0, 0, 0, 0, 0, 0, 0, 0,
|
| 21 |
+
0, 0, 0, 0, 0, 0, 0, 0,
|
| 22 |
+
0, 0, 0, 0, 0, 0, 0, 0,
|
| 23 |
+
0, 0, 0, 0, 0, 0, 0, 0,
|
| 24 |
+
0, 0, 0, 0, 0, 0, 0, 0);
|
| 25 |
+
__m512i b = a;
|
| 26 |
+
__mmask64 equality_mask = _mm512_cmp_epi8_mask(a, b, _MM_CMPINT_EQ);
|
| 27 |
+
return 0;
|
| 28 |
+
}
|
| 29 |
+
")
|
| 30 |
+
|
| 31 |
+
set(AVX2_CODE "
|
| 32 |
+
#include <immintrin.h>
|
| 33 |
+
int main()
|
| 34 |
+
{
|
| 35 |
+
__m256i a = {0};
|
| 36 |
+
a = _mm256_abs_epi16(a);
|
| 37 |
+
__m256i x;
|
| 38 |
+
_mm256_extract_epi64(x, 0); // we rely on this in our AVX2 code
|
| 39 |
+
return 0;
|
| 40 |
+
}
|
| 41 |
+
")
|
| 42 |
+
|
| 43 |
+
set(FMA_CODE "
|
| 44 |
+
#include <immintrin.h>
|
| 45 |
+
int main()
|
| 46 |
+
{
|
| 47 |
+
__m256 acc = _mm256_setzero_ps();
|
| 48 |
+
const __m256 d = _mm256_setzero_ps();
|
| 49 |
+
const __m256 p = _mm256_setzero_ps();
|
| 50 |
+
acc = _mm256_fmadd_ps( d, p, acc );
|
| 51 |
+
return 0;
|
| 52 |
+
}
|
| 53 |
+
")
|
| 54 |
+
|
| 55 |
+
macro(check_sse type flags)
|
| 56 |
+
set(__FLAG_I 1)
|
| 57 |
+
set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
|
| 58 |
+
foreach (__FLAG ${flags})
|
| 59 |
+
if (NOT ${type}_FOUND)
|
| 60 |
+
set(CMAKE_REQUIRED_FLAGS ${__FLAG})
|
| 61 |
+
check_c_source_runs("${${type}_CODE}" HAS_${type}_${__FLAG_I})
|
| 62 |
+
if (HAS_${type}_${__FLAG_I})
|
| 63 |
+
set(${type}_FOUND TRUE CACHE BOOL "${type} support")
|
| 64 |
+
set(${type}_FLAGS "${__FLAG}" CACHE STRING "${type} flags")
|
| 65 |
+
endif()
|
| 66 |
+
math(EXPR __FLAG_I "${__FLAG_I}+1")
|
| 67 |
+
endif()
|
| 68 |
+
endforeach()
|
| 69 |
+
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
|
| 70 |
+
|
| 71 |
+
if (NOT ${type}_FOUND)
|
| 72 |
+
set(${type}_FOUND FALSE CACHE BOOL "${type} support")
|
| 73 |
+
set(${type}_FLAGS "" CACHE STRING "${type} flags")
|
| 74 |
+
endif()
|
| 75 |
+
|
| 76 |
+
mark_as_advanced(${type}_FOUND ${type}_FLAGS)
|
| 77 |
+
endmacro()
|
| 78 |
+
|
| 79 |
+
# flags are for MSVC only!
|
| 80 |
+
check_sse("AVX" " ;/arch:AVX")
|
| 81 |
+
if (NOT ${AVX_FOUND})
|
| 82 |
+
set(GGML_AVX OFF)
|
| 83 |
+
else()
|
| 84 |
+
set(GGML_AVX ON)
|
| 85 |
+
endif()
|
| 86 |
+
|
| 87 |
+
check_sse("AVX2" " ;/arch:AVX2")
|
| 88 |
+
check_sse("FMA" " ;/arch:AVX2")
|
| 89 |
+
if ((NOT ${AVX2_FOUND}) OR (NOT ${FMA_FOUND}))
|
| 90 |
+
set(GGML_AVX2 OFF)
|
| 91 |
+
else()
|
| 92 |
+
set(GGML_AVX2 ON)
|
| 93 |
+
endif()
|
| 94 |
+
|
| 95 |
+
check_sse("AVX512" " ;/arch:AVX512")
|
| 96 |
+
if (NOT ${AVX512_FOUND})
|
| 97 |
+
set(GGML_AVX512 OFF)
|
| 98 |
+
else()
|
| 99 |
+
set(GGML_AVX512 ON)
|
| 100 |
+
endif()
|
ggml/ggml_vk_generate_shaders.py
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
|
| 3 |
+
import logging
|
| 4 |
+
import argparse
|
| 5 |
+
import asyncio
|
| 6 |
+
import os
|
| 7 |
+
from tempfile import gettempdir
|
| 8 |
+
|
| 9 |
+
logger = logging.getLogger("ggml-vk-generate-shaders")
|
| 10 |
+
|
| 11 |
+
GLSLC = "glslc"
|
| 12 |
+
|
| 13 |
+
type_names = [
|
| 14 |
+
"f32",
|
| 15 |
+
"f16",
|
| 16 |
+
"q4_0",
|
| 17 |
+
"q4_1",
|
| 18 |
+
"q5_0",
|
| 19 |
+
"q5_1",
|
| 20 |
+
"q8_0",
|
| 21 |
+
"q2_k",
|
| 22 |
+
"q3_k",
|
| 23 |
+
"q4_k",
|
| 24 |
+
"q5_k",
|
| 25 |
+
"q6_k",
|
| 26 |
+
]
|
| 27 |
+
|
| 28 |
+
ASYNCIO_CONCURRENCY = 64
|
| 29 |
+
|
| 30 |
+
input_dir = "vulkan-shaders"
|
| 31 |
+
output_dir = gettempdir()
|
| 32 |
+
|
| 33 |
+
lock = asyncio.Lock()
|
| 34 |
+
shader_fnames = []
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
async def string_to_spv(name, in_fname, defines, fp16=True):
|
| 38 |
+
name = f"{name}{'_fp32' if not fp16 else ''}"
|
| 39 |
+
out_fname = os.path.join(output_dir, f"{name}.spv")
|
| 40 |
+
|
| 41 |
+
in_path = os.path.join(input_dir, in_fname)
|
| 42 |
+
|
| 43 |
+
cmd = [GLSLC, "-fshader-stage=compute", "--target-env=vulkan1.2", "-O", in_path, "-o", out_fname]
|
| 44 |
+
|
| 45 |
+
cmd.extend([f"-D{key}={value}" for key, value in defines.items()])
|
| 46 |
+
|
| 47 |
+
proc = await asyncio.create_subprocess_exec(*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
|
| 48 |
+
|
| 49 |
+
stdout, stderr = await proc.communicate()
|
| 50 |
+
|
| 51 |
+
stdout = stdout.decode()
|
| 52 |
+
error = stderr.decode()
|
| 53 |
+
|
| 54 |
+
if proc.returncode:
|
| 55 |
+
cmd = " ".join(cmd)
|
| 56 |
+
logger.error(f"cannot compile {name}\n\n{cmd}\n\n{error}")
|
| 57 |
+
return
|
| 58 |
+
|
| 59 |
+
async with lock:
|
| 60 |
+
shader_fnames.append((name, out_fname))
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def matmul_shaders(tasks, fp16, matmul_id):
|
| 64 |
+
if fp16:
|
| 65 |
+
load_vec = "8"
|
| 66 |
+
aligned_b_type_f32 = "mat2x4"
|
| 67 |
+
aligned_b_type_f16 = "f16mat2x4"
|
| 68 |
+
else:
|
| 69 |
+
load_vec = "4"
|
| 70 |
+
aligned_b_type_f32 = "vec4"
|
| 71 |
+
aligned_b_type_f16 = "f16vec4"
|
| 72 |
+
|
| 73 |
+
base_dict = {"FLOAT_TYPE": "float" if not fp16 else "float16_t"}
|
| 74 |
+
shader_name = "matmul"
|
| 75 |
+
|
| 76 |
+
if matmul_id:
|
| 77 |
+
base_dict["MUL_MAT_ID"] = "1"
|
| 78 |
+
shader_name = "matmul_id"
|
| 79 |
+
|
| 80 |
+
if fp16:
|
| 81 |
+
base_dict["FLOAT16"] = "1"
|
| 82 |
+
|
| 83 |
+
# Shaders with f16 B_TYPE
|
| 84 |
+
tasks.append(string_to_spv(f"{shader_name}_f32_f16", "mul_mm.comp", base_dict | {"DATA_A_F32": "1", "B_TYPE": "float16_t", "D_TYPE": "float"}, fp16))
|
| 85 |
+
tasks.append(string_to_spv(f"{shader_name}_f32_f16_aligned", "mul_mm.comp", base_dict | {"DATA_A_F32": "1", "LOAD_VEC_A": load_vec, "LOAD_VEC_B": load_vec, "B_TYPE": aligned_b_type_f16, "D_TYPE": "float"}, fp16))
|
| 86 |
+
|
| 87 |
+
tasks.append(string_to_spv(f"{shader_name}_f16", "mul_mm.comp", base_dict | {"DATA_A_F16": "1", "B_TYPE": "float16_t", "D_TYPE": "float"}, fp16))
|
| 88 |
+
tasks.append(string_to_spv(f"{shader_name}_f16_aligned", "mul_mm.comp", base_dict | {"DATA_A_F16": "1", "LOAD_VEC_A": load_vec, "LOAD_VEC_B": load_vec, "B_TYPE": aligned_b_type_f16, "D_TYPE": "float"}, fp16))
|
| 89 |
+
|
| 90 |
+
for tname in type_names:
|
| 91 |
+
data_a_key = f"DATA_A_{tname.upper()}"
|
| 92 |
+
load_vec_a = load_vec if tname in ("f32", "f16") else "2"
|
| 93 |
+
tasks.append(string_to_spv(f"{shader_name}_{tname}_f32", "mul_mm.comp", base_dict | {data_a_key: "1", "B_TYPE": "float", "D_TYPE": "float"}, fp16))
|
| 94 |
+
tasks.append(string_to_spv(f"{shader_name}_{tname}_f32_aligned", "mul_mm.comp", base_dict | {data_a_key: "2", "LOAD_VEC_A": load_vec_a, "LOAD_VEC_B": load_vec, "B_TYPE": aligned_b_type_f32, "D_TYPE": "float"}, fp16))
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
async def main():
|
| 98 |
+
logger.info("ggml_vulkan: Generating and compiling shaders to SPIR-V")
|
| 99 |
+
|
| 100 |
+
tasks = []
|
| 101 |
+
|
| 102 |
+
for fp16 in (False, True):
|
| 103 |
+
# MUL_MAT
|
| 104 |
+
matmul_shaders(tasks, fp16, False)
|
| 105 |
+
# MUL_MAT_ID
|
| 106 |
+
matmul_shaders(tasks, fp16, True)
|
| 107 |
+
|
| 108 |
+
for tname in type_names:
|
| 109 |
+
base_dict = {"FLOAT_TYPE": "float"}
|
| 110 |
+
|
| 111 |
+
# mul mat vec
|
| 112 |
+
data_a_key = f"DATA_A_{tname.upper()}"
|
| 113 |
+
shader = f"mul_mat_vec_{tname}.comp" if tname.endswith("_k") else "mul_mat_vec.comp"
|
| 114 |
+
|
| 115 |
+
tasks.append(string_to_spv(f"mul_mat_vec_{tname}_f32_f32", shader, base_dict | {data_a_key: "1", "B_TYPE": "float", "D_TYPE": "float"}))
|
| 116 |
+
tasks.append(string_to_spv(f"mul_mat_vec_{tname}_f16_f32", shader, base_dict | {data_a_key: "1", "B_TYPE": "float16_t", "D_TYPE": "float"}))
|
| 117 |
+
|
| 118 |
+
tasks.append(string_to_spv(f"mul_mat_vec_id_{tname}_f32", shader, base_dict | {"MUL_MAT_ID": "1", data_a_key: "1", "B_TYPE": "float", "D_TYPE": "float"}))
|
| 119 |
+
|
| 120 |
+
# Dequant shaders
|
| 121 |
+
if tname != "f16":
|
| 122 |
+
tasks.append(string_to_spv(f"dequant_{tname}", f"dequant_{tname}.comp", base_dict | {data_a_key: "1", "D_TYPE": "float16_t"}))
|
| 123 |
+
|
| 124 |
+
# get_rows
|
| 125 |
+
if not tname.endswith("_k"):
|
| 126 |
+
shader = "get_rows.comp" if tname in ("f32", "f16") else "get_rows_quant.comp"
|
| 127 |
+
|
| 128 |
+
if tname == "f16":
|
| 129 |
+
tasks.append(string_to_spv(f"get_rows_{tname}", shader, {data_a_key: "1", "B_TYPE": "int", "D_TYPE": "float16_t", "OPTIMIZATION_ERROR_WORKAROUND": "1"}))
|
| 130 |
+
else:
|
| 131 |
+
tasks.append(string_to_spv(f"get_rows_{tname}", shader, {data_a_key: "1", "B_TYPE": "int", "D_TYPE": "float16_t"}))
|
| 132 |
+
tasks.append(string_to_spv(f"get_rows_{tname}_f32", shader, {data_a_key: "1", "B_TYPE": "int", "D_TYPE": "float"}))
|
| 133 |
+
|
| 134 |
+
tasks.append(string_to_spv("mul_mat_vec_p021_f16_f32", "mul_mat_vec_p021.comp", {"A_TYPE": "float16_t", "B_TYPE": "float", "D_TYPE": "float"}))
|
| 135 |
+
tasks.append(string_to_spv("mul_mat_vec_nc_f16_f32", "mul_mat_vec_nc.comp", {"A_TYPE": "float16_t", "B_TYPE": "float", "D_TYPE": "float"}))
|
| 136 |
+
|
| 137 |
+
# Norms
|
| 138 |
+
tasks.append(string_to_spv("norm_f32", "norm.comp", base_dict | {"A_TYPE": "float", "D_TYPE": "float"}))
|
| 139 |
+
tasks.append(string_to_spv("rms_norm_f32", "rms_norm.comp", base_dict | {"A_TYPE": "float", "D_TYPE": "float"}))
|
| 140 |
+
|
| 141 |
+
tasks.append(string_to_spv("cpy_f32_f32", "copy.comp", {"A_TYPE": "float", "D_TYPE": "float"}))
|
| 142 |
+
tasks.append(string_to_spv("cpy_f32_f16", "copy.comp", {"A_TYPE": "float", "D_TYPE": "float16_t"}))
|
| 143 |
+
tasks.append(string_to_spv("cpy_f16_f16", "copy.comp", {"A_TYPE": "float16_t", "D_TYPE": "float16_t", "OPTIMIZATION_ERROR_WORKAROUND": "1"}))
|
| 144 |
+
|
| 145 |
+
tasks.append(string_to_spv("add_f32", "add.comp", {"A_TYPE": "float", "B_TYPE": "float", "D_TYPE": "float", "FLOAT_TYPE": "float"}))
|
| 146 |
+
|
| 147 |
+
tasks.append(string_to_spv("split_k_reduce", "mul_mat_split_k_reduce.comp", {}))
|
| 148 |
+
|
| 149 |
+
tasks.append(string_to_spv("mul_f32", "mul.comp", {"A_TYPE": "float", "B_TYPE": "float", "D_TYPE": "float", "FLOAT_TYPE": "float"}))
|
| 150 |
+
|
| 151 |
+
tasks.append(string_to_spv("div_f32", "div.comp", {"A_TYPE": "float", "B_TYPE": "float", "D_TYPE": "float", "FLOAT_TYPE": "float"}))
|
| 152 |
+
|
| 153 |
+
tasks.append(string_to_spv("scale_f32", "scale.comp", {"A_TYPE": "float", "D_TYPE": "float", "FLOAT_TYPE": "float"}))
|
| 154 |
+
|
| 155 |
+
tasks.append(string_to_spv("sqr_f32", "square.comp", {"A_TYPE": "float", "D_TYPE": "float", "FLOAT_TYPE": "float"}))
|
| 156 |
+
|
| 157 |
+
tasks.append(string_to_spv("clamp_f32", "clamp.comp", {"A_TYPE": "float", "D_TYPE": "float", "FLOAT_TYPE": "float"}))
|
| 158 |
+
|
| 159 |
+
tasks.append(string_to_spv("gelu_f32", "gelu.comp", {"A_TYPE": "float", "D_TYPE": "float"}))
|
| 160 |
+
tasks.append(string_to_spv("silu_f32", "silu.comp", {"A_TYPE": "float", "D_TYPE": "float"}))
|
| 161 |
+
tasks.append(string_to_spv("relu_f32", "relu.comp", {"A_TYPE": "float", "D_TYPE": "float"}))
|
| 162 |
+
|
| 163 |
+
tasks.append(string_to_spv("diag_mask_inf_f32", "diag_mask_inf.comp", {"A_TYPE": "float", "D_TYPE": "float"}))
|
| 164 |
+
|
| 165 |
+
tasks.append(string_to_spv("soft_max_f32", "soft_max.comp", base_dict | {"A_TYPE": "float", "B_TYPE": "float", "D_TYPE": "float"}))
|
| 166 |
+
tasks.append(string_to_spv("soft_max_f32_f16", "soft_max.comp", base_dict | {"A_TYPE": "float", "B_TYPE": "float16_t", "D_TYPE": "float"}))
|
| 167 |
+
|
| 168 |
+
tasks.append(string_to_spv("rope_norm_f32", "rope_norm.comp", {"A_TYPE": "float", "D_TYPE": "float"}))
|
| 169 |
+
tasks.append(string_to_spv("rope_norm_f16", "rope_norm.comp", {"A_TYPE": "float16_t", "D_TYPE": "float16_t"}))
|
| 170 |
+
|
| 171 |
+
tasks.append(string_to_spv("rope_neox_f32", "rope_neox.comp", {"A_TYPE": "float", "D_TYPE": "float"}))
|
| 172 |
+
tasks.append(string_to_spv("rope_neox_f16", "rope_neox.comp", {"A_TYPE": "float16_t", "D_TYPE": "float16_t"}))
|
| 173 |
+
|
| 174 |
+
tasks.append(string_to_spv("argsort_f32", "argsort.comp", {"A_TYPE": "float"}))
|
| 175 |
+
|
| 176 |
+
tasks.append(string_to_spv("sum_rows_f32", "sum_rows.comp", base_dict | {"A_TYPE": "float", "D_TYPE": "float"}))
|
| 177 |
+
|
| 178 |
+
# Helper to decorate tasks with semaphore acquisition.
|
| 179 |
+
async def withSemaphore(sem, task):
|
| 180 |
+
async with sem:
|
| 181 |
+
return await task
|
| 182 |
+
|
| 183 |
+
# Run tasks concurrently guarded by a concurrency limit.
|
| 184 |
+
sem = asyncio.Semaphore(ASYNCIO_CONCURRENCY)
|
| 185 |
+
await asyncio.gather(*(withSemaphore(sem, task) for task in tasks))
|
| 186 |
+
|
| 187 |
+
with open("ggml-vulkan-shaders.hpp", "w") as f:
|
| 188 |
+
f.write("#include <cstdint>\n\n")
|
| 189 |
+
for name, path in sorted(shader_fnames):
|
| 190 |
+
|
| 191 |
+
with open(path, "rb") as spv:
|
| 192 |
+
counter = 0
|
| 193 |
+
newline_counter = 0
|
| 194 |
+
f.write(f"unsigned char {name}_data[] = {{\n")
|
| 195 |
+
for val in spv.read():
|
| 196 |
+
f.write(f"0x{val:02x},")
|
| 197 |
+
newline_counter += 1
|
| 198 |
+
counter += 1
|
| 199 |
+
if newline_counter >= 12:
|
| 200 |
+
newline_counter = 0
|
| 201 |
+
f.write("\n")
|
| 202 |
+
f.write("\n};\n")
|
| 203 |
+
f.write(f"const uint64_t {name}_len = {counter};\n\n")
|
| 204 |
+
os.remove(path)
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
if __name__ == "__main__":
|
| 208 |
+
parser = argparse.ArgumentParser(description="GGML Vulkan Shader Generator")
|
| 209 |
+
|
| 210 |
+
parser.add_argument("--glslc", help="Path to glslc")
|
| 211 |
+
parser.add_argument("--verbose", action="store_true", help="increase output verbosity")
|
| 212 |
+
|
| 213 |
+
args = parser.parse_args()
|
| 214 |
+
|
| 215 |
+
logging.basicConfig(level=logging.DEBUG if args.verbose else logging.INFO)
|
| 216 |
+
|
| 217 |
+
if args.glslc:
|
| 218 |
+
GLSLC = args.glslc
|
| 219 |
+
|
| 220 |
+
asyncio.run(main())
|
ggml-alloc.h → ggml/include/ggml-alloc.h
RENAMED
|
File without changes
|
ggml-backend.h → ggml/include/ggml-backend.h
RENAMED
|
File without changes
|
ggml-blas.h → ggml/include/ggml-blas.h
RENAMED
|
File without changes
|
ggml-cuda.h → ggml/include/ggml-cuda.h
RENAMED
|
File without changes
|
ggml-kompute.h → ggml/include/ggml-kompute.h
RENAMED
|
File without changes
|
ggml-metal.h → ggml/include/ggml-metal.h
RENAMED
|
File without changes
|
ggml-rpc.h → ggml/include/ggml-rpc.h
RENAMED
|
File without changes
|
ggml-sycl.h → ggml/include/ggml-sycl.h
RENAMED
|
@@ -8,7 +8,9 @@
|
|
| 8 |
|
| 9 |
#include "ggml.h"
|
| 10 |
#include "ggml-backend.h"
|
| 11 |
-
|
|
|
|
|
|
|
| 12 |
|
| 13 |
#ifdef __cplusplus
|
| 14 |
extern "C" {
|
|
|
|
| 8 |
|
| 9 |
#include "ggml.h"
|
| 10 |
#include "ggml-backend.h"
|
| 11 |
+
|
| 12 |
+
#define GGML_SYCL_NAME "SYCL"
|
| 13 |
+
#define GGML_SYCL_MAX_DEVICES 48
|
| 14 |
|
| 15 |
#ifdef __cplusplus
|
| 16 |
extern "C" {
|
ggml-vulkan.h → ggml/include/ggml-vulkan.h
RENAMED
|
File without changes
|
ggml.h → ggml/include/ggml.h
RENAMED
|
@@ -312,6 +312,12 @@
|
|
| 312 |
GGML_TENSOR_LOCALS(int64_t, ne, dst, ne) \
|
| 313 |
GGML_TENSOR_LOCALS(size_t, nb, dst, nb)
|
| 314 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 315 |
#ifdef __cplusplus
|
| 316 |
extern "C" {
|
| 317 |
#endif
|
|
@@ -585,11 +591,7 @@ extern "C" {
|
|
| 585 |
struct ggml_tensor * grad;
|
| 586 |
struct ggml_tensor * src[GGML_MAX_SRC];
|
| 587 |
|
| 588 |
-
//
|
| 589 |
-
int perf_runs;
|
| 590 |
-
int64_t perf_cycles;
|
| 591 |
-
int64_t perf_time_us;
|
| 592 |
-
|
| 593 |
struct ggml_tensor * view_src;
|
| 594 |
size_t view_offs;
|
| 595 |
|
|
@@ -599,7 +601,7 @@ extern "C" {
|
|
| 599 |
|
| 600 |
void * extra; // extra things e.g. for ggml-cuda.cu
|
| 601 |
|
| 602 |
-
char padding[
|
| 603 |
};
|
| 604 |
|
| 605 |
static const size_t GGML_TENSOR_SIZE = sizeof(struct ggml_tensor);
|
|
@@ -646,11 +648,6 @@ extern "C" {
|
|
| 646 |
struct ggml_hash_set visited_hash_table;
|
| 647 |
|
| 648 |
enum ggml_cgraph_eval_order order;
|
| 649 |
-
|
| 650 |
-
// performance
|
| 651 |
-
int perf_runs;
|
| 652 |
-
int64_t perf_cycles;
|
| 653 |
-
int64_t perf_time_us;
|
| 654 |
};
|
| 655 |
|
| 656 |
// scratch buffer
|
|
@@ -667,28 +664,6 @@ extern "C" {
|
|
| 667 |
bool no_alloc; // don't allocate memory for the tensor data
|
| 668 |
};
|
| 669 |
|
| 670 |
-
|
| 671 |
-
// compute types
|
| 672 |
-
|
| 673 |
-
// NOTE: the INIT or FINALIZE pass is not scheduled unless explicitly enabled.
|
| 674 |
-
// This behavior was changed since https://github.com/ggerganov/llama.cpp/pull/1995.
|
| 675 |
-
enum ggml_task_type {
|
| 676 |
-
GGML_TASK_TYPE_INIT = 0,
|
| 677 |
-
GGML_TASK_TYPE_COMPUTE,
|
| 678 |
-
GGML_TASK_TYPE_FINALIZE,
|
| 679 |
-
};
|
| 680 |
-
|
| 681 |
-
struct ggml_compute_params {
|
| 682 |
-
enum ggml_task_type type;
|
| 683 |
-
|
| 684 |
-
// ith = thread index, nth = number of threads
|
| 685 |
-
int ith, nth;
|
| 686 |
-
|
| 687 |
-
// work buffer for all threads
|
| 688 |
-
size_t wsize;
|
| 689 |
-
void * wdata;
|
| 690 |
-
};
|
| 691 |
-
|
| 692 |
// numa strategies
|
| 693 |
enum ggml_numa_strategy {
|
| 694 |
GGML_NUMA_STRATEGY_DISABLED = 0,
|
|
|
|
| 312 |
GGML_TENSOR_LOCALS(int64_t, ne, dst, ne) \
|
| 313 |
GGML_TENSOR_LOCALS(size_t, nb, dst, nb)
|
| 314 |
|
| 315 |
+
#define GGML_TENSOR_BINARY_OP_LOCALS01 \
|
| 316 |
+
GGML_TENSOR_LOCALS(int64_t, ne0, src0, ne) \
|
| 317 |
+
GGML_TENSOR_LOCALS(size_t, nb0, src0, nb) \
|
| 318 |
+
GGML_TENSOR_LOCALS(int64_t, ne1, src1, ne) \
|
| 319 |
+
GGML_TENSOR_LOCALS(size_t, nb1, src1, nb)
|
| 320 |
+
|
| 321 |
#ifdef __cplusplus
|
| 322 |
extern "C" {
|
| 323 |
#endif
|
|
|
|
| 591 |
struct ggml_tensor * grad;
|
| 592 |
struct ggml_tensor * src[GGML_MAX_SRC];
|
| 593 |
|
| 594 |
+
// source tensor and offset for views
|
|
|
|
|
|
|
|
|
|
|
|
|
| 595 |
struct ggml_tensor * view_src;
|
| 596 |
size_t view_offs;
|
| 597 |
|
|
|
|
| 601 |
|
| 602 |
void * extra; // extra things e.g. for ggml-cuda.cu
|
| 603 |
|
| 604 |
+
// char padding[4];
|
| 605 |
};
|
| 606 |
|
| 607 |
static const size_t GGML_TENSOR_SIZE = sizeof(struct ggml_tensor);
|
|
|
|
| 648 |
struct ggml_hash_set visited_hash_table;
|
| 649 |
|
| 650 |
enum ggml_cgraph_eval_order order;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 651 |
};
|
| 652 |
|
| 653 |
// scratch buffer
|
|
|
|
| 664 |
bool no_alloc; // don't allocate memory for the tensor data
|
| 665 |
};
|
| 666 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 667 |
// numa strategies
|
| 668 |
enum ggml_numa_strategy {
|
| 669 |
GGML_NUMA_STRATEGY_DISABLED = 0,
|
ggml/src/CMakeLists.txt
ADDED
|
@@ -0,0 +1,1171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
include(CheckCXXCompilerFlag)
|
| 2 |
+
|
| 3 |
+
unset(GGML_CDEF_PUBLIC)
|
| 4 |
+
|
| 5 |
+
add_compile_definitions(GGML_SCHED_MAX_COPIES=${GGML_SCHED_MAX_COPIES})
|
| 6 |
+
|
| 7 |
+
# enable libstdc++ assertions for debug builds
|
| 8 |
+
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
| 9 |
+
add_compile_definitions($<$<CONFIG:Debug>:_GLIBCXX_ASSERTIONS>)
|
| 10 |
+
endif()
|
| 11 |
+
|
| 12 |
+
if (NOT MSVC)
|
| 13 |
+
if (GGML_SANITIZE_THREAD)
|
| 14 |
+
add_compile_options(-fsanitize=thread)
|
| 15 |
+
link_libraries (-fsanitize=thread)
|
| 16 |
+
endif()
|
| 17 |
+
|
| 18 |
+
if (GGML_SANITIZE_ADDRESS)
|
| 19 |
+
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
|
| 20 |
+
link_libraries (-fsanitize=address)
|
| 21 |
+
endif()
|
| 22 |
+
|
| 23 |
+
if (GGML_SANITIZE_UNDEFINED)
|
| 24 |
+
add_compile_options(-fsanitize=undefined)
|
| 25 |
+
link_libraries (-fsanitize=undefined)
|
| 26 |
+
endif()
|
| 27 |
+
endif()
|
| 28 |
+
|
| 29 |
+
if (APPLE AND GGML_ACCELERATE)
|
| 30 |
+
find_library(ACCELERATE_FRAMEWORK Accelerate)
|
| 31 |
+
if (ACCELERATE_FRAMEWORK)
|
| 32 |
+
message(STATUS "Accelerate framework found")
|
| 33 |
+
|
| 34 |
+
add_compile_definitions(GGML_USE_ACCELERATE)
|
| 35 |
+
add_compile_definitions(ACCELERATE_NEW_LAPACK)
|
| 36 |
+
add_compile_definitions(ACCELERATE_LAPACK_ILP64)
|
| 37 |
+
|
| 38 |
+
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} ${ACCELERATE_FRAMEWORK})
|
| 39 |
+
else()
|
| 40 |
+
message(WARNING "Accelerate framework not found")
|
| 41 |
+
endif()
|
| 42 |
+
endif()
|
| 43 |
+
|
| 44 |
+
if (GGML_METAL)
|
| 45 |
+
find_library(FOUNDATION_LIBRARY Foundation REQUIRED)
|
| 46 |
+
find_library(METAL_FRAMEWORK Metal REQUIRED)
|
| 47 |
+
find_library(METALKIT_FRAMEWORK MetalKit REQUIRED)
|
| 48 |
+
|
| 49 |
+
message(STATUS "Metal framework found")
|
| 50 |
+
set(GGML_HEADERS_METAL ../include/ggml-metal.h)
|
| 51 |
+
set(GGML_SOURCES_METAL ggml-metal.m)
|
| 52 |
+
|
| 53 |
+
list(APPEND GGML_CDEF_PUBLIC GGML_USE_METAL)
|
| 54 |
+
if (GGML_METAL_NDEBUG)
|
| 55 |
+
add_compile_definitions(GGML_METAL_NDEBUG)
|
| 56 |
+
endif()
|
| 57 |
+
|
| 58 |
+
# copy ggml-common.h and ggml-metal.metal to bin directory
|
| 59 |
+
configure_file(ggml-common.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ggml-common.h COPYONLY)
|
| 60 |
+
configure_file(ggml-metal.metal ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ggml-metal.metal COPYONLY)
|
| 61 |
+
|
| 62 |
+
if (GGML_METAL_EMBED_LIBRARY)
|
| 63 |
+
enable_language(ASM)
|
| 64 |
+
|
| 65 |
+
add_compile_definitions(GGML_METAL_EMBED_LIBRARY)
|
| 66 |
+
|
| 67 |
+
set(METALLIB_COMMON "${CMAKE_CURRENT_SOURCE_DIR}/ggml-common.h")
|
| 68 |
+
set(METALLIB_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/ggml-metal.metal")
|
| 69 |
+
|
| 70 |
+
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/autogenerated")
|
| 71 |
+
|
| 72 |
+
# merge ggml-common.h and ggml-metal.metal into a single file
|
| 73 |
+
set(METALLIB_EMBED_ASM "${CMAKE_BINARY_DIR}/autogenerated/ggml-metal-embed.s")
|
| 74 |
+
set(METALLIB_SOURCE_EMBED "${CMAKE_BINARY_DIR}/autogenerated/ggml-metal-embed.metal")
|
| 75 |
+
|
| 76 |
+
add_custom_command(
|
| 77 |
+
OUTPUT ${METALLIB_EMBED_ASM}
|
| 78 |
+
COMMAND echo "Embedding Metal library"
|
| 79 |
+
COMMAND sed -e '/\#include \"ggml-common.h\"/r ${METALLIB_COMMON}' -e '/\#include \"ggml-common.h\"/d' < ${METALLIB_SOURCE} > ${METALLIB_SOURCE_EMBED}
|
| 80 |
+
COMMAND echo ".section __DATA,__ggml_metallib" > ${METALLIB_EMBED_ASM}
|
| 81 |
+
COMMAND echo ".globl _ggml_metallib_start" >> ${METALLIB_EMBED_ASM}
|
| 82 |
+
COMMAND echo "_ggml_metallib_start:" >> ${METALLIB_EMBED_ASM}
|
| 83 |
+
COMMAND echo ".incbin \\\"${METALLIB_SOURCE_EMBED}\\\"" >> ${METALLIB_EMBED_ASM}
|
| 84 |
+
COMMAND echo ".globl _ggml_metallib_end" >> ${METALLIB_EMBED_ASM}
|
| 85 |
+
COMMAND echo "_ggml_metallib_end:" >> ${METALLIB_EMBED_ASM}
|
| 86 |
+
DEPENDS ggml-metal.metal ggml-common.h
|
| 87 |
+
COMMENT "Generate assembly for embedded Metal library"
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
+
set(GGML_SOURCES_METAL ${GGML_SOURCES_METAL} ${METALLIB_EMBED_ASM})
|
| 91 |
+
else()
|
| 92 |
+
if (GGML_METAL_SHADER_DEBUG)
|
| 93 |
+
# custom command to do the following:
|
| 94 |
+
# xcrun -sdk macosx metal -fno-fast-math -c ggml-metal.metal -o ggml-metal.air
|
| 95 |
+
# xcrun -sdk macosx metallib ggml-metal.air -o default.metallib
|
| 96 |
+
#
|
| 97 |
+
# note: this is the only way I found to disable fast-math in Metal. it's ugly, but at least it works
|
| 98 |
+
# disabling fast math is needed in order to pass tests/test-backend-ops
|
| 99 |
+
# note: adding -fno-inline fixes the tests when using MTL_SHADER_VALIDATION=1
|
| 100 |
+
# note: unfortunately, we have to call it default.metallib instead of ggml.metallib
|
| 101 |
+
# ref: https://github.com/ggerganov/whisper.cpp/issues/1720
|
| 102 |
+
set(XC_FLAGS -fno-fast-math -fno-inline -g)
|
| 103 |
+
else()
|
| 104 |
+
set(XC_FLAGS -O3)
|
| 105 |
+
endif()
|
| 106 |
+
|
| 107 |
+
# Append macOS metal versioning flags
|
| 108 |
+
if (GGML_METAL_MACOSX_VERSION_MIN)
|
| 109 |
+
message(STATUS "Adding -mmacosx-version-min=${GGML_METAL_MACOSX_VERSION_MIN} flag to metal compilation")
|
| 110 |
+
list (APPEND XC_FLAGS -mmacosx-version-min=${GGML_METAL_MACOSX_VERSION_MIN})
|
| 111 |
+
endif()
|
| 112 |
+
|
| 113 |
+
if (GGML_METAL_STD)
|
| 114 |
+
message(STATUS "Adding -std=${GGML_METAL_STD} flag to metal compilation")
|
| 115 |
+
list (APPEND XC_FLAGS -std=${GGML_METAL_STD})
|
| 116 |
+
endif()
|
| 117 |
+
|
| 118 |
+
add_custom_command(
|
| 119 |
+
OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/default.metallib
|
| 120 |
+
COMMAND xcrun -sdk macosx metal ${XC_FLAGS} -c ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ggml-metal.metal -o ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ggml-metal.air
|
| 121 |
+
COMMAND xcrun -sdk macosx metallib ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ggml-metal.air -o ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/default.metallib
|
| 122 |
+
COMMAND rm -f ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ggml-metal.air
|
| 123 |
+
COMMAND rm -f ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ggml-common.h
|
| 124 |
+
COMMAND rm -f ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ggml-metal.metal
|
| 125 |
+
DEPENDS ggml-metal.metal ggml-common.h
|
| 126 |
+
COMMENT "Compiling Metal kernels"
|
| 127 |
+
)
|
| 128 |
+
|
| 129 |
+
add_custom_target(
|
| 130 |
+
ggml-metal ALL
|
| 131 |
+
DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/default.metallib
|
| 132 |
+
)
|
| 133 |
+
endif() # GGML_METAL_EMBED_LIBRARY
|
| 134 |
+
|
| 135 |
+
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS}
|
| 136 |
+
${FOUNDATION_LIBRARY}
|
| 137 |
+
${METAL_FRAMEWORK}
|
| 138 |
+
${METALKIT_FRAMEWORK}
|
| 139 |
+
)
|
| 140 |
+
endif()
|
| 141 |
+
|
| 142 |
+
if (GGML_OPENMP)
|
| 143 |
+
find_package(OpenMP)
|
| 144 |
+
if (OpenMP_FOUND)
|
| 145 |
+
message(STATUS "OpenMP found")
|
| 146 |
+
|
| 147 |
+
add_compile_definitions(GGML_USE_OPENMP)
|
| 148 |
+
|
| 149 |
+
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} OpenMP::OpenMP_C OpenMP::OpenMP_CXX)
|
| 150 |
+
else()
|
| 151 |
+
message(WARNING "OpenMP not found")
|
| 152 |
+
endif()
|
| 153 |
+
endif()
|
| 154 |
+
|
| 155 |
+
if (GGML_BLAS)
|
| 156 |
+
if (GGML_STATIC)
|
| 157 |
+
set(BLA_STATIC ON)
|
| 158 |
+
endif()
|
| 159 |
+
#if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.22)
|
| 160 |
+
# set(BLA_SIZEOF_INTEGER 8)
|
| 161 |
+
#endif()
|
| 162 |
+
|
| 163 |
+
set(BLA_VENDOR ${GGML_BLAS_VENDOR})
|
| 164 |
+
find_package(BLAS)
|
| 165 |
+
|
| 166 |
+
if (BLAS_FOUND)
|
| 167 |
+
message(STATUS "BLAS found, Libraries: ${BLAS_LIBRARIES}")
|
| 168 |
+
|
| 169 |
+
if (("${BLAS_INCLUDE_DIRS}" STREQUAL "") AND NOT (${GGML_BLAS_VENDOR} MATCHES "Apple"))
|
| 170 |
+
# BLAS_INCLUDE_DIRS is missing in FindBLAS.cmake.
|
| 171 |
+
# see https://gitlab.kitware.com/cmake/cmake/-/issues/20268
|
| 172 |
+
find_package(PkgConfig REQUIRED)
|
| 173 |
+
if (${GGML_BLAS_VENDOR} MATCHES "Generic")
|
| 174 |
+
pkg_check_modules(DepBLAS REQUIRED blas)
|
| 175 |
+
elseif (${GGML_BLAS_VENDOR} MATCHES "OpenBLAS")
|
| 176 |
+
# As of openblas v0.3.22, the 64-bit is named openblas64.pc
|
| 177 |
+
pkg_check_modules(DepBLAS openblas64)
|
| 178 |
+
if (NOT DepBLAS_FOUND)
|
| 179 |
+
pkg_check_modules(DepBLAS REQUIRED openblas)
|
| 180 |
+
endif()
|
| 181 |
+
elseif (${GGML_BLAS_VENDOR} MATCHES "FLAME")
|
| 182 |
+
pkg_check_modules(DepBLAS REQUIRED blis)
|
| 183 |
+
elseif (${GGML_BLAS_VENDOR} MATCHES "ATLAS")
|
| 184 |
+
pkg_check_modules(DepBLAS REQUIRED blas-atlas)
|
| 185 |
+
elseif (${GGML_BLAS_VENDOR} MATCHES "FlexiBLAS")
|
| 186 |
+
pkg_check_modules(DepBLAS REQUIRED flexiblas_api)
|
| 187 |
+
elseif (${GGML_BLAS_VENDOR} MATCHES "Intel")
|
| 188 |
+
# all Intel* libraries share the same include path
|
| 189 |
+
pkg_check_modules(DepBLAS REQUIRED mkl-sdl)
|
| 190 |
+
elseif (${GGML_BLAS_VENDOR} MATCHES "NVHPC")
|
| 191 |
+
# this doesn't provide pkg-config
|
| 192 |
+
# suggest to assign BLAS_INCLUDE_DIRS on your own
|
| 193 |
+
if ("${NVHPC_VERSION}" STREQUAL "")
|
| 194 |
+
message(WARNING "Better to set NVHPC_VERSION")
|
| 195 |
+
else()
|
| 196 |
+
set(DepBLAS_FOUND ON)
|
| 197 |
+
set(DepBLAS_INCLUDE_DIRS "/opt/nvidia/hpc_sdk/${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}/${NVHPC_VERSION}/math_libs/include")
|
| 198 |
+
endif()
|
| 199 |
+
endif()
|
| 200 |
+
if (DepBLAS_FOUND)
|
| 201 |
+
set(BLAS_INCLUDE_DIRS ${DepBLAS_INCLUDE_DIRS})
|
| 202 |
+
else()
|
| 203 |
+
message(WARNING "BLAS_INCLUDE_DIRS neither been provided nor been automatically"
|
| 204 |
+
" detected by pkgconfig, trying to find cblas.h from possible paths...")
|
| 205 |
+
find_path(BLAS_INCLUDE_DIRS
|
| 206 |
+
NAMES cblas.h
|
| 207 |
+
HINTS
|
| 208 |
+
/usr/include
|
| 209 |
+
/usr/local/include
|
| 210 |
+
/usr/include/openblas
|
| 211 |
+
/opt/homebrew/opt/openblas/include
|
| 212 |
+
/usr/local/opt/openblas/include
|
| 213 |
+
/usr/include/x86_64-linux-gnu/openblas/include
|
| 214 |
+
)
|
| 215 |
+
endif()
|
| 216 |
+
endif()
|
| 217 |
+
|
| 218 |
+
message(STATUS "BLAS found, Includes: ${BLAS_INCLUDE_DIRS}")
|
| 219 |
+
|
| 220 |
+
add_compile_options(${BLAS_LINKER_FLAGS})
|
| 221 |
+
|
| 222 |
+
list(APPEND GGML_CDEF_PUBLIC GGML_USE_BLAS)
|
| 223 |
+
|
| 224 |
+
if (${BLAS_INCLUDE_DIRS} MATCHES "mkl" AND (${GGML_BLAS_VENDOR} MATCHES "Generic" OR ${GGML_BLAS_VENDOR} MATCHES "Intel"))
|
| 225 |
+
add_compile_definitions(GGML_BLAS_USE_MKL)
|
| 226 |
+
endif()
|
| 227 |
+
|
| 228 |
+
set(GGML_HEADERS_BLAS ../include/ggml-blas.h)
|
| 229 |
+
set(GGML_SOURCES_BLAS ggml-blas.cpp)
|
| 230 |
+
|
| 231 |
+
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} ${BLAS_LIBRARIES})
|
| 232 |
+
set(GGML_EXTRA_INCLUDES ${GGML_EXTRA_INCLUDES} ${BLAS_INCLUDE_DIRS})
|
| 233 |
+
else()
|
| 234 |
+
message(WARNING "BLAS not found, please refer to "
|
| 235 |
+
"https://cmake.org/cmake/help/latest/module/FindBLAS.html#blas-lapack-vendors"
|
| 236 |
+
" to set correct GGML_BLAS_VENDOR")
|
| 237 |
+
endif()
|
| 238 |
+
endif()
|
| 239 |
+
|
| 240 |
+
if (GGML_LLAMAFILE)
|
| 241 |
+
message(STATUS "Using ggml SGEMM")
|
| 242 |
+
|
| 243 |
+
add_compile_definitions(GGML_USE_LLAMAFILE)
|
| 244 |
+
|
| 245 |
+
set(GGML_HEADERS_LLAMAFILE sgemm.h)
|
| 246 |
+
set(GGML_SOURCES_LLAMAFILE sgemm.cpp)
|
| 247 |
+
endif()
|
| 248 |
+
|
| 249 |
+
if (GGML_CUDA)
|
| 250 |
+
cmake_minimum_required(VERSION 3.18) # for CMAKE_CUDA_ARCHITECTURES
|
| 251 |
+
|
| 252 |
+
find_package(CUDAToolkit)
|
| 253 |
+
|
| 254 |
+
if (CUDAToolkit_FOUND)
|
| 255 |
+
message(STATUS "CUDA found")
|
| 256 |
+
|
| 257 |
+
if (NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
|
| 258 |
+
# 52 == lowest CUDA 12 standard
|
| 259 |
+
# 60 == FP16 CUDA intrinsics
|
| 260 |
+
# 61 == integer CUDA intrinsics
|
| 261 |
+
# 70 == compute capability at which unrolling a loop in mul_mat_q kernels is faster
|
| 262 |
+
if (GGML_CUDA_F16 OR GGML_CUDA_DMMV_F16)
|
| 263 |
+
set(CMAKE_CUDA_ARCHITECTURES "60;61;70;75")
|
| 264 |
+
else()
|
| 265 |
+
set(CMAKE_CUDA_ARCHITECTURES "52;61;70;75")
|
| 266 |
+
#set(CMAKE_CUDA_ARCHITECTURES "OFF") # use this to compile much faster, but only F16 models work
|
| 267 |
+
endif()
|
| 268 |
+
endif()
|
| 269 |
+
message(STATUS "Using CUDA architectures: ${CMAKE_CUDA_ARCHITECTURES}")
|
| 270 |
+
|
| 271 |
+
enable_language(CUDA)
|
| 272 |
+
|
| 273 |
+
file(GLOB GGML_HEADERS_CUDA "ggml-cuda/*.cuh")
|
| 274 |
+
list(APPEND GGML_HEADERS_CUDA "../include/ggml-cuda.h")
|
| 275 |
+
|
| 276 |
+
file(GLOB GGML_SOURCES_CUDA "ggml-cuda/*.cu")
|
| 277 |
+
list(APPEND GGML_SOURCES_CUDA "ggml-cuda.cu")
|
| 278 |
+
file(GLOB SRCS "ggml-cuda/template-instances/fattn-wmma*.cu")
|
| 279 |
+
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 280 |
+
file(GLOB SRCS "ggml-cuda/template-instances/mmq*.cu")
|
| 281 |
+
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 282 |
+
|
| 283 |
+
if (GGML_CUDA_FA_ALL_QUANTS)
|
| 284 |
+
file(GLOB SRCS "ggml-cuda/template-instances/fattn-vec*.cu")
|
| 285 |
+
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 286 |
+
add_compile_definitions(GGML_CUDA_FA_ALL_QUANTS)
|
| 287 |
+
else()
|
| 288 |
+
file(GLOB SRCS "ggml-cuda/template-instances/fattn-vec*q4_0-q4_0.cu")
|
| 289 |
+
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 290 |
+
file(GLOB SRCS "ggml-cuda/template-instances/fattn-vec*q8_0-q8_0.cu")
|
| 291 |
+
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 292 |
+
file(GLOB SRCS "ggml-cuda/template-instances/fattn-vec*f16-f16.cu")
|
| 293 |
+
list(APPEND GGML_SOURCES_CUDA ${SRCS})
|
| 294 |
+
endif()
|
| 295 |
+
|
| 296 |
+
list(APPEND GGML_CDEF_PUBLIC GGML_USE_CUDA)
|
| 297 |
+
|
| 298 |
+
add_compile_definitions(GGML_CUDA_USE_GRAPHS)
|
| 299 |
+
add_compile_definitions(GGML_CUDA_DMMV_X=${GGML_CUDA_DMMV_X})
|
| 300 |
+
add_compile_definitions(GGML_CUDA_MMV_Y=${GGML_CUDA_MMV_Y})
|
| 301 |
+
add_compile_definitions(K_QUANTS_PER_ITERATION=${GGML_CUDA_KQUANTS_ITER})
|
| 302 |
+
add_compile_definitions(GGML_CUDA_PEER_MAX_BATCH_SIZE=${GGML_CUDA_PEER_MAX_BATCH_SIZE})
|
| 303 |
+
|
| 304 |
+
if (GGML_CUDA_FORCE_DMMV)
|
| 305 |
+
add_compile_definitions(GGML_CUDA_FORCE_DMMV)
|
| 306 |
+
endif()
|
| 307 |
+
|
| 308 |
+
if (GGML_CUDA_FORCE_MMQ)
|
| 309 |
+
add_compile_definitions(GGML_CUDA_FORCE_MMQ)
|
| 310 |
+
endif()
|
| 311 |
+
|
| 312 |
+
if (GGML_CUDA_FORCE_CUBLAS)
|
| 313 |
+
add_compile_definitions(GGML_CUDA_FORCE_CUBLAS)
|
| 314 |
+
endif()
|
| 315 |
+
|
| 316 |
+
if (GGML_CUDA_NO_VMM)
|
| 317 |
+
add_compile_definitions(GGML_CUDA_NO_VMM)
|
| 318 |
+
endif()
|
| 319 |
+
|
| 320 |
+
if (DEFINED GGML_CUDA_DMMV_Y)
|
| 321 |
+
add_compile_definitions(GGML_CUDA_MMV_Y=${GGML_CUDA_DMMV_Y}) # for backwards compatibility
|
| 322 |
+
endif()
|
| 323 |
+
|
| 324 |
+
if (GGML_CUDA_F16 OR GGML_CUDA_DMMV_F16)
|
| 325 |
+
add_compile_definitions(GGML_CUDA_F16)
|
| 326 |
+
endif()
|
| 327 |
+
|
| 328 |
+
if (GGML_CUDA_NO_PEER_COPY)
|
| 329 |
+
add_compile_definitions(GGML_CUDA_NO_PEER_COPY)
|
| 330 |
+
endif()
|
| 331 |
+
|
| 332 |
+
if (GGML_STATIC)
|
| 333 |
+
if (WIN32)
|
| 334 |
+
# As of 12.3.1 CUDA Toolkit for Windows does not offer a static cublas library
|
| 335 |
+
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} CUDA::cudart_static CUDA::cublas CUDA::cublasLt)
|
| 336 |
+
else ()
|
| 337 |
+
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} CUDA::cudart_static CUDA::cublas_static CUDA::cublasLt_static)
|
| 338 |
+
endif()
|
| 339 |
+
else()
|
| 340 |
+
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} CUDA::cudart CUDA::cublas CUDA::cublasLt)
|
| 341 |
+
endif()
|
| 342 |
+
|
| 343 |
+
if (GGML_CUDA_NO_VMM)
|
| 344 |
+
# No VMM requested, no need to link directly with the cuda driver lib (libcuda.so)
|
| 345 |
+
else()
|
| 346 |
+
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} CUDA::cuda_driver) # required by cuDeviceGetAttribute(), cuMemGetAllocationGranularity(...), ...
|
| 347 |
+
endif()
|
| 348 |
+
else()
|
| 349 |
+
message(WARNING "CUDA not found")
|
| 350 |
+
endif()
|
| 351 |
+
endif()
|
| 352 |
+
|
| 353 |
+
if (GGML_HIPBLAS)
|
| 354 |
+
if (NOT EXISTS $ENV{ROCM_PATH})
|
| 355 |
+
if (NOT EXISTS /opt/rocm)
|
| 356 |
+
set(ROCM_PATH /usr)
|
| 357 |
+
else()
|
| 358 |
+
set(ROCM_PATH /opt/rocm)
|
| 359 |
+
endif()
|
| 360 |
+
else()
|
| 361 |
+
set(ROCM_PATH $ENV{ROCM_PATH})
|
| 362 |
+
endif()
|
| 363 |
+
|
| 364 |
+
list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH})
|
| 365 |
+
list(APPEND CMAKE_PREFIX_PATH "${ROCM_PATH}/lib64/cmake")
|
| 366 |
+
|
| 367 |
+
# CMake on Windows doesn't support the HIP language yet
|
| 368 |
+
if (WIN32)
|
| 369 |
+
set(CXX_IS_HIPCC TRUE)
|
| 370 |
+
else()
|
| 371 |
+
string(REGEX MATCH "hipcc(\.bat)?$" CXX_IS_HIPCC "${CMAKE_CXX_COMPILER}")
|
| 372 |
+
endif()
|
| 373 |
+
|
| 374 |
+
if (CXX_IS_HIPCC)
|
| 375 |
+
if (LINUX)
|
| 376 |
+
if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
| 377 |
+
message(WARNING "Only LLVM is supported for HIP, hint: CXX=/opt/rocm/llvm/bin/clang++")
|
| 378 |
+
endif()
|
| 379 |
+
|
| 380 |
+
message(WARNING "Setting hipcc as the C++ compiler is legacy behavior."
|
| 381 |
+
" Prefer setting the HIP compiler directly. See README for details.")
|
| 382 |
+
endif()
|
| 383 |
+
else()
|
| 384 |
+
# Forward AMDGPU_TARGETS to CMAKE_HIP_ARCHITECTURES.
|
| 385 |
+
if (AMDGPU_TARGETS AND NOT CMAKE_HIP_ARCHITECTURES)
|
| 386 |
+
set(CMAKE_HIP_ARCHITECTURES ${AMDGPU_TARGETS})
|
| 387 |
+
endif()
|
| 388 |
+
cmake_minimum_required(VERSION 3.21)
|
| 389 |
+
enable_language(HIP)
|
| 390 |
+
endif()
|
| 391 |
+
|
| 392 |
+
find_package(hip REQUIRED)
|
| 393 |
+
find_package(hipblas REQUIRED)
|
| 394 |
+
find_package(rocblas REQUIRED)
|
| 395 |
+
|
| 396 |
+
message(STATUS "HIP and hipBLAS found")
|
| 397 |
+
|
| 398 |
+
file(GLOB GGML_HEADERS_ROCM "ggml-cuda/*.cuh")
|
| 399 |
+
list(APPEND GGML_HEADERS_ROCM "../include/ggml-cuda.h")
|
| 400 |
+
|
| 401 |
+
file(GLOB GGML_SOURCES_ROCM "ggml-cuda/*.cu")
|
| 402 |
+
list(APPEND GGML_SOURCES_ROCM "ggml-cuda.cu")
|
| 403 |
+
file(GLOB SRCS "ggml-cuda/template-instances/fattn-wmma*.cu")
|
| 404 |
+
list(APPEND GGML_SOURCES_ROCM ${SRCS})
|
| 405 |
+
file(GLOB SRCS "ggml-cuda/template-instances/mmq*.cu")
|
| 406 |
+
list(APPEND GGML_SOURCES_ROCM ${SRCS})
|
| 407 |
+
|
| 408 |
+
if (GGML_CUDA_FA_ALL_QUANTS)
|
| 409 |
+
file(GLOB SRCS "ggml-cuda/template-instances/fattn-vec*.cu")
|
| 410 |
+
list(APPEND GGML_SOURCES_ROCM ${SRCS})
|
| 411 |
+
add_compile_definitions(GGML_CUDA_FA_ALL_QUANTS)
|
| 412 |
+
else()
|
| 413 |
+
file(GLOB SRCS "ggml-cuda/template-instances/fattn-vec*q4_0-q4_0.cu")
|
| 414 |
+
list(APPEND GGML_SOURCES_ROCM ${SRCS})
|
| 415 |
+
file(GLOB SRCS "ggml-cuda/template-instances/fattn-vec*q8_0-q8_0.cu")
|
| 416 |
+
list(APPEND GGML_SOURCES_ROCM ${SRCS})
|
| 417 |
+
file(GLOB SRCS "ggml-cuda/template-instances/fattn-vec*f16-f16.cu")
|
| 418 |
+
list(APPEND GGML_SOURCES_ROCM ${SRCS})
|
| 419 |
+
endif()
|
| 420 |
+
|
| 421 |
+
list(APPEND GGML_CDEF_PUBLIC GGML_USE_CUDA)
|
| 422 |
+
|
| 423 |
+
add_compile_definitions(GGML_USE_HIPBLAS)
|
| 424 |
+
add_compile_definitions(GGML_CUDA_DMMV_X=${GGML_CUDA_DMMV_X})
|
| 425 |
+
add_compile_definitions(GGML_CUDA_MMV_Y=${GGML_CUDA_MMV_Y})
|
| 426 |
+
add_compile_definitions(K_QUANTS_PER_ITERATION=${GGML_CUDA_KQUANTS_ITER})
|
| 427 |
+
|
| 428 |
+
if (GGML_HIP_UMA)
|
| 429 |
+
add_compile_definitions(GGML_HIP_UMA)
|
| 430 |
+
endif()
|
| 431 |
+
|
| 432 |
+
if (GGML_CUDA_FORCE_DMMV)
|
| 433 |
+
add_compile_definitions(GGML_CUDA_FORCE_DMMV)
|
| 434 |
+
endif()
|
| 435 |
+
|
| 436 |
+
if (GGML_CUDA_FORCE_MMQ)
|
| 437 |
+
add_compile_definitions(GGML_CUDA_FORCE_MMQ)
|
| 438 |
+
endif()
|
| 439 |
+
|
| 440 |
+
if (GGML_CUDA_NO_PEER_COPY)
|
| 441 |
+
add_compile_definitions(GGML_CUDA_NO_PEER_COPY)
|
| 442 |
+
endif()
|
| 443 |
+
|
| 444 |
+
if (CXX_IS_HIPCC)
|
| 445 |
+
set_source_files_properties(${GGML_SOURCES_ROCM} PROPERTIES LANGUAGE CXX)
|
| 446 |
+
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} hip::device)
|
| 447 |
+
else()
|
| 448 |
+
set_source_files_properties(${GGML_SOURCES_ROCM} PROPERTIES LANGUAGE HIP)
|
| 449 |
+
endif()
|
| 450 |
+
|
| 451 |
+
if (GGML_STATIC)
|
| 452 |
+
message(FATAL_ERROR "Static linking not supported for HIP/ROCm")
|
| 453 |
+
endif()
|
| 454 |
+
|
| 455 |
+
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} PUBLIC hip::host roc::rocblas roc::hipblas)
|
| 456 |
+
endif()
|
| 457 |
+
|
| 458 |
+
if (GGML_SYCL)
|
| 459 |
+
if (NOT GGML_SYCL_TARGET MATCHES "^(INTEL|NVIDIA)$")
|
| 460 |
+
message(FATAL_ERROR "Invalid backend chosen, supported options are INTEL or NVIDIA")
|
| 461 |
+
endif()
|
| 462 |
+
|
| 463 |
+
if ( NOT DEFINED ENV{ONEAPI_ROOT})
|
| 464 |
+
message(FATAL_ERROR "Not detect ENV {ONEAPI_ROOT}, please install oneAPI & source it, like: source /opt/intel/oneapi/setvars.sh")
|
| 465 |
+
endif()
|
| 466 |
+
#todo: AOT
|
| 467 |
+
|
| 468 |
+
find_package(IntelSYCL REQUIRED)
|
| 469 |
+
find_package(MKL REQUIRED)
|
| 470 |
+
|
| 471 |
+
message(STATUS "SYCL found")
|
| 472 |
+
|
| 473 |
+
list(APPEND GGML_CDEF_PUBLIC GGML_USE_SYCL)
|
| 474 |
+
|
| 475 |
+
if (GGML_SYCL_F16)
|
| 476 |
+
add_compile_definitions(GGML_SYCL_F16)
|
| 477 |
+
endif()
|
| 478 |
+
|
| 479 |
+
if (GGML_CUDA_FORCE_MMQ)
|
| 480 |
+
add_compile_definitions(GGML_SYCL_FORCE_MMQ)
|
| 481 |
+
endif()
|
| 482 |
+
|
| 483 |
+
add_compile_options(-I./) #include DPCT
|
| 484 |
+
|
| 485 |
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing")
|
| 486 |
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
| 487 |
+
if (GGML_SYCL_TARGET STREQUAL "NVIDIA")
|
| 488 |
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsycl-targets=nvptx64-nvidia-cuda")
|
| 489 |
+
endif()
|
| 490 |
+
|
| 491 |
+
file(GLOB GGML_HEADERS_SYCL "ggml-sycl/*.hpp")
|
| 492 |
+
list(APPEND GGML_HEADERS_SYCL "../include/ggml-sycl.h")
|
| 493 |
+
|
| 494 |
+
file(GLOB GGML_SOURCES_SYCL "ggml-sycl/*.cpp")
|
| 495 |
+
list(APPEND GGML_SOURCES_SYCL "ggml-sycl.cpp")
|
| 496 |
+
|
| 497 |
+
if (WIN32)
|
| 498 |
+
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} IntelSYCL::SYCL_CXX MKL::MKL MKL::MKL_SYCL)
|
| 499 |
+
else()
|
| 500 |
+
add_compile_options(-I/${SYCL_INCLUDE_DIR})
|
| 501 |
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsycl -L${MKLROOT}/lib")
|
| 502 |
+
|
| 503 |
+
if (GGML_SYCL_TARGET STREQUAL "INTEL")
|
| 504 |
+
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} -fsycl OpenCL mkl_core pthread m dl mkl_sycl_blas mkl_intel_ilp64 mkl_tbb_thread)
|
| 505 |
+
elseif (GGML_SYCL_TARGET STREQUAL "NVIDIA")
|
| 506 |
+
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} -fsycl pthread m dl onemkl)
|
| 507 |
+
endif()
|
| 508 |
+
endif()
|
| 509 |
+
endif()
|
| 510 |
+
|
| 511 |
+
if (GGML_RPC)
|
| 512 |
+
message(STATUS "RPC found")
|
| 513 |
+
|
| 514 |
+
list(APPEND GGML_CDEF_PUBLIC GGML_USE_RPC)
|
| 515 |
+
|
| 516 |
+
if (WIN32)
|
| 517 |
+
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} ws2_32)
|
| 518 |
+
endif()
|
| 519 |
+
|
| 520 |
+
set(GGML_HEADERS_RPC ../include/ggml-rpc.h)
|
| 521 |
+
set(GGML_SOURCES_RPC ggml-rpc.cpp)
|
| 522 |
+
endif()
|
| 523 |
+
|
| 524 |
+
if (GGML_VULKAN)
|
| 525 |
+
find_package(Vulkan)
|
| 526 |
+
|
| 527 |
+
if (Vulkan_FOUND)
|
| 528 |
+
message(STATUS "Vulkan found")
|
| 529 |
+
|
| 530 |
+
set(GGML_HEADERS_VULKAN ../include/ggml-vulkan.h)
|
| 531 |
+
set(GGML_SOURCES_VULKAN ggml-vulkan.cpp)
|
| 532 |
+
|
| 533 |
+
list(APPEND GGML_CDEF_PUBLIC GGML_USE_VULKAN)
|
| 534 |
+
|
| 535 |
+
# Workaround to the "can't dereference invalidated vector iterator" bug in clang-cl debug build
|
| 536 |
+
# Posssibly relevant: https://stackoverflow.com/questions/74748276/visual-studio-no-displays-the-correct-length-of-stdvector
|
| 537 |
+
if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
| 538 |
+
add_compile_definitions(_ITERATOR_DEBUG_LEVEL=0)
|
| 539 |
+
endif()
|
| 540 |
+
|
| 541 |
+
if (GGML_VULKAN_CHECK_RESULTS)
|
| 542 |
+
add_compile_definitions(GGML_VULKAN_CHECK_RESULTS)
|
| 543 |
+
endif()
|
| 544 |
+
|
| 545 |
+
if (GGML_VULKAN_DEBUG)
|
| 546 |
+
add_compile_definitions(GGML_VULKAN_DEBUG)
|
| 547 |
+
endif()
|
| 548 |
+
|
| 549 |
+
if (GGML_VULKAN_MEMORY_DEBUG)
|
| 550 |
+
add_compile_definitions(GGML_VULKAN_MEMORY_DEBUG)
|
| 551 |
+
endif()
|
| 552 |
+
|
| 553 |
+
if (GGML_VULKAN_VALIDATE)
|
| 554 |
+
add_compile_definitions(GGML_VULKAN_VALIDATE)
|
| 555 |
+
endif()
|
| 556 |
+
|
| 557 |
+
if (GGML_VULKAN_RUN_TESTS)
|
| 558 |
+
add_compile_definitions(GGML_VULKAN_RUN_TESTS)
|
| 559 |
+
endif()
|
| 560 |
+
|
| 561 |
+
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} Vulkan::Vulkan)
|
| 562 |
+
else()
|
| 563 |
+
message(WARNING "Vulkan not found")
|
| 564 |
+
endif()
|
| 565 |
+
endif()
|
| 566 |
+
|
| 567 |
+
if (GGML_KOMPUTE)
|
| 568 |
+
add_compile_definitions(VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1)
|
| 569 |
+
|
| 570 |
+
find_package(Vulkan COMPONENTS glslc REQUIRED)
|
| 571 |
+
find_program(glslc_executable NAMES glslc HINTS Vulkan::glslc)
|
| 572 |
+
|
| 573 |
+
if (NOT glslc_executable)
|
| 574 |
+
message(FATAL_ERROR "glslc not found")
|
| 575 |
+
endif()
|
| 576 |
+
|
| 577 |
+
function(compile_shader)
|
| 578 |
+
set(options)
|
| 579 |
+
set(oneValueArgs)
|
| 580 |
+
set(multiValueArgs SOURCES)
|
| 581 |
+
cmake_parse_arguments(compile_shader "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
| 582 |
+
foreach(source ${compile_shader_SOURCES})
|
| 583 |
+
get_filename_component(filename ${source} NAME)
|
| 584 |
+
set(spv_file ${filename}.spv)
|
| 585 |
+
add_custom_command(
|
| 586 |
+
OUTPUT ${spv_file}
|
| 587 |
+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${source}
|
| 588 |
+
${CMAKE_CURRENT_SOURCE_DIR}/kompute-shaders/common.comp
|
| 589 |
+
${CMAKE_CURRENT_SOURCE_DIR}/kompute-shaders/op_getrows.comp
|
| 590 |
+
${CMAKE_CURRENT_SOURCE_DIR}/kompute-shaders/op_mul_mv_q_n_pre.comp
|
| 591 |
+
${CMAKE_CURRENT_SOURCE_DIR}/kompute-shaders/op_mul_mv_q_n.comp
|
| 592 |
+
COMMAND ${glslc_executable} --target-env=vulkan1.2 -o ${spv_file} ${CMAKE_CURRENT_SOURCE_DIR}/${source}
|
| 593 |
+
COMMENT "Compiling ${source} to ${spv_file}"
|
| 594 |
+
)
|
| 595 |
+
|
| 596 |
+
get_filename_component(RAW_FILE_NAME ${spv_file} NAME)
|
| 597 |
+
set(FILE_NAME "shader${RAW_FILE_NAME}")
|
| 598 |
+
string(REPLACE ".comp.spv" ".h" HEADER_FILE ${FILE_NAME})
|
| 599 |
+
string(TOUPPER ${HEADER_FILE} HEADER_FILE_DEFINE)
|
| 600 |
+
string(REPLACE "." "_" HEADER_FILE_DEFINE "${HEADER_FILE_DEFINE}")
|
| 601 |
+
set(OUTPUT_HEADER_FILE "${HEADER_FILE}")
|
| 602 |
+
message(STATUS "${HEADER_FILE} generating ${HEADER_FILE_DEFINE}")
|
| 603 |
+
if(CMAKE_GENERATOR MATCHES "Visual Studio")
|
| 604 |
+
add_custom_command(
|
| 605 |
+
OUTPUT ${OUTPUT_HEADER_FILE}
|
| 606 |
+
COMMAND ${CMAKE_COMMAND} -E echo "/*THIS FILE HAS BEEN AUTOMATICALLY GENERATED - DO NOT EDIT*/" > ${OUTPUT_HEADER_FILE}
|
| 607 |
+
COMMAND ${CMAKE_COMMAND} -E echo \"\#ifndef ${HEADER_FILE_DEFINE}\" >> ${OUTPUT_HEADER_FILE}
|
| 608 |
+
COMMAND ${CMAKE_COMMAND} -E echo \"\#define ${HEADER_FILE_DEFINE}\" >> ${OUTPUT_HEADER_FILE}
|
| 609 |
+
COMMAND ${CMAKE_COMMAND} -E echo "namespace kp {" >> ${OUTPUT_HEADER_FILE}
|
| 610 |
+
COMMAND ${CMAKE_COMMAND} -E echo "namespace shader_data {" >> ${OUTPUT_HEADER_FILE}
|
| 611 |
+
COMMAND ${CMAKE_BINARY_DIR}/bin/$<CONFIG>/xxd -i ${RAW_FILE_NAME} >> ${OUTPUT_HEADER_FILE}
|
| 612 |
+
COMMAND ${CMAKE_COMMAND} -E echo "}}" >> ${OUTPUT_HEADER_FILE}
|
| 613 |
+
COMMAND ${CMAKE_COMMAND} -E echo \"\#endif // define ${HEADER_FILE_DEFINE}\" >> ${OUTPUT_HEADER_FILE}
|
| 614 |
+
DEPENDS ${spv_file} xxd
|
| 615 |
+
COMMENT "Converting to hpp: ${FILE_NAME} ${CMAKE_BINARY_DIR}/bin/$<CONFIG>/xxd"
|
| 616 |
+
)
|
| 617 |
+
else()
|
| 618 |
+
add_custom_command(
|
| 619 |
+
OUTPUT ${OUTPUT_HEADER_FILE}
|
| 620 |
+
COMMAND ${CMAKE_COMMAND} -E echo "/*THIS FILE HAS BEEN AUTOMATICALLY GENERATED - DO NOT EDIT*/" > ${OUTPUT_HEADER_FILE}
|
| 621 |
+
COMMAND ${CMAKE_COMMAND} -E echo \"\#ifndef ${HEADER_FILE_DEFINE}\" >> ${OUTPUT_HEADER_FILE}
|
| 622 |
+
COMMAND ${CMAKE_COMMAND} -E echo \"\#define ${HEADER_FILE_DEFINE}\" >> ${OUTPUT_HEADER_FILE}
|
| 623 |
+
COMMAND ${CMAKE_COMMAND} -E echo "namespace kp {" >> ${OUTPUT_HEADER_FILE}
|
| 624 |
+
COMMAND ${CMAKE_COMMAND} -E echo "namespace shader_data {" >> ${OUTPUT_HEADER_FILE}
|
| 625 |
+
COMMAND ${CMAKE_BINARY_DIR}/bin/xxd -i ${RAW_FILE_NAME} >> ${OUTPUT_HEADER_FILE}
|
| 626 |
+
COMMAND ${CMAKE_COMMAND} -E echo "}}" >> ${OUTPUT_HEADER_FILE}
|
| 627 |
+
COMMAND ${CMAKE_COMMAND} -E echo \"\#endif // define ${HEADER_FILE_DEFINE}\" >> ${OUTPUT_HEADER_FILE}
|
| 628 |
+
DEPENDS ${spv_file} xxd
|
| 629 |
+
COMMENT "Converting to hpp: ${FILE_NAME} ${CMAKE_BINARY_DIR}/bin/xxd"
|
| 630 |
+
)
|
| 631 |
+
endif()
|
| 632 |
+
endforeach()
|
| 633 |
+
endfunction()
|
| 634 |
+
|
| 635 |
+
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/kompute/CMakeLists.txt")
|
| 636 |
+
message(STATUS "Kompute found")
|
| 637 |
+
set(KOMPUTE_OPT_LOG_LEVEL Error CACHE STRING "Kompute log level")
|
| 638 |
+
add_subdirectory(kompute)
|
| 639 |
+
|
| 640 |
+
# Compile our shaders
|
| 641 |
+
compile_shader(SOURCES
|
| 642 |
+
kompute-shaders/op_scale.comp
|
| 643 |
+
kompute-shaders/op_scale_8.comp
|
| 644 |
+
kompute-shaders/op_add.comp
|
| 645 |
+
kompute-shaders/op_addrow.comp
|
| 646 |
+
kompute-shaders/op_mul.comp
|
| 647 |
+
kompute-shaders/op_silu.comp
|
| 648 |
+
kompute-shaders/op_relu.comp
|
| 649 |
+
kompute-shaders/op_gelu.comp
|
| 650 |
+
kompute-shaders/op_softmax.comp
|
| 651 |
+
kompute-shaders/op_norm.comp
|
| 652 |
+
kompute-shaders/op_rmsnorm.comp
|
| 653 |
+
kompute-shaders/op_diagmask.comp
|
| 654 |
+
kompute-shaders/op_mul_mat_mat_f32.comp
|
| 655 |
+
kompute-shaders/op_mul_mat_f16.comp
|
| 656 |
+
kompute-shaders/op_mul_mat_q8_0.comp
|
| 657 |
+
kompute-shaders/op_mul_mat_q4_0.comp
|
| 658 |
+
kompute-shaders/op_mul_mat_q4_1.comp
|
| 659 |
+
kompute-shaders/op_mul_mat_q6_k.comp
|
| 660 |
+
kompute-shaders/op_getrows_f32.comp
|
| 661 |
+
kompute-shaders/op_getrows_f16.comp
|
| 662 |
+
kompute-shaders/op_getrows_q4_0.comp
|
| 663 |
+
kompute-shaders/op_getrows_q4_1.comp
|
| 664 |
+
kompute-shaders/op_getrows_q6_k.comp
|
| 665 |
+
kompute-shaders/op_rope_f16.comp
|
| 666 |
+
kompute-shaders/op_rope_f32.comp
|
| 667 |
+
kompute-shaders/op_cpy_f16_f16.comp
|
| 668 |
+
kompute-shaders/op_cpy_f16_f32.comp
|
| 669 |
+
kompute-shaders/op_cpy_f32_f16.comp
|
| 670 |
+
kompute-shaders/op_cpy_f32_f32.comp
|
| 671 |
+
)
|
| 672 |
+
|
| 673 |
+
# Create a custom target for our generated shaders
|
| 674 |
+
add_custom_target(generated_shaders DEPENDS
|
| 675 |
+
shaderop_scale.h
|
| 676 |
+
shaderop_scale_8.h
|
| 677 |
+
shaderop_add.h
|
| 678 |
+
shaderop_addrow.h
|
| 679 |
+
shaderop_mul.h
|
| 680 |
+
shaderop_silu.h
|
| 681 |
+
shaderop_relu.h
|
| 682 |
+
shaderop_gelu.h
|
| 683 |
+
shaderop_softmax.h
|
| 684 |
+
shaderop_norm.h
|
| 685 |
+
shaderop_rmsnorm.h
|
| 686 |
+
shaderop_diagmask.h
|
| 687 |
+
shaderop_mul_mat_mat_f32.h
|
| 688 |
+
shaderop_mul_mat_f16.h
|
| 689 |
+
shaderop_mul_mat_q8_0.h
|
| 690 |
+
shaderop_mul_mat_q4_0.h
|
| 691 |
+
shaderop_mul_mat_q4_1.h
|
| 692 |
+
shaderop_mul_mat_q6_k.h
|
| 693 |
+
shaderop_getrows_f32.h
|
| 694 |
+
shaderop_getrows_f16.h
|
| 695 |
+
shaderop_getrows_q4_0.h
|
| 696 |
+
shaderop_getrows_q4_1.h
|
| 697 |
+
shaderop_getrows_q6_k.h
|
| 698 |
+
shaderop_rope_f16.h
|
| 699 |
+
shaderop_rope_f32.h
|
| 700 |
+
shaderop_cpy_f16_f16.h
|
| 701 |
+
shaderop_cpy_f16_f32.h
|
| 702 |
+
shaderop_cpy_f32_f16.h
|
| 703 |
+
shaderop_cpy_f32_f32.h
|
| 704 |
+
)
|
| 705 |
+
|
| 706 |
+
# Create a custom command that depends on the generated_shaders
|
| 707 |
+
add_custom_command(
|
| 708 |
+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ggml-kompute.stamp
|
| 709 |
+
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/ggml-kompute.stamp
|
| 710 |
+
DEPENDS generated_shaders
|
| 711 |
+
COMMENT "Ensuring shaders are generated before compiling ggml-kompute.cpp"
|
| 712 |
+
)
|
| 713 |
+
|
| 714 |
+
# Add the stamp to the main sources to ensure dependency tracking
|
| 715 |
+
set(GGML_SOURCES_KOMPUTE ggml-kompute.cpp ${CMAKE_CURRENT_BINARY_DIR}/ggml-kompute.stamp)
|
| 716 |
+
set(GGML_HEADERS_KOMPUTE ../include/ggml-kompute.h ${CMAKE_CURRENT_BINARY_DIR}/ggml-kompute.stamp)
|
| 717 |
+
|
| 718 |
+
list(APPEND GGML_CDEF_PUBLIC GGML_USE_KOMPUTE)
|
| 719 |
+
|
| 720 |
+
set(GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} kompute)
|
| 721 |
+
set(GGML_EXTRA_INCLUDES ${GGML_EXTRA_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
|
| 722 |
+
else()
|
| 723 |
+
message(WARNING "Kompute not found")
|
| 724 |
+
endif()
|
| 725 |
+
endif()
|
| 726 |
+
|
| 727 |
+
if (GGML_CPU_HBM)
|
| 728 |
+
find_library(memkind memkind REQUIRED)
|
| 729 |
+
|
| 730 |
+
message(STATUS "Using memkind for CPU HBM")
|
| 731 |
+
|
| 732 |
+
add_compile_definitions(GGML_USE_CPU_HBM)
|
| 733 |
+
|
| 734 |
+
target_link_libraries(ggml PUBLIC memkind)
|
| 735 |
+
endif()
|
| 736 |
+
|
| 737 |
+
function(get_flags CCID CCVER)
|
| 738 |
+
set(C_FLAGS "")
|
| 739 |
+
set(CXX_FLAGS "")
|
| 740 |
+
|
| 741 |
+
if (CCID MATCHES "Clang")
|
| 742 |
+
set(C_FLAGS -Wunreachable-code-break -Wunreachable-code-return)
|
| 743 |
+
set(CXX_FLAGS -Wunreachable-code-break -Wunreachable-code-return -Wmissing-prototypes -Wextra-semi)
|
| 744 |
+
|
| 745 |
+
if (
|
| 746 |
+
(CCID STREQUAL "Clang" AND CCVER VERSION_GREATER_EQUAL 3.8.0) OR
|
| 747 |
+
(CCID STREQUAL "AppleClang" AND CCVER VERSION_GREATER_EQUAL 7.3.0)
|
| 748 |
+
)
|
| 749 |
+
list(APPEND C_FLAGS -Wdouble-promotion)
|
| 750 |
+
endif()
|
| 751 |
+
elseif (CCID STREQUAL "GNU")
|
| 752 |
+
set(C_FLAGS -Wdouble-promotion)
|
| 753 |
+
set(CXX_FLAGS -Wno-array-bounds)
|
| 754 |
+
|
| 755 |
+
if (CCVER VERSION_GREATER_EQUAL 7.1.0)
|
| 756 |
+
list(APPEND CXX_FLAGS -Wno-format-truncation)
|
| 757 |
+
endif()
|
| 758 |
+
if (CCVER VERSION_GREATER_EQUAL 8.1.0)
|
| 759 |
+
list(APPEND CXX_FLAGS -Wextra-semi)
|
| 760 |
+
endif()
|
| 761 |
+
endif()
|
| 762 |
+
|
| 763 |
+
set(GF_C_FLAGS ${C_FLAGS} PARENT_SCOPE)
|
| 764 |
+
set(GF_CXX_FLAGS ${CXX_FLAGS} PARENT_SCOPE)
|
| 765 |
+
endfunction()
|
| 766 |
+
|
| 767 |
+
if (GGML_FATAL_WARNINGS)
|
| 768 |
+
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
| 769 |
+
list(APPEND C_FLAGS -Werror)
|
| 770 |
+
list(APPEND CXX_FLAGS -Werror)
|
| 771 |
+
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
| 772 |
+
add_compile_options(/WX)
|
| 773 |
+
endif()
|
| 774 |
+
endif()
|
| 775 |
+
|
| 776 |
+
if (GGML_ALL_WARNINGS)
|
| 777 |
+
if (NOT MSVC)
|
| 778 |
+
list(APPEND WARNING_FLAGS -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function)
|
| 779 |
+
list(APPEND C_FLAGS -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes
|
| 780 |
+
-Werror=implicit-int -Werror=implicit-function-declaration)
|
| 781 |
+
list(APPEND CXX_FLAGS -Wmissing-declarations -Wmissing-noreturn)
|
| 782 |
+
|
| 783 |
+
list(APPEND C_FLAGS ${WARNING_FLAGS})
|
| 784 |
+
list(APPEND CXX_FLAGS ${WARNING_FLAGS})
|
| 785 |
+
|
| 786 |
+
get_flags(${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION})
|
| 787 |
+
|
| 788 |
+
add_compile_options("$<$<COMPILE_LANGUAGE:C>:${C_FLAGS};${GF_C_FLAGS}>"
|
| 789 |
+
"$<$<COMPILE_LANGUAGE:CXX>:${CXX_FLAGS};${GF_CXX_FLAGS}>")
|
| 790 |
+
else()
|
| 791 |
+
# todo : msvc
|
| 792 |
+
set(C_FLAGS "")
|
| 793 |
+
set(CXX_FLAGS "")
|
| 794 |
+
endif()
|
| 795 |
+
endif()
|
| 796 |
+
|
| 797 |
+
set(CUDA_CXX_FLAGS "")
|
| 798 |
+
|
| 799 |
+
if (GGML_CUDA)
|
| 800 |
+
set(CUDA_FLAGS -use_fast_math)
|
| 801 |
+
|
| 802 |
+
if (GGML_FATAL_WARNINGS)
|
| 803 |
+
list(APPEND CUDA_FLAGS -Werror all-warnings)
|
| 804 |
+
endif()
|
| 805 |
+
|
| 806 |
+
if (GGML_ALL_WARNINGS AND NOT MSVC)
|
| 807 |
+
set(NVCC_CMD ${CMAKE_CUDA_COMPILER} .c)
|
| 808 |
+
if (NOT CMAKE_CUDA_HOST_COMPILER STREQUAL "")
|
| 809 |
+
list(APPEND NVCC_CMD -ccbin ${CMAKE_CUDA_HOST_COMPILER})
|
| 810 |
+
endif()
|
| 811 |
+
|
| 812 |
+
execute_process(
|
| 813 |
+
COMMAND ${NVCC_CMD} -Xcompiler --version
|
| 814 |
+
OUTPUT_VARIABLE CUDA_CCFULLVER
|
| 815 |
+
ERROR_QUIET
|
| 816 |
+
)
|
| 817 |
+
|
| 818 |
+
if (NOT CUDA_CCFULLVER MATCHES clang)
|
| 819 |
+
set(CUDA_CCID "GNU")
|
| 820 |
+
execute_process(
|
| 821 |
+
COMMAND ${NVCC_CMD} -Xcompiler "-dumpfullversion -dumpversion"
|
| 822 |
+
OUTPUT_VARIABLE CUDA_CCVER
|
| 823 |
+
ERROR_QUIET
|
| 824 |
+
)
|
| 825 |
+
else()
|
| 826 |
+
if (CUDA_CCFULLVER MATCHES Apple)
|
| 827 |
+
set(CUDA_CCID "AppleClang")
|
| 828 |
+
else()
|
| 829 |
+
set(CUDA_CCID "Clang")
|
| 830 |
+
endif()
|
| 831 |
+
string(REGEX REPLACE "^.* version ([0-9.]*).*$" "\\1" CUDA_CCVER ${CUDA_CCFULLVER})
|
| 832 |
+
endif()
|
| 833 |
+
|
| 834 |
+
message("-- CUDA host compiler is ${CUDA_CCID} ${CUDA_CCVER}")
|
| 835 |
+
|
| 836 |
+
get_flags(${CUDA_CCID} ${CUDA_CCVER})
|
| 837 |
+
list(APPEND CUDA_CXX_FLAGS ${CXX_FLAGS} ${GF_CXX_FLAGS}) # This is passed to -Xcompiler later
|
| 838 |
+
endif()
|
| 839 |
+
|
| 840 |
+
if (NOT MSVC)
|
| 841 |
+
list(APPEND CUDA_CXX_FLAGS -Wno-pedantic)
|
| 842 |
+
endif()
|
| 843 |
+
endif()
|
| 844 |
+
|
| 845 |
+
if (GGML_LTO)
|
| 846 |
+
include(CheckIPOSupported)
|
| 847 |
+
check_ipo_supported(RESULT result OUTPUT output)
|
| 848 |
+
if (result)
|
| 849 |
+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
| 850 |
+
else()
|
| 851 |
+
message(WARNING "IPO is not supported: ${output}")
|
| 852 |
+
endif()
|
| 853 |
+
endif()
|
| 854 |
+
|
| 855 |
+
if (GGML_CCACHE)
|
| 856 |
+
find_program(GGML_CCACHE_FOUND ccache)
|
| 857 |
+
|
| 858 |
+
if (GGML_CCACHE_FOUND)
|
| 859 |
+
# TODO: should not be set globally
|
| 860 |
+
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
| 861 |
+
set(ENV{CCACHE_SLOPPINESS} time_macros)
|
| 862 |
+
message(STATUS "ccache found, compilation results will be cached. Disable with GGML_CCACHE=OFF.")
|
| 863 |
+
else()
|
| 864 |
+
message(STATUS "Warning: ccache not found - consider installing it for faster compilation or disable this warning with GGML_CCACHE=OFF")
|
| 865 |
+
endif ()
|
| 866 |
+
endif()
|
| 867 |
+
|
| 868 |
+
# this version of Apple ld64 is buggy
|
| 869 |
+
execute_process(
|
| 870 |
+
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_EXE_LINKER_FLAGS} -Wl,-v
|
| 871 |
+
ERROR_VARIABLE output
|
| 872 |
+
OUTPUT_QUIET
|
| 873 |
+
)
|
| 874 |
+
|
| 875 |
+
if (output MATCHES "dyld-1015\.7")
|
| 876 |
+
add_compile_definitions(HAVE_BUGGY_APPLE_LINKER)
|
| 877 |
+
endif()
|
| 878 |
+
|
| 879 |
+
# architecture specific
|
| 880 |
+
# TODO: probably these flags need to be tweaked on some architectures
|
| 881 |
+
# feel free to update the Makefile for your architecture and send a pull request or issue
|
| 882 |
+
message(STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
|
| 883 |
+
if (MSVC)
|
| 884 |
+
string(TOLOWER "${CMAKE_GENERATOR_PLATFORM}" CMAKE_GENERATOR_PLATFORM_LWR)
|
| 885 |
+
message(STATUS "CMAKE_GENERATOR_PLATFORM: ${CMAKE_GENERATOR_PLATFORM}")
|
| 886 |
+
else ()
|
| 887 |
+
set(CMAKE_GENERATOR_PLATFORM_LWR "")
|
| 888 |
+
endif ()
|
| 889 |
+
|
| 890 |
+
if (NOT MSVC)
|
| 891 |
+
if (GGML_STATIC)
|
| 892 |
+
add_link_options(-static)
|
| 893 |
+
if (MINGW)
|
| 894 |
+
add_link_options(-static-libgcc -static-libstdc++)
|
| 895 |
+
endif()
|
| 896 |
+
endif()
|
| 897 |
+
if (GGML_GPROF)
|
| 898 |
+
add_compile_options(-pg)
|
| 899 |
+
endif()
|
| 900 |
+
endif()
|
| 901 |
+
|
| 902 |
+
set(ARCH_FLAGS "")
|
| 903 |
+
|
| 904 |
+
if (CMAKE_OSX_ARCHITECTURES STREQUAL "arm64" OR
|
| 905 |
+
CMAKE_GENERATOR_PLATFORM_LWR STREQUAL "arm64" OR
|
| 906 |
+
(NOT CMAKE_OSX_ARCHITECTURES AND
|
| 907 |
+
NOT CMAKE_GENERATOR_PLATFORM_LWR AND
|
| 908 |
+
CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm.*|ARM64)$"))
|
| 909 |
+
|
| 910 |
+
message(STATUS "ARM detected")
|
| 911 |
+
|
| 912 |
+
if (MSVC)
|
| 913 |
+
add_compile_definitions(__aarch64__) # MSVC defines _M_ARM64 instead
|
| 914 |
+
add_compile_definitions(__ARM_NEON)
|
| 915 |
+
add_compile_definitions(__ARM_FEATURE_FMA)
|
| 916 |
+
|
| 917 |
+
set(CMAKE_REQUIRED_FLAGS_PREV ${CMAKE_REQUIRED_FLAGS})
|
| 918 |
+
string(JOIN " " CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "/arch:armv8.2")
|
| 919 |
+
|
| 920 |
+
check_cxx_source_compiles("#include <arm_neon.h>\nint main() { int8x16_t _a, _b; int32x4_t _s = vdotq_s32(_s, _a, _b); return 0; }" GGML_COMPILER_SUPPORT_DOTPROD)
|
| 921 |
+
if (GGML_COMPILER_SUPPORT_DOTPROD)
|
| 922 |
+
add_compile_definitions(__ARM_FEATURE_DOTPROD)
|
| 923 |
+
endif ()
|
| 924 |
+
|
| 925 |
+
check_cxx_source_compiles("#include <arm_neon.h>\nint main() { int8x16_t _a, _b; int32x4_t _s = vmlaq_f32(_s, _a, _b); return 0; }" GGML_COMPILER_SUPPORT_MATMUL_INT8)
|
| 926 |
+
|
| 927 |
+
if (GGML_COMPILER_SUPPORT_MATMUL_INT8)
|
| 928 |
+
add_compile_definitions(__ARM_FEATURE_MATMUL_INT8)
|
| 929 |
+
endif ()
|
| 930 |
+
|
| 931 |
+
check_cxx_source_compiles("#include <arm_neon.h>\nint main() { float16_t _a; float16x8_t _s = vdupq_n_f16(_a); return 0; }" GGML_COMPILER_SUPPORT_FP16_VECTOR_ARITHMETIC)
|
| 932 |
+
if (GGML_COMPILER_SUPPORT_FP16_VECTOR_ARITHMETIC)
|
| 933 |
+
add_compile_definitions(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
|
| 934 |
+
endif ()
|
| 935 |
+
|
| 936 |
+
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_PREV})
|
| 937 |
+
else()
|
| 938 |
+
check_cxx_compiler_flag(-mfp16-format=ieee COMPILER_SUPPORTS_FP16_FORMAT_I3E)
|
| 939 |
+
if (NOT "${COMPILER_SUPPORTS_FP16_FORMAT_I3E}" STREQUAL "")
|
| 940 |
+
list(APPEND ARCH_FLAGS -mfp16-format=ieee)
|
| 941 |
+
endif()
|
| 942 |
+
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv6")
|
| 943 |
+
# Raspberry Pi 1, Zero
|
| 944 |
+
list(APPEND ARCH_FLAGS -mfpu=neon-fp-armv8 -mno-unaligned-access)
|
| 945 |
+
endif()
|
| 946 |
+
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv7")
|
| 947 |
+
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Android")
|
| 948 |
+
# Android armeabi-v7a
|
| 949 |
+
list(APPEND ARCH_FLAGS -mfpu=neon-vfpv4 -mno-unaligned-access -funsafe-math-optimizations)
|
| 950 |
+
else()
|
| 951 |
+
# Raspberry Pi 2
|
| 952 |
+
list(APPEND ARCH_FLAGS -mfpu=neon-fp-armv8 -mno-unaligned-access -funsafe-math-optimizations)
|
| 953 |
+
endif()
|
| 954 |
+
endif()
|
| 955 |
+
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv8")
|
| 956 |
+
# Android arm64-v8a
|
| 957 |
+
# Raspberry Pi 3, 4, Zero 2 (32-bit)
|
| 958 |
+
list(APPEND ARCH_FLAGS -mno-unaligned-access)
|
| 959 |
+
endif()
|
| 960 |
+
if (GGML_SVE)
|
| 961 |
+
list(APPEND ARCH_FLAGS -march=armv8.6-a+sve)
|
| 962 |
+
endif()
|
| 963 |
+
endif()
|
| 964 |
+
elseif (CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64" OR CMAKE_GENERATOR_PLATFORM_LWR MATCHES "^(x86_64|i686|amd64|x64|win32)$" OR
|
| 965 |
+
(NOT CMAKE_OSX_ARCHITECTURES AND NOT CMAKE_GENERATOR_PLATFORM_LWR AND
|
| 966 |
+
CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|i686|AMD64)$"))
|
| 967 |
+
message(STATUS "x86 detected")
|
| 968 |
+
if (MSVC)
|
| 969 |
+
# instruction set detection for MSVC only
|
| 970 |
+
if (GGML_NATIVE)
|
| 971 |
+
# TODO: improve, should not reference files from the parent folder
|
| 972 |
+
include(../cmake/FindSIMD.cmake)
|
| 973 |
+
endif ()
|
| 974 |
+
if (GGML_AVX512)
|
| 975 |
+
list(APPEND ARCH_FLAGS /arch:AVX512)
|
| 976 |
+
# MSVC has no compile-time flags enabling specific
|
| 977 |
+
# AVX512 extensions, neither it defines the
|
| 978 |
+
# macros corresponding to the extensions.
|
| 979 |
+
# Do it manually.
|
| 980 |
+
if (GGML_AVX512_VBMI)
|
| 981 |
+
add_compile_definitions($<$<COMPILE_LANGUAGE:C>:__AVX512VBMI__>)
|
| 982 |
+
add_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:__AVX512VBMI__>)
|
| 983 |
+
endif()
|
| 984 |
+
if (GGML_AVX512_VNNI)
|
| 985 |
+
add_compile_definitions($<$<COMPILE_LANGUAGE:C>:__AVX512VNNI__>)
|
| 986 |
+
add_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:__AVX512VNNI__>)
|
| 987 |
+
endif()
|
| 988 |
+
if (GGML_AVX512_BF16)
|
| 989 |
+
add_compile_definitions($<$<COMPILE_LANGUAGE:C>:__AVX512BF16__>)
|
| 990 |
+
add_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:__AVX512BF16__>)
|
| 991 |
+
endif()
|
| 992 |
+
elseif (GGML_AVX2)
|
| 993 |
+
list(APPEND ARCH_FLAGS /arch:AVX2)
|
| 994 |
+
elseif (GGML_AVX)
|
| 995 |
+
list(APPEND ARCH_FLAGS /arch:AVX)
|
| 996 |
+
endif()
|
| 997 |
+
else()
|
| 998 |
+
if (GGML_NATIVE)
|
| 999 |
+
list(APPEND ARCH_FLAGS -march=native)
|
| 1000 |
+
endif()
|
| 1001 |
+
if (GGML_F16C)
|
| 1002 |
+
list(APPEND ARCH_FLAGS -mf16c)
|
| 1003 |
+
endif()
|
| 1004 |
+
if (GGML_FMA)
|
| 1005 |
+
list(APPEND ARCH_FLAGS -mfma)
|
| 1006 |
+
endif()
|
| 1007 |
+
if (GGML_AVX)
|
| 1008 |
+
list(APPEND ARCH_FLAGS -mavx)
|
| 1009 |
+
endif()
|
| 1010 |
+
if (GGML_AVX2)
|
| 1011 |
+
list(APPEND ARCH_FLAGS -mavx2)
|
| 1012 |
+
endif()
|
| 1013 |
+
if (GGML_AVX512)
|
| 1014 |
+
list(APPEND ARCH_FLAGS -mavx512f)
|
| 1015 |
+
list(APPEND ARCH_FLAGS -mavx512bw)
|
| 1016 |
+
endif()
|
| 1017 |
+
if (GGML_AVX512_VBMI)
|
| 1018 |
+
list(APPEND ARCH_FLAGS -mavx512vbmi)
|
| 1019 |
+
endif()
|
| 1020 |
+
if (GGML_AVX512_VNNI)
|
| 1021 |
+
list(APPEND ARCH_FLAGS -mavx512vnni)
|
| 1022 |
+
endif()
|
| 1023 |
+
if (GGML_AVX512_BF16)
|
| 1024 |
+
list(APPEND ARCH_FLAGS -mavx512bf16)
|
| 1025 |
+
endif()
|
| 1026 |
+
endif()
|
| 1027 |
+
elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64")
|
| 1028 |
+
message(STATUS "PowerPC detected")
|
| 1029 |
+
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64le")
|
| 1030 |
+
list(APPEND ARCH_FLAGS -mcpu=powerpc64le)
|
| 1031 |
+
else()
|
| 1032 |
+
list(APPEND ARCH_FLAGS -mcpu=native -mtune=native)
|
| 1033 |
+
#TODO: Add targets for Power8/Power9 (Altivec/VSX) and Power10(MMA) and query for big endian systems (ppc64/le/be)
|
| 1034 |
+
endif()
|
| 1035 |
+
elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "loongarch64")
|
| 1036 |
+
message(STATUS "loongarch64 detected")
|
| 1037 |
+
|
| 1038 |
+
list(APPEND ARCH_FLAGS -march=loongarch64)
|
| 1039 |
+
if (GGML_LASX)
|
| 1040 |
+
list(APPEND ARCH_FLAGS -mlasx)
|
| 1041 |
+
endif()
|
| 1042 |
+
if (GGML_LSX)
|
| 1043 |
+
list(APPEND ARCH_FLAGS -mlsx)
|
| 1044 |
+
endif()
|
| 1045 |
+
else()
|
| 1046 |
+
message(STATUS "Unknown architecture")
|
| 1047 |
+
endif()
|
| 1048 |
+
|
| 1049 |
+
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:${ARCH_FLAGS}>")
|
| 1050 |
+
add_compile_options("$<$<COMPILE_LANGUAGE:C>:${ARCH_FLAGS}>")
|
| 1051 |
+
|
| 1052 |
+
if (GGML_CUDA)
|
| 1053 |
+
list(APPEND CUDA_CXX_FLAGS ${ARCH_FLAGS})
|
| 1054 |
+
list(JOIN CUDA_CXX_FLAGS " " CUDA_CXX_FLAGS_JOINED) # pass host compiler flags as a single argument
|
| 1055 |
+
|
| 1056 |
+
if (NOT CUDA_CXX_FLAGS_JOINED STREQUAL "")
|
| 1057 |
+
list(APPEND CUDA_FLAGS -Xcompiler ${CUDA_CXX_FLAGS_JOINED})
|
| 1058 |
+
endif()
|
| 1059 |
+
|
| 1060 |
+
add_compile_options("$<$<COMPILE_LANGUAGE:CUDA>:${CUDA_FLAGS}>")
|
| 1061 |
+
endif()
|
| 1062 |
+
|
| 1063 |
+
if (MINGW)
|
| 1064 |
+
# Target Windows 8 for PrefetchVirtualMemory
|
| 1065 |
+
add_compile_definitions(_WIN32_WINNT=${GGML_WIN_VER})
|
| 1066 |
+
endif()
|
| 1067 |
+
|
| 1068 |
+
#
|
| 1069 |
+
# POSIX conformance
|
| 1070 |
+
#
|
| 1071 |
+
|
| 1072 |
+
# clock_gettime came in POSIX.1b (1993)
|
| 1073 |
+
# CLOCK_MONOTONIC came in POSIX.1-2001 / SUSv3 as optional
|
| 1074 |
+
# posix_memalign came in POSIX.1-2001 / SUSv3
|
| 1075 |
+
# M_PI is an XSI extension since POSIX.1-2001 / SUSv3, came in XPG1 (1985)
|
| 1076 |
+
add_compile_definitions(_XOPEN_SOURCE=600)
|
| 1077 |
+
|
| 1078 |
+
# Somehow in OpenBSD whenever POSIX conformance is specified
|
| 1079 |
+
# some string functions rely on locale_t availability,
|
| 1080 |
+
# which was introduced in POSIX.1-2008, forcing us to go higher
|
| 1081 |
+
if (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
|
| 1082 |
+
remove_definitions(-D_XOPEN_SOURCE=600)
|
| 1083 |
+
add_compile_definitions(_XOPEN_SOURCE=700)
|
| 1084 |
+
endif()
|
| 1085 |
+
|
| 1086 |
+
# Data types, macros and functions related to controlling CPU affinity and
|
| 1087 |
+
# some memory allocation are available on Linux through GNU extensions in libc
|
| 1088 |
+
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
| 1089 |
+
add_compile_definitions(_GNU_SOURCE)
|
| 1090 |
+
endif()
|
| 1091 |
+
|
| 1092 |
+
# RLIMIT_MEMLOCK came in BSD, is not specified in POSIX.1,
|
| 1093 |
+
# and on macOS its availability depends on enabling Darwin extensions
|
| 1094 |
+
# similarly on DragonFly, enabling BSD extensions is necessary
|
| 1095 |
+
if (
|
| 1096 |
+
CMAKE_SYSTEM_NAME MATCHES "Darwin" OR
|
| 1097 |
+
CMAKE_SYSTEM_NAME MATCHES "iOS" OR
|
| 1098 |
+
CMAKE_SYSTEM_NAME MATCHES "tvOS" OR
|
| 1099 |
+
CMAKE_SYSTEM_NAME MATCHES "DragonFly"
|
| 1100 |
+
)
|
| 1101 |
+
add_compile_definitions(_DARWIN_C_SOURCE)
|
| 1102 |
+
endif()
|
| 1103 |
+
|
| 1104 |
+
# alloca is a non-standard interface that is not visible on BSDs when
|
| 1105 |
+
# POSIX conformance is specified, but not all of them provide a clean way
|
| 1106 |
+
# to enable it in such cases
|
| 1107 |
+
if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
| 1108 |
+
add_compile_definitions(__BSD_VISIBLE)
|
| 1109 |
+
endif()
|
| 1110 |
+
if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
|
| 1111 |
+
add_compile_definitions(_NETBSD_SOURCE)
|
| 1112 |
+
endif()
|
| 1113 |
+
if (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
|
| 1114 |
+
add_compile_definitions(_BSD_SOURCE)
|
| 1115 |
+
endif()
|
| 1116 |
+
|
| 1117 |
+
if (WIN32)
|
| 1118 |
+
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
| 1119 |
+
|
| 1120 |
+
if (BUILD_SHARED_LIBS)
|
| 1121 |
+
# TODO: should not use this
|
| 1122 |
+
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
| 1123 |
+
endif()
|
| 1124 |
+
endif()
|
| 1125 |
+
|
| 1126 |
+
#
|
| 1127 |
+
# libraries
|
| 1128 |
+
#
|
| 1129 |
+
|
| 1130 |
+
# ggml
|
| 1131 |
+
|
| 1132 |
+
add_library(ggml
|
| 1133 |
+
../include/ggml.h
|
| 1134 |
+
../include/ggml-alloc.h
|
| 1135 |
+
../include/ggml-backend.h
|
| 1136 |
+
ggml.c
|
| 1137 |
+
ggml-alloc.c
|
| 1138 |
+
ggml-backend.c
|
| 1139 |
+
ggml-quants.c
|
| 1140 |
+
ggml-quants.h
|
| 1141 |
+
${GGML_SOURCES_CUDA} ${GGML_HEADERS_CUDA}
|
| 1142 |
+
${GGML_SOURCES_METAL} ${GGML_HEADERS_METAL}
|
| 1143 |
+
${GGML_SOURCES_RPC} ${GGML_HEADERS_RPC}
|
| 1144 |
+
${GGML_SOURCES_EXTRA} ${GGML_HEADERS_EXTRA}
|
| 1145 |
+
${GGML_SOURCES_SYCL} ${GGML_HEADERS_SYCL}
|
| 1146 |
+
${GGML_SOURCES_KOMPUTE} ${GGML_HEADERS_KOMPUTE}
|
| 1147 |
+
${GGML_SOURCES_VULKAN} ${GGML_HEADERS_VULKAN}
|
| 1148 |
+
${GGML_SOURCES_ROCM} ${GGML_HEADERS_ROCM}
|
| 1149 |
+
${GGML_SOURCES_BLAS} ${GGML_HEADERS_BLAS}
|
| 1150 |
+
${GGML_SOURCES_LLAMAFILE} ${GGML_HEADERS_LLAMAFILE}
|
| 1151 |
+
)
|
| 1152 |
+
|
| 1153 |
+
if (EMSCRIPTEN)
|
| 1154 |
+
set_target_properties(ggml PROPERTIES COMPILE_FLAGS "-msimd128")
|
| 1155 |
+
endif()
|
| 1156 |
+
|
| 1157 |
+
target_compile_definitions(ggml PUBLIC ${GGML_CDEF_PUBLIC})
|
| 1158 |
+
target_include_directories(ggml PUBLIC ../include)
|
| 1159 |
+
target_include_directories(ggml PRIVATE . ${GGML_EXTRA_INCLUDES})
|
| 1160 |
+
target_compile_features (ggml PRIVATE c_std_11) # don't bump
|
| 1161 |
+
|
| 1162 |
+
target_link_libraries(ggml PRIVATE Threads::Threads ${GGML_EXTRA_LIBS})
|
| 1163 |
+
|
| 1164 |
+
find_library(MATH_LIBRARY m)
|
| 1165 |
+
if (MATH_LIBRARY)
|
| 1166 |
+
target_link_libraries(ggml PRIVATE ${MATH_LIBRARY})
|
| 1167 |
+
endif()
|
| 1168 |
+
|
| 1169 |
+
if (BUILD_SHARED_LIBS)
|
| 1170 |
+
set_target_properties(ggml PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
| 1171 |
+
endif()
|
ggml-alloc.c → ggml/src/ggml-alloc.c
RENAMED
|
File without changes
|