build.yml 38 KB

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