build.yml 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238
  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. -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-14
  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. strategy:
  605. matrix:
  606. destination: ['generic/platform=macOS', 'generic/platform=iOS', 'generic/platform=tvOS']
  607. steps:
  608. - name: Clone
  609. id: checkout
  610. uses: actions/checkout@v4
  611. - name: ccache
  612. uses: ggml-org/ccache-action@v1.2.16
  613. with:
  614. key: macOS-latest-swift
  615. evict-old-files: 1d
  616. - name: Dependencies
  617. id: depends
  618. continue-on-error: true
  619. run: |
  620. brew update
  621. - name: Build llama.cpp with CMake
  622. id: cmake_build
  623. run: |
  624. sysctl -a
  625. cmake -B build -G Xcode \
  626. -DGGML_METAL_USE_BF16=ON \
  627. -DGGML_METAL_EMBED_LIBRARY=ON \
  628. -DLLAMA_CURL=OFF \
  629. -DLLAMA_BUILD_EXAMPLES=OFF \
  630. -DLLAMA_BUILD_TOOLS=OFF \
  631. -DLLAMA_BUILD_TESTS=OFF \
  632. -DLLAMA_BUILD_SERVER=OFF \
  633. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
  634. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  635. - name: xcodebuild for swift package
  636. id: xcodebuild
  637. run: |
  638. ./build-xcframework.sh
  639. windows-msys2:
  640. runs-on: windows-2025
  641. strategy:
  642. fail-fast: false
  643. matrix:
  644. include:
  645. - { sys: UCRT64, env: ucrt-x86_64, build: Release }
  646. - { sys: CLANG64, env: clang-x86_64, build: Release }
  647. steps:
  648. - name: Clone
  649. uses: actions/checkout@v4
  650. - name: ccache
  651. uses: ggml-org/ccache-action@v1.2.16
  652. with:
  653. key: windows-msys2
  654. variant: ccache
  655. evict-old-files: 1d
  656. - name: Setup ${{ matrix.sys }}
  657. uses: msys2/setup-msys2@v2
  658. with:
  659. update: true
  660. msystem: ${{matrix.sys}}
  661. install: >-
  662. base-devel
  663. git
  664. mingw-w64-${{matrix.env}}-toolchain
  665. mingw-w64-${{matrix.env}}-cmake
  666. mingw-w64-${{matrix.env}}-openblas
  667. - name: Build using CMake
  668. shell: msys2 {0}
  669. run: |
  670. cmake -B build
  671. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  672. - name: Clean after building using CMake
  673. shell: msys2 {0}
  674. run: |
  675. rm -rf build
  676. - name: Build using CMake w/ OpenBLAS
  677. shell: msys2 {0}
  678. run: |
  679. cmake -B build -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
  680. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  681. windows-latest-cmake:
  682. runs-on: windows-2025
  683. env:
  684. OPENBLAS_VERSION: 0.3.23
  685. SDE_VERSION: 9.33.0-2024-01-07
  686. VULKAN_VERSION: 1.4.313.2
  687. strategy:
  688. matrix:
  689. include:
  690. - build: 'cpu-x64 (static)'
  691. arch: 'x64'
  692. 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'
  693. - build: 'openblas-x64'
  694. arch: 'x64'
  695. 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"'
  696. - build: 'vulkan-x64'
  697. arch: 'x64'
  698. 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'
  699. - build: 'llvm-arm64'
  700. arch: 'arm64'
  701. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON'
  702. - build: 'llvm-arm64-opencl-adreno'
  703. arch: 'arm64'
  704. 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'
  705. steps:
  706. - name: Clone
  707. id: checkout
  708. uses: actions/checkout@v4
  709. - name: ccache
  710. uses: ggml-org/ccache-action@v1.2.16
  711. with:
  712. key: windows-latest-cmake-${{ matrix.build }}
  713. variant: ccache
  714. evict-old-files: 1d
  715. - name: Download OpenBLAS
  716. id: get_openblas
  717. if: ${{ matrix.build == 'openblas-x64' }}
  718. run: |
  719. 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"
  720. curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE"
  721. mkdir $env:RUNNER_TEMP/openblas
  722. tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas
  723. $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
  724. $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
  725. $lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe')
  726. & $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll
  727. - name: Install Vulkan SDK
  728. id: get_vulkan
  729. if: ${{ matrix.build == 'vulkan-x64' }}
  730. run: |
  731. 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"
  732. & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
  733. Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
  734. Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
  735. - name: Install Ninja
  736. id: install_ninja
  737. run: |
  738. choco install ninja
  739. - name: Install OpenCL Headers and Libs
  740. id: install_opencl
  741. if: ${{ matrix.build == 'llvm-arm64-opencl-adreno' }}
  742. run: |
  743. git clone https://github.com/KhronosGroup/OpenCL-Headers
  744. cd OpenCL-Headers
  745. cmake -B build `
  746. -DBUILD_TESTING=OFF `
  747. -DOPENCL_HEADERS_BUILD_TESTING=OFF `
  748. -DOPENCL_HEADERS_BUILD_CXX_TESTS=OFF `
  749. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  750. cmake --build build --target install
  751. git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader
  752. cd OpenCL-ICD-Loader
  753. cmake -B build-arm64-release `
  754. -A arm64 `
  755. -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" `
  756. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  757. cmake --build build-arm64-release --target install --config release
  758. - name: libCURL
  759. id: get_libcurl
  760. uses: ./.github/actions/windows-setup-curl
  761. with:
  762. architecture: ${{ matrix.arch == 'x64' && 'win64' || 'win64a' }}
  763. - name: Build
  764. id: cmake_build
  765. env:
  766. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  767. run: |
  768. cmake -S . -B build ${{ matrix.defines }} `
  769. -DCURL_LIBRARY="$env:CURL_PATH/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:CURL_PATH/include"
  770. cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}
  771. cp $env:CURL_PATH/bin/libcurl-*.dll build/bin/Release
  772. - name: Add libopenblas.dll
  773. id: add_libopenblas_dll
  774. if: ${{ matrix.build == 'openblas-x64' }}
  775. run: |
  776. cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll
  777. cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt
  778. - name: Test
  779. id: cmake_test
  780. if: ${{ matrix.arch == 'x64' }}
  781. run: |
  782. cd build
  783. ctest -L main -C Release --verbose --timeout 900
  784. # TODO: disabled for now, consider adding tests for all CPU variants instead
  785. # - name: Test (Intel SDE)
  786. # id: cmake_test_sde
  787. # if: ${{ matrix.build == 'avx512-x64' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation
  788. # run: |
  789. # curl.exe -o $env:RUNNER_TEMP/sde.tar.xz -L "https://downloadmirror.intel.com/813591/sde-external-${env:SDE_VERSION}-win.tar.xz"
  790. # # for some weird reason windows tar doesn't like sde tar.xz
  791. # 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar.xz
  792. # 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar
  793. # $sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe)
  794. # cd build
  795. # $env:LLAMA_SKIP_TESTS_SLOW_ON_EMULATOR = 1
  796. # & $sde -future -- ctest -L main -C Release --verbose --timeout 900
  797. ubuntu-latest-cmake-cuda:
  798. runs-on: ubuntu-latest
  799. container: nvidia/cuda:12.6.2-devel-ubuntu24.04
  800. steps:
  801. - name: Clone
  802. id: checkout
  803. uses: actions/checkout@v4
  804. - name: Install dependencies
  805. env:
  806. DEBIAN_FRONTEND: noninteractive
  807. run: |
  808. apt update
  809. apt install -y cmake build-essential ninja-build libgomp1 git libcurl4-openssl-dev
  810. - name: ccache
  811. uses: ggml-org/ccache-action@v1.2.16
  812. with:
  813. key: ubuntu-latest-cmake-cuda
  814. evict-old-files: 1d
  815. - name: Build with CMake
  816. run: |
  817. cmake -S . -B build -G Ninja \
  818. -DCMAKE_BUILD_TYPE=Release \
  819. -DCMAKE_CUDA_ARCHITECTURES=89-real \
  820. -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined \
  821. -DLLAMA_FATAL_WARNINGS=ON \
  822. -DGGML_NATIVE=OFF \
  823. -DGGML_CUDA=ON
  824. cmake --build build
  825. windows-2022-cmake-cuda:
  826. runs-on: windows-2022
  827. strategy:
  828. matrix:
  829. cuda: ['12.4']
  830. steps:
  831. - name: Clone
  832. id: checkout
  833. uses: actions/checkout@v4
  834. - name: Install ccache
  835. uses: ggml-org/ccache-action@v1.2.16
  836. with:
  837. key: windows-cuda-${{ matrix.cuda }}
  838. variant: ccache
  839. evict-old-files: 1d
  840. - name: Install Cuda Toolkit
  841. uses: ./.github/actions/windows-setup-cuda
  842. with:
  843. cuda_version: ${{ matrix.cuda }}
  844. - name: Install Ninja
  845. id: install_ninja
  846. run: |
  847. choco install ninja
  848. - name: libCURL
  849. id: get_libcurl
  850. uses: ./.github/actions/windows-setup-curl
  851. - name: Build
  852. id: cmake_build
  853. shell: cmd
  854. env:
  855. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  856. run: |
  857. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
  858. cmake -S . -B build -G "Ninja Multi-Config" ^
  859. -DLLAMA_BUILD_SERVER=ON ^
  860. -DGGML_NATIVE=OFF ^
  861. -DGGML_BACKEND_DL=ON ^
  862. -DGGML_CPU_ALL_VARIANTS=ON ^
  863. -DGGML_CUDA=ON ^
  864. -DGGML_RPC=ON ^
  865. -DCURL_LIBRARY="%CURL_PATH%/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="%CURL_PATH%/include"
  866. set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
  867. cmake --build build --config Release -j %NINJA_JOBS% -t ggml
  868. cmake --build build --config Release
  869. windows-latest-cmake-sycl:
  870. runs-on: windows-2022
  871. defaults:
  872. run:
  873. shell: bash
  874. env:
  875. 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
  876. WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel
  877. ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI"
  878. steps:
  879. - name: Clone
  880. id: checkout
  881. uses: actions/checkout@v4
  882. - name: ccache
  883. uses: ggml-org/ccache-action@v1.2.16
  884. with:
  885. key: windows-latest-cmake-sycl
  886. variant: ccache
  887. evict-old-files: 1d
  888. - name: Install
  889. run: |
  890. scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
  891. # TODO: add libcurl support ; we will also need to modify win-build-sycl.bat to accept user-specified args
  892. - name: Build
  893. id: cmake_build
  894. run: examples/sycl/win-build-sycl.bat
  895. windows-latest-cmake-hip:
  896. runs-on: windows-2022
  897. env:
  898. # The ROCm version must correspond to the version used in the HIP SDK.
  899. ROCM_VERSION: "6.4.2"
  900. HIPSDK_INSTALLER_VERSION: "25.Q3"
  901. steps:
  902. - name: Clone
  903. id: checkout
  904. uses: actions/checkout@v4
  905. - name: Clone rocWMMA repository
  906. id: clone_rocwmma
  907. run: |
  908. git clone https://github.com/rocm/rocwmma --branch rocm-${{ env.ROCM_VERSION }} --depth 1
  909. - name: Cache ROCm Installation
  910. id: cache-rocm
  911. uses: actions/cache@v4
  912. with:
  913. path: C:\Program Files\AMD\ROCm
  914. key: rocm-${{ env.HIPSDK_INSTALLER_VERSION }}-${{ runner.os }}
  915. - name: Install ROCm
  916. if: steps.cache-rocm.outputs.cache-hit != 'true'
  917. id: depends
  918. run: |
  919. $ErrorActionPreference = "Stop"
  920. write-host "Downloading AMD HIP SDK Installer"
  921. 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"
  922. write-host "Installing AMD HIP SDK"
  923. $proc = Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -PassThru
  924. $completed = $proc.WaitForExit(600000)
  925. if (-not $completed) {
  926. Write-Error "ROCm installation timed out after 10 minutes. Killing the process"
  927. $proc.Kill()
  928. exit 1
  929. }
  930. if ($proc.ExitCode -ne 0) {
  931. Write-Error "ROCm installation failed with exit code $($proc.ExitCode)"
  932. exit 1
  933. }
  934. write-host "Completed AMD HIP SDK installation"
  935. - name: Verify ROCm
  936. id: verify
  937. run: |
  938. # Find and test ROCm installation
  939. $clangPath = Get-ChildItem 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | Select-Object -First 1
  940. if (-not $clangPath) {
  941. Write-Error "ROCm installation not found"
  942. exit 1
  943. }
  944. & $clangPath.FullName --version
  945. - name: Install ccache
  946. uses: ggml-org/ccache-action@v1.2.16
  947. with:
  948. key: ${{ github.job }}
  949. evict-old-files: 1d
  950. - name: libCURL
  951. id: get_libcurl
  952. uses: ./.github/actions/windows-setup-curl
  953. - name: Build
  954. id: cmake_build
  955. env:
  956. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  957. run: |
  958. $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
  959. $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
  960. cmake -G "Unix Makefiles" -B build -S . `
  961. -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
  962. -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
  963. -DCMAKE_CXX_FLAGS="-I$($PWD.Path.Replace('\', '/'))/rocwmma/library/include/" `
  964. -DCMAKE_BUILD_TYPE=Release `
  965. -DGGML_HIP=ON `
  966. -DGGML_HIP_ROCWMMA_FATTN=ON `
  967. -DGGML_RPC=ON `
  968. -DCURL_LIBRARY="$env:CURL_PATH/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:CURL_PATH/include"
  969. cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
  970. ios-xcode-build:
  971. runs-on: macos-latest
  972. steps:
  973. - name: Checkout code
  974. uses: actions/checkout@v4
  975. - name: Setup Xcode
  976. uses: maxim-lobanov/setup-xcode@v1
  977. with:
  978. xcode-version: latest-stable
  979. - name: Build
  980. id: cmake_build
  981. run: |
  982. sysctl -a
  983. cmake -B build -G Xcode \
  984. -DGGML_METAL_USE_BF16=ON \
  985. -DGGML_METAL_EMBED_LIBRARY=ON \
  986. -DLLAMA_CURL=OFF \
  987. -DLLAMA_BUILD_EXAMPLES=OFF \
  988. -DLLAMA_BUILD_TOOLS=OFF \
  989. -DLLAMA_BUILD_TESTS=OFF \
  990. -DLLAMA_BUILD_SERVER=OFF \
  991. -DCMAKE_SYSTEM_NAME=iOS \
  992. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  993. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  994. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  995. - name: xcodebuild for swift package
  996. id: xcodebuild
  997. run: |
  998. ./build-xcframework.sh
  999. - name: Build Xcode project
  1000. 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
  1001. android-build:
  1002. runs-on: ubuntu-latest
  1003. steps:
  1004. - name: Clone
  1005. uses: actions/checkout@v4
  1006. - name: ccache
  1007. uses: ggml-org/ccache-action@v1.2.16
  1008. with:
  1009. key: android-build
  1010. evict-old-files: 1d
  1011. - name: Set up JDK
  1012. uses: actions/setup-java@v3
  1013. with:
  1014. java-version: 17
  1015. distribution: zulu
  1016. - name: Setup Android SDK
  1017. uses: android-actions/setup-android@v3
  1018. with:
  1019. log-accepted-android-sdk-licenses: false
  1020. - name: Build
  1021. run: |
  1022. cd examples/llama.android
  1023. ./gradlew build --no-daemon
  1024. openEuler-latest-cmake-cann:
  1025. if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'Ascend NPU') }}
  1026. defaults:
  1027. run:
  1028. shell: bash -el {0}
  1029. strategy:
  1030. matrix:
  1031. arch: [x86, aarch64]
  1032. cann:
  1033. - '8.1.RC1.alpha001-910b-openeuler22.03-py3.10'
  1034. device:
  1035. - 'ascend910b3'
  1036. build:
  1037. - 'Release'
  1038. runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
  1039. container: ascendai/cann:${{ matrix.cann }}
  1040. steps:
  1041. - name: Checkout
  1042. uses: actions/checkout@v4
  1043. - name: Dependencies
  1044. run: |
  1045. yum update -y
  1046. yum install -y git gcc gcc-c++ make cmake libcurl-devel
  1047. - name: Build
  1048. run: |
  1049. export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
  1050. cmake -S . -B build \
  1051. -DCMAKE_BUILD_TYPE=${{ matrix.build }} \
  1052. -DGGML_CANN=on \
  1053. -DSOC_TYPE=${{ matrix.device }}
  1054. cmake --build build -j $(nproc)