char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Ludovic Henryci: Bump ggml-org/ccache-action to v1.2.24 (#28083)234a6ebaa

char/aliceai-t5-moe
6.2 KiB183 linesraw
1name: CI (CUDA, windows)
2
3# TODO: this workflow is only triggered manually because it is very heavy on the CI
4#       when we provision dedicated windows runners, we can enable it for pushes too
5# note: running this workflow manually will populate the ccache for the release builds
6#       this can be used before merging a PR to speed up the release workflow
7on:
8  workflow_dispatch: # allows manual triggering
9
10# note: this will run in queue with the release workflow
11concurrency:
12  group: release
13  queue: max
14
15env:
16  GH_TOKEN: ${{ github.token }}
17  GGML_NLOOP: 3
18  GGML_N_THREADS: 1
19  LLAMA_ARG_LOG_COLORS: 1
20  LLAMA_ARG_LOG_PREFIX: 1
21  LLAMA_ARG_LOG_TIMESTAMPS: 1
22
23jobs:
24  cuda:
25    name: windows-cuda (${{ matrix.cuda }}, ${{ matrix.arch }})
26    runs-on: windows-2022
27
28    permissions:
29      actions: write
30
31    strategy:
32      matrix:
33        include:
34          - cuda: '12.4'
35            arch: x64
36            defines: '-DGGML_CUDA_CUB_3DOT2=ON'
37          - cuda: '13.3'
38            arch: x64
39            defines: ''
40          - cuda: '13.4'
41            arch: arm64
42            defines: '-DCMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-msvc-cuda.cmake'
43
44    steps:
45      - name: Clone
46        id: checkout
47        uses: actions/checkout@v6
48
49      - name: ccache
50        uses: ggml-org/ccache-action@v1.2.24
51        with:
52          key: release-windows-2022-${{ matrix.arch }}-cuda-${{ matrix.cuda }}
53
54      - name: Install Cuda Toolkit
55        uses: ./.github/actions/windows-setup-cuda
56        with:
57          cuda_version: ${{ matrix.cuda }}
58          cuda_arch: ${{ matrix.arch }}
59
60      - name: Install Ninja
61        id: install_ninja
62        run: |
63          choco install ninja
64
65      - name: Build
66        id: cmake_build
67        shell: cmd
68        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%-1
77          cmake --build build --config Release -j %NINJA_JOBS% --target ggml-cuda
78
79      - name: ccache-clear
80        uses: ./.github/actions/ccache-clear
81        with:
82          key: release-windows-2022-${{ matrix.arch }}-cuda-${{ matrix.cuda }}
83
84  hip:
85    runs-on: windows-2022
86
87    permissions:
88      actions: write
89
90    env:
91      # Make sure this is in sync with build-cache.yml
92      ROCM_VERSION: "7.14.0"
93
94    strategy:
95      matrix:
96        include:
97          # sync with release.yml
98          - name: "radeon"
99            gpu_targets: "gfx1150;gfx1151;gfx1200;gfx1201;gfx1100;gfx1101;gfx1102;gfx1030;gfx1031;gfx1032"
100
101    steps:
102      - name: Clone
103        id: checkout
104        uses: actions/checkout@v6
105
106      # - name: Cache ROCm Installation
107      #   uses: actions/cache@v5
108      #   id: cache-rocm
109      #   with:
110      #     path: C:\TheRock\build
111      #     key: rocm-wheels-${{ env.ROCM_VERSION }}-multi-arch-${{ runner.os }}
112
113      - name: Setup ROCm
114        # if: steps.cache-rocm.outputs.cache-hit != 'true'
115        uses: ./.github/actions/windows-setup-rocm
116        with:
117          version: ${{ env.ROCM_VERSION }}
118
119      - name: Setup ROCm Environment
120        run: |
121          $ErrorActionPreference = "Stop"
122
123          # Activate venv from cache or fresh install
124          & C:\TheRock\build\.venv\Scripts\Activate.ps1
125
126          # Expand the devel tree (idempotent; no-op if already done during install)
127          rocm-sdk init
128          if ($LASTEXITCODE -ne 0) { throw "rocm-sdk init failed with exit code $LASTEXITCODE" }
129
130          # Get ROCm installation paths using the rocm-sdk CLI tool
131          $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_ENV
139          echo "CMAKE_PREFIX_PATH=$cmakePath" >> $env:GITHUB_ENV
140          echo "HIP_DEVICE_LIB_PATH=$rocmPath\lib\llvm\amdgcn\bitcode" >> $env:GITHUB_ENV
141          echo "HIP_PLATFORM=amd" >> $env:GITHUB_ENV
142          echo "LLVM_PATH=$rocmPath\lib\llvm" >> $env:GITHUB_ENV
143          echo "$binPath" >> $env:GITHUB_PATH
144
145          # Keep venv in PATH for subsequent steps
146          echo "C:\TheRock\build\.venv\Scripts" >> $env:GITHUB_PATH
147
148      - name: Verify ROCm
149        id: verify
150        run: |
151          # Test the ROCm clang shipped in the installed wheel
152          & "${env:HIP_PATH}\lib\llvm\bin\clang.exe" --version
153
154      - name: ccache
155        uses: ggml-org/ccache-action@v1.2.24
156        with:
157          # TODO: this build does not match the build in release.yml, so we use a different cache key
158          #       ideally, the builds should match, similar to the CUDA build above so that we would be able
159          #       to populate the ccache for the release with manual runs of this workflow
160          #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: Build
164        id: cmake_build
165        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=ON
177          cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
178
179      - name: ccache-clear
180        uses: ./.github/actions/ccache-clear
181        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 }}