build.yml 38 KB

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