build.yml 46 KB

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