build.yml 65 KB

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