build.yml 68 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134
  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. '**/*.glsl'
  24. ]
  25. pull_request:
  26. types: [opened, synchronize, reopened]
  27. paths: [
  28. '.github/workflows/build.yml',
  29. '.github/workflows/build-linux-cross.yml',
  30. '.github/workflows/build-cmake-pkg.yml',
  31. '**/CMakeLists.txt',
  32. '**/.cmake',
  33. '**/*.h',
  34. '**/*.hpp',
  35. '**/*.c',
  36. '**/*.cpp',
  37. '**/*.cu',
  38. '**/*.cuh',
  39. '**/*.swift',
  40. '**/*.m',
  41. '**/*.metal',
  42. '**/*.comp',
  43. '**/*.glsl'
  44. ]
  45. concurrency:
  46. group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
  47. cancel-in-progress: true
  48. env:
  49. GGML_NLOOP: 3
  50. GGML_N_THREADS: 1
  51. LLAMA_LOG_COLORS: 1
  52. LLAMA_LOG_PREFIX: 1
  53. LLAMA_LOG_TIMESTAMPS: 1
  54. jobs:
  55. macOS-latest-cmake-arm64:
  56. runs-on: macos-latest
  57. steps:
  58. - name: Clone
  59. id: checkout
  60. uses: actions/checkout@v4
  61. - name: ccache
  62. uses: ggml-org/ccache-action@v1.2.16
  63. with:
  64. key: macOS-latest-cmake-arm64
  65. evict-old-files: 1d
  66. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  67. - name: Build
  68. id: cmake_build
  69. run: |
  70. sysctl -a
  71. cmake -B build \
  72. -DCMAKE_BUILD_RPATH="@loader_path" \
  73. -DLLAMA_FATAL_WARNINGS=ON \
  74. -DLLAMA_CURL=OFF \
  75. -DLLAMA_BUILD_BORINGSSL=ON \
  76. -DGGML_METAL_USE_BF16=ON \
  77. -DGGML_METAL_EMBED_LIBRARY=OFF \
  78. -DGGML_METAL_SHADER_DEBUG=ON \
  79. -DGGML_RPC=ON
  80. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  81. 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
  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-15-intel
  89. steps:
  90. - name: Clone
  91. id: checkout
  92. uses: actions/checkout@v4
  93. - name: ccache
  94. uses: ggml-org/ccache-action@v1.2.16
  95. with:
  96. key: macOS-latest-cmake-x64
  97. evict-old-files: 1d
  98. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  99. - name: Build
  100. id: cmake_build
  101. run: |
  102. sysctl -a
  103. # Metal is disabled due to intermittent failures with Github runners not having a GPU:
  104. # https://github.com/ggml-org/llama.cpp/actions/runs/8635935781/job/23674807267#step:5:2313
  105. cmake -B build \
  106. -DCMAKE_BUILD_RPATH="@loader_path" \
  107. -DLLAMA_FATAL_WARNINGS=ON \
  108. -DLLAMA_CURL=OFF \
  109. -DLLAMA_BUILD_BORINGSSL=ON \
  110. -DGGML_METAL=OFF \
  111. -DGGML_RPC=ON \
  112. -DCMAKE_OSX_DEPLOYMENT_TARGET=13.3
  113. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  114. - name: Test
  115. id: cmake_test
  116. run: |
  117. cd build
  118. ctest -L main --verbose --timeout 900
  119. macOS-latest-cmake-arm64-webgpu:
  120. runs-on: macos-latest
  121. steps:
  122. - name: Clone
  123. id: checkout
  124. uses: actions/checkout@v4
  125. - name: ccache
  126. uses: ggml-org/ccache-action@v1.2.16
  127. with:
  128. key: macOS-latest-cmake-arm64-webgpu
  129. evict-old-files: 1d
  130. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  131. - name: Dawn Dependency
  132. id: dawn-depends
  133. run: |
  134. DAWN_VERSION="v2.0.0"
  135. DAWN_OWNER="reeselevine"
  136. DAWN_REPO="dawn"
  137. DAWN_ASSET_NAME="Dawn-5e9a4865b1635796ccc77dd30057f2b4002a1355-macos-latest-Release.zip"
  138. echo "Fetching release asset from https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  139. curl -L -o artifact.zip \
  140. "https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  141. mkdir dawn
  142. unzip artifact.zip
  143. tar -xvf Dawn-5e9a4865b1635796ccc77dd30057f2b4002a1355-macos-latest-Release.tar.gz -C dawn --strip-components=1
  144. - name: Build
  145. id: cmake_build
  146. run: |
  147. export CMAKE_PREFIX_PATH=dawn
  148. cmake -B build -DGGML_WEBGPU=ON -DGGML_METAL=OFF -DGGML_BLAS=OFF
  149. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  150. - name: Test
  151. id: cmake_test
  152. run: |
  153. cd build
  154. ctest -L main --verbose --timeout 900
  155. ubuntu-cpu-cmake:
  156. strategy:
  157. matrix:
  158. include:
  159. - build: 'x64'
  160. os: ubuntu-22.04
  161. - build: 'arm64'
  162. os: ubuntu-22.04-arm
  163. - build: 's390x'
  164. os: ubuntu-24.04-s390x
  165. - build: 'ppc64le'
  166. os: ubuntu-24.04-ppc64le
  167. runs-on: ${{ matrix.os }}
  168. steps:
  169. - name: Clone
  170. id: checkout
  171. uses: actions/checkout@v4
  172. - name: ccache
  173. uses: ggml-org/ccache-action@v1.2.16
  174. with:
  175. key: ubuntu-cpu-cmake-${{ matrix.build }}
  176. evict-old-files: 1d
  177. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  178. - name: Build Dependencies
  179. id: build_depends
  180. run: |
  181. sudo apt-get update
  182. sudo apt-get install -y --no-install-recommends \
  183. python3 python3-pip python3-dev \
  184. libjpeg-dev build-essential libssl-dev \
  185. git-lfs
  186. - name: Python Dependencies
  187. id: python_depends
  188. run: |
  189. python3 -m pip install --upgrade pip
  190. pip3 install ./gguf-py
  191. - name: Swap Endianness
  192. id: endianness
  193. if: ${{ matrix.build == 's390x' }}
  194. run: |
  195. for f in models/*.gguf; do
  196. echo YES | python3 gguf-py/gguf/scripts/gguf_convert_endian.py $f big
  197. done
  198. - name: Build
  199. id: cmake_build
  200. run: |
  201. cmake -B build \
  202. -DLLAMA_CURL=OFF \
  203. -DLLAMA_OPENSSL=ON \
  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. if: ${{ matrix.build != 's390x' }}
  215. run: |
  216. cd build
  217. echo "Fetch tokenizer"
  218. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin
  219. echo "Fetch llama2c model"
  220. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin
  221. ./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf
  222. ./bin/llama-completion -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
  223. - name: Test llama2c (s390x)
  224. id: llama2c_test_s390x
  225. if: ${{ matrix.build == 's390x' }}
  226. run: |
  227. cd build
  228. echo "Fetch llama2c big-endian model"
  229. wget https://huggingface.co/ggml-org/models/resolve/main/tinyllamas/stories260K-be.gguf
  230. ./bin/llama-completion -m stories260K-be.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
  231. ubuntu-latest-cmake-sanitizer:
  232. runs-on: ubuntu-latest
  233. continue-on-error: true
  234. strategy:
  235. matrix:
  236. sanitizer: [ADDRESS, THREAD, UNDEFINED]
  237. build_type: [Debug]
  238. steps:
  239. - name: Clone
  240. id: checkout
  241. uses: actions/checkout@v4
  242. - name: ccache
  243. uses: ggml-org/ccache-action@v1.2.16
  244. with:
  245. key: ubuntu-latest-cmake-sanitizer-${{ matrix.sanitizer }}
  246. evict-old-files: 1d
  247. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  248. - name: Dependencies
  249. id: depends
  250. run: |
  251. sudo apt-get update
  252. sudo apt-get install build-essential libssl-dev
  253. - name: Build
  254. id: cmake_build
  255. if: ${{ matrix.sanitizer != 'THREAD' }}
  256. run: |
  257. cmake -B build \
  258. -DLLAMA_CURL=OFF \
  259. -DLLAMA_OPENSSL=ON \
  260. -DLLAMA_FATAL_WARNINGS=ON \
  261. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  262. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
  263. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  264. - name: Build (no OpenMP)
  265. id: cmake_build_no_openmp
  266. if: ${{ matrix.sanitizer == 'THREAD' }}
  267. run: |
  268. cmake -B build \
  269. -DLLAMA_CURL=OFF \
  270. -DLLAMA_OPENSSL=ON \
  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 libssl-dev
  292. - name: Build
  293. id: cmake_build
  294. run: |
  295. mkdir build
  296. cd build
  297. cmake .. \
  298. -DLLAMA_CURL=OFF \
  299. -DLLAMA_OPENSSL=ON \
  300. -DLLAMA_FATAL_WARNINGS=ON \
  301. -DLLAMA_LLGUIDANCE=ON
  302. cmake --build . --config Release -j $(nproc)
  303. - name: Test
  304. id: cmake_test
  305. run: |
  306. cd build
  307. ctest -L main --verbose --timeout 900
  308. ubuntu-latest-cmake-rpc:
  309. runs-on: ubuntu-latest
  310. continue-on-error: true
  311. steps:
  312. - name: Clone
  313. id: checkout
  314. uses: actions/checkout@v4
  315. # - name: ccache
  316. # uses: ggml-org/ccache-action@v1.2.16
  317. # with:
  318. # key: ubuntu-latest-cmake-rpc
  319. # evict-old-files: 1d
  320. - name: Dependencies
  321. id: depends
  322. run: |
  323. sudo apt-get update
  324. sudo apt-get install build-essential libssl-dev
  325. - name: Build
  326. id: cmake_build
  327. run: |
  328. cmake -B build \
  329. -DLLAMA_CURL=OFF \
  330. -DLLAMA_OPENSSL=ON \
  331. -DGGML_RPC=ON
  332. cmake --build build --config Release -j $(nproc)
  333. - name: Test
  334. id: cmake_test
  335. run: |
  336. cd build
  337. ctest -L main --verbose
  338. ubuntu-24-cmake-vulkan-deb:
  339. runs-on: ubuntu-24.04
  340. steps:
  341. - name: Clone
  342. id: checkout
  343. uses: actions/checkout@v4
  344. - name: ccache
  345. uses: ggml-org/ccache-action@v1.2.16
  346. with:
  347. key: ubuntu-24-cmake-vulkan-deb
  348. evict-old-files: 1d
  349. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  350. - name: Dependencies
  351. id: depends
  352. run: |
  353. sudo apt-get install -y glslc libvulkan-dev libssl-dev
  354. - name: Configure
  355. id: cmake_configure
  356. run: |
  357. cmake -B build \
  358. -DLLAMA_CURL=OFF \
  359. -DLLAMA_OPENSSL=ON \
  360. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  361. -DGGML_BACKEND_DL=ON \
  362. -DGGML_CPU_ALL_VARIANTS=ON \
  363. -DGGML_VULKAN=ON
  364. - name: Build
  365. id: cmake_build
  366. run: |
  367. cmake --build build -j $(nproc)
  368. ubuntu-24-cmake-vulkan:
  369. runs-on: ubuntu-24.04
  370. steps:
  371. - name: Clone
  372. id: checkout
  373. uses: actions/checkout@v4
  374. - name: ccache
  375. uses: ggml-org/ccache-action@v1.2.16
  376. with:
  377. key: ubuntu-24-cmake-vulkan
  378. evict-old-files: 1d
  379. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  380. - name: Dependencies
  381. id: depends
  382. run: |
  383. sudo add-apt-repository -y ppa:kisak/kisak-mesa
  384. sudo apt-get update -y
  385. sudo apt-get install -y build-essential mesa-vulkan-drivers libxcb-xinput0 libxcb-xinerama0 libxcb-cursor-dev libssl-dev
  386. - name: Get latest Vulkan SDK version
  387. id: vulkan_sdk_version
  388. run: |
  389. echo "VULKAN_SDK_VERSION=$(curl https://vulkan.lunarg.com/sdk/latest/linux.txt)" >> "$GITHUB_ENV"
  390. - name: Use Vulkan SDK Cache
  391. uses: actions/cache@v4
  392. id: cache-sdk
  393. with:
  394. path: ./vulkan_sdk
  395. key: vulkan-sdk-${{ env.VULKAN_SDK_VERSION }}-${{ runner.os }}
  396. - name: Setup Vulkan SDK
  397. if: steps.cache-sdk.outputs.cache-hit != 'true'
  398. uses: ./.github/actions/linux-setup-vulkan
  399. with:
  400. path: ./vulkan_sdk
  401. version: ${{ env.VULKAN_SDK_VERSION }}
  402. - name: Build
  403. id: cmake_build
  404. run: |
  405. source ./vulkan_sdk/setup-env.sh
  406. cmake -B build \
  407. -DLLAMA_CURL=OFF \
  408. -DLLAMA_OPENSSL=ON \
  409. -DGGML_VULKAN=ON
  410. cmake --build build --config Release -j $(nproc)
  411. - name: Test
  412. id: cmake_test
  413. run: |
  414. cd build
  415. export GGML_VK_VISIBLE_DEVICES=0
  416. export GGML_VK_DISABLE_F16=1
  417. # This is using llvmpipe and runs slower than other backends
  418. ctest -L main --verbose --timeout 4200
  419. ubuntu-24-cmake-webgpu:
  420. runs-on: ubuntu-24.04
  421. steps:
  422. - name: Clone
  423. id: checkout
  424. uses: actions/checkout@v4
  425. - name: ccache
  426. uses: ggml-org/ccache-action@v1.2.16
  427. with:
  428. key: ubuntu-24-cmake-webgpu
  429. evict-old-files: 1d
  430. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  431. - name: Dependencies
  432. id: depends
  433. run: |
  434. sudo add-apt-repository -y ppa:kisak/kisak-mesa
  435. sudo apt-get update -y
  436. sudo apt-get install -y build-essential mesa-vulkan-drivers libxcb-xinput0 libxcb-xinerama0 libxcb-cursor-dev libssl-dev
  437. - name: Get latest Vulkan SDK version
  438. id: vulkan_sdk_version
  439. run: |
  440. echo "VULKAN_SDK_VERSION=$(curl https://vulkan.lunarg.com/sdk/latest/linux.txt)" >> "$GITHUB_ENV"
  441. - name: Use Vulkan SDK Cache
  442. uses: actions/cache@v4
  443. id: cache-sdk
  444. with:
  445. path: ./vulkan_sdk
  446. key: vulkan-sdk-${{ env.VULKAN_SDK_VERSION }}-${{ runner.os }}
  447. - name: Setup Vulkan SDK
  448. if: steps.cache-sdk.outputs.cache-hit != 'true'
  449. uses: ./.github/actions/linux-setup-vulkan
  450. with:
  451. path: ./vulkan_sdk
  452. version: ${{ env.VULKAN_SDK_VERSION }}
  453. - name: Dawn Dependency
  454. id: dawn-depends
  455. run: |
  456. sudo apt-get install -y libxrandr-dev libxinerama-dev libxcursor-dev mesa-common-dev libx11-xcb-dev libxi-dev
  457. DAWN_VERSION="v2.0.0"
  458. DAWN_OWNER="reeselevine"
  459. DAWN_REPO="dawn"
  460. DAWN_ASSET_NAME="Dawn-5e9a4865b1635796ccc77dd30057f2b4002a1355-ubuntu-latest-Release.zip"
  461. echo "Fetching release asset from https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  462. curl -L -o artifact.zip \
  463. "https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  464. mkdir dawn
  465. unzip artifact.zip
  466. tar -xvf Dawn-5e9a4865b1635796ccc77dd30057f2b4002a1355-ubuntu-latest-Release.tar.gz -C dawn --strip-components=1
  467. - name: Build
  468. id: cmake_build
  469. run: |
  470. export Dawn_DIR=dawn/lib64/cmake/Dawn
  471. cmake -B build \
  472. -DLLAMA_CURL=OFF \
  473. -DLLAMA_OPENSSL=ON \
  474. -DGGML_WEBGPU=ON
  475. cmake --build build --config Release -j $(nproc)
  476. - name: Test
  477. id: cmake_test
  478. run: |
  479. cd build
  480. # This is using llvmpipe and runs slower than other backends
  481. ctest -L main --verbose --timeout 3600
  482. ubuntu-24-wasm-webgpu:
  483. runs-on: ubuntu-24.04
  484. steps:
  485. - name: Clone
  486. id: checkout
  487. uses: actions/checkout@v4
  488. - name: ccache
  489. uses: ggml-org/ccache-action@v1.2.16
  490. with:
  491. key: ubuntu-latest-wasm-webgpu
  492. evict-old-files: 1d
  493. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  494. - name: Install Emscripten
  495. run: |
  496. git clone https://github.com/emscripten-core/emsdk.git
  497. cd emsdk
  498. ./emsdk install latest
  499. ./emsdk activate latest
  500. - name: Fetch emdawnwebgpu
  501. run: |
  502. DAWN_TAG="v20251027.212519"
  503. EMDAWN_PKG="emdawnwebgpu_pkg-${DAWN_TAG}.zip"
  504. echo "Downloading ${EMDAWN_PKG}"
  505. curl -L -o emdawn.zip \
  506. "https://github.com/google/dawn/releases/download/${DAWN_TAG}/${EMDAWN_PKG}"
  507. unzip emdawn.zip
  508. - name: Build WASM WebGPU
  509. run: |
  510. source emsdk/emsdk_env.sh
  511. emcmake cmake -B build-wasm \
  512. -DGGML_WEBGPU=ON \
  513. -DLLAMA_CURL=OFF \
  514. -DEMDAWNWEBGPU_DIR=emdawnwebgpu_pkg
  515. cmake --build build-wasm --target test-backend-ops -j $(nproc)
  516. ubuntu-22-cmake-hip:
  517. runs-on: ubuntu-22.04
  518. container: rocm/dev-ubuntu-22.04:6.1.2
  519. steps:
  520. - name: Clone
  521. id: checkout
  522. uses: actions/checkout@v4
  523. - name: Dependencies
  524. id: depends
  525. run: |
  526. sudo apt-get update
  527. sudo apt-get install -y build-essential git cmake rocblas-dev hipblas-dev libssl-dev rocwmma-dev
  528. - name: ccache
  529. uses: ggml-org/ccache-action@v1.2.16
  530. with:
  531. key: ubuntu-22-cmake-hip
  532. evict-old-files: 1d
  533. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  534. - name: Build with native CMake HIP support
  535. id: cmake_build
  536. run: |
  537. cmake -B build -S . \
  538. -DLLAMA_CURL=OFF \
  539. -DLLAMA_OPENSSL=ON \
  540. -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \
  541. -DGGML_HIP_ROCWMMA_FATTN=ON \
  542. -DGGML_HIP=ON
  543. cmake --build build --config Release -j $(nproc)
  544. ubuntu-22-cmake-musa:
  545. runs-on: ubuntu-22.04
  546. container: mthreads/musa:rc4.3.0-devel-ubuntu22.04-amd64
  547. steps:
  548. - name: Clone
  549. id: checkout
  550. uses: actions/checkout@v4
  551. - name: Dependencies
  552. id: depends
  553. run: |
  554. apt-get update
  555. apt-get install -y build-essential git cmake libssl-dev
  556. - name: ccache
  557. uses: ggml-org/ccache-action@v1.2.16
  558. with:
  559. key: ubuntu-22-cmake-musa
  560. evict-old-files: 1d
  561. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  562. - name: Build with native CMake MUSA support
  563. id: cmake_build
  564. run: |
  565. cmake -B build -S . \
  566. -DLLAMA_CURL=OFF \
  567. -DLLAMA_OPENSSL=ON \
  568. -DGGML_MUSA=ON
  569. cmake --build build --config Release -j $(nproc)
  570. ubuntu-22-cmake-sycl:
  571. runs-on: ubuntu-22.04
  572. continue-on-error: true
  573. steps:
  574. - uses: actions/checkout@v4
  575. - name: add oneAPI to apt
  576. shell: bash
  577. run: |
  578. cd /tmp
  579. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  580. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  581. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  582. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  583. - name: install oneAPI dpcpp compiler
  584. shell: bash
  585. run: |
  586. sudo apt update
  587. sudo apt install intel-oneapi-compiler-dpcpp-cpp libssl-dev
  588. - name: install oneAPI MKL library
  589. shell: bash
  590. run: |
  591. sudo apt install intel-oneapi-mkl-devel
  592. - name: Clone
  593. id: checkout
  594. uses: actions/checkout@v4
  595. - name: ccache
  596. uses: ggml-org/ccache-action@v1.2.16
  597. with:
  598. key: ubuntu-22-cmake-sycl
  599. evict-old-files: 1d
  600. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  601. - name: Build
  602. id: cmake_build
  603. run: |
  604. source /opt/intel/oneapi/setvars.sh
  605. cmake -B build \
  606. -DLLAMA_CURL=OFF \
  607. -DLLAMA_OPENSSL=ON \
  608. -DGGML_SYCL=ON \
  609. -DCMAKE_C_COMPILER=icx \
  610. -DCMAKE_CXX_COMPILER=icpx
  611. cmake --build build --config Release -j $(nproc)
  612. ubuntu-22-cmake-sycl-fp16:
  613. runs-on: ubuntu-22.04
  614. continue-on-error: true
  615. steps:
  616. - uses: actions/checkout@v4
  617. - name: add oneAPI to apt
  618. shell: bash
  619. run: |
  620. cd /tmp
  621. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  622. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  623. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  624. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  625. - name: install oneAPI dpcpp compiler
  626. shell: bash
  627. run: |
  628. sudo apt update
  629. sudo apt install intel-oneapi-compiler-dpcpp-cpp libssl-dev
  630. - name: install oneAPI MKL library
  631. shell: bash
  632. run: |
  633. sudo apt install intel-oneapi-mkl-devel
  634. - name: Clone
  635. id: checkout
  636. uses: actions/checkout@v4
  637. - name: ccache
  638. uses: ggml-org/ccache-action@v1.2.16
  639. with:
  640. key: ubuntu-22-cmake-sycl-fp16
  641. evict-old-files: 1d
  642. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  643. - name: Build
  644. id: cmake_build
  645. run: |
  646. source /opt/intel/oneapi/setvars.sh
  647. cmake -B build \
  648. -DLLAMA_CURL=OFF \
  649. -DLLAMA_OPENSSL=ON \
  650. -DGGML_SYCL=ON \
  651. -DCMAKE_C_COMPILER=icx \
  652. -DCMAKE_CXX_COMPILER=icpx \
  653. -DGGML_SYCL_F16=ON
  654. cmake --build build --config Release -j $(nproc)
  655. build-linux-cross:
  656. uses: ./.github/workflows/build-linux-cross.yml
  657. build-cmake-pkg:
  658. uses: ./.github/workflows/build-cmake-pkg.yml
  659. macOS-latest-cmake-ios:
  660. runs-on: macos-latest
  661. steps:
  662. - name: Clone
  663. id: checkout
  664. uses: actions/checkout@v4
  665. - name: ccache
  666. uses: ggml-org/ccache-action@v1.2.16
  667. with:
  668. key: macOS-latest-cmake-ios
  669. evict-old-files: 1d
  670. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  671. - name: Build
  672. id: cmake_build
  673. run: |
  674. sysctl -a
  675. cmake -B build -G Xcode \
  676. -DGGML_METAL_USE_BF16=ON \
  677. -DGGML_METAL_EMBED_LIBRARY=ON \
  678. -DLLAMA_BUILD_COMMON=OFF \
  679. -DLLAMA_BUILD_EXAMPLES=OFF \
  680. -DLLAMA_BUILD_TOOLS=OFF \
  681. -DLLAMA_BUILD_TESTS=OFF \
  682. -DLLAMA_BUILD_SERVER=OFF \
  683. -DCMAKE_SYSTEM_NAME=iOS \
  684. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  685. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  686. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  687. macOS-latest-cmake-tvos:
  688. runs-on: macos-latest
  689. steps:
  690. - name: Clone
  691. id: checkout
  692. uses: actions/checkout@v4
  693. - name: ccache
  694. uses: ggml-org/ccache-action@v1.2.16
  695. with:
  696. key: macOS-latest-cmake-tvos
  697. evict-old-files: 1d
  698. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  699. - name: Build
  700. id: cmake_build
  701. run: |
  702. sysctl -a
  703. cmake -B build -G Xcode \
  704. -DGGML_METAL_USE_BF16=ON \
  705. -DGGML_METAL_EMBED_LIBRARY=ON \
  706. -DLLAMA_BUILD_COMMON=OFF \
  707. -DLLAMA_BUILD_EXAMPLES=OFF \
  708. -DLLAMA_BUILD_TOOLS=OFF \
  709. -DLLAMA_BUILD_TESTS=OFF \
  710. -DLLAMA_BUILD_SERVER=OFF \
  711. -DCMAKE_SYSTEM_NAME=tvOS \
  712. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  713. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  714. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  715. macOS-latest-cmake-visionos:
  716. runs-on: macos-latest
  717. steps:
  718. - name: Clone
  719. id: checkout
  720. uses: actions/checkout@v4
  721. - name: Build
  722. id: cmake_build
  723. run: |
  724. sysctl -a
  725. cmake -B build -G Xcode \
  726. -DGGML_METAL_USE_BF16=ON \
  727. -DGGML_METAL_EMBED_LIBRARY=ON \
  728. -DLLAMA_BUILD_COMMON=OFF \
  729. -DLLAMA_BUILD_EXAMPLES=OFF \
  730. -DLLAMA_BUILD_TOOLS=OFF \
  731. -DLLAMA_BUILD_TESTS=OFF \
  732. -DLLAMA_BUILD_SERVER=OFF \
  733. -DCMAKE_SYSTEM_NAME=visionOS \
  734. -DCMAKE_OSX_DEPLOYMENT_TARGET=1.0 \
  735. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  736. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  737. macOS-latest-swift:
  738. runs-on: macos-latest
  739. needs: ios-xcode-build
  740. strategy:
  741. matrix:
  742. destination: ['generic/platform=macOS', 'generic/platform=iOS', 'generic/platform=tvOS']
  743. steps:
  744. - name: Clone
  745. id: checkout
  746. uses: actions/checkout@v4
  747. - name: ccache
  748. uses: ggml-org/ccache-action@v1.2.16
  749. with:
  750. key: macOS-latest-swift
  751. evict-old-files: 1d
  752. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  753. - name: Download xcframework artifact
  754. uses: actions/download-artifact@v4
  755. with:
  756. name: llama-xcframework
  757. path: build-apple/llama.xcframework/
  758. - name: Build llama.cpp with CMake
  759. id: cmake_build
  760. run: |
  761. sysctl -a
  762. cmake -B build -G Xcode \
  763. -DGGML_METAL_USE_BF16=ON \
  764. -DGGML_METAL_EMBED_LIBRARY=ON \
  765. -DLLAMA_CURL=OFF \
  766. -DLLAMA_BUILD_EXAMPLES=OFF \
  767. -DLLAMA_BUILD_TOOLS=OFF \
  768. -DLLAMA_BUILD_TESTS=OFF \
  769. -DLLAMA_BUILD_SERVER=OFF \
  770. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
  771. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  772. windows-msys2:
  773. runs-on: windows-2025
  774. strategy:
  775. fail-fast: false
  776. matrix:
  777. include:
  778. - { sys: UCRT64, env: ucrt-x86_64, build: Release }
  779. - { sys: CLANG64, env: clang-x86_64, build: Release }
  780. steps:
  781. - name: Clone
  782. uses: actions/checkout@v4
  783. - name: ccache
  784. uses: ggml-org/ccache-action@v1.2.16
  785. with:
  786. key: windows-msys2
  787. variant: ccache
  788. evict-old-files: 1d
  789. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  790. - name: Setup ${{ matrix.sys }}
  791. uses: msys2/setup-msys2@v2
  792. with:
  793. update: true
  794. msystem: ${{matrix.sys}}
  795. install: >-
  796. base-devel
  797. git
  798. mingw-w64-${{matrix.env}}-toolchain
  799. mingw-w64-${{matrix.env}}-cmake
  800. mingw-w64-${{matrix.env}}-openblas
  801. - name: Build using CMake
  802. shell: msys2 {0}
  803. run: |
  804. cmake -B build
  805. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  806. - name: Clean after building using CMake
  807. shell: msys2 {0}
  808. run: |
  809. rm -rf build
  810. - name: Build using CMake w/ OpenBLAS
  811. shell: msys2 {0}
  812. run: |
  813. cmake -B build -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
  814. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  815. windows-latest-cmake:
  816. runs-on: windows-2025
  817. env:
  818. OPENBLAS_VERSION: 0.3.23
  819. SDE_VERSION: 9.33.0-2024-01-07
  820. VULKAN_VERSION: 1.4.313.2
  821. strategy:
  822. matrix:
  823. include:
  824. - build: 'cpu-x64 (static)'
  825. arch: 'x64'
  826. 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'
  827. - build: 'openblas-x64'
  828. arch: 'x64'
  829. 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"'
  830. - build: 'vulkan-x64'
  831. arch: 'x64'
  832. 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'
  833. - build: 'llvm-arm64'
  834. arch: 'arm64'
  835. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON'
  836. - build: 'llvm-arm64-opencl-adreno'
  837. arch: 'arm64'
  838. 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'
  839. steps:
  840. - name: Clone
  841. id: checkout
  842. uses: actions/checkout@v4
  843. - name: ccache
  844. uses: ggml-org/ccache-action@v1.2.16
  845. with:
  846. key: windows-latest-cmake-${{ matrix.build }}
  847. variant: ccache
  848. evict-old-files: 1d
  849. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  850. - name: Download OpenBLAS
  851. id: get_openblas
  852. if: ${{ matrix.build == 'openblas-x64' }}
  853. run: |
  854. 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"
  855. curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE"
  856. mkdir $env:RUNNER_TEMP/openblas
  857. tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas
  858. $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
  859. $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
  860. $lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe')
  861. & $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll
  862. - name: Install Vulkan SDK
  863. id: get_vulkan
  864. if: ${{ matrix.build == 'vulkan-x64' }}
  865. run: |
  866. 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"
  867. & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
  868. Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
  869. Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
  870. - name: Install Ninja
  871. id: install_ninja
  872. run: |
  873. choco install ninja
  874. - name: Install OpenCL Headers and Libs
  875. id: install_opencl
  876. if: ${{ matrix.build == 'llvm-arm64-opencl-adreno' }}
  877. run: |
  878. git clone https://github.com/KhronosGroup/OpenCL-Headers
  879. cd OpenCL-Headers
  880. cmake -B build `
  881. -DBUILD_TESTING=OFF `
  882. -DOPENCL_HEADERS_BUILD_TESTING=OFF `
  883. -DOPENCL_HEADERS_BUILD_CXX_TESTS=OFF `
  884. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  885. cmake --build build --target install
  886. git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader
  887. cd OpenCL-ICD-Loader
  888. cmake -B build-arm64-release `
  889. -A arm64 `
  890. -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" `
  891. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  892. cmake --build build-arm64-release --target install --config release
  893. - name: Build
  894. id: cmake_build
  895. run: |
  896. cmake -S . -B build ${{ matrix.defines }} `
  897. -DLLAMA_CURL=OFF -DLLAMA_BUILD_BORINGSSL=ON
  898. cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}
  899. - name: Add libopenblas.dll
  900. id: add_libopenblas_dll
  901. if: ${{ matrix.build == 'openblas-x64' }}
  902. run: |
  903. cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll
  904. cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt
  905. - name: Test
  906. id: cmake_test
  907. if: ${{ matrix.arch == 'x64' }}
  908. run: |
  909. cd build
  910. ctest -L main -C Release --verbose --timeout 900
  911. # TODO: disabled for now, consider adding tests for all CPU variants instead
  912. # - name: Test (Intel SDE)
  913. # id: cmake_test_sde
  914. # if: ${{ matrix.build == 'avx512-x64' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation
  915. # run: |
  916. # curl.exe -o $env:RUNNER_TEMP/sde.tar.xz -L "https://downloadmirror.intel.com/813591/sde-external-${env:SDE_VERSION}-win.tar.xz"
  917. # # for some weird reason windows tar doesn't like sde tar.xz
  918. # 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar.xz
  919. # 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar
  920. # $sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe)
  921. # cd build
  922. # $env:LLAMA_SKIP_TESTS_SLOW_ON_EMULATOR = 1
  923. # & $sde -future -- ctest -L main -C Release --verbose --timeout 900
  924. ubuntu-latest-cmake-cuda:
  925. runs-on: ubuntu-latest
  926. container: nvidia/cuda:12.6.2-devel-ubuntu24.04
  927. steps:
  928. - name: Clone
  929. id: checkout
  930. uses: actions/checkout@v4
  931. - name: Install dependencies
  932. env:
  933. DEBIAN_FRONTEND: noninteractive
  934. run: |
  935. apt update
  936. apt install -y cmake build-essential ninja-build libgomp1 git libssl-dev
  937. - name: ccache
  938. uses: ggml-org/ccache-action@v1.2.16
  939. with:
  940. key: ubuntu-latest-cmake-cuda
  941. evict-old-files: 1d
  942. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  943. - name: Build with CMake
  944. # TODO: Remove GGML_CUDA_CUB_3DOT2 flag once CCCL 3.2 is bundled within CTK and that CTK version is used in this project
  945. run: |
  946. cmake -S . -B build -G Ninja \
  947. -DLLAMA_CURL=OFF \
  948. -DLLAMA_OPENSSL=ON \
  949. -DLLAMA_FATAL_WARNINGS=ON \
  950. -DCMAKE_BUILD_TYPE=Release \
  951. -DCMAKE_CUDA_ARCHITECTURES=89-real \
  952. -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined \
  953. -DGGML_NATIVE=OFF \
  954. -DGGML_CUDA=ON \
  955. -DGGML_CUDA_CUB_3DOT2=ON
  956. cmake --build build
  957. windows-2022-cmake-cuda:
  958. runs-on: windows-2022
  959. strategy:
  960. matrix:
  961. cuda: ['12.4']
  962. steps:
  963. - name: Clone
  964. id: checkout
  965. uses: actions/checkout@v4
  966. - name: Install ccache
  967. uses: ggml-org/ccache-action@v1.2.16
  968. with:
  969. key: windows-cuda-${{ matrix.cuda }}
  970. variant: ccache
  971. evict-old-files: 1d
  972. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  973. - name: Install Cuda Toolkit
  974. uses: ./.github/actions/windows-setup-cuda
  975. with:
  976. cuda_version: ${{ matrix.cuda }}
  977. - name: Install Ninja
  978. id: install_ninja
  979. run: |
  980. choco install ninja
  981. - name: Build
  982. id: cmake_build
  983. shell: cmd
  984. # TODO: Remove GGML_CUDA_CUB_3DOT2 flag once CCCL 3.2 is bundled within CTK and that CTK version is used in this project
  985. run: |
  986. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
  987. cmake -S . -B build -G "Ninja Multi-Config" ^
  988. -DLLAMA_BUILD_SERVER=ON ^
  989. -DLLAMA_CURL=OFF ^
  990. -DLLAMA_BUILD_BORINGSSL=ON ^
  991. -DGGML_NATIVE=OFF ^
  992. -DGGML_BACKEND_DL=ON ^
  993. -DGGML_CPU_ALL_VARIANTS=ON ^
  994. -DGGML_CUDA=ON ^
  995. -DGGML_RPC=ON ^
  996. -DGGML_CUDA_CUB_3DOT2=ON
  997. set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
  998. cmake --build build --config Release -j %NINJA_JOBS% -t ggml
  999. cmake --build build --config Release
  1000. windows-latest-cmake-sycl:
  1001. runs-on: windows-2022
  1002. defaults:
  1003. run:
  1004. shell: bash
  1005. env:
  1006. 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
  1007. WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel
  1008. ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI"
  1009. steps:
  1010. - name: Clone
  1011. id: checkout
  1012. uses: actions/checkout@v4
  1013. - name: ccache
  1014. uses: ggml-org/ccache-action@v1.2.16
  1015. with:
  1016. key: windows-latest-cmake-sycl
  1017. variant: ccache
  1018. evict-old-files: 1d
  1019. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1020. - name: Install
  1021. run: |
  1022. scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
  1023. # TODO: add ssl support ; we will also need to modify win-build-sycl.bat to accept user-specified args
  1024. - name: Build
  1025. id: cmake_build
  1026. run: examples/sycl/win-build-sycl.bat
  1027. windows-latest-cmake-hip:
  1028. runs-on: windows-2022
  1029. env:
  1030. # The ROCm version must correspond to the version used in the HIP SDK.
  1031. ROCM_VERSION: "6.4.2"
  1032. # Make sure this is in sync with build-cache.yml
  1033. HIPSDK_INSTALLER_VERSION: "25.Q3"
  1034. steps:
  1035. - name: Clone
  1036. id: checkout
  1037. uses: actions/checkout@v4
  1038. - name: Grab rocWMMA package
  1039. id: grab_rocwmma
  1040. run: |
  1041. 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"
  1042. 7z x rocwmma.deb
  1043. 7z x data.tar
  1044. - name: Use ROCm Installation Cache
  1045. uses: actions/cache@v4
  1046. id: cache-rocm
  1047. with:
  1048. path: C:\Program Files\AMD\ROCm
  1049. key: rocm-${{ env.HIPSDK_INSTALLER_VERSION }}-${{ runner.os }}
  1050. - name: Setup ROCm
  1051. if: steps.cache-rocm.outputs.cache-hit != 'true'
  1052. uses: ./.github/actions/windows-setup-rocm
  1053. with:
  1054. version: ${{ env.HIPSDK_INSTALLER_VERSION }}
  1055. - name: Verify ROCm
  1056. id: verify
  1057. run: |
  1058. # Find and test ROCm installation
  1059. $clangPath = Get-ChildItem 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | Select-Object -First 1
  1060. if (-not $clangPath) {
  1061. Write-Error "ROCm installation not found"
  1062. exit 1
  1063. }
  1064. & $clangPath.FullName --version
  1065. - name: Install ccache
  1066. uses: ggml-org/ccache-action@v1.2.16
  1067. with:
  1068. key: ${{ github.job }}
  1069. evict-old-files: 1d
  1070. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1071. - name: Build
  1072. id: cmake_build
  1073. run: |
  1074. $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
  1075. $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
  1076. cmake -G "Unix Makefiles" -B build -S . `
  1077. -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
  1078. -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
  1079. -DCMAKE_CXX_FLAGS="-I$($PWD.Path.Replace('\', '/'))/opt/rocm-${{ env.ROCM_VERSION }}/include/" `
  1080. -DCMAKE_BUILD_TYPE=Release `
  1081. -DLLAMA_CURL=OFF `
  1082. -DLLAMA_BUILD_BORINGSSL=ON `
  1083. -DROCM_DIR="${env:HIP_PATH}" `
  1084. -DGGML_HIP=ON `
  1085. -DGGML_HIP_ROCWMMA_FATTN=ON `
  1086. -DGGML_RPC=ON
  1087. cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
  1088. ios-xcode-build:
  1089. runs-on: macos-latest
  1090. steps:
  1091. - name: Checkout code
  1092. uses: actions/checkout@v4
  1093. - name: Setup Xcode
  1094. uses: maxim-lobanov/setup-xcode@v1
  1095. with:
  1096. xcode-version: latest-stable
  1097. - name: Build
  1098. id: cmake_build
  1099. run: |
  1100. sysctl -a
  1101. cmake -B build -G Xcode \
  1102. -DGGML_METAL_USE_BF16=ON \
  1103. -DGGML_METAL_EMBED_LIBRARY=ON \
  1104. -DLLAMA_CURL=OFF \
  1105. -DLLAMA_BUILD_EXAMPLES=OFF \
  1106. -DLLAMA_BUILD_TOOLS=OFF \
  1107. -DLLAMA_BUILD_TESTS=OFF \
  1108. -DLLAMA_BUILD_SERVER=OFF \
  1109. -DCMAKE_SYSTEM_NAME=iOS \
  1110. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  1111. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  1112. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  1113. - name: xcodebuild for swift package
  1114. id: xcodebuild
  1115. run: |
  1116. ./build-xcframework.sh
  1117. - name: Upload xcframework artifact
  1118. uses: actions/upload-artifact@v4
  1119. with:
  1120. name: llama-xcframework
  1121. path: build-apple/llama.xcframework/
  1122. retention-days: 1
  1123. - name: Build Xcode project
  1124. run: |
  1125. xcodebuild -downloadPlatform iOS
  1126. 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
  1127. android-build:
  1128. runs-on: ubuntu-latest
  1129. steps:
  1130. - name: Clone
  1131. uses: actions/checkout@v4
  1132. # Disabled due to size (400MB) and always 0 cache hits
  1133. # - name: ccache
  1134. # uses: ggml-org/ccache-action@v1.2.16
  1135. # with:
  1136. # key: android-build
  1137. # evict-old-files: 1d
  1138. - name: Set up JDK
  1139. uses: actions/setup-java@v3
  1140. with:
  1141. java-version: 17
  1142. distribution: zulu
  1143. - name: Setup Android SDK
  1144. uses: android-actions/setup-android@v3
  1145. with:
  1146. log-accepted-android-sdk-licenses: false
  1147. - name: Build
  1148. run: |
  1149. cd examples/llama.android
  1150. ./gradlew build --no-daemon
  1151. android-ndk-build:
  1152. runs-on: ubuntu-latest
  1153. env:
  1154. OPENCL_VERSION: 2025.07.22
  1155. strategy:
  1156. matrix:
  1157. include:
  1158. - build: 'arm64-cpu'
  1159. defines: '-D ANDROID_ABI=arm64-v8a -D ANDROID_PLATFORM=android-31 -D CMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake -D GGML_NATIVE=OFF -DGGML_CPU_ARM_ARCH=armv8.5-a+fp16+i8mm -G Ninja -D LLAMA_CURL=OFF -D GGML_OPENMP=OFF'
  1160. - build: 'arm64-snapdragon'
  1161. defines: '--preset arm64-android-snapdragon-release'
  1162. steps:
  1163. - name: Clone
  1164. id: checkout
  1165. uses: actions/checkout@v4
  1166. - name: Install OpenCL Headers and Libs
  1167. id: install_opencl
  1168. if: ${{ matrix.build == 'arm64-snapdragon' }}
  1169. run: |
  1170. mkdir opencl
  1171. curl -L -o opencl/clhpp.tar.gz https://github.com/KhronosGroup/OpenCL-CLHPP/archive/refs/tags/v${OPENCL_VERSION}.tar.gz
  1172. curl -L -o opencl/headers.tar.gz https://github.com/KhronosGroup/OpenCL-Headers/archive/refs/tags/v${OPENCL_VERSION}.tar.gz
  1173. curl -L -o opencl/icd-loader.tar.gz https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/refs/tags/v${OPENCL_VERSION}.tar.gz
  1174. tar -xaf opencl/headers.tar.gz -C opencl
  1175. tar -xaf opencl/clhpp.tar.gz -C opencl
  1176. tar -xaf opencl/icd-loader.tar.gz -C opencl
  1177. sudo cp -r opencl/OpenCL-Headers-${OPENCL_VERSION}/CL ${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include
  1178. sudo cp -r opencl/OpenCL-CLHPP-${OPENCL_VERSION}/include/CL/* ${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/CL
  1179. cd opencl/OpenCL-ICD-Loader-${OPENCL_VERSION}
  1180. cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake -DOPENCL_ICD_LOADER_HEADERS_DIR=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=31 -DANDROID_STL=c++_shared
  1181. cmake --build build
  1182. sudo cp build/libOpenCL.so ${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android
  1183. rm -rf opencl
  1184. - name: Install Hexagon SDK
  1185. id: install_hexsdk
  1186. if: ${{ matrix.build == 'arm64-snapdragon' }}
  1187. env:
  1188. HEXSDK_VER: 6.4.0.2
  1189. HEXTLS_VER: 19.0.04
  1190. run: |
  1191. curl -L -o hex-sdk.tar.gz https://github.com/snapdragon-toolchain/hexagon-sdk/releases/download/v$HEXSDK_VER/hexagon-sdk-v$HEXSDK_VER-amd64-lnx.tar.xz
  1192. mkdir hex-sdk
  1193. tar -xaf hex-sdk.tar.gz -C hex-sdk
  1194. ls -l hex-sdk
  1195. sudo mv hex-sdk /opt/hexagon
  1196. echo "HEXAGON_SDK_ROOT=/opt/hexagon/$HEXSDK_VER" >> "$GITHUB_ENV"
  1197. echo "HEXAGON_TOOLS_ROOT=/opt/hexagon/$HEXSDK_VER/tools/HEXAGON_Tools/$HEXTLS_VER" >> "$GITHUB_ENV"
  1198. echo "DEFAULT_HLOS_ARCH=64" >> "$GITHUB_ENV"
  1199. echo "DEFAULT_TOOLS_VARIANT=toolv19" >> "$GITHUB_ENV"
  1200. echo "DEFAULT_NO_QURT_INC=0" >> "$GITHUB_ENV"
  1201. echo "DEFAULT_DSP_ARCH=v73" >> "$GITHUB_ENV"
  1202. - name: Update CMake presets
  1203. id: update_presets
  1204. if: ${{ matrix.build == 'arm64-snapdragon' }}
  1205. run: |
  1206. cp docs/backend/hexagon/CMakeUserPresets.json .
  1207. - name: Build
  1208. id: ndk_build
  1209. run: |
  1210. cmake ${{ matrix.defines }} -B build
  1211. cmake --build build
  1212. cmake --install build --prefix pkg-adb/llama.cpp
  1213. - name: Test
  1214. id: cmake_test
  1215. run: |
  1216. echo "FIXME: test on devices"
  1217. openEuler-latest-cmake-cann:
  1218. if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'Ascend NPU') }}
  1219. defaults:
  1220. run:
  1221. shell: bash -el {0}
  1222. strategy:
  1223. matrix:
  1224. arch: [x86, aarch64]
  1225. chip_type: ['910b', '310p']
  1226. build: ['Release']
  1227. runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
  1228. steps:
  1229. - name: Checkout
  1230. uses: actions/checkout@v4
  1231. with:
  1232. fetch-depth: 0
  1233. - name: Free up disk space
  1234. uses: ggml-org/free-disk-space@v1.3.1
  1235. with:
  1236. tool-cache: true
  1237. - name: Set container image
  1238. id: cann-image
  1239. run: |
  1240. image="ascendai/cann:${{ matrix.chip_type == '910b' && '8.3.rc2-910b-openeuler24.03-py3.11' || '8.3.rc2-310p-openeuler24.03-py3.11' }}"
  1241. echo "image=${image}" >> "${GITHUB_OUTPUT}"
  1242. - name: Pull container image
  1243. run: docker pull "${{ steps.cann-image.outputs.image }}"
  1244. - name: Build
  1245. env:
  1246. BUILD_TYPE: ${{ matrix.build }}
  1247. SOC_TYPE: ascend${{ matrix.chip_type }}
  1248. run: |
  1249. HOST_UID=$(id -u)
  1250. HOST_GID=$(id -g)
  1251. docker run --rm \
  1252. -v "${PWD}:/workspace" \
  1253. -w /workspace \
  1254. -e SOC_TYPE=${SOC_TYPE} \
  1255. -e BUILD_TYPE=${BUILD_TYPE} \
  1256. "${{ steps.cann-image.outputs.image }}" \
  1257. bash -lc '
  1258. set -e
  1259. yum install -y --setopt=install_weak_deps=False --setopt=tsflags=nodocs git gcc gcc-c++ make cmake libcurl-devel
  1260. yum clean all && rm -rf /var/cache/yum
  1261. git config --global --add safe.directory "/workspace"
  1262. export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
  1263. cmake -S . -B build \
  1264. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
  1265. -DGGML_CANN=on \
  1266. -DSOC_TYPE=${SOC_TYPE}
  1267. cmake --build build -j $(nproc)
  1268. chown -R '"${HOST_UID}"':'"${HOST_GID}"' /workspace/build
  1269. '
  1270. # TODO: simplify the following workflows using a matrix
  1271. # TODO: run lighter CI on PRs and the full CI only on master (if needed)
  1272. ggml-ci-x64-cpu-low-perf:
  1273. runs-on: ubuntu-22.04
  1274. steps:
  1275. - name: Clone
  1276. id: checkout
  1277. uses: actions/checkout@v4
  1278. - name: ccache
  1279. uses: ggml-org/ccache-action@v1.2.16
  1280. with:
  1281. key: ggml-ci-x64-cpu-low-perf
  1282. evict-old-files: 1d
  1283. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1284. - name: Dependencies
  1285. id: depends
  1286. run: |
  1287. sudo apt-get update
  1288. sudo apt-get install build-essential libcurl4-openssl-dev
  1289. - name: Test
  1290. id: ggml-ci
  1291. run: |
  1292. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_LOW_PERF=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1293. ggml-ci-arm64-cpu-low-perf:
  1294. runs-on: ubuntu-22.04-arm
  1295. steps:
  1296. - name: Clone
  1297. id: checkout
  1298. uses: actions/checkout@v4
  1299. - name: ccache
  1300. uses: ggml-org/ccache-action@v1.2.16
  1301. with:
  1302. key: ggml-ci-arm64-cpu-low-perf
  1303. evict-old-files: 1d
  1304. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1305. - name: Dependencies
  1306. id: depends
  1307. run: |
  1308. sudo apt-get update
  1309. sudo apt-get install build-essential libcurl4-openssl-dev
  1310. - name: Test
  1311. id: ggml-ci
  1312. run: |
  1313. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_LOW_PERF=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1314. ggml-ci-x64-cpu-high-perf:
  1315. runs-on: ubuntu-22.04
  1316. steps:
  1317. - name: Clone
  1318. id: checkout
  1319. uses: actions/checkout@v4
  1320. - name: ccache
  1321. uses: ggml-org/ccache-action@v1.2.16
  1322. with:
  1323. key: ggml-ci-x64-cpu-high-perf
  1324. evict-old-files: 1d
  1325. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1326. - name: Dependencies
  1327. id: depends
  1328. run: |
  1329. sudo apt-get update
  1330. sudo apt-get install build-essential libcurl4-openssl-dev
  1331. - name: Test
  1332. id: ggml-ci
  1333. run: |
  1334. LLAMA_ARG_THREADS=$(nproc) bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1335. ggml-ci-arm64-cpu-high-perf:
  1336. runs-on: ubuntu-22.04-arm
  1337. steps:
  1338. - name: Clone
  1339. id: checkout
  1340. uses: actions/checkout@v4
  1341. - name: ccache
  1342. uses: ggml-org/ccache-action@v1.2.16
  1343. with:
  1344. key: ggml-ci-arm64-cpu-high-perf
  1345. evict-old-files: 1d
  1346. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1347. - name: Dependencies
  1348. id: depends
  1349. run: |
  1350. sudo apt-get update
  1351. sudo apt-get install build-essential libcurl4-openssl-dev
  1352. - name: Test
  1353. id: ggml-ci
  1354. run: |
  1355. 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
  1356. ggml-ci-arm64-cpu-high-perf-sve:
  1357. runs-on: ubuntu-22.04-arm
  1358. steps:
  1359. - name: Clone
  1360. id: checkout
  1361. uses: actions/checkout@v4
  1362. - name: ccache
  1363. uses: ggml-org/ccache-action@v1.2.16
  1364. with:
  1365. key: ggml-ci-arm64-cpu-high-perf-sve
  1366. evict-old-files: 1d
  1367. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1368. - name: Dependencies
  1369. id: depends
  1370. run: |
  1371. sudo apt-get update
  1372. sudo apt-get install build-essential libcurl4-openssl-dev
  1373. - name: Test
  1374. id: ggml-ci
  1375. run: |
  1376. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_NO_BF16=1 GG_BUILD_EXTRA_TESTS_0=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1377. ggml-ci-x64-nvidia-cuda:
  1378. runs-on: [self-hosted, Linux, X64, NVIDIA]
  1379. steps:
  1380. - name: Clone
  1381. id: checkout
  1382. uses: actions/checkout@v4
  1383. - name: Test
  1384. id: ggml-ci
  1385. run: |
  1386. nvidia-smi
  1387. GG_BUILD_CUDA=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1388. ggml-ci-x64-nvidia-vulkan-cm:
  1389. runs-on: [self-hosted, Linux, X64, NVIDIA]
  1390. steps:
  1391. - name: Clone
  1392. id: checkout
  1393. uses: actions/checkout@v4
  1394. - name: Test
  1395. id: ggml-ci
  1396. run: |
  1397. vulkaninfo --summary
  1398. GG_BUILD_VULKAN=1 GGML_VK_DISABLE_COOPMAT2=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1399. ggml-ci-x64-nvidia-vulkan-cm2:
  1400. runs-on: [self-hosted, Linux, X64, NVIDIA, COOPMAT2]
  1401. steps:
  1402. - name: Clone
  1403. id: checkout
  1404. uses: actions/checkout@v4
  1405. - name: Test
  1406. id: ggml-ci
  1407. run: |
  1408. vulkaninfo --summary
  1409. GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1410. ggml-ci-x64-cpu-amx:
  1411. runs-on: [self-hosted, Linux, X64, CPU, AMX]
  1412. steps:
  1413. - name: Clone
  1414. id: checkout
  1415. uses: actions/checkout@v4
  1416. - name: Test
  1417. id: ggml-ci
  1418. run: |
  1419. bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1420. # ggml-ci-x64-amd-vulkan:
  1421. # runs-on: [self-hosted, Linux, X64, AMD]
  1422. # steps:
  1423. # - name: Clone
  1424. # id: checkout
  1425. # uses: actions/checkout@v4
  1426. # - name: Test
  1427. # id: ggml-ci
  1428. # run: |
  1429. # vulkaninfo --summary
  1430. # GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1431. # ggml-ci-x64-amd-rocm:
  1432. # runs-on: [self-hosted, Linux, X64, AMD]
  1433. # steps:
  1434. # - name: Clone
  1435. # id: checkout
  1436. # uses: actions/checkout@v4
  1437. # - name: Test
  1438. # id: ggml-ci
  1439. # run: |
  1440. # amd-smi static
  1441. # GG_BUILD_ROCM=1 GG_BUILD_AMDGPU_TARGETS="gfx1101" bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1442. ggml-ci-mac-metal:
  1443. runs-on: [self-hosted, macOS, ARM64]
  1444. steps:
  1445. - name: Clone
  1446. id: checkout
  1447. uses: actions/checkout@v4
  1448. - name: Test
  1449. id: ggml-ci
  1450. run: |
  1451. GG_BUILD_METAL=1 bash ./ci/run.sh ~/results/llama.cpp ~/mnt/llama.cpp
  1452. ggml-ci-mac-vulkan:
  1453. runs-on: [self-hosted, macOS, ARM64]
  1454. steps:
  1455. - name: Clone
  1456. id: checkout
  1457. uses: actions/checkout@v4
  1458. - name: Test
  1459. id: ggml-ci
  1460. run: |
  1461. vulkaninfo --summary
  1462. GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp ~/mnt/llama.cpp
  1463. ggml-ci-arm64-cpu-kleidiai:
  1464. runs-on: ubuntu-22.04-arm
  1465. steps:
  1466. - name: Clone
  1467. id: checkout
  1468. uses: actions/checkout@v4
  1469. - name: ccache
  1470. uses: ggml-org/ccache-action@v1.2.16
  1471. with:
  1472. key: ggml-ci-arm64-cpu-kleidiai
  1473. evict-old-files: 1d
  1474. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1475. - name: Dependencies
  1476. id: depends
  1477. run: |
  1478. sudo apt-get update
  1479. sudo apt-get install -y build-essential libcurl4-openssl-dev
  1480. - name: Test
  1481. id: ggml-ci
  1482. run: |
  1483. GG_BUILD_KLEIDIAI=1 GG_BUILD_EXTRA_TESTS_0=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1484. ubuntu-cpu-cmake-riscv64-native:
  1485. runs-on: RISCV64
  1486. steps:
  1487. - name: Install dependencies
  1488. run: |
  1489. sudo apt-get update
  1490. # Install necessary packages
  1491. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential libssl-dev wget ccache git-lfs
  1492. # Set gcc-14 and g++-14 as the default compilers
  1493. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1494. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1495. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1496. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1497. # Install Rust stable version
  1498. rustup install stable
  1499. rustup default stable
  1500. git lfs install
  1501. - name: Clone
  1502. id: checkout
  1503. uses: actions/checkout@v4
  1504. - name: Check environment
  1505. run: |
  1506. uname -a
  1507. gcc --version
  1508. g++ --version
  1509. ldd --version
  1510. cmake --version
  1511. rustc --version
  1512. - name: Setup ccache
  1513. run: |
  1514. # Set unique cache directory for this job
  1515. export CCACHE_DIR="$HOME/.ccache/cpu-cmake-rv64-native"
  1516. mkdir -p "$CCACHE_DIR"
  1517. # Configure ccache for optimal performance
  1518. ccache --set-config=max_size=5G
  1519. ccache --set-config=compression=true
  1520. ccache --set-config=compression_level=6
  1521. ccache --set-config=cache_dir="$CCACHE_DIR"
  1522. # Enable more aggressive caching
  1523. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1524. ccache --set-config=hash_dir=false
  1525. # Export for subsequent steps
  1526. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1527. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1528. - name: Build
  1529. id: cmake_build
  1530. run: |
  1531. cmake -B build \
  1532. -DLLAMA_CURL=OFF \
  1533. -DLLAMA_OPENSSL=ON \
  1534. -DCMAKE_BUILD_TYPE=Release \
  1535. -DGGML_OPENMP=OFF \
  1536. -DLLAMA_BUILD_EXAMPLES=ON \
  1537. -DLLAMA_BUILD_TOOLS=ON \
  1538. -DLLAMA_BUILD_TESTS=ON \
  1539. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1540. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1541. -DGGML_RPC=ON \
  1542. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1543. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1544. cmake --build build --config Release -j $(nproc)
  1545. - name: Test
  1546. id: cmake_test
  1547. run: |
  1548. cd build
  1549. ctest -L 'main|curl' --verbose --timeout 900
  1550. - name: Test llama2c conversion
  1551. id: llama2c_test
  1552. run: |
  1553. cd build
  1554. echo "Fetch tokenizer"
  1555. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin
  1556. echo "Fetch llama2c model"
  1557. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin
  1558. ./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf
  1559. ./bin/llama-completion -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
  1560. ubuntu-cmake-sanitizer-riscv64-native:
  1561. runs-on: RISCV64
  1562. continue-on-error: true
  1563. strategy:
  1564. matrix:
  1565. sanitizer: [ADDRESS, THREAD, UNDEFINED]
  1566. build_type: [Debug]
  1567. steps:
  1568. - name: Install dependencies
  1569. run: |
  1570. sudo apt-get update
  1571. # Install necessary packages
  1572. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential wget ccache git-lfs
  1573. # Set gcc-14 and g++-14 as the default compilers
  1574. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1575. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1576. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1577. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1578. # Install Rust stable version
  1579. rustup install stable
  1580. rustup default stable
  1581. git lfs install
  1582. - name: GCC version check
  1583. run: |
  1584. gcc --version
  1585. g++ --version
  1586. - name: Clone
  1587. id: checkout
  1588. uses: actions/checkout@v4
  1589. - name: Setup ccache
  1590. run: |
  1591. # Unique cache directory per matrix combination
  1592. export CCACHE_DIR="$HOME/.ccache/sanitizer-${{ matrix.sanitizer }}-${{ matrix.build_type }}"
  1593. mkdir -p "$CCACHE_DIR"
  1594. # Configure ccache
  1595. ccache --set-config=max_size=5G
  1596. ccache --set-config=compression=true
  1597. ccache --set-config=compression_level=6
  1598. ccache --set-config=cache_dir="$CCACHE_DIR"
  1599. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1600. ccache --set-config=hash_dir=false
  1601. # Export for subsequent steps
  1602. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1603. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1604. - name: Build
  1605. id: cmake_build
  1606. if: ${{ matrix.sanitizer != 'THREAD' }}
  1607. run: |
  1608. cmake -B build \
  1609. -DLLAMA_CURL=OFF \
  1610. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  1611. -DGGML_OPENMP=ON \
  1612. -DLLAMA_BUILD_EXAMPLES=ON \
  1613. -DLLAMA_BUILD_TOOLS=ON \
  1614. -DLLAMA_BUILD_TESTS=OFF \
  1615. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1616. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1617. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  1618. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1619. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1620. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  1621. - name: Build (no OpenMP)
  1622. id: cmake_build_no_openmp
  1623. if: ${{ matrix.sanitizer == 'THREAD' }}
  1624. run: |
  1625. cmake -B build \
  1626. -DLLAMA_CURL=OFF \
  1627. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  1628. -DGGML_OPENMP=OFF \
  1629. -DLLAMA_BUILD_EXAMPLES=ON \
  1630. -DLLAMA_BUILD_TOOLS=ON \
  1631. -DLLAMA_BUILD_TESTS=OFF \
  1632. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1633. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1634. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  1635. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1636. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1637. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  1638. - name: Test
  1639. id: cmake_test
  1640. run: |
  1641. cd build
  1642. ctest -L main --verbose --timeout 900
  1643. ubuntu-llguidance-riscv64-native:
  1644. runs-on: RISCV64
  1645. steps:
  1646. - name: Install dependencies
  1647. run: |
  1648. sudo apt-get update
  1649. # Install necessary packages
  1650. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential wget ccache git-lfs
  1651. # Set gcc-14 and g++-14 as the default compilers
  1652. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1653. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1654. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1655. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1656. # Install Rust stable version
  1657. rustup install stable
  1658. rustup default stable
  1659. git lfs install
  1660. - name: GCC version check
  1661. run: |
  1662. gcc --version
  1663. g++ --version
  1664. - name: Clone
  1665. id: checkout
  1666. uses: actions/checkout@v4
  1667. - name: Setup ccache
  1668. run: |
  1669. export CCACHE_DIR="$HOME/.ccache/llguidance-riscv64"
  1670. mkdir -p "$CCACHE_DIR"
  1671. ccache --set-config=max_size=5G
  1672. ccache --set-config=compression=true
  1673. ccache --set-config=compression_level=6
  1674. ccache --set-config=cache_dir="$CCACHE_DIR"
  1675. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1676. ccache --set-config=hash_dir=false
  1677. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1678. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1679. - name: Build
  1680. id: cmake_build
  1681. run: |
  1682. cmake -B build \
  1683. -DLLAMA_CURL=OFF \
  1684. -DCMAKE_BUILD_TYPE=Release \
  1685. -DGGML_OPENMP=OFF \
  1686. -DLLAMA_BUILD_EXAMPLES=ON \
  1687. -DLLAMA_BUILD_TOOLS=ON \
  1688. -DLLAMA_BUILD_TESTS=OFF \
  1689. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1690. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1691. -DLLAMA_LLGUIDANCE=ON \
  1692. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1693. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1694. cmake --build build --config Release -j $(nproc)
  1695. - name: Test
  1696. id: cmake_test
  1697. run: |
  1698. cd build
  1699. ctest -L main --verbose --timeout 900
  1700. ubuntu-cmake-rpc-riscv64-native:
  1701. runs-on: RISCV64
  1702. continue-on-error: true
  1703. steps:
  1704. - name: Install dependencies
  1705. run: |
  1706. sudo apt-get update
  1707. # Install necessary packages
  1708. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential libssl-dev wget ccache git-lfs
  1709. # Set gcc-14 and g++-14 as the default compilers
  1710. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1711. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1712. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1713. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1714. # Install Rust stable version
  1715. rustup install stable
  1716. rustup default stable
  1717. git lfs install
  1718. - name: GCC version check
  1719. run: |
  1720. gcc --version
  1721. g++ --version
  1722. - name: Clone
  1723. id: checkout
  1724. uses: actions/checkout@v4
  1725. - name: Setup ccache
  1726. run: |
  1727. export CCACHE_DIR="$HOME/.ccache/rpc-riscv64"
  1728. mkdir -p "$CCACHE_DIR"
  1729. ccache --set-config=max_size=5G
  1730. ccache --set-config=compression=true
  1731. ccache --set-config=compression_level=6
  1732. ccache --set-config=cache_dir="$CCACHE_DIR"
  1733. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1734. ccache --set-config=hash_dir=false
  1735. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1736. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1737. - name: Build
  1738. id: cmake_build
  1739. run: |
  1740. cmake -B build \
  1741. -DLLAMA_CURL=OFF \
  1742. -DLLAMA_OPENSSL=ON \
  1743. -DCMAKE_BUILD_TYPE=Release \
  1744. -DGGML_OPENMP=OFF \
  1745. -DLLAMA_BUILD_EXAMPLES=ON \
  1746. -DLLAMA_BUILD_TOOLS=ON \
  1747. -DLLAMA_BUILD_TESTS=ON \
  1748. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1749. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1750. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1751. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14 \
  1752. -DGGML_RPC=ON
  1753. cmake --build build --config Release -j $(nproc)
  1754. - name: Test
  1755. id: cmake_test
  1756. run: |
  1757. cd build
  1758. ctest -L main --verbose
  1759. ggml-ci-arm64-graviton4-kleidiai:
  1760. runs-on: ah-ubuntu_22_04-c8g_8x
  1761. steps:
  1762. - name: Clone
  1763. id: checkout
  1764. uses: actions/checkout@v4
  1765. - name: Dependencies
  1766. id: depends
  1767. run: |
  1768. set -euxo pipefail
  1769. sudo apt-get update
  1770. sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a \
  1771. apt-get install -y \
  1772. build-essential \
  1773. libcurl4-openssl-dev \
  1774. python3-venv \
  1775. gpg \
  1776. wget \
  1777. time \
  1778. git-lfs
  1779. git lfs install
  1780. # install the latest cmake
  1781. sudo install -d /usr/share/keyrings
  1782. wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc \
  1783. | gpg --dearmor \
  1784. | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
  1785. echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' \
  1786. | sudo tee /etc/apt/sources.list.d/kitware.list
  1787. sudo apt-get update
  1788. sudo apt-get install -y cmake
  1789. - name: ccache
  1790. uses: ggml-org/ccache-action@v1.2.16
  1791. with:
  1792. key: ggml-ci-arm64-graviton4-kleidiai
  1793. evict-old-files: 1d
  1794. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1795. - name: Test
  1796. id: ggml-ci
  1797. run: |
  1798. GG_BUILD_KLEIDIAI=1 \
  1799. GG_BUILD_EXTRA_TESTS_0=1 \
  1800. bash ./ci/run.sh ./tmp/results ./tmp/mnt