build.yml 67 KB

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