build.yml 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249
  1. name: CI
  2. on:
  3. workflow_dispatch: # allows manual triggering
  4. push:
  5. branches:
  6. - master
  7. paths: [
  8. '.github/workflows/build.yml',
  9. '.github/workflows/build-linux-cross.yml',
  10. '.github/workflows/build-cmake-pkg.yml',
  11. '**/CMakeLists.txt',
  12. '**/.cmake',
  13. '**/*.h',
  14. '**/*.hpp',
  15. '**/*.c',
  16. '**/*.cpp',
  17. '**/*.cu',
  18. '**/*.cuh',
  19. '**/*.swift',
  20. '**/*.m',
  21. '**/*.metal',
  22. '**/*.comp'
  23. ]
  24. pull_request:
  25. types: [opened, synchronize, reopened]
  26. paths: [
  27. '.github/workflows/build.yml',
  28. '.github/workflows/build-linux-cross.yml',
  29. '.github/workflows/build-cmake-pkg.yml',
  30. '**/CMakeLists.txt',
  31. '**/.cmake',
  32. '**/*.h',
  33. '**/*.hpp',
  34. '**/*.c',
  35. '**/*.cpp',
  36. '**/*.cu',
  37. '**/*.cuh',
  38. '**/*.swift',
  39. '**/*.m',
  40. '**/*.metal',
  41. '**/*.comp'
  42. ]
  43. concurrency:
  44. group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
  45. cancel-in-progress: true
  46. env:
  47. GGML_NLOOP: 3
  48. GGML_N_THREADS: 1
  49. LLAMA_LOG_COLORS: 1
  50. LLAMA_LOG_PREFIX: 1
  51. LLAMA_LOG_TIMESTAMPS: 1
  52. jobs:
  53. macOS-latest-cmake-arm64:
  54. runs-on: macos-latest
  55. steps:
  56. - name: Clone
  57. id: checkout
  58. uses: actions/checkout@v4
  59. - name: ccache
  60. uses: ggml-org/ccache-action@v1.2.16
  61. with:
  62. key: macOS-latest-cmake-arm64
  63. evict-old-files: 1d
  64. - name: Dependencies
  65. id: depends
  66. continue-on-error: true
  67. run: |
  68. brew update
  69. brew install curl
  70. - name: Build
  71. id: cmake_build
  72. run: |
  73. sysctl -a
  74. cmake -B build \
  75. -DCMAKE_BUILD_RPATH="@loader_path" \
  76. -DLLAMA_FATAL_WARNINGS=ON \
  77. -DGGML_METAL_USE_BF16=ON \
  78. -DGGML_METAL_EMBED_LIBRARY=OFF \
  79. -DGGML_METAL_SHADER_DEBUG=ON \
  80. -DGGML_RPC=ON
  81. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  82. leaks -atExit -- ./build/bin/test-thread-safety -hf ggml-org/gemma-3-270m-qat-GGUF -ngl 99 -p "$(printf 'hello %.0s' {1..128})" -n 16 -c 512 -ub 32 -np 2 -t 2 -lv 1
  83. - name: Test
  84. id: cmake_test
  85. run: |
  86. cd build
  87. ctest -L 'main|curl' --verbose --timeout 900
  88. macOS-latest-cmake-x64:
  89. runs-on: macos-13
  90. steps:
  91. - name: Clone
  92. id: checkout
  93. uses: actions/checkout@v4
  94. - name: ccache
  95. uses: ggml-org/ccache-action@v1.2.16
  96. with:
  97. key: macOS-latest-cmake-x64
  98. evict-old-files: 1d
  99. - name: Dependencies
  100. id: depends
  101. continue-on-error: true
  102. run: |
  103. brew update
  104. brew install curl
  105. - name: Build
  106. id: cmake_build
  107. run: |
  108. sysctl -a
  109. # Metal is disabled due to intermittent failures with Github runners not having a GPU:
  110. # https://github.com/ggml-org/llama.cpp/actions/runs/8635935781/job/23674807267#step:5:2313
  111. cmake -B build \
  112. -DCMAKE_BUILD_RPATH="@loader_path" \
  113. -DLLAMA_FATAL_WARNINGS=ON \
  114. -DGGML_METAL=OFF \
  115. -DGGML_RPC=ON \
  116. -DCMAKE_OSX_DEPLOYMENT_TARGET=13.3
  117. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  118. - name: Test
  119. id: cmake_test
  120. run: |
  121. cd build
  122. ctest -L main --verbose --timeout 900
  123. macOS-latest-cmake-arm64-webgpu:
  124. runs-on: macos-latest
  125. steps:
  126. - name: Clone
  127. id: checkout
  128. uses: actions/checkout@v4
  129. - name: ccache
  130. uses: ggml-org/ccache-action@v1.2.16
  131. with:
  132. key: macOS-latest-cmake-arm64-webgpu
  133. evict-old-files: 1d
  134. - name: Dependencies
  135. id: depends
  136. continue-on-error: true
  137. run: |
  138. brew update
  139. brew install curl
  140. - name: Dawn Dependency
  141. id: dawn-depends
  142. run: |
  143. DAWN_VERSION="v1.0.0"
  144. DAWN_OWNER="reeselevine"
  145. DAWN_REPO="dawn"
  146. DAWN_ASSET_NAME="Dawn-a1a6b45cced25a3b7f4fb491e0ae70796cc7f22b-macos-latest-Release.tar.gz"
  147. echo "Fetching release asset from https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  148. curl -L -o artifact.tar.gz \
  149. "https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  150. mkdir dawn
  151. tar -xvf artifact.tar.gz -C dawn --strip-components=1
  152. - name: Build
  153. id: cmake_build
  154. run: |
  155. export CMAKE_PREFIX_PATH=dawn
  156. cmake -B build -DGGML_WEBGPU=ON -DGGML_METAL=OFF -DGGML_BLAS=OFF
  157. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  158. - name: Test
  159. id: cmake_test
  160. run: |
  161. cd build
  162. ctest -L main --verbose --timeout 900
  163. ubuntu-cpu-cmake:
  164. strategy:
  165. matrix:
  166. include:
  167. - build: 'x64'
  168. os: ubuntu-22.04
  169. - build: 'arm64'
  170. os: ubuntu-22.04-arm
  171. runs-on: ${{ matrix.os }}
  172. steps:
  173. - name: Clone
  174. id: checkout
  175. uses: actions/checkout@v4
  176. - name: ccache
  177. uses: ggml-org/ccache-action@v1.2.16
  178. with:
  179. key: ubuntu-cpu-cmake
  180. evict-old-files: 1d
  181. - name: Dependencies
  182. id: depends
  183. run: |
  184. sudo apt-get update
  185. sudo apt-get install build-essential libcurl4-openssl-dev
  186. - name: Build
  187. id: cmake_build
  188. run: |
  189. cmake -B build \
  190. -DLLAMA_FATAL_WARNINGS=ON \
  191. -DGGML_RPC=ON
  192. cmake --build build --config Release -j $(nproc)
  193. - name: Test
  194. id: cmake_test
  195. run: |
  196. cd build
  197. ctest -L 'main|curl' --verbose --timeout 900
  198. - name: Test llama2c conversion
  199. id: llama2c_test
  200. run: |
  201. cd build
  202. echo "Fetch tokenizer"
  203. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin
  204. echo "Fetch llama2c model"
  205. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin
  206. ./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf
  207. ./bin/llama-cli -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
  208. ubuntu-latest-cmake-sanitizer:
  209. runs-on: ubuntu-latest
  210. continue-on-error: true
  211. strategy:
  212. matrix:
  213. sanitizer: [ADDRESS, THREAD, UNDEFINED]
  214. build_type: [Debug]
  215. steps:
  216. - name: Clone
  217. id: checkout
  218. uses: actions/checkout@v4
  219. - name: ccache
  220. uses: ggml-org/ccache-action@v1.2.16
  221. with:
  222. key: ubuntu-latest-cmake-sanitizer-${{ matrix.sanitizer }}
  223. evict-old-files: 1d
  224. - name: Dependencies
  225. id: depends
  226. run: |
  227. sudo apt-get update
  228. sudo apt-get install build-essential libcurl4-openssl-dev
  229. - name: Build
  230. id: cmake_build
  231. if: ${{ matrix.sanitizer != 'THREAD' }}
  232. run: |
  233. cmake -B build \
  234. -DLLAMA_FATAL_WARNINGS=ON \
  235. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  236. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
  237. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  238. - name: Build (no OpenMP)
  239. id: cmake_build_no_openmp
  240. if: ${{ matrix.sanitizer == 'THREAD' }}
  241. run: |
  242. cmake -B build \
  243. -DLLAMA_FATAL_WARNINGS=ON \
  244. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  245. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  246. -DGGML_OPENMP=OFF
  247. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  248. - name: Test
  249. id: cmake_test
  250. run: |
  251. cd build
  252. ctest -L main --verbose --timeout 900
  253. ubuntu-latest-llguidance:
  254. runs-on: ubuntu-latest
  255. steps:
  256. - name: Clone
  257. id: checkout
  258. uses: actions/checkout@v4
  259. - name: Dependencies
  260. id: depends
  261. run: |
  262. sudo apt-get update
  263. sudo apt-get install build-essential libcurl4-openssl-dev
  264. - name: Build
  265. id: cmake_build
  266. run: |
  267. mkdir build
  268. cd build
  269. cmake .. \
  270. -DLLAMA_FATAL_WARNINGS=ON \
  271. -DLLAMA_LLGUIDANCE=ON
  272. cmake --build . --config Release -j $(nproc)
  273. - name: Test
  274. id: cmake_test
  275. run: |
  276. cd build
  277. ctest -L main --verbose --timeout 900
  278. ubuntu-latest-cmake-rpc:
  279. runs-on: ubuntu-latest
  280. continue-on-error: true
  281. steps:
  282. - name: Clone
  283. id: checkout
  284. uses: actions/checkout@v4
  285. - name: ccache
  286. uses: ggml-org/ccache-action@v1.2.16
  287. with:
  288. key: ubuntu-latest-cmake-rpc
  289. evict-old-files: 1d
  290. - name: Dependencies
  291. id: depends
  292. run: |
  293. sudo apt-get update
  294. sudo apt-get install build-essential libcurl4-openssl-dev
  295. - name: Build
  296. id: cmake_build
  297. run: |
  298. cmake -B build \
  299. -DGGML_RPC=ON
  300. cmake --build build --config Release -j $(nproc)
  301. - name: Test
  302. id: cmake_test
  303. run: |
  304. cd build
  305. ctest -L main --verbose
  306. ubuntu-22-cmake-vulkan:
  307. runs-on: ubuntu-22.04
  308. steps:
  309. - name: Clone
  310. id: checkout
  311. uses: actions/checkout@v4
  312. - name: ccache
  313. uses: ggml-org/ccache-action@v1.2.16
  314. with:
  315. key: ubuntu-22-cmake-vulkan
  316. evict-old-files: 1d
  317. - name: Dependencies
  318. id: depends
  319. run: |
  320. wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
  321. sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
  322. sudo apt-get update -y
  323. sudo apt-get install -y build-essential mesa-vulkan-drivers vulkan-sdk libcurl4-openssl-dev
  324. - name: Build
  325. id: cmake_build
  326. run: |
  327. cmake -B build \
  328. -DGGML_VULKAN=ON
  329. cmake --build build --config Release -j $(nproc)
  330. - name: Test
  331. id: cmake_test
  332. run: |
  333. cd build
  334. export GGML_VK_VISIBLE_DEVICES=0
  335. # This is using llvmpipe and runs slower than other backends
  336. ctest -L main --verbose --timeout 4200
  337. ubuntu-22-cmake-webgpu:
  338. runs-on: ubuntu-22.04
  339. steps:
  340. - name: Clone
  341. id: checkout
  342. uses: actions/checkout@v4
  343. - name: ccache
  344. uses: ggml-org/ccache-action@v1.2.16
  345. with:
  346. key: ubuntu-22-cmake-webgpu
  347. evict-old-files: 1d
  348. - name: Vulkan SDK Dependencies
  349. id: vulkan-depends
  350. run: |
  351. wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
  352. sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
  353. sudo apt-get update -y
  354. sudo apt-get install -y build-essential mesa-vulkan-drivers vulkan-sdk libcurl4-openssl-dev
  355. - name: Dawn Dependency
  356. id: dawn-depends
  357. run: |
  358. sudo apt-get install -y libxrandr-dev libxinerama-dev libxcursor-dev mesa-common-dev libx11-xcb-dev libxi-dev
  359. DAWN_VERSION="v1.0.0"
  360. DAWN_OWNER="reeselevine"
  361. DAWN_REPO="dawn"
  362. DAWN_ASSET_NAME="Dawn-a1a6b45cced25a3b7f4fb491e0ae70796cc7f22b-ubuntu-latest-Release.tar.gz"
  363. echo "Fetching release asset from https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  364. curl -L -o artifact.tar.gz \
  365. "https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  366. mkdir dawn
  367. tar -xvf artifact.tar.gz -C dawn --strip-components=1
  368. - name: Build
  369. id: cmake_build
  370. run: |
  371. export Dawn_DIR=dawn/lib64/cmake/Dawn
  372. cmake -B build -DGGML_WEBGPU=ON
  373. cmake --build build --config Release -j $(nproc)
  374. - name: Test
  375. id: cmake_test
  376. run: |
  377. cd build
  378. # This is using llvmpipe and runs slower than other backends
  379. ctest -L main --verbose --timeout 3600
  380. ubuntu-22-cmake-hip:
  381. runs-on: ubuntu-22.04
  382. container: rocm/dev-ubuntu-22.04:6.1.2
  383. steps:
  384. - name: Clone
  385. id: checkout
  386. uses: actions/checkout@v4
  387. - name: Dependencies
  388. id: depends
  389. run: |
  390. sudo apt-get update
  391. sudo apt-get install -y build-essential git cmake rocblas-dev hipblas-dev libcurl4-openssl-dev
  392. - name: ccache
  393. uses: ggml-org/ccache-action@v1.2.16
  394. with:
  395. key: ubuntu-22-cmake-hip
  396. evict-old-files: 1d
  397. - name: Build with native CMake HIP support
  398. id: cmake_build
  399. run: |
  400. cmake -B build -S . \
  401. -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \
  402. -DGGML_HIP_ROCWMMA_FATTN=ON \
  403. -DGGML_HIP=ON
  404. cmake --build build --config Release -j $(nproc)
  405. ubuntu-22-cmake-musa:
  406. runs-on: ubuntu-22.04
  407. container: mthreads/musa:rc4.2.0-devel-ubuntu22.04-amd64
  408. steps:
  409. - name: Clone
  410. id: checkout
  411. uses: actions/checkout@v4
  412. - name: Dependencies
  413. id: depends
  414. run: |
  415. apt-get update
  416. apt-get install -y build-essential git cmake libcurl4-openssl-dev
  417. - name: ccache
  418. uses: ggml-org/ccache-action@v1.2.16
  419. with:
  420. key: ubuntu-22-cmake-musa
  421. evict-old-files: 1d
  422. - name: Build with native CMake MUSA support
  423. id: cmake_build
  424. run: |
  425. cmake -B build -S . \
  426. -DGGML_MUSA=ON
  427. cmake --build build --config Release -j $(nproc)
  428. ubuntu-22-cmake-sycl:
  429. runs-on: ubuntu-22.04
  430. continue-on-error: true
  431. steps:
  432. - uses: actions/checkout@v4
  433. - name: add oneAPI to apt
  434. shell: bash
  435. run: |
  436. cd /tmp
  437. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  438. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  439. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  440. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  441. - name: install oneAPI dpcpp compiler
  442. shell: bash
  443. run: |
  444. sudo apt update
  445. sudo apt install intel-oneapi-compiler-dpcpp-cpp libcurl4-openssl-dev
  446. - name: install oneAPI MKL library
  447. shell: bash
  448. run: |
  449. sudo apt install intel-oneapi-mkl-devel
  450. - name: Clone
  451. id: checkout
  452. uses: actions/checkout@v4
  453. - name: ccache
  454. uses: ggml-org/ccache-action@v1.2.16
  455. with:
  456. key: ubuntu-22-cmake-sycl
  457. evict-old-files: 1d
  458. - name: Build
  459. id: cmake_build
  460. run: |
  461. source /opt/intel/oneapi/setvars.sh
  462. cmake -B build \
  463. -DGGML_SYCL=ON \
  464. -DCMAKE_C_COMPILER=icx \
  465. -DCMAKE_CXX_COMPILER=icpx
  466. cmake --build build --config Release -j $(nproc)
  467. ubuntu-22-cmake-sycl-fp16:
  468. runs-on: ubuntu-22.04
  469. continue-on-error: true
  470. steps:
  471. - uses: actions/checkout@v4
  472. - name: add oneAPI to apt
  473. shell: bash
  474. run: |
  475. cd /tmp
  476. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  477. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  478. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  479. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  480. - name: install oneAPI dpcpp compiler
  481. shell: bash
  482. run: |
  483. sudo apt update
  484. sudo apt install intel-oneapi-compiler-dpcpp-cpp libcurl4-openssl-dev
  485. - name: install oneAPI MKL library
  486. shell: bash
  487. run: |
  488. sudo apt install intel-oneapi-mkl-devel
  489. - name: Clone
  490. id: checkout
  491. uses: actions/checkout@v4
  492. - name: ccache
  493. uses: ggml-org/ccache-action@v1.2.16
  494. with:
  495. key: ubuntu-22-cmake-sycl-fp16
  496. evict-old-files: 1d
  497. - name: Build
  498. id: cmake_build
  499. run: |
  500. source /opt/intel/oneapi/setvars.sh
  501. cmake -B build \
  502. -DGGML_SYCL=ON \
  503. -DCMAKE_C_COMPILER=icx \
  504. -DCMAKE_CXX_COMPILER=icpx \
  505. -DGGML_SYCL_F16=ON
  506. cmake --build build --config Release -j $(nproc)
  507. build-linux-cross:
  508. uses: ./.github/workflows/build-linux-cross.yml
  509. build-cmake-pkg:
  510. uses: ./.github/workflows/build-cmake-pkg.yml
  511. macOS-latest-cmake-ios:
  512. runs-on: macos-latest
  513. steps:
  514. - name: Clone
  515. id: checkout
  516. uses: actions/checkout@v4
  517. - name: ccache
  518. uses: ggml-org/ccache-action@v1.2.16
  519. with:
  520. key: macOS-latest-cmake-ios
  521. evict-old-files: 1d
  522. - name: Dependencies
  523. id: depends
  524. continue-on-error: true
  525. run: |
  526. brew update
  527. - name: Build
  528. id: cmake_build
  529. run: |
  530. sysctl -a
  531. cmake -B build -G Xcode \
  532. -DGGML_METAL_USE_BF16=ON \
  533. -DGGML_METAL_EMBED_LIBRARY=ON \
  534. -DLLAMA_BUILD_COMMON=OFF \
  535. -DLLAMA_BUILD_EXAMPLES=OFF \
  536. -DLLAMA_BUILD_TOOLS=OFF \
  537. -DLLAMA_BUILD_TESTS=OFF \
  538. -DLLAMA_BUILD_SERVER=OFF \
  539. -DCMAKE_SYSTEM_NAME=iOS \
  540. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  541. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  542. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  543. macOS-latest-cmake-tvos:
  544. runs-on: macos-latest
  545. steps:
  546. - name: Clone
  547. id: checkout
  548. uses: actions/checkout@v4
  549. - name: ccache
  550. uses: ggml-org/ccache-action@v1.2.16
  551. with:
  552. key: macOS-latest-cmake-tvos
  553. evict-old-files: 1d
  554. - name: Dependencies
  555. id: depends
  556. continue-on-error: true
  557. run: |
  558. brew update
  559. - name: Build
  560. id: cmake_build
  561. run: |
  562. sysctl -a
  563. cmake -B build -G Xcode \
  564. -DGGML_METAL_USE_BF16=ON \
  565. -DGGML_METAL_EMBED_LIBRARY=ON \
  566. -DLLAMA_BUILD_COMMON=OFF \
  567. -DLLAMA_BUILD_EXAMPLES=OFF \
  568. -DLLAMA_BUILD_TOOLS=OFF \
  569. -DLLAMA_BUILD_TESTS=OFF \
  570. -DLLAMA_BUILD_SERVER=OFF \
  571. -DCMAKE_SYSTEM_NAME=tvOS \
  572. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  573. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  574. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  575. macOS-latest-cmake-visionos:
  576. runs-on: macos-latest
  577. steps:
  578. - name: Clone
  579. id: checkout
  580. uses: actions/checkout@v4
  581. - name: Dependencies
  582. id: depends
  583. continue-on-error: true
  584. run: |
  585. brew update
  586. - name: Build
  587. id: cmake_build
  588. run: |
  589. sysctl -a
  590. cmake -B build -G Xcode \
  591. -DGGML_METAL_USE_BF16=ON \
  592. -DGGML_METAL_EMBED_LIBRARY=ON \
  593. -DLLAMA_BUILD_COMMON=OFF \
  594. -DLLAMA_BUILD_EXAMPLES=OFF \
  595. -DLLAMA_BUILD_TOOLS=OFF \
  596. -DLLAMA_BUILD_TESTS=OFF \
  597. -DLLAMA_BUILD_SERVER=OFF \
  598. -DCMAKE_SYSTEM_NAME=visionOS \
  599. -DCMAKE_OSX_DEPLOYMENT_TARGET=1.0 \
  600. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  601. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  602. macOS-latest-swift:
  603. runs-on: macos-latest
  604. needs: ios-xcode-build
  605. strategy:
  606. matrix:
  607. destination: ['generic/platform=macOS', 'generic/platform=iOS', 'generic/platform=tvOS']
  608. steps:
  609. - name: Clone
  610. id: checkout
  611. uses: actions/checkout@v4
  612. - name: ccache
  613. uses: ggml-org/ccache-action@v1.2.16
  614. with:
  615. key: macOS-latest-swift
  616. evict-old-files: 1d
  617. - name: Download xcframework artifact
  618. uses: actions/download-artifact@v4
  619. with:
  620. name: llama-xcframework
  621. path: build-apple/llama.xcframework/
  622. - name: Dependencies
  623. id: depends
  624. continue-on-error: true
  625. run: |
  626. brew update
  627. - name: Build llama.cpp with CMake
  628. id: cmake_build
  629. run: |
  630. sysctl -a
  631. cmake -B build -G Xcode \
  632. -DGGML_METAL_USE_BF16=ON \
  633. -DGGML_METAL_EMBED_LIBRARY=ON \
  634. -DLLAMA_CURL=OFF \
  635. -DLLAMA_BUILD_EXAMPLES=OFF \
  636. -DLLAMA_BUILD_TOOLS=OFF \
  637. -DLLAMA_BUILD_TESTS=OFF \
  638. -DLLAMA_BUILD_SERVER=OFF \
  639. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
  640. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  641. windows-msys2:
  642. runs-on: windows-2025
  643. strategy:
  644. fail-fast: false
  645. matrix:
  646. include:
  647. - { sys: UCRT64, env: ucrt-x86_64, build: Release }
  648. - { sys: CLANG64, env: clang-x86_64, build: Release }
  649. steps:
  650. - name: Clone
  651. uses: actions/checkout@v4
  652. - name: ccache
  653. uses: ggml-org/ccache-action@v1.2.16
  654. with:
  655. key: windows-msys2
  656. variant: ccache
  657. evict-old-files: 1d
  658. - name: Setup ${{ matrix.sys }}
  659. uses: msys2/setup-msys2@v2
  660. with:
  661. update: true
  662. msystem: ${{matrix.sys}}
  663. install: >-
  664. base-devel
  665. git
  666. mingw-w64-${{matrix.env}}-toolchain
  667. mingw-w64-${{matrix.env}}-cmake
  668. mingw-w64-${{matrix.env}}-openblas
  669. - name: Build using CMake
  670. shell: msys2 {0}
  671. run: |
  672. cmake -B build
  673. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  674. - name: Clean after building using CMake
  675. shell: msys2 {0}
  676. run: |
  677. rm -rf build
  678. - name: Build using CMake w/ OpenBLAS
  679. shell: msys2 {0}
  680. run: |
  681. cmake -B build -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
  682. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  683. windows-latest-cmake:
  684. runs-on: windows-2025
  685. env:
  686. OPENBLAS_VERSION: 0.3.23
  687. SDE_VERSION: 9.33.0-2024-01-07
  688. VULKAN_VERSION: 1.4.313.2
  689. strategy:
  690. matrix:
  691. include:
  692. - build: 'cpu-x64 (static)'
  693. arch: 'x64'
  694. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/x64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DBUILD_SHARED_LIBS=OFF'
  695. - build: 'openblas-x64'
  696. arch: 'x64'
  697. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/x64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -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"'
  698. - build: 'vulkan-x64'
  699. arch: 'x64'
  700. defines: '-DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DGGML_VULKAN=ON'
  701. - build: 'llvm-arm64'
  702. arch: 'arm64'
  703. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON'
  704. - build: 'llvm-arm64-opencl-adreno'
  705. arch: 'arm64'
  706. 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'
  707. steps:
  708. - name: Clone
  709. id: checkout
  710. uses: actions/checkout@v4
  711. - name: ccache
  712. uses: ggml-org/ccache-action@v1.2.16
  713. with:
  714. key: windows-latest-cmake-${{ matrix.build }}
  715. variant: ccache
  716. evict-old-files: 1d
  717. - name: Download OpenBLAS
  718. id: get_openblas
  719. if: ${{ matrix.build == 'openblas-x64' }}
  720. run: |
  721. 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"
  722. curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE"
  723. mkdir $env:RUNNER_TEMP/openblas
  724. tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas
  725. $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
  726. $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
  727. $lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe')
  728. & $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll
  729. - name: Install Vulkan SDK
  730. id: get_vulkan
  731. if: ${{ matrix.build == 'vulkan-x64' }}
  732. run: |
  733. curl.exe -o $env:RUNNER_TEMP/VulkanSDK-Installer.exe -L "https://sdk.lunarg.com/sdk/download/${env:VULKAN_VERSION}/windows/vulkansdk-windows-X64-${env:VULKAN_VERSION}.exe"
  734. & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
  735. Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
  736. Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
  737. - name: Install Ninja
  738. id: install_ninja
  739. run: |
  740. choco install ninja
  741. - name: Install OpenCL Headers and Libs
  742. id: install_opencl
  743. if: ${{ matrix.build == 'llvm-arm64-opencl-adreno' }}
  744. run: |
  745. git clone https://github.com/KhronosGroup/OpenCL-Headers
  746. cd OpenCL-Headers
  747. cmake -B build `
  748. -DBUILD_TESTING=OFF `
  749. -DOPENCL_HEADERS_BUILD_TESTING=OFF `
  750. -DOPENCL_HEADERS_BUILD_CXX_TESTS=OFF `
  751. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  752. cmake --build build --target install
  753. git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader
  754. cd OpenCL-ICD-Loader
  755. cmake -B build-arm64-release `
  756. -A arm64 `
  757. -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" `
  758. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  759. cmake --build build-arm64-release --target install --config release
  760. - name: libCURL
  761. id: get_libcurl
  762. uses: ./.github/actions/windows-setup-curl
  763. with:
  764. architecture: ${{ matrix.arch == 'x64' && 'win64' || 'win64a' }}
  765. - name: Build
  766. id: cmake_build
  767. env:
  768. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  769. run: |
  770. cmake -S . -B build ${{ matrix.defines }} `
  771. -DCURL_LIBRARY="$env:CURL_PATH/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:CURL_PATH/include"
  772. cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}
  773. cp $env:CURL_PATH/bin/libcurl-*.dll build/bin/Release
  774. - name: Add libopenblas.dll
  775. id: add_libopenblas_dll
  776. if: ${{ matrix.build == 'openblas-x64' }}
  777. run: |
  778. cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll
  779. cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt
  780. - name: Test
  781. id: cmake_test
  782. if: ${{ matrix.arch == 'x64' }}
  783. run: |
  784. cd build
  785. ctest -L main -C Release --verbose --timeout 900
  786. # TODO: disabled for now, consider adding tests for all CPU variants instead
  787. # - name: Test (Intel SDE)
  788. # id: cmake_test_sde
  789. # if: ${{ matrix.build == 'avx512-x64' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation
  790. # run: |
  791. # curl.exe -o $env:RUNNER_TEMP/sde.tar.xz -L "https://downloadmirror.intel.com/813591/sde-external-${env:SDE_VERSION}-win.tar.xz"
  792. # # for some weird reason windows tar doesn't like sde tar.xz
  793. # 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar.xz
  794. # 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar
  795. # $sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe)
  796. # cd build
  797. # $env:LLAMA_SKIP_TESTS_SLOW_ON_EMULATOR = 1
  798. # & $sde -future -- ctest -L main -C Release --verbose --timeout 900
  799. ubuntu-latest-cmake-cuda:
  800. runs-on: ubuntu-latest
  801. container: nvidia/cuda:12.6.2-devel-ubuntu24.04
  802. steps:
  803. - name: Clone
  804. id: checkout
  805. uses: actions/checkout@v4
  806. - name: Install dependencies
  807. env:
  808. DEBIAN_FRONTEND: noninteractive
  809. run: |
  810. apt update
  811. apt install -y cmake build-essential ninja-build libgomp1 git libcurl4-openssl-dev
  812. - name: ccache
  813. uses: ggml-org/ccache-action@v1.2.16
  814. with:
  815. key: ubuntu-latest-cmake-cuda
  816. evict-old-files: 1d
  817. - name: Build with CMake
  818. run: |
  819. cmake -S . -B build -G Ninja \
  820. -DCMAKE_BUILD_TYPE=Release \
  821. -DCMAKE_CUDA_ARCHITECTURES=89-real \
  822. -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined \
  823. -DLLAMA_FATAL_WARNINGS=ON \
  824. -DGGML_NATIVE=OFF \
  825. -DGGML_CUDA=ON
  826. cmake --build build
  827. windows-2022-cmake-cuda:
  828. runs-on: windows-2022
  829. strategy:
  830. matrix:
  831. cuda: ['12.4']
  832. steps:
  833. - name: Clone
  834. id: checkout
  835. uses: actions/checkout@v4
  836. - name: Install ccache
  837. uses: ggml-org/ccache-action@v1.2.16
  838. with:
  839. key: windows-cuda-${{ matrix.cuda }}
  840. variant: ccache
  841. evict-old-files: 1d
  842. - name: Install Cuda Toolkit
  843. uses: ./.github/actions/windows-setup-cuda
  844. with:
  845. cuda_version: ${{ matrix.cuda }}
  846. - name: Install Ninja
  847. id: install_ninja
  848. run: |
  849. choco install ninja
  850. - name: libCURL
  851. id: get_libcurl
  852. uses: ./.github/actions/windows-setup-curl
  853. - name: Build
  854. id: cmake_build
  855. shell: cmd
  856. env:
  857. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  858. run: |
  859. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
  860. cmake -S . -B build -G "Ninja Multi-Config" ^
  861. -DLLAMA_BUILD_SERVER=ON ^
  862. -DGGML_NATIVE=OFF ^
  863. -DGGML_BACKEND_DL=ON ^
  864. -DGGML_CPU_ALL_VARIANTS=ON ^
  865. -DGGML_CUDA=ON ^
  866. -DGGML_RPC=ON ^
  867. -DCURL_LIBRARY="%CURL_PATH%/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="%CURL_PATH%/include"
  868. set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
  869. cmake --build build --config Release -j %NINJA_JOBS% -t ggml
  870. cmake --build build --config Release
  871. windows-latest-cmake-sycl:
  872. runs-on: windows-2022
  873. defaults:
  874. run:
  875. shell: bash
  876. env:
  877. WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7cd9bba0-7aab-4e30-b3ae-2221006a4a05/intel-oneapi-base-toolkit-2025.1.1.34_offline.exe
  878. WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel
  879. ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI"
  880. steps:
  881. - name: Clone
  882. id: checkout
  883. uses: actions/checkout@v4
  884. - name: ccache
  885. uses: ggml-org/ccache-action@v1.2.16
  886. with:
  887. key: windows-latest-cmake-sycl
  888. variant: ccache
  889. evict-old-files: 1d
  890. - name: Install
  891. run: |
  892. scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
  893. # TODO: add libcurl support ; we will also need to modify win-build-sycl.bat to accept user-specified args
  894. - name: Build
  895. id: cmake_build
  896. run: examples/sycl/win-build-sycl.bat
  897. windows-latest-cmake-hip:
  898. runs-on: windows-2022
  899. env:
  900. # The ROCm version must correspond to the version used in the HIP SDK.
  901. ROCM_VERSION: "6.4.2"
  902. HIPSDK_INSTALLER_VERSION: "25.Q3"
  903. steps:
  904. - name: Clone
  905. id: checkout
  906. uses: actions/checkout@v4
  907. - name: Clone rocWMMA repository
  908. id: clone_rocwmma
  909. run: |
  910. git clone https://github.com/rocm/rocwmma --branch rocm-${{ env.ROCM_VERSION }} --depth 1
  911. - name: Cache ROCm Installation
  912. id: cache-rocm
  913. uses: actions/cache@v4
  914. with:
  915. path: C:\Program Files\AMD\ROCm
  916. key: rocm-${{ env.HIPSDK_INSTALLER_VERSION }}-${{ runner.os }}
  917. - name: Install ROCm
  918. if: steps.cache-rocm.outputs.cache-hit != 'true'
  919. id: depends
  920. run: |
  921. $ErrorActionPreference = "Stop"
  922. write-host "Downloading AMD HIP SDK Installer"
  923. Invoke-WebRequest -Uri "https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-WinSvr2022-For-HIP.exe" -OutFile "${env:RUNNER_TEMP}\rocm-install.exe"
  924. write-host "Installing AMD HIP SDK"
  925. $proc = Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -PassThru
  926. $completed = $proc.WaitForExit(600000)
  927. if (-not $completed) {
  928. Write-Error "ROCm installation timed out after 10 minutes. Killing the process"
  929. $proc.Kill()
  930. exit 1
  931. }
  932. if ($proc.ExitCode -ne 0) {
  933. Write-Error "ROCm installation failed with exit code $($proc.ExitCode)"
  934. exit 1
  935. }
  936. write-host "Completed AMD HIP SDK installation"
  937. - name: Verify ROCm
  938. id: verify
  939. run: |
  940. # Find and test ROCm installation
  941. $clangPath = Get-ChildItem 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | Select-Object -First 1
  942. if (-not $clangPath) {
  943. Write-Error "ROCm installation not found"
  944. exit 1
  945. }
  946. & $clangPath.FullName --version
  947. - name: Install ccache
  948. uses: ggml-org/ccache-action@v1.2.16
  949. with:
  950. key: ${{ github.job }}
  951. evict-old-files: 1d
  952. - name: libCURL
  953. id: get_libcurl
  954. uses: ./.github/actions/windows-setup-curl
  955. - name: Build
  956. id: cmake_build
  957. env:
  958. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  959. run: |
  960. $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
  961. $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
  962. cmake -G "Unix Makefiles" -B build -S . `
  963. -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
  964. -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
  965. -DCMAKE_CXX_FLAGS="-I$($PWD.Path.Replace('\', '/'))/rocwmma/library/include/" `
  966. -DCMAKE_BUILD_TYPE=Release `
  967. -DGGML_HIP=ON `
  968. -DGGML_HIP_ROCWMMA_FATTN=ON `
  969. -DGGML_RPC=ON `
  970. -DCURL_LIBRARY="$env:CURL_PATH/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:CURL_PATH/include"
  971. cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
  972. ios-xcode-build:
  973. runs-on: macos-latest
  974. steps:
  975. - name: Checkout code
  976. uses: actions/checkout@v4
  977. - name: Setup Xcode
  978. uses: maxim-lobanov/setup-xcode@v1
  979. with:
  980. xcode-version: latest-stable
  981. - name: Build
  982. id: cmake_build
  983. run: |
  984. sysctl -a
  985. cmake -B build -G Xcode \
  986. -DGGML_METAL_USE_BF16=ON \
  987. -DGGML_METAL_EMBED_LIBRARY=ON \
  988. -DLLAMA_CURL=OFF \
  989. -DLLAMA_BUILD_EXAMPLES=OFF \
  990. -DLLAMA_BUILD_TOOLS=OFF \
  991. -DLLAMA_BUILD_TESTS=OFF \
  992. -DLLAMA_BUILD_SERVER=OFF \
  993. -DCMAKE_SYSTEM_NAME=iOS \
  994. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  995. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  996. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  997. - name: xcodebuild for swift package
  998. id: xcodebuild
  999. run: |
  1000. ./build-xcframework.sh
  1001. - name: Upload xcframework artifact
  1002. uses: actions/upload-artifact@v4
  1003. with:
  1004. name: llama-xcframework
  1005. path: build-apple/llama.xcframework/
  1006. retention-days: 1
  1007. - name: Build Xcode project
  1008. run: |
  1009. xcodebuild -downloadPlatform iOS
  1010. 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
  1011. android-build:
  1012. runs-on: ubuntu-latest
  1013. steps:
  1014. - name: Clone
  1015. uses: actions/checkout@v4
  1016. - name: ccache
  1017. uses: ggml-org/ccache-action@v1.2.16
  1018. with:
  1019. key: android-build
  1020. evict-old-files: 1d
  1021. - name: Set up JDK
  1022. uses: actions/setup-java@v3
  1023. with:
  1024. java-version: 17
  1025. distribution: zulu
  1026. - name: Setup Android SDK
  1027. uses: android-actions/setup-android@v3
  1028. with:
  1029. log-accepted-android-sdk-licenses: false
  1030. - name: Build
  1031. run: |
  1032. cd examples/llama.android
  1033. ./gradlew build --no-daemon
  1034. openEuler-latest-cmake-cann:
  1035. if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'Ascend NPU') }}
  1036. defaults:
  1037. run:
  1038. shell: bash -el {0}
  1039. strategy:
  1040. matrix:
  1041. arch: [x86, aarch64]
  1042. cann:
  1043. - '8.1.RC1.alpha001-910b-openeuler22.03-py3.10'
  1044. device:
  1045. - 'ascend910b3'
  1046. build:
  1047. - 'Release'
  1048. runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
  1049. container: ascendai/cann:${{ matrix.cann }}
  1050. steps:
  1051. - name: Checkout
  1052. uses: actions/checkout@v4
  1053. - name: Dependencies
  1054. run: |
  1055. yum update -y
  1056. yum install -y git gcc gcc-c++ make cmake libcurl-devel
  1057. - name: Build
  1058. run: |
  1059. export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
  1060. cmake -S . -B build \
  1061. -DCMAKE_BUILD_TYPE=${{ matrix.build }} \
  1062. -DGGML_CANN=on \
  1063. -DSOC_TYPE=${{ matrix.device }}
  1064. cmake --build build -j $(nproc)