build.yml 67 KB

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