build.yml 67 KB

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