KBaba7/llama.cpp
0
1name: CI2 3on:4 workflow_dispatch: # allows manual triggering5 inputs:6 create_release:7 description: 'Create new release'8 required: true9 type: boolean10 push:11 branches:12 - master13 paths: ['.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m', '**/*.metal', '**/*.comp']14 pull_request:15 types: [opened, synchronize, reopened]16 paths: ['.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m', '**/*.metal', '**/*.comp']17 18concurrency:19 group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}20 cancel-in-progress: true21 22# Fine-grant permission23# https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token24permissions:25 contents: write # for creating release26 27env:28 BRANCH_NAME: ${{ github.head_ref || github.ref_name }}29 GGML_NLOOP: 330 GGML_N_THREADS: 131 LLAMA_LOG_COLORS: 132 LLAMA_LOG_PREFIX: 133 LLAMA_LOG_TIMESTAMPS: 134 35jobs:36 macOS-latest-cmake-arm64:37 runs-on: macos-1438 39 steps:40 - name: Clone41 id: checkout42 uses: actions/checkout@v443 with:44 fetch-depth: 045 46 - name: ccache47 uses: hendrikmuhs/ccache-action@v1.2.1648 with:49 key: macOS-latest-cmake-arm6450 evict-old-files: 1d51 52 - name: Dependencies53 id: depends54 continue-on-error: true55 run: |56 brew update57 58 - name: Build59 id: cmake_build60 run: |61 sysctl -a62 cmake -B build \63 -DCMAKE_BUILD_RPATH="@loader_path" \64 -DLLAMA_FATAL_WARNINGS=ON \65 -DLLAMA_CURL=ON \66 -DGGML_METAL_USE_BF16=ON \67 -DGGML_METAL_EMBED_LIBRARY=ON \68 -DGGML_RPC=ON69 cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)70 71 - name: Test72 id: cmake_test73 run: |74 cd build75 ctest -L 'main|curl' --verbose --timeout 90076 77 - name: Determine tag name78 id: tag79 shell: bash80 run: |81 BUILD_NUMBER="$(git rev-list --count HEAD)"82 SHORT_HASH="$(git rev-parse --short=7 HEAD)"83 if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then84 echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT85 else86 SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')87 echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT88 fi89 90 - name: Pack artifacts91 id: pack_artifacts92 if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}93 run: |94 cp LICENSE ./build/bin/95 cp examples/run/linenoise.cpp/LICENSE ./build/bin/LICENSE.linenoise.cpp96 zip -r llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip ./build/bin/*97 98 - name: Upload artifacts99 if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}100 uses: actions/upload-artifact@v4101 with:102 path: llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip103 name: llama-bin-macos-arm64.zip104 105 macOS-latest-cmake-x64:106 runs-on: macos-13107 108 steps:109 - name: Clone110 id: checkout111 uses: actions/checkout@v4112 with:113 fetch-depth: 0114 115 - name: ccache116 uses: hendrikmuhs/ccache-action@v1.2.16117 with:118 key: macOS-latest-cmake-x64119 evict-old-files: 1d120 121 - name: Dependencies122 id: depends123 continue-on-error: true124 run: |125 brew update126 127 - name: Build128 id: cmake_build129 run: |130 sysctl -a131 # Metal is disabled due to intermittent failures with Github runners not having a GPU:132 # https://github.com/ggerganov/llama.cpp/actions/runs/8635935781/job/23674807267#step:5:2313133 cmake -B build \134 -DCMAKE_BUILD_RPATH="@loader_path" \135 -DLLAMA_FATAL_WARNINGS=ON \136 -DLLAMA_CURL=ON \137 -DGGML_METAL=OFF \138 -DGGML_RPC=ON139 cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)140 141 - name: Test142 id: cmake_test143 run: |144 cd build145 ctest -L main --verbose --timeout 900146 147 - name: Determine tag name148 id: tag149 shell: bash150 run: |151 BUILD_NUMBER="$(git rev-list --count HEAD)"152 SHORT_HASH="$(git rev-parse --short=7 HEAD)"153 if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then154 echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT155 else156 SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')157 echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT158 fi159 160 - name: Pack artifacts161 id: pack_artifacts162 if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}163 run: |164 cp LICENSE ./build/bin/165 cp examples/run/linenoise.cpp/LICENSE ./build/bin/LICENSE.linenoise.cpp166 zip -r llama-${{ steps.tag.outputs.name }}-bin-macos-x64.zip ./build/bin/*167 168 - name: Upload artifacts169 if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}170 uses: actions/upload-artifact@v4171 with:172 path: llama-${{ steps.tag.outputs.name }}-bin-macos-x64.zip173 name: llama-bin-macos-x64.zip174 175 ubuntu-cpu-cmake:176 runs-on: ubuntu-22.04177 178 steps:179 - name: Clone180 id: checkout181 uses: actions/checkout@v4182 with:183 fetch-depth: 0184 185 - name: ccache186 uses: hendrikmuhs/ccache-action@v1.2.16187 with:188 key: ubuntu-cpu-cmake189 evict-old-files: 1d190 191 - name: Dependencies192 id: depends193 run: |194 sudo apt-get update195 sudo apt-get install build-essential libcurl4-openssl-dev196 197 - name: Build198 id: cmake_build199 run: |200 cmake -B build \201 -DLLAMA_FATAL_WARNINGS=ON \202 -DLLAMA_CURL=ON \203 -DGGML_RPC=ON204 cmake --build build --config Release -j $(nproc)205 206 - name: Test207 id: cmake_test208 run: |209 cd build210 ctest -L 'main|curl' --verbose --timeout 900211 212 - name: Test llama2c conversion213 id: llama2c_test214 run: |215 cd build216 echo "Fetch tokenizer"217 wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin218 echo "Fetch llama2c model"219 wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin220 ./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf221 ./bin/llama-cli -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256222 223 - name: Determine tag name224 id: tag225 shell: bash226 run: |227 BUILD_NUMBER="$(git rev-list --count HEAD)"228 SHORT_HASH="$(git rev-parse --short=7 HEAD)"229 if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then230 echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT231 else232 SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')233 echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT234 fi235 236 - name: Pack artifacts237 id: pack_artifacts238 if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}239 run: |240 cp LICENSE ./build/bin/241 cp examples/run/linenoise.cpp/LICENSE ./build/bin/LICENSE.linenoise.cpp242 zip -r llama-${{ steps.tag.outputs.name }}-bin-ubuntu-x64.zip ./build/bin/*243 244 - name: Upload artifacts245 if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}246 uses: actions/upload-artifact@v4247 with:248 path: llama-${{ steps.tag.outputs.name }}-bin-ubuntu-x64.zip249 name: llama-bin-ubuntu-x64.zip250 251 ubuntu-latest-cmake-sanitizer:252 runs-on: ubuntu-latest253 254 continue-on-error: true255 256 strategy:257 matrix:258 sanitizer: [ADDRESS, THREAD, UNDEFINED]259 build_type: [Debug]260 261 steps:262 - name: Clone263 id: checkout264 uses: actions/checkout@v4265 266 - name: ccache267 uses: hendrikmuhs/ccache-action@v1.2.16268 with:269 key: ubuntu-latest-cmake-sanitizer-${{ matrix.sanitizer }}270 evict-old-files: 1d271 272 - name: Dependencies273 id: depends274 run: |275 sudo apt-get update276 sudo apt-get install build-essential277 278 - name: Build279 id: cmake_build280 if: ${{ matrix.sanitizer != 'THREAD' }}281 run: |282 cmake -B build \283 -DLLAMA_FATAL_WARNINGS=ON \284 -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \285 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}286 cmake --build build --config ${{ matrix.build_type }} -j $(nproc)287 288 - name: Build (no OpenMP)289 id: cmake_build_no_openmp290 if: ${{ matrix.sanitizer == 'THREAD' }}291 run: |292 cmake -B build \293 -DLLAMA_FATAL_WARNINGS=ON \294 -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \295 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \296 -DGGML_OPENMP=OFF297 cmake --build build --config ${{ matrix.build_type }} -j $(nproc)298 299 - name: Test300 id: cmake_test301 run: |302 cd build303 ctest -L main --verbose --timeout 900304 305 ubuntu-latest-llguidance:306 runs-on: ubuntu-latest307 308 steps:309 - name: Clone310 id: checkout311 uses: actions/checkout@v4312 313 - name: Dependencies314 id: depends315 run: |316 sudo apt-get update317 sudo apt-get install build-essential318 319 - name: Build320 id: cmake_build321 run: |322 mkdir build323 cd build324 cmake .. \325 -DLLAMA_FATAL_WARNINGS=ON \326 -DLLAMA_LLGUIDANCE=ON327 cmake --build . --config Release -j $(nproc)328 329 - name: Test330 id: cmake_test331 run: |332 cd build333 ctest -L main --verbose --timeout 900334 335 ubuntu-latest-cmake-rpc:336 runs-on: ubuntu-latest337 338 continue-on-error: true339 340 steps:341 - name: Clone342 id: checkout343 uses: actions/checkout@v4344 345 - name: ccache346 uses: hendrikmuhs/ccache-action@v1.2.16347 with:348 key: ubuntu-latest-cmake-rpc349 evict-old-files: 1d350 351 - name: Dependencies352 id: depends353 run: |354 sudo apt-get update355 sudo apt-get install build-essential356 357 - name: Build358 id: cmake_build359 run: |360 cmake -B build \361 -DGGML_RPC=ON362 cmake --build build --config Release -j $(nproc)363 364 - name: Test365 id: cmake_test366 run: |367 cd build368 ctest -L main --verbose369 370 ubuntu-22-cmake-vulkan:371 runs-on: ubuntu-22.04372 373 steps:374 - name: Clone375 id: checkout376 uses: actions/checkout@v4377 378 - name: ccache379 uses: hendrikmuhs/ccache-action@v1.2.16380 with:381 key: ubuntu-22-cmake-vulkan382 evict-old-files: 1d383 384 - name: Dependencies385 id: depends386 run: |387 wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -388 sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list389 sudo apt-get update -y390 sudo apt-get install -y build-essential mesa-vulkan-drivers vulkan-sdk391 392 - name: Build393 id: cmake_build394 run: |395 cmake -B build \396 -DGGML_VULKAN=ON397 cmake --build build --config Release -j $(nproc)398 399 - name: Test400 id: cmake_test401 run: |402 cd build403 # This is using llvmpipe and runs slower than other backends404 ctest -L main --verbose --timeout 1800405 406 ubuntu-22-cmake-hip:407 runs-on: ubuntu-22.04408 container: rocm/dev-ubuntu-22.04:6.0.2409 410 steps:411 - name: Clone412 id: checkout413 uses: actions/checkout@v4414 415 - name: Dependencies416 id: depends417 run: |418 sudo apt-get update419 sudo apt-get install -y build-essential git cmake rocblas-dev hipblas-dev420 421 - name: ccache422 uses: hendrikmuhs/ccache-action@v1.2.16423 with:424 key: ubuntu-22-cmake-hip425 evict-old-files: 1d426 427 - name: Build with native CMake HIP support428 id: cmake_build429 run: |430 cmake -B build -S . \431 -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \432 -DGGML_HIP=ON433 cmake --build build --config Release -j $(nproc)434 435 - name: Build with legacy HIP support436 id: cmake_build_legacy_hip437 run: |438 cmake -B build2 -S . \439 -DCMAKE_C_COMPILER=hipcc \440 -DCMAKE_CXX_COMPILER=hipcc \441 -DGGML_HIP=ON442 cmake --build build2 --config Release -j $(nproc)443 444 ubuntu-22-cmake-musa:445 runs-on: ubuntu-22.04446 container: mthreads/musa:rc3.1.0-devel-ubuntu22.04447 448 steps:449 - name: Clone450 id: checkout451 uses: actions/checkout@v4452 453 - name: Dependencies454 id: depends455 run: |456 apt-get update457 apt-get install -y build-essential git cmake libcurl4-openssl-dev458 459 - name: ccache460 uses: hendrikmuhs/ccache-action@v1.2.16461 with:462 key: ubuntu-22-cmake-musa463 evict-old-files: 1d464 465 - name: Build with native CMake MUSA support466 id: cmake_build467 run: |468 cmake -B build -S . \469 -DGGML_MUSA=ON470 cmake --build build --config Release -j $(nproc)471 472 ubuntu-22-cmake-sycl:473 runs-on: ubuntu-22.04474 475 continue-on-error: true476 477 steps:478 - uses: actions/checkout@v4479 480 - name: add oneAPI to apt481 shell: bash482 run: |483 cd /tmp484 wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB485 sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB486 rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB487 sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"488 489 - name: install oneAPI dpcpp compiler490 shell: bash491 run: |492 sudo apt update493 sudo apt install intel-oneapi-compiler-dpcpp-cpp494 495 - name: install oneAPI MKL library496 shell: bash497 run: |498 sudo apt install intel-oneapi-mkl-devel499 500 - name: Clone501 id: checkout502 uses: actions/checkout@v4503 504 - name: ccache505 uses: hendrikmuhs/ccache-action@v1.2.16506 with:507 key: ubuntu-22-cmake-sycl508 evict-old-files: 1d509 510 - name: Build511 id: cmake_build512 run: |513 source /opt/intel/oneapi/setvars.sh514 cmake -B build \515 -DGGML_SYCL=ON \516 -DCMAKE_C_COMPILER=icx \517 -DCMAKE_CXX_COMPILER=icpx518 cmake --build build --config Release -j $(nproc)519 520 ubuntu-22-cmake-sycl-fp16:521 runs-on: ubuntu-22.04522 523 continue-on-error: true524 525 steps:526 - uses: actions/checkout@v4527 528 - name: add oneAPI to apt529 shell: bash530 run: |531 cd /tmp532 wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB533 sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB534 rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB535 sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"536 537 - name: install oneAPI dpcpp compiler538 shell: bash539 run: |540 sudo apt update541 sudo apt install intel-oneapi-compiler-dpcpp-cpp542 543 - name: install oneAPI MKL library544 shell: bash545 run: |546 sudo apt install intel-oneapi-mkl-devel547 548 - name: Clone549 id: checkout550 uses: actions/checkout@v4551 552 - name: ccache553 uses: hendrikmuhs/ccache-action@v1.2.16554 with:555 key: ubuntu-22-cmake-sycl-fp16556 evict-old-files: 1d557 558 - name: Build559 id: cmake_build560 run: |561 source /opt/intel/oneapi/setvars.sh562 cmake -B build \563 -DGGML_SYCL=ON \564 -DCMAKE_C_COMPILER=icx \565 -DCMAKE_CXX_COMPILER=icpx \566 -DGGML_SYCL_F16=ON567 cmake --build build --config Release -j $(nproc)568 569 macOS-latest-cmake-ios:570 runs-on: macos-latest571 572 steps:573 - name: Clone574 id: checkout575 uses: actions/checkout@v4576 577 - name: ccache578 uses: hendrikmuhs/ccache-action@v1.2.16579 with:580 key: macOS-latest-cmake-ios581 evict-old-files: 1d582 583 - name: Dependencies584 id: depends585 continue-on-error: true586 run: |587 brew update588 589 - name: Build590 id: cmake_build591 run: |592 sysctl -a593 cmake -B build -G Xcode \594 -DGGML_METAL_USE_BF16=ON \595 -DGGML_METAL_EMBED_LIBRARY=ON \596 -DLLAMA_BUILD_EXAMPLES=OFF \597 -DLLAMA_BUILD_TESTS=OFF \598 -DLLAMA_BUILD_SERVER=OFF \599 -DCMAKE_SYSTEM_NAME=iOS \600 -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \601 -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml602 cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO603 604 macOS-latest-cmake-tvos:605 runs-on: macos-latest606 607 steps:608 - name: Clone609 id: checkout610 uses: actions/checkout@v4611 612 - name: ccache613 uses: hendrikmuhs/ccache-action@v1.2.16614 with:615 key: macOS-latest-cmake-tvos616 evict-old-files: 1d617 618 - name: Dependencies619 id: depends620 continue-on-error: true621 run: |622 brew update623 624 - name: Build625 id: cmake_build626 run: |627 sysctl -a628 cmake -B build -G Xcode \629 -DGGML_METAL_USE_BF16=ON \630 -DGGML_METAL_EMBED_LIBRARY=ON \631 -DLLAMA_BUILD_EXAMPLES=OFF \632 -DLLAMA_BUILD_TESTS=OFF \633 -DLLAMA_BUILD_SERVER=OFF \634 -DCMAKE_SYSTEM_NAME=tvOS \635 -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \636 -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml637 cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO638 639 macOS-latest-swift:640 runs-on: macos-latest641 642 strategy:643 matrix:644 destination: ['generic/platform=macOS', 'generic/platform=iOS', 'generic/platform=tvOS']645 646 steps:647 - name: Clone648 id: checkout649 uses: actions/checkout@v4650 651 - name: ccache652 uses: hendrikmuhs/ccache-action@v1.2.16653 with:654 key: macOS-latest-swift655 evict-old-files: 1d656 657 - name: Dependencies658 id: depends659 continue-on-error: true660 run: |661 brew update662 663 - name: Build llama.cpp with CMake664 id: cmake_build665 run: |666 sysctl -a667 cmake -B build -G Xcode \668 -DGGML_METAL_USE_BF16=ON \669 -DGGML_METAL_EMBED_LIBRARY=ON \670 -DLLAMA_BUILD_EXAMPLES=OFF \671 -DLLAMA_BUILD_TESTS=OFF \672 -DLLAMA_BUILD_SERVER=OFF \673 -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"674 cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)675 sudo cmake --install build --config Release676 677 - name: xcodebuild for swift package678 id: xcodebuild679 run: |680 xcodebuild -scheme llama-Package -destination "${{ matrix.destination }}"681 682 windows-msys2:683 runs-on: windows-latest684 685 strategy:686 fail-fast: false687 matrix:688 include:689 - { sys: UCRT64, env: ucrt-x86_64, build: Release }690 - { sys: CLANG64, env: clang-x86_64, build: Release }691 692 steps:693 - name: Clone694 uses: actions/checkout@v4695 696 - name: ccache697 uses: hendrikmuhs/ccache-action@v1.2.16698 with:699 key: windows-msys2700 variant: sccache701 evict-old-files: 1d702 703 - name: Setup ${{ matrix.sys }}704 uses: msys2/setup-msys2@v2705 with:706 update: true707 msystem: ${{matrix.sys}}708 install: >-709 base-devel710 git711 mingw-w64-${{matrix.env}}-toolchain712 mingw-w64-${{matrix.env}}-cmake713 mingw-w64-${{matrix.env}}-openblas714 715 - name: Build using CMake716 shell: msys2 {0}717 run: |718 cmake -B build719 cmake --build build --config ${{ matrix.build }} -j $(nproc)720 721 - name: Clean after building using CMake722 shell: msys2 {0}723 run: |724 rm -rf build725 726 - name: Build using CMake w/ OpenBLAS727 shell: msys2 {0}728 run: |729 cmake -B build -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS730 cmake --build build --config ${{ matrix.build }} -j $(nproc)731 732 windows-latest-cmake:733 runs-on: windows-latest734 735 env:736 OPENBLAS_VERSION: 0.3.23737 SDE_VERSION: 9.33.0-2024-01-07738 VULKAN_VERSION: 1.3.261.1739 740 strategy:741 matrix:742 include:743 - build: 'noavx-x64'744 defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF'745 - build: 'avx2-x64'746 defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON'747 - build: 'avx-x64'748 defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_AVX2=OFF'749 - build: 'avx512-x64'750 defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_AVX512=ON'751 - build: 'openblas-x64'752 defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS -DBLAS_INCLUDE_DIRS="$env:RUNNER_TEMP/openblas/include" -DBLAS_LIBRARIES="$env:RUNNER_TEMP/openblas/lib/openblas.lib"'753 - build: 'kompute-x64'754 defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_KOMPUTE=ON -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON'755 - build: 'vulkan-x64'756 defines: '-DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_VULKAN=ON'757 - build: 'llvm-arm64'758 defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON'759 - build: 'msvc-arm64'760 defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-msvc.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON'761 - build: 'llvm-arm64-opencl-adreno'762 defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" -DGGML_OPENCL=ON -DGGML_OPENCL_USE_ADRENO_KERNELS=ON'763 764 steps:765 - name: Clone766 id: checkout767 uses: actions/checkout@v4768 with:769 fetch-depth: 0770 771 - name: ccache772 uses: hendrikmuhs/ccache-action@v1.2.16773 with:774 key: windows-latest-cmake-${{ matrix.build }}775 variant: sccache776 evict-old-files: 1d777 778 - name: Clone Kompute submodule779 id: clone_kompute780 if: ${{ matrix.build == 'kompute-x64' }}781 run: |782 git submodule update --init ggml/src/ggml-kompute/kompute783 784 - name: Download OpenBLAS785 id: get_openblas786 if: ${{ matrix.build == 'openblas-x64' }}787 run: |788 curl.exe -o $env:RUNNER_TEMP/openblas.zip -L "https://github.com/xianyi/OpenBLAS/releases/download/v${env:OPENBLAS_VERSION}/OpenBLAS-${env:OPENBLAS_VERSION}-x64.zip"789 curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE"790 mkdir $env:RUNNER_TEMP/openblas791 tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas792 $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)793 $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))794 $lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe')795 & $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll796 797 - name: Install Vulkan SDK798 id: get_vulkan799 if: ${{ matrix.build == 'kompute-x64' || matrix.build == 'vulkan-x64' }}800 run: |801 curl.exe -o $env:RUNNER_TEMP/VulkanSDK-Installer.exe -L "https://sdk.lunarg.com/sdk/download/${env:VULKAN_VERSION}/windows/VulkanSDK-${env:VULKAN_VERSION}-Installer.exe"802 & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install803 Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"804 Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"805 806 - name: Install Ninja807 id: install_ninja808 run: |809 choco install ninja810 811 - name: Install OpenCL Headers and Libs812 id: install_opencl813 if: ${{ matrix.build == 'llvm-arm64-opencl-adreno' }}814 run: |815 git clone https://github.com/KhronosGroup/OpenCL-Headers816 cd OpenCL-Headers817 cmake -B build `818 -DBUILD_TESTING=OFF `819 -DOPENCL_HEADERS_BUILD_TESTING=OFF `820 -DOPENCL_HEADERS_BUILD_CXX_TESTS=OFF `821 -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"822 cmake --build build --target install823 git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader824 cd OpenCL-ICD-Loader825 cmake -B build-arm64-release `826 -A arm64 `827 -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" `828 -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"829 cmake --build build-arm64-release --target install --config release830 831 - name: Build832 id: cmake_build833 run: |834 cmake -S . -B build ${{ matrix.defines }}835 cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}836 837 - name: Add libopenblas.dll838 id: add_libopenblas_dll839 if: ${{ matrix.build == 'openblas-x64' }}840 run: |841 cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll842 cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt843 844 - name: Check AVX512F support845 id: check_avx512f846 if: ${{ matrix.build == 'avx512-x64' }}847 continue-on-error: true848 run: |849 cd build850 $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)851 $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))852 $cl = $(join-path $msvc 'bin\Hostx64\x64\cl.exe')853 echo 'int main(void){unsigned int a[4];__cpuid(a,7);return !(a[1]&65536);}' >> avx512f.c854 & $cl /O2 /GS- /kernel avx512f.c /link /nodefaultlib /entry:main855 .\avx512f.exe && echo "AVX512F: YES" && ( echo HAS_AVX512F=1 >> $env:GITHUB_ENV ) || echo "AVX512F: NO"856 857 - name: Test858 id: cmake_test859 # not all machines have native AVX-512860 if: ${{ matrix.build != 'msvc-arm64' && matrix.build != 'llvm-arm64' && matrix.build != 'llvm-arm64-opencl-adreno' && matrix.build != 'kompute-x64' && matrix.build != 'vulkan-x64' && (matrix.build != 'avx512-x64' || env.HAS_AVX512F == '1') }}861 run: |862 cd build863 ctest -L main -C Release --verbose --timeout 900864 865 - name: Test (Intel SDE)866 id: cmake_test_sde867 if: ${{ matrix.build == 'avx512-x64' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation868 run: |869 curl.exe -o $env:RUNNER_TEMP/sde.tar.xz -L "https://downloadmirror.intel.com/813591/sde-external-${env:SDE_VERSION}-win.tar.xz"870 # for some weird reason windows tar doesn't like sde tar.xz871 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar.xz872 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar873 $sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe)874 cd build875 $env:LLAMA_SKIP_TESTS_SLOW_ON_EMULATOR = 1876 & $sde -future -- ctest -L main -C Release --verbose --timeout 900877 878 - name: Determine tag name879 id: tag880 shell: bash881 run: |882 BUILD_NUMBER="$(git rev-list --count HEAD)"883 SHORT_HASH="$(git rev-parse --short=7 HEAD)"884 if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then885 echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT886 else887 SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')888 echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT889 fi890 891 - name: Pack artifacts892 id: pack_artifacts893 if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}894 run: |895 Copy-Item LICENSE .\build\bin\Release\llama.cpp.txt896 Copy-Item .\examples\run\linenoise.cpp\LICENSE .\build\bin\Release\linenoise.cpp.txt897 7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}.zip .\build\bin\Release\*898 899 - name: Upload artifacts900 if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}901 uses: actions/upload-artifact@v4902 with:903 path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}.zip904 name: llama-bin-win-${{ matrix.build }}.zip905 906 ubuntu-latest-cmake-cuda:907 runs-on: ubuntu-latest908 container: nvidia/cuda:12.6.2-devel-ubuntu24.04909 910 steps:911 - name: Clone912 id: checkout913 uses: actions/checkout@v4914 with:915 fetch-depth: 0916 917 - name: Install dependencies918 env:919 DEBIAN_FRONTEND: noninteractive920 run: |921 apt update922 apt install -y cmake build-essential ninja-build libgomp1 git923 924 - name: ccache925 uses: hendrikmuhs/ccache-action@v1.2.16926 with:927 key: ubuntu-latest-cmake-cuda928 evict-old-files: 1d929 930 - name: Build with CMake931 run: |932 cmake -S . -B build -G Ninja \933 -DCMAKE_BUILD_TYPE=Release \934 -DCMAKE_CUDA_ARCHITECTURES=89-real \935 -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined \936 -DLLAMA_FATAL_WARNINGS=ON \937 -DGGML_NATIVE=OFF \938 -DGGML_CUDA=ON939 cmake --build build940 941 windows-2019-cmake-cuda:942 runs-on: windows-2019943 944 strategy:945 matrix:946 cuda: ['12.4', '11.7']947 build: ['cuda']948 949 steps:950 - name: Clone951 id: checkout952 uses: actions/checkout@v4953 with:954 fetch-depth: 0955 956 - name: Install ccache957 uses: hendrikmuhs/ccache-action@v1.2.16958 with:959 key: ${{ github.job }}-${{ matrix.cuda }}-${{ matrix.build }}960 variant: sccache961 evict-old-files: 1d962 963 - name: Install Cuda Toolkit 11.7964 if: ${{ matrix.cuda == '11.7' }}965 run: |966 mkdir -p "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7"967 choco install unzip -y968 curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_cudart/windows-x86_64/cuda_cudart-windows-x86_64-11.7.99-archive.zip"969 curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvcc/windows-x86_64/cuda_nvcc-windows-x86_64-11.7.99-archive.zip"970 curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvrtc/windows-x86_64/cuda_nvrtc-windows-x86_64-11.7.99-archive.zip"971 curl -O "https://developer.download.nvidia.com/compute/cuda/redist/libcublas/windows-x86_64/libcublas-windows-x86_64-11.7.4.6-archive.zip"972 curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvtx/windows-x86_64/cuda_nvtx-windows-x86_64-11.7.91-archive.zip"973 curl -O "https://developer.download.nvidia.com/compute/cuda/redist/visual_studio_integration/windows-x86_64/visual_studio_integration-windows-x86_64-11.7.91-archive.zip"974 curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvprof/windows-x86_64/cuda_nvprof-windows-x86_64-11.7.101-archive.zip"975 curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_cccl/windows-x86_64/cuda_cccl-windows-x86_64-11.7.91-archive.zip"976 unzip '*.zip' -d "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7"977 xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\cuda_cudart-windows-x86_64-11.7.99-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" /E /I /H /Y978 xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\cuda_nvcc-windows-x86_64-11.7.99-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" /E /I /H /Y979 xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\cuda_nvrtc-windows-x86_64-11.7.99-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" /E /I /H /Y980 xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\libcublas-windows-x86_64-11.7.4.6-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" /E /I /H /Y981 xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\cuda_nvtx-windows-x86_64-11.7.91-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" /E /I /H /Y982 xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\visual_studio_integration-windows-x86_64-11.7.91-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" /E /I /H /Y983 xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\cuda_nvprof-windows-x86_64-11.7.101-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" /E /I /H /Y984 xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\cuda_cccl-windows-x86_64-11.7.91-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" /E /I /H /Y985 echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append986 echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\libnvvp" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append987 echo "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8988 echo "CUDA_PATH_V11_7=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8989 990 - name: Install Cuda Toolkit 12.4991 if: ${{ matrix.cuda == '12.4' }}992 run: |993 mkdir -p "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4"994 choco install unzip -y995 curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_cudart/windows-x86_64/cuda_cudart-windows-x86_64-12.4.127-archive.zip"996 curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvcc/windows-x86_64/cuda_nvcc-windows-x86_64-12.4.131-archive.zip"997 curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvrtc/windows-x86_64/cuda_nvrtc-windows-x86_64-12.4.127-archive.zip"998 curl -O "https://developer.download.nvidia.com/compute/cuda/redist/libcublas/windows-x86_64/libcublas-windows-x86_64-12.4.5.8-archive.zip"999 curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvtx/windows-x86_64/cuda_nvtx-windows-x86_64-12.4.127-archive.zip"1000 curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_profiler_api/windows-x86_64/cuda_profiler_api-windows-x86_64-12.4.127-archive.zip"1001 curl -O "https://developer.download.nvidia.com/compute/cuda/redist/visual_studio_integration/windows-x86_64/visual_studio_integration-windows-x86_64-12.4.127-archive.zip"1002 curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvprof/windows-x86_64/cuda_nvprof-windows-x86_64-12.4.127-archive.zip"1003 curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_cccl/windows-x86_64/cuda_cccl-windows-x86_64-12.4.127-archive.zip"1004 unzip '*.zip' -d "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4"1005 xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\cuda_cudart-windows-x86_64-12.4.127-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y1006 xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\cuda_nvcc-windows-x86_64-12.4.131-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y1007 xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\cuda_nvrtc-windows-x86_64-12.4.127-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y1008 xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\libcublas-windows-x86_64-12.4.5.8-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y1009 xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\cuda_nvtx-windows-x86_64-12.4.127-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y1010 xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\cuda_profiler_api-windows-x86_64-12.4.127-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y1011 xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\visual_studio_integration-windows-x86_64-12.4.127-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y1012 xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\cuda_nvprof-windows-x86_64-12.4.127-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y1013 xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\cuda_cccl-windows-x86_64-12.4.127-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" /E /I /H /Y1014 echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append1015 echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\libnvvp" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append1016 echo "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf81017 echo "CUDA_PATH_V12_4=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf81018 1019 - name: Install Ninja1020 id: install_ninja1021 run: |1022 choco install ninja1023 1024 - name: Build1025 id: cmake_build1026 shell: cmd1027 run: |1028 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"1029 cmake -S . -B build -G "Ninja Multi-Config" ^1030 -DLLAMA_BUILD_SERVER=ON ^1031 -DGGML_NATIVE=OFF ^1032 -DGGML_CUDA=ON ^1033 -DGGML_RPC=ON1034 set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-11035 cmake --build build --config Release -j %NINJA_JOBS% -t ggml1036 cmake --build build --config Release1037 1038 - name: Determine tag name1039 id: tag1040 shell: bash1041 run: |1042 BUILD_NUMBER="$(git rev-list --count HEAD)"1043 SHORT_HASH="$(git rev-parse --short=7 HEAD)"1044 if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then1045 echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT1046 else1047 SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')1048 echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT1049 fi1050 1051 - name: Pack artifacts1052 id: pack_artifacts1053 if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}1054 run: |1055 7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip .\build\bin\Release\*1056 1057 - name: Upload artifacts1058 if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}1059 uses: actions/upload-artifact@v41060 with:1061 path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip1062 name: llama-bin-win-cu${{ matrix.cuda }}-x64.zip1063 1064 - name: Copy and pack Cuda runtime1065 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}1066 run: |1067 echo "Cuda install location: ${{ env.CUDA_PATH }}"1068 $dst='.\build\bin\cudart\'1069 robocopy "${{env.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll1070 robocopy "${{env.CUDA_PATH}}\lib" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll1071 7z a cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip $dst\*1072 1073 - name: Upload Cuda runtime1074 if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}1075 uses: actions/upload-artifact@v41076 with:1077 path: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip1078 name: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip1079 1080 windows-latest-cmake-sycl:1081 runs-on: windows-latest1082 1083 defaults:1084 run:1085 shell: bash1086 1087 env:1088 WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/b380d914-366b-4b77-a74a-05e3c38b3514/intel-oneapi-base-toolkit-2025.0.0.882_offline.exe1089 WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel1090 ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI"1091 steps:1092 - name: Clone1093 id: checkout1094 uses: actions/checkout@v41095 with:1096 fetch-depth: 01097 1098 - name: ccache1099 uses: hendrikmuhs/ccache-action@v1.2.161100 with:1101 key: windows-latest-cmake-sycl1102 variant: sccache1103 evict-old-files: 1d1104 1105 - name: Install1106 run: |1107 scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL1108 1109 - name: Build1110 id: cmake_build1111 run: examples/sycl/win-build-sycl.bat1112 1113 - name: Determine tag name1114 id: tag1115 shell: bash1116 run: |1117 BUILD_NUMBER="$(git rev-list --count HEAD)"1118 SHORT_HASH="$(git rev-parse --short=7 HEAD)"1119 if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then1120 echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT1121 else1122 SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')1123 echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT1124 fi1125 1126 - name: Build the release package1127 id: pack_artifacts1128 if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}1129 run: |1130 echo "cp oneAPI running time dll files in ${{ env.ONEAPI_ROOT }} to ./build/bin"1131 1132 cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_sycl_blas.5.dll" ./build/bin1133 cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_core.2.dll" ./build/bin1134 cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_tbb_thread.2.dll" ./build/bin1135 1136 cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_adapter_level_zero.dll" ./build/bin1137 cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_adapter_opencl.dll" ./build/bin1138 cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_loader.dll" ./build/bin1139 cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_win_proxy_loader.dll" ./build/bin1140 1141 cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/sycl8.dll" ./build/bin1142 cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/svml_dispmd.dll" ./build/bin1143 cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/libmmd.dll" ./build/bin1144 cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/libiomp5md.dll" ./build/bin1145 1146 cp "${{ env.ONEAPI_ROOT }}/dnnl/latest/bin/dnnl.dll" ./build/bin1147 cp "${{ env.ONEAPI_ROOT }}/tbb/latest/bin/tbb12.dll" ./build/bin1148 1149 echo "cp oneAPI running time dll files to ./build/bin done"1150 7z a llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip ./build/bin/*1151 1152 - name: Upload the release package1153 if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}1154 uses: actions/upload-artifact@v41155 with:1156 path: llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip1157 name: llama-bin-win-sycl-x64.zip1158 1159 windows-latest-cmake-hip:1160 if: ${{ github.event.inputs.create_release != 'true' }}1161 runs-on: windows-latest1162 1163 steps:1164 - name: Clone1165 id: checkout1166 uses: actions/checkout@v41167 1168 - name: Install1169 id: depends1170 run: |1171 $ErrorActionPreference = "Stop"1172 write-host "Downloading AMD HIP SDK Installer"1173 Invoke-WebRequest -Uri "https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-24.Q3-WinSvr2022-For-HIP.exe" -OutFile "${env:RUNNER_TEMP}\rocm-install.exe"1174 write-host "Installing AMD HIP SDK"1175 Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -Wait1176 write-host "Completed AMD HIP SDK installation"1177 1178 - name: Verify ROCm1179 id: verify1180 run: |1181 & 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' --version1182 1183 - name: Install ccache1184 uses: hendrikmuhs/ccache-action@v1.2.161185 with:1186 key: ${{ github.job }}1187 evict-old-files: 1d1188 1189 - name: Build1190 id: cmake_build1191 run: |1192 $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)1193 $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"1194 cmake -G "Unix Makefiles" -B build -S . `1195 -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `1196 -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `1197 -DCMAKE_BUILD_TYPE=Release `1198 -DGGML_HIP=ON `1199 -DGGML_RPC=ON1200 cmake --build build -j ${env:NUMBER_OF_PROCESSORS}