Team Ai
Modelpublic

Felipe97/llama-cpp-compiled

sourceHugging Faceupdated 21d agoView on Hugging Face
0likes1.2kdownloads
build-cuda-windows.yml184 linesDownload Raw Back to workflows
1name: CI (CUDA, windows)2 3# TODO: this workflow is only triggered manually because it is very heavy on the CI4#       when we provision dedicated windows runners, we can enable it for pushes too5# note: running this workflow manually will populate the ccache for the release builds6#       this can be used before merging a PR to speed up the release workflow7on:8  workflow_dispatch: # allows manual triggering9 10# note: this will run in queue with the release workflow11concurrency:12  group: release13  queue: max14 15env:16  GH_TOKEN: ${{ github.token }}17  GGML_NLOOP: 318  GGML_N_THREADS: 119  LLAMA_ARG_LOG_COLORS: 120  LLAMA_ARG_LOG_PREFIX: 121  LLAMA_ARG_LOG_TIMESTAMPS: 122 23jobs:24  cuda:25    name: windows-cuda (${{ matrix.cuda }}, ${{ matrix.arch }})26    runs-on: windows-202227 28    permissions:29      actions: write30 31    strategy:32      matrix:33        include:34          - cuda: '12.4'35            arch: x6436            defines: '-DGGML_CUDA_CUB_3DOT2=ON'37          - cuda: '13.4'38            arch: x6439            defines: ''40          - cuda: '13.4'41            arch: arm6442            defines: '-DCMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-msvc-cuda.cmake'43 44    steps:45      - name: Clone46        id: checkout47        uses: actions/checkout@v648 49      - name: ccache50        uses: ggml-org/ccache-action@v1.2.2451        with:52          key: release-windows-2022-${{ matrix.arch }}-cuda-${{ matrix.cuda }}53 54      - name: Install Cuda Toolkit55        uses: ./.github/actions/windows-setup-cuda56        with:57          cuda_version: ${{ matrix.cuda }}58          cuda_arch: ${{ matrix.arch }}59 60      - name: Install Ninja61        id: install_ninja62        run: |63          choco install ninja64 65      - name: Build66        id: cmake_build67        shell: cmd68        run: |69          call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch == 'x64' && 'x64' || 'amd64_arm64' }}70          cmake -S . -B build -G "Ninja Multi-Config" ^71            -DGGML_BACKEND_DL=ON ^72            -DGGML_NATIVE=OFF ^73            -DGGML_CPU=OFF ^74            -DGGML_CUDA=ON ^75            -DLLAMA_BUILD_BORINGSSL=ON ${{ matrix.defines }}76          set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-177          cmake --build build --config Release -j %NINJA_JOBS% --target ggml-cuda78 79      - name: ccache-clear80        uses: ./.github/actions/ccache-clear81        with:82          key: release-windows-2022-${{ matrix.arch }}-cuda-${{ matrix.cuda }}83 84  hip:85    runs-on: windows-202286 87    permissions:88      actions: write89 90    env:91      # Make sure this is in sync with build-cache.yml92      ROCM_VERSION: "7.14.0"93 94    strategy:95      matrix:96        include:97          # sync with release.yml98          - name: "radeon"99            gpu_targets: "gfx1150;gfx1151;gfx1200;gfx1201;gfx1100;gfx1101;gfx1102;gfx1030;gfx1031;gfx1032"100 101    steps:102      - name: Clone103        id: checkout104        uses: actions/checkout@v6105 106      # - name: Cache ROCm Installation107      #   uses: actions/cache@v5108      #   id: cache-rocm109      #   with:110      #     path: C:\TheRock\build111      #     key: rocm-wheels-${{ env.ROCM_VERSION }}-multi-arch-${{ runner.os }}112 113      - name: Setup ROCm114        # if: steps.cache-rocm.outputs.cache-hit != 'true'115        uses: ./.github/actions/windows-setup-rocm116        with:117          version: ${{ env.ROCM_VERSION }}118 119      - name: Setup ROCm Environment120        run: |121          $ErrorActionPreference = "Stop"122 123          # Activate venv from cache or fresh install124          & C:\TheRock\build\.venv\Scripts\Activate.ps1125 126          # Expand the devel tree (idempotent; no-op if already done during install)127          rocm-sdk init128          if ($LASTEXITCODE -ne 0) { throw "rocm-sdk init failed with exit code $LASTEXITCODE" }129 130          # Get ROCm installation paths using the rocm-sdk CLI tool131          $rocmPath = (rocm-sdk path --root)132          if (-not $rocmPath) { throw "rocm-sdk path --root returned empty - devel package may not be installed" }133          $rocmPath = $rocmPath.Trim()134          $cmakePath = (rocm-sdk path --cmake).Trim()135          $binPath = (rocm-sdk path --bin).Trim()136          write-host "ROCm root: $rocmPath"137 138          echo "HIP_PATH=$rocmPath" >> $env:GITHUB_ENV139          echo "CMAKE_PREFIX_PATH=$cmakePath" >> $env:GITHUB_ENV140          echo "HIP_DEVICE_LIB_PATH=$rocmPath\lib\llvm\amdgcn\bitcode" >> $env:GITHUB_ENV141          echo "HIP_PLATFORM=amd" >> $env:GITHUB_ENV142          echo "LLVM_PATH=$rocmPath\lib\llvm" >> $env:GITHUB_ENV143          echo "$binPath" >> $env:GITHUB_PATH144 145          # Keep venv in PATH for subsequent steps146          echo "C:\TheRock\build\.venv\Scripts" >> $env:GITHUB_PATH147 148      - name: Verify ROCm149        id: verify150        run: |151          # Test the ROCm clang shipped in the installed wheel152          & "${env:HIP_PATH}\lib\llvm\bin\clang.exe" --version153 154      - name: ccache155        uses: ggml-org/ccache-action@v1.2.24156        with:157          # TODO: this build does not match the build in release.yml, so we use a different cache key158          #       ideally, the builds should match, similar to the CUDA build above so that we would be able159          #       to populate the ccache for the release with manual runs of this workflow160          #key: release-windows-2022-x64-hip-${{ env.ROCM_VERSION }}-${{ matrix.name }}161          key: cuda-windows-2022-x64-hip-${{ env.ROCM_VERSION }}-${{ matrix.name }}162 163      - name: Build164        id: cmake_build165        run: |166          cmake -G "Unix Makefiles" -B build -S . `167            -DCMAKE_PREFIX_PATH="${env:HIP_PATH}" `168            -DCMAKE_C_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" `169            -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang++.exe" `170            -DCMAKE_HIP_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" `171            -DCMAKE_BUILD_TYPE=Release `172            -DLLAMA_BUILD_BORINGSSL=ON `173            -DHIP_PATH="${env:HIP_PATH}" `174            -DGGML_HIP=ON `175            -DGPU_TARGETS="gfx1100" `176            -DGGML_RPC=ON177          cmake --build build -j ${env:NUMBER_OF_PROCESSORS}178 179      - name: ccache-clear180        uses: ./.github/actions/ccache-clear181        with:182          #key: release-windows-2022-x64-hip-${{ env.ROCM_VERSION }}-${{ matrix.name }}183          key: cuda-windows-2022-x64-hip-${{ env.ROCM_VERSION }}-${{ matrix.name }}184