build.yml 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162
  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 --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"
  138. echo "Fetching release asset from https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}.zip"
  139. curl -L -o artifact.zip \
  140. "https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}.zip"
  141. mkdir dawn
  142. unzip artifact.zip
  143. tar -xvf ${DAWN_ASSET_NAME}.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 --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"
  461. echo "Fetching release asset from https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}.zip"
  462. curl -L -o artifact.zip \
  463. "https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}.zip"
  464. mkdir dawn
  465. unzip artifact.zip
  466. tar -xvf ${DAWN_ASSET_NAME}.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. defaults:
  1219. run:
  1220. shell: bash -el {0}
  1221. strategy:
  1222. matrix:
  1223. arch: [x86, aarch64]
  1224. chip_type: ['910b', '310p']
  1225. build: ['Release']
  1226. runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
  1227. steps:
  1228. - name: Checkout
  1229. uses: actions/checkout@v4
  1230. with:
  1231. fetch-depth: 0
  1232. - name: Free up disk space
  1233. uses: ggml-org/free-disk-space@v1.3.1
  1234. with:
  1235. tool-cache: true
  1236. - name: Set container image
  1237. id: cann-image
  1238. run: |
  1239. image="ascendai/cann:${{ matrix.chip_type == '910b' && '8.3.rc2-910b-openeuler24.03-py3.11' || '8.3.rc2-310p-openeuler24.03-py3.11' }}"
  1240. echo "image=${image}" >> "${GITHUB_OUTPUT}"
  1241. - name: Pull container image
  1242. run: docker pull "${{ steps.cann-image.outputs.image }}"
  1243. - name: Build
  1244. env:
  1245. BUILD_TYPE: ${{ matrix.build }}
  1246. SOC_TYPE: ascend${{ matrix.chip_type }}
  1247. run: |
  1248. HOST_UID=$(id -u)
  1249. HOST_GID=$(id -g)
  1250. docker run --rm \
  1251. -v "${PWD}:/workspace" \
  1252. -w /workspace \
  1253. -e SOC_TYPE=${SOC_TYPE} \
  1254. -e BUILD_TYPE=${BUILD_TYPE} \
  1255. "${{ steps.cann-image.outputs.image }}" \
  1256. bash -lc '
  1257. set -e
  1258. yum install -y --setopt=install_weak_deps=False --setopt=tsflags=nodocs git gcc gcc-c++ make cmake openssl-devel
  1259. yum clean all && rm -rf /var/cache/yum
  1260. git config --global --add safe.directory "/workspace"
  1261. export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
  1262. cmake -S . -B build \
  1263. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
  1264. -DLLAMA_CURL=OFF \
  1265. -DLLAMA_OPENSSL=ON \
  1266. -DGGML_CANN=on \
  1267. -DSOC_TYPE=${SOC_TYPE}
  1268. cmake --build build -j $(nproc)
  1269. chown -R '"${HOST_UID}"':'"${HOST_GID}"' /workspace/build
  1270. '
  1271. # TODO: simplify the following workflows using a matrix
  1272. # TODO: run lighter CI on PRs and the full CI only on master (if needed)
  1273. ggml-ci-x64-cpu-low-perf:
  1274. runs-on: ubuntu-22.04
  1275. steps:
  1276. - name: Clone
  1277. id: checkout
  1278. uses: actions/checkout@v4
  1279. - name: ccache
  1280. uses: ggml-org/ccache-action@v1.2.16
  1281. with:
  1282. key: ggml-ci-x64-cpu-low-perf
  1283. evict-old-files: 1d
  1284. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1285. - name: Dependencies
  1286. id: depends
  1287. run: |
  1288. sudo apt-get update
  1289. sudo apt-get install build-essential
  1290. - name: Test
  1291. id: ggml-ci
  1292. run: |
  1293. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_LOW_PERF=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1294. ggml-ci-arm64-cpu-low-perf:
  1295. runs-on: ubuntu-22.04-arm
  1296. steps:
  1297. - name: Clone
  1298. id: checkout
  1299. uses: actions/checkout@v4
  1300. - name: ccache
  1301. uses: ggml-org/ccache-action@v1.2.16
  1302. with:
  1303. key: ggml-ci-arm64-cpu-low-perf
  1304. evict-old-files: 1d
  1305. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1306. - name: Dependencies
  1307. id: depends
  1308. run: |
  1309. sudo apt-get update
  1310. sudo apt-get install build-essential
  1311. - name: Test
  1312. id: ggml-ci
  1313. run: |
  1314. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_LOW_PERF=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1315. ggml-ci-x64-cpu-high-perf:
  1316. runs-on: ubuntu-22.04
  1317. steps:
  1318. - name: Clone
  1319. id: checkout
  1320. uses: actions/checkout@v4
  1321. - name: ccache
  1322. uses: ggml-org/ccache-action@v1.2.16
  1323. with:
  1324. key: ggml-ci-x64-cpu-high-perf
  1325. evict-old-files: 1d
  1326. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1327. - name: Dependencies
  1328. id: depends
  1329. run: |
  1330. sudo apt-get update
  1331. sudo apt-get install build-essential
  1332. - name: Test
  1333. id: ggml-ci
  1334. run: |
  1335. LLAMA_ARG_THREADS=$(nproc) bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1336. ggml-ci-arm64-cpu-high-perf:
  1337. runs-on: ubuntu-22.04-arm
  1338. steps:
  1339. - name: Clone
  1340. id: checkout
  1341. uses: actions/checkout@v4
  1342. - name: ccache
  1343. uses: ggml-org/ccache-action@v1.2.16
  1344. with:
  1345. key: ggml-ci-arm64-cpu-high-perf
  1346. evict-old-files: 1d
  1347. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1348. - name: Dependencies
  1349. id: depends
  1350. run: |
  1351. sudo apt-get update
  1352. sudo apt-get install build-essential
  1353. - name: Test
  1354. id: ggml-ci
  1355. run: |
  1356. 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
  1357. ggml-ci-arm64-cpu-high-perf-sve:
  1358. runs-on: ubuntu-22.04-arm
  1359. steps:
  1360. - name: Clone
  1361. id: checkout
  1362. uses: actions/checkout@v4
  1363. - name: ccache
  1364. uses: ggml-org/ccache-action@v1.2.16
  1365. with:
  1366. key: ggml-ci-arm64-cpu-high-perf-sve
  1367. evict-old-files: 1d
  1368. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1369. - name: Dependencies
  1370. id: depends
  1371. run: |
  1372. sudo apt-get update
  1373. sudo apt-get install build-essential
  1374. - name: Test
  1375. id: ggml-ci
  1376. run: |
  1377. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_NO_BF16=1 GG_BUILD_EXTRA_TESTS_0=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1378. ggml-ci-x64-nvidia-cuda:
  1379. runs-on: [self-hosted, Linux, X64, NVIDIA]
  1380. steps:
  1381. - name: Clone
  1382. id: checkout
  1383. uses: actions/checkout@v4
  1384. - name: Test
  1385. id: ggml-ci
  1386. run: |
  1387. nvidia-smi
  1388. GG_BUILD_CUDA=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1389. ggml-ci-x64-nvidia-vulkan-cm:
  1390. runs-on: [self-hosted, Linux, X64, NVIDIA]
  1391. steps:
  1392. - name: Clone
  1393. id: checkout
  1394. uses: actions/checkout@v4
  1395. - name: Test
  1396. id: ggml-ci
  1397. run: |
  1398. vulkaninfo --summary
  1399. GG_BUILD_VULKAN=1 GGML_VK_DISABLE_COOPMAT2=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1400. ggml-ci-x64-nvidia-vulkan-cm2:
  1401. runs-on: [self-hosted, Linux, X64, NVIDIA, COOPMAT2]
  1402. steps:
  1403. - name: Clone
  1404. id: checkout
  1405. uses: actions/checkout@v4
  1406. - name: Test
  1407. id: ggml-ci
  1408. run: |
  1409. vulkaninfo --summary
  1410. GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1411. ggml-ci-x64-cpu-amx:
  1412. runs-on: [self-hosted, Linux, X64, CPU, AMX]
  1413. steps:
  1414. - name: Clone
  1415. id: checkout
  1416. uses: actions/checkout@v4
  1417. - name: Test
  1418. id: ggml-ci
  1419. run: |
  1420. bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1421. # ggml-ci-x64-amd-vulkan:
  1422. # runs-on: [self-hosted, Linux, X64, AMD]
  1423. # steps:
  1424. # - name: Clone
  1425. # id: checkout
  1426. # uses: actions/checkout@v4
  1427. # - name: Test
  1428. # id: ggml-ci
  1429. # run: |
  1430. # vulkaninfo --summary
  1431. # GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1432. # ggml-ci-x64-amd-rocm:
  1433. # runs-on: [self-hosted, Linux, X64, AMD]
  1434. # steps:
  1435. # - name: Clone
  1436. # id: checkout
  1437. # uses: actions/checkout@v4
  1438. # - name: Test
  1439. # id: ggml-ci
  1440. # run: |
  1441. # amd-smi static
  1442. # GG_BUILD_ROCM=1 GG_BUILD_AMDGPU_TARGETS="gfx1101" bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1443. ggml-ci-mac-metal:
  1444. runs-on: [self-hosted, macOS, ARM64]
  1445. steps:
  1446. - name: Clone
  1447. id: checkout
  1448. uses: actions/checkout@v4
  1449. - name: Test
  1450. id: ggml-ci
  1451. run: |
  1452. GG_BUILD_METAL=1 bash ./ci/run.sh ~/results/llama.cpp ~/mnt/llama.cpp
  1453. ggml-ci-mac-webgpu:
  1454. runs-on: [self-hosted, macOS, ARM64]
  1455. steps:
  1456. - name: Clone
  1457. id: checkout
  1458. uses: actions/checkout@v4
  1459. - name: Dawn Dependency
  1460. id: dawn-depends
  1461. run: |
  1462. DAWN_VERSION="v2.0.0"
  1463. DAWN_OWNER="reeselevine"
  1464. DAWN_REPO="dawn"
  1465. DAWN_ASSET_NAME="Dawn-5e9a4865b1635796ccc77dd30057f2b4002a1355-macos-latest-Release"
  1466. echo "Fetching release asset from https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}.zip"
  1467. curl -L -o artifact.zip \
  1468. "https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}.zip"
  1469. mkdir dawn
  1470. unzip artifact.zip
  1471. tar -xvf ${DAWN_ASSET_NAME}.tar.gz -C dawn --strip-components=1
  1472. - name: Test
  1473. id: ggml-ci
  1474. run: |
  1475. GG_BUILD_WEBGPU=1 GG_BUILD_WEBGPU_DAWN_PREFIX="$GITHUB_WORKSPACE/dawn" \
  1476. bash ./ci/run.sh ~/results/llama.cpp ~/mnt/llama.cpp
  1477. ggml-ci-mac-vulkan:
  1478. runs-on: [self-hosted, macOS, ARM64]
  1479. steps:
  1480. - name: Clone
  1481. id: checkout
  1482. uses: actions/checkout@v4
  1483. - name: Test
  1484. id: ggml-ci
  1485. run: |
  1486. vulkaninfo --summary
  1487. GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp ~/mnt/llama.cpp
  1488. ggml-ci-arm64-cpu-kleidiai:
  1489. runs-on: ubuntu-22.04-arm
  1490. steps:
  1491. - name: Clone
  1492. id: checkout
  1493. uses: actions/checkout@v4
  1494. - name: ccache
  1495. uses: ggml-org/ccache-action@v1.2.16
  1496. with:
  1497. key: ggml-ci-arm64-cpu-kleidiai
  1498. evict-old-files: 1d
  1499. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1500. - name: Dependencies
  1501. id: depends
  1502. run: |
  1503. sudo apt-get update
  1504. sudo apt-get install -y build-essential
  1505. - name: Test
  1506. id: ggml-ci
  1507. run: |
  1508. GG_BUILD_KLEIDIAI=1 GG_BUILD_EXTRA_TESTS_0=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1509. ubuntu-cpu-cmake-riscv64-native:
  1510. runs-on: RISCV64
  1511. steps:
  1512. - name: Install dependencies
  1513. run: |
  1514. sudo apt-get update
  1515. # Install necessary packages
  1516. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential libssl-dev wget ccache git-lfs
  1517. # Set gcc-14 and g++-14 as the default compilers
  1518. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1519. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1520. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1521. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1522. # Install Rust stable version
  1523. rustup install stable
  1524. rustup default stable
  1525. git lfs install
  1526. - name: Clone
  1527. id: checkout
  1528. uses: actions/checkout@v4
  1529. - name: Check environment
  1530. run: |
  1531. uname -a
  1532. gcc --version
  1533. g++ --version
  1534. ldd --version
  1535. cmake --version
  1536. rustc --version
  1537. - name: Setup ccache
  1538. run: |
  1539. # Set unique cache directory for this job
  1540. export CCACHE_DIR="$HOME/.ccache/cpu-cmake-rv64-native"
  1541. mkdir -p "$CCACHE_DIR"
  1542. # Configure ccache for optimal performance
  1543. ccache --set-config=max_size=5G
  1544. ccache --set-config=compression=true
  1545. ccache --set-config=compression_level=6
  1546. ccache --set-config=cache_dir="$CCACHE_DIR"
  1547. # Enable more aggressive caching
  1548. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1549. ccache --set-config=hash_dir=false
  1550. # Export for subsequent steps
  1551. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1552. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1553. - name: Build
  1554. id: cmake_build
  1555. run: |
  1556. cmake -B build \
  1557. -DLLAMA_CURL=OFF \
  1558. -DLLAMA_OPENSSL=ON \
  1559. -DCMAKE_BUILD_TYPE=Release \
  1560. -DGGML_OPENMP=OFF \
  1561. -DLLAMA_BUILD_EXAMPLES=ON \
  1562. -DLLAMA_BUILD_TOOLS=ON \
  1563. -DLLAMA_BUILD_TESTS=ON \
  1564. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1565. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1566. -DGGML_RPC=ON \
  1567. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1568. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1569. cmake --build build --config Release -j $(nproc)
  1570. - name: Test
  1571. id: cmake_test
  1572. run: |
  1573. cd build
  1574. ctest -L main --verbose --timeout 900
  1575. - name: Test llama2c conversion
  1576. id: llama2c_test
  1577. run: |
  1578. cd build
  1579. echo "Fetch tokenizer"
  1580. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin
  1581. echo "Fetch llama2c model"
  1582. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin
  1583. ./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf
  1584. ./bin/llama-completion -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
  1585. ubuntu-cmake-sanitizer-riscv64-native:
  1586. runs-on: RISCV64
  1587. continue-on-error: true
  1588. strategy:
  1589. matrix:
  1590. sanitizer: [ADDRESS, THREAD, UNDEFINED]
  1591. build_type: [Debug]
  1592. steps:
  1593. - name: Install dependencies
  1594. run: |
  1595. sudo apt-get update
  1596. # Install necessary packages
  1597. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential wget ccache git-lfs
  1598. # Set gcc-14 and g++-14 as the default compilers
  1599. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1600. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1601. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1602. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1603. # Install Rust stable version
  1604. rustup install stable
  1605. rustup default stable
  1606. git lfs install
  1607. - name: GCC version check
  1608. run: |
  1609. gcc --version
  1610. g++ --version
  1611. - name: Clone
  1612. id: checkout
  1613. uses: actions/checkout@v4
  1614. - name: Setup ccache
  1615. run: |
  1616. # Unique cache directory per matrix combination
  1617. export CCACHE_DIR="$HOME/.ccache/sanitizer-${{ matrix.sanitizer }}-${{ matrix.build_type }}"
  1618. mkdir -p "$CCACHE_DIR"
  1619. # Configure ccache
  1620. ccache --set-config=max_size=5G
  1621. ccache --set-config=compression=true
  1622. ccache --set-config=compression_level=6
  1623. ccache --set-config=cache_dir="$CCACHE_DIR"
  1624. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1625. ccache --set-config=hash_dir=false
  1626. # Export for subsequent steps
  1627. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1628. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1629. - name: Build
  1630. id: cmake_build
  1631. if: ${{ matrix.sanitizer != 'THREAD' }}
  1632. run: |
  1633. cmake -B build \
  1634. -DLLAMA_CURL=OFF \
  1635. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  1636. -DGGML_OPENMP=ON \
  1637. -DLLAMA_BUILD_EXAMPLES=ON \
  1638. -DLLAMA_BUILD_TOOLS=ON \
  1639. -DLLAMA_BUILD_TESTS=OFF \
  1640. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1641. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1642. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  1643. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1644. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1645. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  1646. - name: Build (no OpenMP)
  1647. id: cmake_build_no_openmp
  1648. if: ${{ matrix.sanitizer == 'THREAD' }}
  1649. run: |
  1650. cmake -B build \
  1651. -DLLAMA_CURL=OFF \
  1652. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  1653. -DGGML_OPENMP=OFF \
  1654. -DLLAMA_BUILD_EXAMPLES=ON \
  1655. -DLLAMA_BUILD_TOOLS=ON \
  1656. -DLLAMA_BUILD_TESTS=OFF \
  1657. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1658. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1659. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  1660. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1661. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1662. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  1663. - name: Test
  1664. id: cmake_test
  1665. run: |
  1666. cd build
  1667. ctest -L main --verbose --timeout 900
  1668. ubuntu-llguidance-riscv64-native:
  1669. runs-on: RISCV64
  1670. steps:
  1671. - name: Install dependencies
  1672. run: |
  1673. sudo apt-get update
  1674. # Install necessary packages
  1675. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential wget ccache git-lfs
  1676. # Set gcc-14 and g++-14 as the default compilers
  1677. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1678. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1679. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1680. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1681. # Install Rust stable version
  1682. rustup install stable
  1683. rustup default stable
  1684. git lfs install
  1685. - name: GCC version check
  1686. run: |
  1687. gcc --version
  1688. g++ --version
  1689. - name: Clone
  1690. id: checkout
  1691. uses: actions/checkout@v4
  1692. - name: Setup ccache
  1693. run: |
  1694. export CCACHE_DIR="$HOME/.ccache/llguidance-riscv64"
  1695. mkdir -p "$CCACHE_DIR"
  1696. ccache --set-config=max_size=5G
  1697. ccache --set-config=compression=true
  1698. ccache --set-config=compression_level=6
  1699. ccache --set-config=cache_dir="$CCACHE_DIR"
  1700. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1701. ccache --set-config=hash_dir=false
  1702. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1703. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1704. - name: Build
  1705. id: cmake_build
  1706. run: |
  1707. cmake -B build \
  1708. -DLLAMA_CURL=OFF \
  1709. -DCMAKE_BUILD_TYPE=Release \
  1710. -DGGML_OPENMP=OFF \
  1711. -DLLAMA_BUILD_EXAMPLES=ON \
  1712. -DLLAMA_BUILD_TOOLS=ON \
  1713. -DLLAMA_BUILD_TESTS=OFF \
  1714. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1715. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1716. -DLLAMA_LLGUIDANCE=ON \
  1717. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1718. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1719. cmake --build build --config Release -j $(nproc)
  1720. - name: Test
  1721. id: cmake_test
  1722. run: |
  1723. cd build
  1724. ctest -L main --verbose --timeout 900
  1725. ubuntu-cmake-rpc-riscv64-native:
  1726. runs-on: RISCV64
  1727. continue-on-error: true
  1728. steps:
  1729. - name: Install dependencies
  1730. run: |
  1731. sudo apt-get update
  1732. # Install necessary packages
  1733. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential libssl-dev wget ccache git-lfs
  1734. # Set gcc-14 and g++-14 as the default compilers
  1735. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1736. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1737. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1738. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1739. # Install Rust stable version
  1740. rustup install stable
  1741. rustup default stable
  1742. git lfs install
  1743. - name: GCC version check
  1744. run: |
  1745. gcc --version
  1746. g++ --version
  1747. - name: Clone
  1748. id: checkout
  1749. uses: actions/checkout@v4
  1750. - name: Setup ccache
  1751. run: |
  1752. export CCACHE_DIR="$HOME/.ccache/rpc-riscv64"
  1753. mkdir -p "$CCACHE_DIR"
  1754. ccache --set-config=max_size=5G
  1755. ccache --set-config=compression=true
  1756. ccache --set-config=compression_level=6
  1757. ccache --set-config=cache_dir="$CCACHE_DIR"
  1758. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1759. ccache --set-config=hash_dir=false
  1760. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1761. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1762. - name: Build
  1763. id: cmake_build
  1764. run: |
  1765. cmake -B build \
  1766. -DLLAMA_CURL=OFF \
  1767. -DLLAMA_OPENSSL=ON \
  1768. -DCMAKE_BUILD_TYPE=Release \
  1769. -DGGML_OPENMP=OFF \
  1770. -DLLAMA_BUILD_EXAMPLES=ON \
  1771. -DLLAMA_BUILD_TOOLS=ON \
  1772. -DLLAMA_BUILD_TESTS=ON \
  1773. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1774. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1775. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1776. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14 \
  1777. -DGGML_RPC=ON
  1778. cmake --build build --config Release -j $(nproc)
  1779. - name: Test
  1780. id: cmake_test
  1781. run: |
  1782. cd build
  1783. ctest -L main --verbose
  1784. ggml-ci-arm64-graviton4-kleidiai:
  1785. runs-on: ah-ubuntu_22_04-c8g_8x
  1786. steps:
  1787. - name: Clone
  1788. id: checkout
  1789. uses: actions/checkout@v4
  1790. - name: Dependencies
  1791. id: depends
  1792. run: |
  1793. set -euxo pipefail
  1794. sudo apt-get update
  1795. sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a \
  1796. apt-get install -y \
  1797. build-essential \
  1798. python3-venv \
  1799. gpg \
  1800. wget \
  1801. time \
  1802. git-lfs
  1803. git lfs install
  1804. # install the latest cmake
  1805. sudo install -d /usr/share/keyrings
  1806. wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc \
  1807. | gpg --dearmor \
  1808. | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
  1809. echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' \
  1810. | sudo tee /etc/apt/sources.list.d/kitware.list
  1811. sudo apt-get update
  1812. sudo apt-get install -y cmake
  1813. - name: ccache
  1814. uses: ggml-org/ccache-action@v1.2.16
  1815. with:
  1816. key: ggml-ci-arm64-graviton4-kleidiai
  1817. evict-old-files: 1d
  1818. save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
  1819. - name: Test
  1820. id: ggml-ci
  1821. run: |
  1822. GG_BUILD_KLEIDIAI=1 \
  1823. GG_BUILD_EXTRA_TESTS_0=1 \
  1824. bash ./ci/run.sh ./tmp/results ./tmp/mnt