release.yml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710
  1. name: Create Release
  2. on:
  3. workflow_dispatch: # allows manual triggering
  4. inputs:
  5. create_release:
  6. description: 'Create new release'
  7. required: true
  8. type: boolean
  9. push:
  10. branches:
  11. - master
  12. paths: ['.github/workflows/release.yml', '**/CMakeLists.txt', '**/.cmake', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m', '**/*.metal', '**/*.comp']
  13. concurrency:
  14. group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
  15. cancel-in-progress: true
  16. # Fine-grant permission
  17. # https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
  18. permissions:
  19. contents: write # for creating release
  20. env:
  21. BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
  22. CMAKE_ARGS: "-DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_TOOLS=ON -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON"
  23. jobs:
  24. macOS-arm64:
  25. runs-on: macos-14
  26. steps:
  27. - name: Clone
  28. id: checkout
  29. uses: actions/checkout@v4
  30. with:
  31. fetch-depth: 0
  32. - name: ccache
  33. uses: hendrikmuhs/ccache-action@v1.2.16
  34. with:
  35. key: macOS-latest-cmake-arm64
  36. evict-old-files: 1d
  37. - name: Dependencies
  38. id: depends
  39. continue-on-error: true
  40. run: |
  41. brew update
  42. brew install curl
  43. - name: Build
  44. id: cmake_build
  45. run: |
  46. sysctl -a
  47. cmake -B build \
  48. -DCMAKE_BUILD_RPATH="@loader_path" \
  49. -DLLAMA_FATAL_WARNINGS=ON \
  50. -DGGML_METAL_USE_BF16=ON \
  51. -DGGML_METAL_EMBED_LIBRARY=ON \
  52. -DGGML_RPC=ON \
  53. ${{ env.CMAKE_ARGS }}
  54. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  55. - name: Determine tag name
  56. id: tag
  57. uses: ./.github/actions/get-tag-name
  58. - name: Pack artifacts
  59. id: pack_artifacts
  60. run: |
  61. cp LICENSE ./build/bin/
  62. zip -r llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip ./build/bin/*
  63. - name: Upload artifacts
  64. uses: actions/upload-artifact@v4
  65. with:
  66. path: llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip
  67. name: llama-bin-macos-arm64.zip
  68. macOS-x64:
  69. runs-on: macos-13
  70. steps:
  71. - name: Clone
  72. id: checkout
  73. uses: actions/checkout@v4
  74. with:
  75. fetch-depth: 0
  76. - name: ccache
  77. uses: hendrikmuhs/ccache-action@v1.2.16
  78. with:
  79. key: macOS-latest-cmake-x64
  80. evict-old-files: 1d
  81. - name: Dependencies
  82. id: depends
  83. continue-on-error: true
  84. run: |
  85. brew update
  86. brew install curl
  87. - name: Build
  88. id: cmake_build
  89. run: |
  90. sysctl -a
  91. # Metal is disabled due to intermittent failures with Github runners not having a GPU:
  92. # https://github.com/ggml-org/llama.cpp/actions/runs/8635935781/job/23674807267#step:5:2313
  93. cmake -B build \
  94. -DCMAKE_BUILD_RPATH="@loader_path" \
  95. -DLLAMA_FATAL_WARNINGS=ON \
  96. -DGGML_METAL=OFF \
  97. -DGGML_RPC=ON
  98. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  99. - name: Determine tag name
  100. id: tag
  101. uses: ./.github/actions/get-tag-name
  102. - name: Pack artifacts
  103. id: pack_artifacts
  104. run: |
  105. cp LICENSE ./build/bin/
  106. zip -r llama-${{ steps.tag.outputs.name }}-bin-macos-x64.zip ./build/bin/*
  107. - name: Upload artifacts
  108. uses: actions/upload-artifact@v4
  109. with:
  110. path: llama-${{ steps.tag.outputs.name }}-bin-macos-x64.zip
  111. name: llama-bin-macos-x64.zip
  112. ubuntu-22-cpu:
  113. strategy:
  114. matrix:
  115. include:
  116. - build: 'x64'
  117. os: ubuntu-22.04
  118. - build: 'arm64'
  119. os: ubuntu-22.04-arm
  120. runs-on: ${{ matrix.os }}
  121. steps:
  122. - name: Clone
  123. id: checkout
  124. uses: actions/checkout@v4
  125. with:
  126. fetch-depth: 0
  127. - name: ccache
  128. uses: hendrikmuhs/ccache-action@v1.2.16
  129. with:
  130. key: ubuntu-cpu-cmake
  131. evict-old-files: 1d
  132. - name: Dependencies
  133. id: depends
  134. run: |
  135. sudo apt-get update
  136. sudo apt-get install build-essential libcurl4-openssl-dev
  137. - name: Build
  138. id: cmake_build
  139. run: |
  140. cmake -B build \
  141. -DLLAMA_FATAL_WARNINGS=ON \
  142. ${{ env.CMAKE_ARGS }}
  143. cmake --build build --config Release -j $(nproc)
  144. - name: Determine tag name
  145. id: tag
  146. uses: ./.github/actions/get-tag-name
  147. - name: Pack artifacts
  148. id: pack_artifacts
  149. run: |
  150. cp LICENSE ./build/bin/
  151. zip -r llama-${{ steps.tag.outputs.name }}-bin-ubuntu-${{ matrix.build }}.zip ./build/bin/*
  152. - name: Upload artifacts
  153. uses: actions/upload-artifact@v4
  154. with:
  155. path: llama-${{ steps.tag.outputs.name }}-bin-ubuntu-${{ matrix.build }}.zip
  156. name: llama-bin-ubuntu-${{ matrix.build }}.zip
  157. ubuntu-22-vulkan:
  158. runs-on: ubuntu-22.04
  159. steps:
  160. - name: Clone
  161. id: checkout
  162. uses: actions/checkout@v4
  163. with:
  164. fetch-depth: 0
  165. - name: ccache
  166. uses: hendrikmuhs/ccache-action@v1.2.16
  167. with:
  168. key: ubuntu-22-cmake-vulkan
  169. evict-old-files: 1d
  170. - name: Dependencies
  171. id: depends
  172. run: |
  173. wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
  174. sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
  175. sudo apt-get update -y
  176. sudo apt-get install -y build-essential mesa-vulkan-drivers vulkan-sdk libcurl4-openssl-dev
  177. - name: Build
  178. id: cmake_build
  179. run: |
  180. cmake -B build \
  181. -DGGML_VULKAN=ON \
  182. ${{ env.CMAKE_ARGS }}
  183. cmake --build build --config Release -j $(nproc)
  184. - name: Determine tag name
  185. id: tag
  186. uses: ./.github/actions/get-tag-name
  187. - name: Pack artifacts
  188. id: pack_artifacts
  189. run: |
  190. cp LICENSE ./build/bin/
  191. zip -r llama-${{ steps.tag.outputs.name }}-bin-ubuntu-vulkan-x64.zip ./build/bin/*
  192. - name: Upload artifacts
  193. uses: actions/upload-artifact@v4
  194. with:
  195. path: llama-${{ steps.tag.outputs.name }}-bin-ubuntu-vulkan-x64.zip
  196. name: llama-bin-ubuntu-vulkan-x64.zip
  197. windows:
  198. runs-on: windows-latest
  199. env:
  200. OPENBLAS_VERSION: 0.3.23
  201. VULKAN_VERSION: 1.4.309.0
  202. strategy:
  203. matrix:
  204. include:
  205. - build: 'cpu-x64'
  206. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/x64-windows-llvm.cmake -DGGML_NATIVE=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DGGML_OPENMP=OFF'
  207. #- build: 'openblas-x64'
  208. # defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/x64-windows-llvm.cmake -DGGML_NATIVE=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DGGML_OPENMP=OFF -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS -DBLAS_INCLUDE_DIRS="$env:RUNNER_TEMP/openblas/include" -DBLAS_LIBRARIES="$env:RUNNER_TEMP/openblas/lib/openblas.lib"'
  209. - build: 'vulkan-x64'
  210. defines: '-DGGML_NATIVE=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DGGML_VULKAN=ON'
  211. - build: 'cpu-arm64'
  212. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DGGML_NATIVE=OFF'
  213. - build: 'opencl-adreno-arm64'
  214. 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'
  215. steps:
  216. - name: Clone
  217. id: checkout
  218. uses: actions/checkout@v4
  219. with:
  220. fetch-depth: 0
  221. - name: ccache
  222. uses: hendrikmuhs/ccache-action@v1.2.16
  223. with:
  224. key: windows-latest-cmake-${{ matrix.build }}
  225. variant: ccache
  226. evict-old-files: 1d
  227. - name: Download OpenBLAS
  228. id: get_openblas
  229. if: ${{ matrix.build == 'openblas-x64' }}
  230. run: |
  231. 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"
  232. curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE"
  233. mkdir $env:RUNNER_TEMP/openblas
  234. tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas
  235. $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
  236. $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
  237. $lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe')
  238. & $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll
  239. - name: Install Vulkan SDK
  240. id: get_vulkan
  241. if: ${{ matrix.build == 'vulkan-x64' }}
  242. run: |
  243. 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"
  244. & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
  245. Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
  246. Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
  247. - name: Install Ninja
  248. id: install_ninja
  249. run: |
  250. choco install ninja
  251. - name: Install OpenCL Headers and Libs
  252. id: install_opencl
  253. if: ${{ matrix.build == 'opencl-adreno-arm64' }}
  254. run: |
  255. git clone https://github.com/KhronosGroup/OpenCL-Headers
  256. cd OpenCL-Headers
  257. cmake -B build `
  258. -DBUILD_TESTING=OFF `
  259. -DOPENCL_HEADERS_BUILD_TESTING=OFF `
  260. -DOPENCL_HEADERS_BUILD_CXX_TESTS=OFF `
  261. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  262. cmake --build build --target install
  263. git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader
  264. cd OpenCL-ICD-Loader
  265. cmake -B build-arm64-release `
  266. -A arm64 `
  267. -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" `
  268. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  269. cmake --build build-arm64-release --target install --config release
  270. - name: libCURL
  271. id: get_libcurl
  272. uses: ./.github/actions/windows-setup-curl
  273. - name: Build
  274. id: cmake_build
  275. env:
  276. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  277. run: |
  278. cmake -S . -B build ${{ matrix.defines }} `
  279. -DCURL_LIBRARY="$env:CURL_PATH/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:CURL_PATH/include" `
  280. ${{ env.CMAKE_ARGS }}
  281. cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}
  282. - name: Add libopenblas.dll
  283. id: add_libopenblas_dll
  284. if: ${{ matrix.build == 'openblas-x64' }}
  285. run: |
  286. cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll
  287. cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt
  288. - name: Determine tag name
  289. id: tag
  290. uses: ./.github/actions/get-tag-name
  291. - name: Pack artifacts
  292. id: pack_artifacts
  293. env:
  294. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  295. run: |
  296. Copy-Item $env:CURL_PATH\bin\libcurl-x64.dll .\build\bin\Release\libcurl-x64.dll
  297. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}.zip .\build\bin\Release\*
  298. - name: Upload artifacts
  299. uses: actions/upload-artifact@v4
  300. with:
  301. path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}.zip
  302. name: llama-bin-win-${{ matrix.build }}.zip
  303. windows-cuda:
  304. runs-on: windows-2019
  305. strategy:
  306. matrix:
  307. cuda: ['12.4', '11.7']
  308. steps:
  309. - name: Clone
  310. id: checkout
  311. uses: actions/checkout@v4
  312. with:
  313. fetch-depth: 0
  314. - name: Install ccache
  315. uses: hendrikmuhs/ccache-action@v1.2.16
  316. with:
  317. key: windows-cuda-${{ matrix.cuda }}
  318. variant: ccache
  319. evict-old-files: 1d
  320. - name: Install Cuda Toolkit
  321. uses: ./.github/actions/windows-setup-cuda
  322. with:
  323. cuda_version: ${{ matrix.cuda }}
  324. - name: Install Ninja
  325. id: install_ninja
  326. run: |
  327. choco install ninja
  328. - name: libCURL
  329. id: get_libcurl
  330. uses: ./.github/actions/windows-setup-curl
  331. - name: Build
  332. id: cmake_build
  333. shell: cmd
  334. env:
  335. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  336. run: |
  337. call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
  338. cmake -S . -B build -G "Ninja Multi-Config" ^
  339. -DGGML_NATIVE=OFF ^
  340. -DGGML_BACKEND_DL=ON ^
  341. -DGGML_CPU_ALL_VARIANTS=ON ^
  342. -DGGML_CUDA=ON ^
  343. -DCURL_LIBRARY="%CURL_PATH%/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="%CURL_PATH%/include" ^
  344. ${{ env.CMAKE_ARGS }}
  345. set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
  346. cmake --build build --config Release -j %NINJA_JOBS% -t ggml
  347. cmake --build build --config Release
  348. - name: Determine tag name
  349. id: tag
  350. uses: ./.github/actions/get-tag-name
  351. - name: Pack artifacts
  352. id: pack_artifacts
  353. env:
  354. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  355. run: |
  356. cp $env:CURL_PATH\bin\libcurl-x64.dll .\build\bin\Release\libcurl-x64.dll
  357. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip .\build\bin\Release\*
  358. - name: Upload artifacts
  359. uses: actions/upload-artifact@v4
  360. with:
  361. path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip
  362. name: llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  363. - name: Copy and pack Cuda runtime
  364. if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  365. run: |
  366. echo "Cuda install location: ${{ env.CUDA_PATH }}"
  367. $dst='.\build\bin\cudart\'
  368. robocopy "${{env.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
  369. robocopy "${{env.CUDA_PATH}}\lib" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
  370. 7z a cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip $dst\*
  371. - name: Upload Cuda runtime
  372. uses: actions/upload-artifact@v4
  373. with:
  374. path: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  375. name: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip
  376. windows-sycl:
  377. runs-on: windows-latest
  378. defaults:
  379. run:
  380. shell: bash
  381. env:
  382. 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.exe
  383. WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel
  384. ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI"
  385. steps:
  386. - name: Clone
  387. id: checkout
  388. uses: actions/checkout@v4
  389. with:
  390. fetch-depth: 0
  391. - name: ccache
  392. uses: hendrikmuhs/ccache-action@v1.2.16
  393. with:
  394. key: windows-latest-cmake-sycl
  395. variant: ccache
  396. evict-old-files: 1d
  397. - name: Install
  398. run: |
  399. scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
  400. # TODO: add libcurl support ; we will also need to modify win-build-sycl.bat to accept user-specified args
  401. - name: Build
  402. id: cmake_build
  403. run: examples/sycl/win-build-sycl.bat
  404. - name: Determine tag name
  405. id: tag
  406. uses: ./.github/actions/get-tag-name
  407. - name: Build the release package
  408. id: pack_artifacts
  409. run: |
  410. echo "cp oneAPI running time dll files in ${{ env.ONEAPI_ROOT }} to ./build/bin"
  411. cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_sycl_blas.5.dll" ./build/bin
  412. cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_core.2.dll" ./build/bin
  413. cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_tbb_thread.2.dll" ./build/bin
  414. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_adapter_level_zero.dll" ./build/bin
  415. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_adapter_opencl.dll" ./build/bin
  416. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_loader.dll" ./build/bin
  417. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_win_proxy_loader.dll" ./build/bin
  418. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/sycl8.dll" ./build/bin
  419. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/svml_dispmd.dll" ./build/bin
  420. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/libmmd.dll" ./build/bin
  421. cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/libiomp5md.dll" ./build/bin
  422. cp "${{ env.ONEAPI_ROOT }}/dnnl/latest/bin/dnnl.dll" ./build/bin
  423. cp "${{ env.ONEAPI_ROOT }}/tbb/latest/bin/tbb12.dll" ./build/bin
  424. echo "cp oneAPI running time dll files to ./build/bin done"
  425. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip ./build/bin/*
  426. - name: Upload the release package
  427. uses: actions/upload-artifact@v4
  428. with:
  429. path: llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip
  430. name: llama-bin-win-sycl-x64.zip
  431. windows-hip:
  432. runs-on: windows-latest
  433. strategy:
  434. matrix:
  435. gpu_target: [gfx1100, gfx1101, gfx1030]
  436. steps:
  437. - name: Clone
  438. id: checkout
  439. uses: actions/checkout@v4
  440. with:
  441. fetch-depth: 0
  442. - name: Clone rocWMMA repository
  443. id: clone_rocwmma
  444. run: |
  445. git clone https://github.com/rocm/rocwmma --branch rocm-6.2.4 --depth 1
  446. - name: ccache
  447. uses: hendrikmuhs/ccache-action@v1.2.16
  448. with:
  449. key: windows-latest-cmake-hip-release
  450. evict-old-files: 1d
  451. - name: Install
  452. id: depends
  453. run: |
  454. $ErrorActionPreference = "Stop"
  455. write-host "Downloading AMD HIP SDK Installer"
  456. 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"
  457. write-host "Installing AMD HIP SDK"
  458. Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -Wait
  459. write-host "Completed AMD HIP SDK installation"
  460. - name: Verify ROCm
  461. id: verify
  462. run: |
  463. & 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' --version
  464. - name: libCURL
  465. id: get_libcurl
  466. uses: ./.github/actions/windows-setup-curl
  467. - name: Build
  468. id: cmake_build
  469. env:
  470. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  471. run: |
  472. $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
  473. $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
  474. cmake -G "Unix Makefiles" -B build -S . `
  475. -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
  476. -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
  477. -DCMAKE_CXX_FLAGS="-I$($PWD.Path.Replace('\', '/'))/rocwmma/library/include/" `
  478. -DCMAKE_BUILD_TYPE=Release `
  479. -DAMDGPU_TARGETS=${{ matrix.gpu_target }} `
  480. -DGGML_HIP_ROCWMMA_FATTN=ON `
  481. -DGGML_HIP=ON `
  482. -DCURL_LIBRARY="$env:CURL_PATH/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:CURL_PATH/include" `
  483. ${{ env.CMAKE_ARGS }}
  484. cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
  485. md "build\bin\rocblas\library\"
  486. cp "${env:HIP_PATH}\bin\hipblas.dll" "build\bin\"
  487. cp "${env:HIP_PATH}\bin\rocblas.dll" "build\bin\"
  488. cp "${env:HIP_PATH}\bin\rocblas\library\*" "build\bin\rocblas\library\"
  489. - name: Determine tag name
  490. id: tag
  491. uses: ./.github/actions/get-tag-name
  492. - name: Pack artifacts
  493. id: pack_artifacts
  494. env:
  495. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  496. run: |
  497. cp $env:CURL_PATH\bin\libcurl-x64.dll .\build\bin\libcurl-x64.dll
  498. 7z a llama-${{ steps.tag.outputs.name }}-bin-win-hip-x64-${{ matrix.gpu_target }}.zip .\build\bin\*
  499. - name: Upload artifacts
  500. uses: actions/upload-artifact@v4
  501. with:
  502. path: llama-${{ steps.tag.outputs.name }}-bin-win-hip-x64-${{ matrix.gpu_target }}.zip
  503. name: llama-bin-win-hip-x64-${{ matrix.gpu_target }}.zip
  504. ios-xcode-build:
  505. runs-on: macos-latest
  506. steps:
  507. - name: Checkout code
  508. uses: actions/checkout@v4
  509. with:
  510. fetch-depth: 0
  511. - name: Build
  512. id: cmake_build
  513. run: |
  514. sysctl -a
  515. cmake -B build -G Xcode \
  516. -DGGML_METAL_USE_BF16=ON \
  517. -DGGML_METAL_EMBED_LIBRARY=ON \
  518. -DLLAMA_CURL=OFF \
  519. -DLLAMA_BUILD_EXAMPLES=OFF \
  520. -DLLAMA_BUILD_TOOLS=OFF \
  521. -DLLAMA_BUILD_TESTS=OFF \
  522. -DLLAMA_BUILD_SERVER=OFF \
  523. -DCMAKE_SYSTEM_NAME=iOS \
  524. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  525. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  526. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  527. - name: xcodebuild for swift package
  528. id: xcodebuild
  529. run: |
  530. ./build-xcframework.sh
  531. - name: Build Xcode project
  532. run: xcodebuild -project examples/llama.swiftui/llama.swiftui.xcodeproj -scheme llama.swiftui -sdk iphoneos CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= -destination 'generic/platform=iOS' FRAMEWORK_FOLDER_PATH=./build-ios build
  533. - name: Determine tag name
  534. id: tag
  535. uses: ./.github/actions/get-tag-name
  536. - name: Pack artifacts
  537. id: pack_artifacts
  538. run: |
  539. zip --symlinks -r llama-${{ steps.tag.outputs.name }}-xcframework.zip build-apple/llama.xcframework
  540. - name: Upload artifacts
  541. uses: actions/upload-artifact@v4
  542. with:
  543. path: llama-${{ steps.tag.outputs.name }}-xcframework.zip
  544. name: llama-${{ steps.tag.outputs.name }}-xcframework
  545. release:
  546. if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  547. runs-on: ubuntu-latest
  548. needs:
  549. - ubuntu-22-cpu
  550. - ubuntu-22-vulkan
  551. - windows
  552. - windows-cuda
  553. - windows-sycl
  554. - windows-hip
  555. - macOS-arm64
  556. - macOS-x64
  557. steps:
  558. - name: Clone
  559. id: checkout
  560. uses: actions/checkout@v4
  561. with:
  562. fetch-depth: 0
  563. - name: Determine tag name
  564. id: tag
  565. uses: ./.github/actions/get-tag-name
  566. - name: Download artifacts
  567. id: download-artifact
  568. uses: actions/download-artifact@v4
  569. with:
  570. path: ./artifact
  571. - name: Move artifacts
  572. id: move_artifacts
  573. run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release
  574. - name: Create release
  575. id: create_release
  576. uses: ggml-org/action-create-release@v1
  577. env:
  578. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  579. with:
  580. tag_name: ${{ steps.tag.outputs.name }}
  581. - name: Upload release
  582. id: upload_release
  583. uses: actions/github-script@v3
  584. with:
  585. github-token: ${{secrets.GITHUB_TOKEN}}
  586. script: |
  587. const path = require('path');
  588. const fs = require('fs');
  589. const release_id = '${{ steps.create_release.outputs.id }}';
  590. for (let file of await fs.readdirSync('./artifact/release')) {
  591. if (path.extname(file) === '.zip') {
  592. console.log('uploadReleaseAsset', file);
  593. await github.repos.uploadReleaseAsset({
  594. owner: context.repo.owner,
  595. repo: context.repo.repo,
  596. release_id: release_id,
  597. name: file,
  598. data: await fs.readFileSync(`./artifact/release/${file}`)
  599. });
  600. }
  601. }