build.yml 67 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122
  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. run: |
  945. cmake -S . -B build -G Ninja \
  946. -DLLAMA_CURL=OFF \
  947. -DLLAMA_OPENSSL=ON \
  948. -DLLAMA_FATAL_WARNINGS=ON \
  949. -DCMAKE_BUILD_TYPE=Release \
  950. -DCMAKE_CUDA_ARCHITECTURES=89-real \
  951. -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined \
  952. -DGGML_NATIVE=OFF \
  953. -DGGML_CUDA=ON
  954. cmake --build build
  955. windows-2022-cmake-cuda:
  956. runs-on: windows-2022
  957. strategy:
  958. matrix:
  959. cuda: ['12.4']
  960. steps:
  961. - name: Clone
  962. id: checkout
  963. uses: actions/checkout@v4
  964. - name: Install ccache
  965. uses: ggml-org/ccache-action@v1.2.16
  966. with:
  967. key: windows-cuda-${{ matrix.cuda }}
  968. variant: ccache
  969. evict-old-files: 1d
  970. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  971. - name: Install Cuda Toolkit
  972. uses: ./.github/actions/windows-setup-cuda
  973. with:
  974. cuda_version: ${{ matrix.cuda }}
  975. - name: Install Ninja
  976. id: install_ninja
  977. run: |
  978. choco install ninja
  979. - name: Build
  980. id: cmake_build
  981. shell: cmd
  982. run: |
  983. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
  984. cmake -S . -B build -G "Ninja Multi-Config" ^
  985. -DLLAMA_BUILD_SERVER=ON ^
  986. -DLLAMA_CURL=OFF ^
  987. -DLLAMA_BUILD_BORINGSSL=ON ^
  988. -DGGML_NATIVE=OFF ^
  989. -DGGML_BACKEND_DL=ON ^
  990. -DGGML_CPU_ALL_VARIANTS=ON ^
  991. -DGGML_CUDA=ON ^
  992. -DGGML_RPC=ON
  993. set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
  994. cmake --build build --config Release -j %NINJA_JOBS% -t ggml
  995. cmake --build build --config Release
  996. windows-latest-cmake-sycl:
  997. runs-on: windows-2022
  998. defaults:
  999. run:
  1000. shell: bash
  1001. env:
  1002. 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
  1003. WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel
  1004. ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI"
  1005. steps:
  1006. - name: Clone
  1007. id: checkout
  1008. uses: actions/checkout@v4
  1009. - name: ccache
  1010. uses: ggml-org/ccache-action@v1.2.16
  1011. with:
  1012. key: windows-latest-cmake-sycl
  1013. variant: ccache
  1014. evict-old-files: 1d
  1015. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1016. - name: Install
  1017. run: |
  1018. scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
  1019. # TODO: add ssl support ; we will also need to modify win-build-sycl.bat to accept user-specified args
  1020. - name: Build
  1021. id: cmake_build
  1022. run: examples/sycl/win-build-sycl.bat
  1023. windows-latest-cmake-hip:
  1024. runs-on: windows-2022
  1025. env:
  1026. # The ROCm version must correspond to the version used in the HIP SDK.
  1027. ROCM_VERSION: "6.4.2"
  1028. # Make sure this is in sync with build-cache.yml
  1029. HIPSDK_INSTALLER_VERSION: "25.Q3"
  1030. steps:
  1031. - name: Clone
  1032. id: checkout
  1033. uses: actions/checkout@v4
  1034. - name: Grab rocWMMA package
  1035. id: grab_rocwmma
  1036. run: |
  1037. 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"
  1038. 7z x rocwmma.deb
  1039. 7z x data.tar
  1040. - name: Use ROCm Installation Cache
  1041. uses: actions/cache@v4
  1042. id: cache-rocm
  1043. with:
  1044. path: C:\Program Files\AMD\ROCm
  1045. key: rocm-${{ env.HIPSDK_INSTALLER_VERSION }}-${{ runner.os }}
  1046. - name: Setup ROCm
  1047. if: steps.cache-rocm.outputs.cache-hit != 'true'
  1048. uses: ./.github/actions/windows-setup-rocm
  1049. with:
  1050. version: ${{ env.HIPSDK_INSTALLER_VERSION }}
  1051. - name: Verify ROCm
  1052. id: verify
  1053. run: |
  1054. # Find and test ROCm installation
  1055. $clangPath = Get-ChildItem 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | Select-Object -First 1
  1056. if (-not $clangPath) {
  1057. Write-Error "ROCm installation not found"
  1058. exit 1
  1059. }
  1060. & $clangPath.FullName --version
  1061. - name: Install ccache
  1062. uses: ggml-org/ccache-action@v1.2.16
  1063. with:
  1064. key: ${{ github.job }}
  1065. evict-old-files: 1d
  1066. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1067. - name: Build
  1068. id: cmake_build
  1069. run: |
  1070. $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
  1071. $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
  1072. cmake -G "Unix Makefiles" -B build -S . `
  1073. -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
  1074. -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
  1075. -DCMAKE_CXX_FLAGS="-I$($PWD.Path.Replace('\', '/'))/opt/rocm-${{ env.ROCM_VERSION }}/include/" `
  1076. -DCMAKE_BUILD_TYPE=Release `
  1077. -DLLAMA_CURL=OFF `
  1078. -DLLAMA_BUILD_BORINGSSL=ON `
  1079. -DROCM_DIR="${env:HIP_PATH}" `
  1080. -DGGML_HIP=ON `
  1081. -DGGML_HIP_ROCWMMA_FATTN=ON `
  1082. -DGGML_RPC=ON
  1083. cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
  1084. ios-xcode-build:
  1085. runs-on: macos-latest
  1086. steps:
  1087. - name: Checkout code
  1088. uses: actions/checkout@v4
  1089. - name: Setup Xcode
  1090. uses: maxim-lobanov/setup-xcode@v1
  1091. with:
  1092. xcode-version: latest-stable
  1093. - name: Build
  1094. id: cmake_build
  1095. run: |
  1096. sysctl -a
  1097. cmake -B build -G Xcode \
  1098. -DGGML_METAL_USE_BF16=ON \
  1099. -DGGML_METAL_EMBED_LIBRARY=ON \
  1100. -DLLAMA_CURL=OFF \
  1101. -DLLAMA_BUILD_EXAMPLES=OFF \
  1102. -DLLAMA_BUILD_TOOLS=OFF \
  1103. -DLLAMA_BUILD_TESTS=OFF \
  1104. -DLLAMA_BUILD_SERVER=OFF \
  1105. -DCMAKE_SYSTEM_NAME=iOS \
  1106. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  1107. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  1108. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  1109. - name: xcodebuild for swift package
  1110. id: xcodebuild
  1111. run: |
  1112. ./build-xcframework.sh
  1113. - name: Upload xcframework artifact
  1114. uses: actions/upload-artifact@v4
  1115. with:
  1116. name: llama-xcframework
  1117. path: build-apple/llama.xcframework/
  1118. retention-days: 1
  1119. - name: Build Xcode project
  1120. run: |
  1121. xcodebuild -downloadPlatform iOS
  1122. 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
  1123. android-build:
  1124. runs-on: ubuntu-latest
  1125. steps:
  1126. - name: Clone
  1127. uses: actions/checkout@v4
  1128. # Disabled due to size (400MB) and always 0 cache hits
  1129. # - name: ccache
  1130. # uses: ggml-org/ccache-action@v1.2.16
  1131. # with:
  1132. # key: android-build
  1133. # evict-old-files: 1d
  1134. - name: Set up JDK
  1135. uses: actions/setup-java@v3
  1136. with:
  1137. java-version: 17
  1138. distribution: zulu
  1139. - name: Setup Android SDK
  1140. uses: android-actions/setup-android@v3
  1141. with:
  1142. log-accepted-android-sdk-licenses: false
  1143. - name: Build
  1144. run: |
  1145. cd examples/llama.android
  1146. ./gradlew build --no-daemon
  1147. android-ndk-build:
  1148. runs-on: ubuntu-latest
  1149. env:
  1150. OPENCL_VERSION: 2025.07.22
  1151. strategy:
  1152. matrix:
  1153. include:
  1154. - build: 'arm64-cpu'
  1155. 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'
  1156. - build: 'arm64-snapdragon'
  1157. defines: '--preset arm64-android-snapdragon-release'
  1158. steps:
  1159. - name: Clone
  1160. id: checkout
  1161. uses: actions/checkout@v4
  1162. - name: Install OpenCL Headers and Libs
  1163. id: install_opencl
  1164. if: ${{ matrix.build == 'arm64-snapdragon' }}
  1165. run: |
  1166. mkdir opencl
  1167. curl -L -o opencl/clhpp.tar.gz https://github.com/KhronosGroup/OpenCL-CLHPP/archive/refs/tags/v${OPENCL_VERSION}.tar.gz
  1168. curl -L -o opencl/headers.tar.gz https://github.com/KhronosGroup/OpenCL-Headers/archive/refs/tags/v${OPENCL_VERSION}.tar.gz
  1169. curl -L -o opencl/icd-loader.tar.gz https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/refs/tags/v${OPENCL_VERSION}.tar.gz
  1170. tar -xaf opencl/headers.tar.gz -C opencl
  1171. tar -xaf opencl/clhpp.tar.gz -C opencl
  1172. tar -xaf opencl/icd-loader.tar.gz -C opencl
  1173. sudo cp -r opencl/OpenCL-Headers-${OPENCL_VERSION}/CL ${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include
  1174. sudo cp -r opencl/OpenCL-CLHPP-${OPENCL_VERSION}/include/CL/* ${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/CL
  1175. cd opencl/OpenCL-ICD-Loader-${OPENCL_VERSION}
  1176. 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
  1177. cmake --build build
  1178. sudo cp build/libOpenCL.so ${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android
  1179. rm -rf opencl
  1180. - name: Install Hexagon SDK
  1181. id: install_hexsdk
  1182. if: ${{ matrix.build == 'arm64-snapdragon' }}
  1183. env:
  1184. HEXSDK_VER: 6.4.0.2
  1185. HEXTLS_VER: 19.0.04
  1186. run: |
  1187. 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
  1188. mkdir hex-sdk
  1189. tar -xaf hex-sdk.tar.gz -C hex-sdk
  1190. ls -l hex-sdk
  1191. sudo mv hex-sdk /opt/hexagon
  1192. echo "HEXAGON_SDK_ROOT=/opt/hexagon/$HEXSDK_VER" >> "$GITHUB_ENV"
  1193. echo "HEXAGON_TOOLS_ROOT=/opt/hexagon/$HEXSDK_VER/tools/HEXAGON_Tools/$HEXTLS_VER" >> "$GITHUB_ENV"
  1194. echo "DEFAULT_HLOS_ARCH=64" >> "$GITHUB_ENV"
  1195. echo "DEFAULT_TOOLS_VARIANT=toolv19" >> "$GITHUB_ENV"
  1196. echo "DEFAULT_NO_QURT_INC=0" >> "$GITHUB_ENV"
  1197. echo "DEFAULT_DSP_ARCH=v73" >> "$GITHUB_ENV"
  1198. - name: Update CMake presets
  1199. id: update_presets
  1200. if: ${{ matrix.build == 'arm64-snapdragon' }}
  1201. run: |
  1202. cp docs/backend/hexagon/CMakeUserPresets.json .
  1203. - name: Build
  1204. id: ndk_build
  1205. run: |
  1206. cmake ${{ matrix.defines }} -B build
  1207. cmake --build build
  1208. cmake --install build --prefix pkg-adb/llama.cpp
  1209. - name: Test
  1210. id: cmake_test
  1211. run: |
  1212. echo "FIXME: test on devices"
  1213. openEuler-latest-cmake-cann:
  1214. if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'Ascend NPU') }}
  1215. defaults:
  1216. run:
  1217. shell: bash -el {0}
  1218. strategy:
  1219. matrix:
  1220. arch: [x86, aarch64]
  1221. chip_type: ['910b', '310p']
  1222. build: ['Release']
  1223. runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
  1224. steps:
  1225. - name: Checkout
  1226. uses: actions/checkout@v4
  1227. with:
  1228. fetch-depth: 0
  1229. - name: Free up disk space
  1230. uses: ggml-org/free-disk-space@v1.3.1
  1231. with:
  1232. tool-cache: true
  1233. - name: Set container image
  1234. id: cann-image
  1235. run: |
  1236. image="ascendai/cann:${{ matrix.chip_type == '910b' && '8.3.rc2-910b-openeuler24.03-py3.11' || '8.3.rc2-310p-openeuler24.03-py3.11' }}"
  1237. echo "image=${image}" >> "${GITHUB_OUTPUT}"
  1238. - name: Pull container image
  1239. run: docker pull "${{ steps.cann-image.outputs.image }}"
  1240. - name: Build
  1241. env:
  1242. BUILD_TYPE: ${{ matrix.build }}
  1243. SOC_TYPE: ascend${{ matrix.chip_type }}
  1244. run: |
  1245. HOST_UID=$(id -u)
  1246. HOST_GID=$(id -g)
  1247. docker run --rm \
  1248. -v "${PWD}:/workspace" \
  1249. -w /workspace \
  1250. -e SOC_TYPE=${SOC_TYPE} \
  1251. -e BUILD_TYPE=${BUILD_TYPE} \
  1252. "${{ steps.cann-image.outputs.image }}" \
  1253. bash -lc '
  1254. set -e
  1255. yum install -y --setopt=install_weak_deps=False --setopt=tsflags=nodocs git gcc gcc-c++ make cmake libcurl-devel
  1256. yum clean all && rm -rf /var/cache/yum
  1257. git config --global --add safe.directory "/workspace"
  1258. export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
  1259. cmake -S . -B build \
  1260. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
  1261. -DGGML_CANN=on \
  1262. -DSOC_TYPE=${SOC_TYPE}
  1263. cmake --build build -j $(nproc)
  1264. chown -R '"${HOST_UID}"':'"${HOST_GID}"' /workspace/build
  1265. '
  1266. # TODO: simplify the following workflows using a matrix
  1267. # TODO: run lighter CI on PRs and the full CI only on master (if needed)
  1268. ggml-ci-x64-cpu-low-perf:
  1269. runs-on: ubuntu-22.04
  1270. steps:
  1271. - name: Clone
  1272. id: checkout
  1273. uses: actions/checkout@v4
  1274. - name: ccache
  1275. uses: ggml-org/ccache-action@v1.2.16
  1276. with:
  1277. key: ggml-ci-x64-cpu-low-perf
  1278. evict-old-files: 1d
  1279. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1280. - name: Dependencies
  1281. id: depends
  1282. run: |
  1283. sudo apt-get update
  1284. sudo apt-get install build-essential libcurl4-openssl-dev
  1285. - name: Test
  1286. id: ggml-ci
  1287. run: |
  1288. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_LOW_PERF=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1289. ggml-ci-arm64-cpu-low-perf:
  1290. runs-on: ubuntu-22.04-arm
  1291. steps:
  1292. - name: Clone
  1293. id: checkout
  1294. uses: actions/checkout@v4
  1295. - name: ccache
  1296. uses: ggml-org/ccache-action@v1.2.16
  1297. with:
  1298. key: ggml-ci-arm64-cpu-low-perf
  1299. evict-old-files: 1d
  1300. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1301. - name: Dependencies
  1302. id: depends
  1303. run: |
  1304. sudo apt-get update
  1305. sudo apt-get install build-essential libcurl4-openssl-dev
  1306. - name: Test
  1307. id: ggml-ci
  1308. run: |
  1309. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_LOW_PERF=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1310. ggml-ci-x64-cpu-high-perf:
  1311. runs-on: ubuntu-22.04
  1312. steps:
  1313. - name: Clone
  1314. id: checkout
  1315. uses: actions/checkout@v4
  1316. - name: ccache
  1317. uses: ggml-org/ccache-action@v1.2.16
  1318. with:
  1319. key: ggml-ci-x64-cpu-high-perf
  1320. evict-old-files: 1d
  1321. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1322. - name: Dependencies
  1323. id: depends
  1324. run: |
  1325. sudo apt-get update
  1326. sudo apt-get install build-essential libcurl4-openssl-dev
  1327. - name: Test
  1328. id: ggml-ci
  1329. run: |
  1330. LLAMA_ARG_THREADS=$(nproc) bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1331. ggml-ci-arm64-cpu-high-perf:
  1332. runs-on: ubuntu-22.04-arm
  1333. steps:
  1334. - name: Clone
  1335. id: checkout
  1336. uses: actions/checkout@v4
  1337. - name: ccache
  1338. uses: ggml-org/ccache-action@v1.2.16
  1339. with:
  1340. key: ggml-ci-arm64-cpu-high-perf
  1341. evict-old-files: 1d
  1342. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1343. - name: Dependencies
  1344. id: depends
  1345. run: |
  1346. sudo apt-get update
  1347. sudo apt-get install build-essential libcurl4-openssl-dev
  1348. - name: Test
  1349. id: ggml-ci
  1350. run: |
  1351. 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
  1352. ggml-ci-arm64-cpu-high-perf-sve:
  1353. runs-on: ubuntu-22.04-arm
  1354. steps:
  1355. - name: Clone
  1356. id: checkout
  1357. uses: actions/checkout@v4
  1358. - name: ccache
  1359. uses: ggml-org/ccache-action@v1.2.16
  1360. with:
  1361. key: ggml-ci-arm64-cpu-high-perf-sve
  1362. evict-old-files: 1d
  1363. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1364. - name: Dependencies
  1365. id: depends
  1366. run: |
  1367. sudo apt-get update
  1368. sudo apt-get install build-essential libcurl4-openssl-dev
  1369. - name: Test
  1370. id: ggml-ci
  1371. run: |
  1372. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_NO_BF16=1 GG_BUILD_EXTRA_TESTS_0=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1373. ggml-ci-x64-nvidia-cuda:
  1374. runs-on: [self-hosted, Linux, X64, NVIDIA]
  1375. steps:
  1376. - name: Clone
  1377. id: checkout
  1378. uses: actions/checkout@v4
  1379. - name: Test
  1380. id: ggml-ci
  1381. run: |
  1382. nvidia-smi
  1383. GG_BUILD_CUDA=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1384. ggml-ci-x64-nvidia-vulkan-cm:
  1385. runs-on: [self-hosted, Linux, X64, NVIDIA]
  1386. steps:
  1387. - name: Clone
  1388. id: checkout
  1389. uses: actions/checkout@v4
  1390. - name: Test
  1391. id: ggml-ci
  1392. run: |
  1393. vulkaninfo --summary
  1394. GG_BUILD_VULKAN=1 GGML_VK_DISABLE_COOPMAT2=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1395. ggml-ci-x64-nvidia-vulkan-cm2:
  1396. runs-on: [self-hosted, Linux, X64, NVIDIA, COOPMAT2]
  1397. steps:
  1398. - name: Clone
  1399. id: checkout
  1400. uses: actions/checkout@v4
  1401. - name: Test
  1402. id: ggml-ci
  1403. run: |
  1404. vulkaninfo --summary
  1405. GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1406. ggml-ci-x64-cpu-amx:
  1407. runs-on: [self-hosted, Linux, X64, CPU, AMX]
  1408. steps:
  1409. - name: Clone
  1410. id: checkout
  1411. uses: actions/checkout@v4
  1412. - name: Test
  1413. id: ggml-ci
  1414. run: |
  1415. bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1416. # ggml-ci-x64-amd-vulkan:
  1417. # runs-on: [self-hosted, Linux, X64, AMD]
  1418. # steps:
  1419. # - name: Clone
  1420. # id: checkout
  1421. # uses: actions/checkout@v4
  1422. # - name: Test
  1423. # id: ggml-ci
  1424. # run: |
  1425. # vulkaninfo --summary
  1426. # GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1427. # ggml-ci-x64-amd-rocm:
  1428. # runs-on: [self-hosted, Linux, X64, AMD]
  1429. # steps:
  1430. # - name: Clone
  1431. # id: checkout
  1432. # uses: actions/checkout@v4
  1433. # - name: Test
  1434. # id: ggml-ci
  1435. # run: |
  1436. # amd-smi static
  1437. # GG_BUILD_ROCM=1 GG_BUILD_AMDGPU_TARGETS="gfx1101" bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1438. ggml-ci-mac-metal:
  1439. runs-on: [self-hosted, macOS, ARM64]
  1440. steps:
  1441. - name: Clone
  1442. id: checkout
  1443. uses: actions/checkout@v4
  1444. - name: Test
  1445. id: ggml-ci
  1446. run: |
  1447. GG_BUILD_METAL=1 bash ./ci/run.sh ~/results/llama.cpp ~/mnt/llama.cpp
  1448. ggml-ci-mac-vulkan:
  1449. runs-on: [self-hosted, macOS, ARM64]
  1450. steps:
  1451. - name: Clone
  1452. id: checkout
  1453. uses: actions/checkout@v4
  1454. - name: Test
  1455. id: ggml-ci
  1456. run: |
  1457. vulkaninfo --summary
  1458. GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp ~/mnt/llama.cpp
  1459. ggml-ci-arm64-cpu-kleidiai:
  1460. runs-on: ubuntu-22.04-arm
  1461. steps:
  1462. - name: Clone
  1463. id: checkout
  1464. uses: actions/checkout@v4
  1465. - name: ccache
  1466. uses: ggml-org/ccache-action@v1.2.16
  1467. with:
  1468. key: ggml-ci-arm64-cpu-kleidiai
  1469. evict-old-files: 1d
  1470. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1471. - name: Dependencies
  1472. id: depends
  1473. run: |
  1474. sudo apt-get update
  1475. sudo apt-get install -y build-essential libcurl4-openssl-dev
  1476. - name: Test
  1477. id: ggml-ci
  1478. run: |
  1479. GG_BUILD_KLEIDIAI=1 GG_BUILD_EXTRA_TESTS_0=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1480. ubuntu-cpu-cmake-riscv64-native:
  1481. runs-on: RISCV64
  1482. steps:
  1483. - name: Install dependencies
  1484. run: |
  1485. sudo apt-get update
  1486. # Install necessary packages
  1487. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential libssl-dev wget ccache
  1488. # Set gcc-14 and g++-14 as the default compilers
  1489. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1490. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1491. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1492. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1493. # Install Rust stable version
  1494. rustup install stable
  1495. rustup default stable
  1496. - name: Clone
  1497. id: checkout
  1498. uses: actions/checkout@v4
  1499. - name: Check environment
  1500. run: |
  1501. uname -a
  1502. gcc --version
  1503. g++ --version
  1504. ldd --version
  1505. cmake --version
  1506. rustc --version
  1507. - name: Setup ccache
  1508. run: |
  1509. # Set unique cache directory for this job
  1510. export CCACHE_DIR="$HOME/.ccache/cpu-cmake-rv64-native"
  1511. mkdir -p "$CCACHE_DIR"
  1512. # Configure ccache for optimal performance
  1513. ccache --set-config=max_size=5G
  1514. ccache --set-config=compression=true
  1515. ccache --set-config=compression_level=6
  1516. ccache --set-config=cache_dir="$CCACHE_DIR"
  1517. # Enable more aggressive caching
  1518. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1519. ccache --set-config=hash_dir=false
  1520. # Export for subsequent steps
  1521. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1522. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1523. - name: Build
  1524. id: cmake_build
  1525. run: |
  1526. cmake -B build \
  1527. -DLLAMA_CURL=OFF \
  1528. -DLLAMA_OPENSSL=ON \
  1529. -DCMAKE_BUILD_TYPE=Release \
  1530. -DGGML_OPENMP=OFF \
  1531. -DLLAMA_BUILD_EXAMPLES=ON \
  1532. -DLLAMA_BUILD_TOOLS=ON \
  1533. -DLLAMA_BUILD_TESTS=ON \
  1534. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1535. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1536. -DGGML_RPC=ON \
  1537. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1538. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1539. cmake --build build --config Release -j $(nproc)
  1540. - name: Test
  1541. id: cmake_test
  1542. run: |
  1543. cd build
  1544. ctest -L 'main|curl' --verbose --timeout 900
  1545. - name: Test llama2c conversion
  1546. id: llama2c_test
  1547. run: |
  1548. cd build
  1549. echo "Fetch tokenizer"
  1550. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin
  1551. echo "Fetch llama2c model"
  1552. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin
  1553. ./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf
  1554. ./bin/llama-completion -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
  1555. ubuntu-cmake-sanitizer-riscv64-native:
  1556. runs-on: RISCV64
  1557. continue-on-error: true
  1558. strategy:
  1559. matrix:
  1560. sanitizer: [ADDRESS, THREAD, UNDEFINED]
  1561. build_type: [Debug]
  1562. steps:
  1563. - name: Install dependencies
  1564. run: |
  1565. sudo apt-get update
  1566. # Install necessary packages
  1567. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential wget ccache
  1568. # Set gcc-14 and g++-14 as the default compilers
  1569. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1570. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1571. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1572. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1573. # Install Rust stable version
  1574. rustup install stable
  1575. rustup default stable
  1576. - name: GCC version check
  1577. run: |
  1578. gcc --version
  1579. g++ --version
  1580. - name: Clone
  1581. id: checkout
  1582. uses: actions/checkout@v4
  1583. - name: Setup ccache
  1584. run: |
  1585. # Unique cache directory per matrix combination
  1586. export CCACHE_DIR="$HOME/.ccache/sanitizer-${{ matrix.sanitizer }}-${{ matrix.build_type }}"
  1587. mkdir -p "$CCACHE_DIR"
  1588. # Configure ccache
  1589. ccache --set-config=max_size=5G
  1590. ccache --set-config=compression=true
  1591. ccache --set-config=compression_level=6
  1592. ccache --set-config=cache_dir="$CCACHE_DIR"
  1593. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1594. ccache --set-config=hash_dir=false
  1595. # Export for subsequent steps
  1596. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1597. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1598. - name: Build
  1599. id: cmake_build
  1600. if: ${{ matrix.sanitizer != 'THREAD' }}
  1601. run: |
  1602. cmake -B build \
  1603. -DLLAMA_CURL=OFF \
  1604. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  1605. -DGGML_OPENMP=ON \
  1606. -DLLAMA_BUILD_EXAMPLES=ON \
  1607. -DLLAMA_BUILD_TOOLS=ON \
  1608. -DLLAMA_BUILD_TESTS=OFF \
  1609. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1610. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1611. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  1612. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1613. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1614. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  1615. - name: Build (no OpenMP)
  1616. id: cmake_build_no_openmp
  1617. if: ${{ matrix.sanitizer == 'THREAD' }}
  1618. run: |
  1619. cmake -B build \
  1620. -DLLAMA_CURL=OFF \
  1621. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  1622. -DGGML_OPENMP=OFF \
  1623. -DLLAMA_BUILD_EXAMPLES=ON \
  1624. -DLLAMA_BUILD_TOOLS=ON \
  1625. -DLLAMA_BUILD_TESTS=OFF \
  1626. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1627. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1628. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  1629. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1630. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1631. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  1632. - name: Test
  1633. id: cmake_test
  1634. run: |
  1635. cd build
  1636. ctest -L main --verbose --timeout 900
  1637. ubuntu-llguidance-riscv64-native:
  1638. runs-on: RISCV64
  1639. steps:
  1640. - name: Install dependencies
  1641. run: |
  1642. sudo apt-get update
  1643. # Install necessary packages
  1644. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential wget ccache
  1645. # Set gcc-14 and g++-14 as the default compilers
  1646. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1647. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1648. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1649. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1650. # Install Rust stable version
  1651. rustup install stable
  1652. rustup default stable
  1653. - name: GCC version check
  1654. run: |
  1655. gcc --version
  1656. g++ --version
  1657. - name: Clone
  1658. id: checkout
  1659. uses: actions/checkout@v4
  1660. - name: Setup ccache
  1661. run: |
  1662. export CCACHE_DIR="$HOME/.ccache/llguidance-riscv64"
  1663. mkdir -p "$CCACHE_DIR"
  1664. ccache --set-config=max_size=5G
  1665. ccache --set-config=compression=true
  1666. ccache --set-config=compression_level=6
  1667. ccache --set-config=cache_dir="$CCACHE_DIR"
  1668. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1669. ccache --set-config=hash_dir=false
  1670. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1671. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1672. - name: Build
  1673. id: cmake_build
  1674. run: |
  1675. cmake -B build \
  1676. -DLLAMA_CURL=OFF \
  1677. -DCMAKE_BUILD_TYPE=Release \
  1678. -DGGML_OPENMP=OFF \
  1679. -DLLAMA_BUILD_EXAMPLES=ON \
  1680. -DLLAMA_BUILD_TOOLS=ON \
  1681. -DLLAMA_BUILD_TESTS=OFF \
  1682. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1683. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1684. -DLLAMA_LLGUIDANCE=ON \
  1685. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1686. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1687. cmake --build build --config Release -j $(nproc)
  1688. - name: Test
  1689. id: cmake_test
  1690. run: |
  1691. cd build
  1692. ctest -L main --verbose --timeout 900
  1693. ubuntu-cmake-rpc-riscv64-native:
  1694. runs-on: RISCV64
  1695. continue-on-error: true
  1696. steps:
  1697. - name: Install dependencies
  1698. run: |
  1699. sudo apt-get update
  1700. # Install necessary packages
  1701. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential libssl-dev wget ccache
  1702. # Set gcc-14 and g++-14 as the default compilers
  1703. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1704. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1705. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1706. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1707. # Install Rust stable version
  1708. rustup install stable
  1709. rustup default stable
  1710. - name: GCC version check
  1711. run: |
  1712. gcc --version
  1713. g++ --version
  1714. - name: Clone
  1715. id: checkout
  1716. uses: actions/checkout@v4
  1717. - name: Setup ccache
  1718. run: |
  1719. export CCACHE_DIR="$HOME/.ccache/rpc-riscv64"
  1720. mkdir -p "$CCACHE_DIR"
  1721. ccache --set-config=max_size=5G
  1722. ccache --set-config=compression=true
  1723. ccache --set-config=compression_level=6
  1724. ccache --set-config=cache_dir="$CCACHE_DIR"
  1725. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1726. ccache --set-config=hash_dir=false
  1727. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1728. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1729. - name: Build
  1730. id: cmake_build
  1731. run: |
  1732. cmake -B build \
  1733. -DLLAMA_CURL=OFF \
  1734. -DLLAMA_OPENSSL=ON \
  1735. -DCMAKE_BUILD_TYPE=Release \
  1736. -DGGML_OPENMP=OFF \
  1737. -DLLAMA_BUILD_EXAMPLES=ON \
  1738. -DLLAMA_BUILD_TOOLS=ON \
  1739. -DLLAMA_BUILD_TESTS=ON \
  1740. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1741. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1742. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1743. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14 \
  1744. -DGGML_RPC=ON
  1745. cmake --build build --config Release -j $(nproc)
  1746. - name: Test
  1747. id: cmake_test
  1748. run: |
  1749. cd build
  1750. ctest -L main --verbose
  1751. ggml-ci-arm64-graviton4-kleidiai:
  1752. runs-on: ah-ubuntu_22_04-c8g_8x
  1753. steps:
  1754. - name: Clone
  1755. id: checkout
  1756. uses: actions/checkout@v4
  1757. - name: Dependencies
  1758. id: depends
  1759. run: |
  1760. set -euxo pipefail
  1761. sudo apt-get update
  1762. sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a \
  1763. apt-get install -y \
  1764. build-essential \
  1765. libcurl4-openssl-dev \
  1766. python3-venv \
  1767. gpg \
  1768. wget \
  1769. time \
  1770. git-lfs
  1771. git lfs install
  1772. # install the latest cmake
  1773. sudo install -d /usr/share/keyrings
  1774. wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc \
  1775. | gpg --dearmor \
  1776. | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
  1777. echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' \
  1778. | sudo tee /etc/apt/sources.list.d/kitware.list
  1779. sudo apt-get update
  1780. sudo apt-get install -y cmake
  1781. - name: ccache
  1782. uses: ggml-org/ccache-action@v1.2.16
  1783. with:
  1784. key: ggml-ci-arm64-graviton4-kleidiai
  1785. evict-old-files: 1d
  1786. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1787. - name: Test
  1788. id: ggml-ci
  1789. run: |
  1790. GG_BUILD_KLEIDIAI=1 \
  1791. GG_BUILD_EXTRA_TESTS_0=1 \
  1792. bash ./ci/run.sh ./tmp/results ./tmp/mnt