build.yml 67 KB

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