build.yml 65 KB

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