build.yml 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022
  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-cli -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-cli -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-22-cmake-hip:
  473. runs-on: ubuntu-22.04
  474. container: rocm/dev-ubuntu-22.04:6.1.2
  475. steps:
  476. - name: Clone
  477. id: checkout
  478. uses: actions/checkout@v4
  479. - name: Dependencies
  480. id: depends
  481. run: |
  482. sudo apt-get update
  483. sudo apt-get install -y build-essential git cmake rocblas-dev hipblas-dev libssl-dev rocwmma-dev
  484. - name: ccache
  485. uses: ggml-org/ccache-action@v1.2.16
  486. with:
  487. key: ubuntu-22-cmake-hip
  488. evict-old-files: 1d
  489. - name: Build with native CMake HIP support
  490. id: cmake_build
  491. run: |
  492. cmake -B build -S . \
  493. -DLLAMA_CURL=OFF \
  494. -DLLAMA_OPENSSL=ON \
  495. -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \
  496. -DGGML_HIP_ROCWMMA_FATTN=ON \
  497. -DGGML_HIP=ON
  498. cmake --build build --config Release -j $(nproc)
  499. ubuntu-22-cmake-musa:
  500. runs-on: ubuntu-22.04
  501. container: mthreads/musa:rc4.3.0-devel-ubuntu22.04-amd64
  502. steps:
  503. - name: Clone
  504. id: checkout
  505. uses: actions/checkout@v4
  506. - name: Dependencies
  507. id: depends
  508. run: |
  509. apt-get update
  510. apt-get install -y build-essential git cmake libssl-dev
  511. - name: ccache
  512. uses: ggml-org/ccache-action@v1.2.16
  513. with:
  514. key: ubuntu-22-cmake-musa
  515. evict-old-files: 1d
  516. - name: Build with native CMake MUSA support
  517. id: cmake_build
  518. run: |
  519. cmake -B build -S . \
  520. -DLLAMA_CURL=OFF \
  521. -DLLAMA_OPENSSL=ON \
  522. -DGGML_MUSA=ON
  523. cmake --build build --config Release -j $(nproc)
  524. ubuntu-22-cmake-sycl:
  525. runs-on: ubuntu-22.04
  526. continue-on-error: true
  527. steps:
  528. - uses: actions/checkout@v4
  529. - name: add oneAPI to apt
  530. shell: bash
  531. run: |
  532. cd /tmp
  533. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  534. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  535. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  536. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  537. - name: install oneAPI dpcpp compiler
  538. shell: bash
  539. run: |
  540. sudo apt update
  541. sudo apt install intel-oneapi-compiler-dpcpp-cpp libssl-dev
  542. - name: install oneAPI MKL library
  543. shell: bash
  544. run: |
  545. sudo apt install intel-oneapi-mkl-devel
  546. - name: Clone
  547. id: checkout
  548. uses: actions/checkout@v4
  549. - name: ccache
  550. uses: ggml-org/ccache-action@v1.2.16
  551. with:
  552. key: ubuntu-22-cmake-sycl
  553. evict-old-files: 1d
  554. - name: Build
  555. id: cmake_build
  556. run: |
  557. source /opt/intel/oneapi/setvars.sh
  558. cmake -B build \
  559. -DLLAMA_CURL=OFF \
  560. -DLLAMA_OPENSSL=ON \
  561. -DGGML_SYCL=ON \
  562. -DCMAKE_C_COMPILER=icx \
  563. -DCMAKE_CXX_COMPILER=icpx
  564. cmake --build build --config Release -j $(nproc)
  565. ubuntu-22-cmake-sycl-fp16:
  566. runs-on: ubuntu-22.04
  567. continue-on-error: true
  568. steps:
  569. - uses: actions/checkout@v4
  570. - name: add oneAPI to apt
  571. shell: bash
  572. run: |
  573. cd /tmp
  574. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  575. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  576. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  577. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  578. - name: install oneAPI dpcpp compiler
  579. shell: bash
  580. run: |
  581. sudo apt update
  582. sudo apt install intel-oneapi-compiler-dpcpp-cpp libssl-dev
  583. - name: install oneAPI MKL library
  584. shell: bash
  585. run: |
  586. sudo apt install intel-oneapi-mkl-devel
  587. - name: Clone
  588. id: checkout
  589. uses: actions/checkout@v4
  590. - name: ccache
  591. uses: ggml-org/ccache-action@v1.2.16
  592. with:
  593. key: ubuntu-22-cmake-sycl-fp16
  594. evict-old-files: 1d
  595. - name: Build
  596. id: cmake_build
  597. run: |
  598. source /opt/intel/oneapi/setvars.sh
  599. cmake -B build \
  600. -DLLAMA_CURL=OFF \
  601. -DLLAMA_OPENSSL=ON \
  602. -DGGML_SYCL=ON \
  603. -DCMAKE_C_COMPILER=icx \
  604. -DCMAKE_CXX_COMPILER=icpx \
  605. -DGGML_SYCL_F16=ON
  606. cmake --build build --config Release -j $(nproc)
  607. build-linux-cross:
  608. uses: ./.github/workflows/build-linux-cross.yml
  609. build-cmake-pkg:
  610. uses: ./.github/workflows/build-cmake-pkg.yml
  611. macOS-latest-cmake-ios:
  612. runs-on: macos-latest
  613. steps:
  614. - name: Clone
  615. id: checkout
  616. uses: actions/checkout@v4
  617. - name: ccache
  618. uses: ggml-org/ccache-action@v1.2.16
  619. with:
  620. key: macOS-latest-cmake-ios
  621. evict-old-files: 1d
  622. - name: Build
  623. id: cmake_build
  624. run: |
  625. sysctl -a
  626. cmake -B build -G Xcode \
  627. -DGGML_METAL_USE_BF16=ON \
  628. -DGGML_METAL_EMBED_LIBRARY=ON \
  629. -DLLAMA_BUILD_COMMON=OFF \
  630. -DLLAMA_BUILD_EXAMPLES=OFF \
  631. -DLLAMA_BUILD_TOOLS=OFF \
  632. -DLLAMA_BUILD_TESTS=OFF \
  633. -DLLAMA_BUILD_SERVER=OFF \
  634. -DCMAKE_SYSTEM_NAME=iOS \
  635. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  636. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  637. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  638. macOS-latest-cmake-tvos:
  639. runs-on: macos-latest
  640. steps:
  641. - name: Clone
  642. id: checkout
  643. uses: actions/checkout@v4
  644. - name: ccache
  645. uses: ggml-org/ccache-action@v1.2.16
  646. with:
  647. key: macOS-latest-cmake-tvos
  648. evict-old-files: 1d
  649. - name: Build
  650. id: cmake_build
  651. run: |
  652. sysctl -a
  653. cmake -B build -G Xcode \
  654. -DGGML_METAL_USE_BF16=ON \
  655. -DGGML_METAL_EMBED_LIBRARY=ON \
  656. -DLLAMA_BUILD_COMMON=OFF \
  657. -DLLAMA_BUILD_EXAMPLES=OFF \
  658. -DLLAMA_BUILD_TOOLS=OFF \
  659. -DLLAMA_BUILD_TESTS=OFF \
  660. -DLLAMA_BUILD_SERVER=OFF \
  661. -DCMAKE_SYSTEM_NAME=tvOS \
  662. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  663. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  664. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  665. macOS-latest-cmake-visionos:
  666. runs-on: macos-latest
  667. steps:
  668. - name: Clone
  669. id: checkout
  670. uses: actions/checkout@v4
  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=visionOS \
  684. -DCMAKE_OSX_DEPLOYMENT_TARGET=1.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-swift:
  688. runs-on: macos-latest
  689. needs: ios-xcode-build
  690. strategy:
  691. matrix:
  692. destination: ['generic/platform=macOS', 'generic/platform=iOS', 'generic/platform=tvOS']
  693. steps:
  694. - name: Clone
  695. id: checkout
  696. uses: actions/checkout@v4
  697. - name: ccache
  698. uses: ggml-org/ccache-action@v1.2.16
  699. with:
  700. key: macOS-latest-swift
  701. evict-old-files: 1d
  702. - name: Download xcframework artifact
  703. uses: actions/download-artifact@v4
  704. with:
  705. name: llama-xcframework
  706. path: build-apple/llama.xcframework/
  707. - name: Build llama.cpp with CMake
  708. id: cmake_build
  709. run: |
  710. sysctl -a
  711. cmake -B build -G Xcode \
  712. -DGGML_METAL_USE_BF16=ON \
  713. -DGGML_METAL_EMBED_LIBRARY=ON \
  714. -DLLAMA_CURL=OFF \
  715. -DLLAMA_BUILD_EXAMPLES=OFF \
  716. -DLLAMA_BUILD_TOOLS=OFF \
  717. -DLLAMA_BUILD_TESTS=OFF \
  718. -DLLAMA_BUILD_SERVER=OFF \
  719. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
  720. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  721. windows-msys2:
  722. runs-on: windows-2025
  723. strategy:
  724. fail-fast: false
  725. matrix:
  726. include:
  727. - { sys: UCRT64, env: ucrt-x86_64, build: Release }
  728. - { sys: CLANG64, env: clang-x86_64, build: Release }
  729. steps:
  730. - name: Clone
  731. uses: actions/checkout@v4
  732. - name: ccache
  733. uses: ggml-org/ccache-action@v1.2.16
  734. with:
  735. key: windows-msys2
  736. variant: ccache
  737. evict-old-files: 1d
  738. - name: Setup ${{ matrix.sys }}
  739. uses: msys2/setup-msys2@v2
  740. with:
  741. update: true
  742. msystem: ${{matrix.sys}}
  743. install: >-
  744. base-devel
  745. git
  746. mingw-w64-${{matrix.env}}-toolchain
  747. mingw-w64-${{matrix.env}}-cmake
  748. mingw-w64-${{matrix.env}}-openblas
  749. - name: Build using CMake
  750. shell: msys2 {0}
  751. run: |
  752. cmake -B build
  753. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  754. - name: Clean after building using CMake
  755. shell: msys2 {0}
  756. run: |
  757. rm -rf build
  758. - name: Build using CMake w/ OpenBLAS
  759. shell: msys2 {0}
  760. run: |
  761. cmake -B build -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
  762. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  763. windows-latest-cmake:
  764. runs-on: windows-2025
  765. env:
  766. OPENBLAS_VERSION: 0.3.23
  767. SDE_VERSION: 9.33.0-2024-01-07
  768. VULKAN_VERSION: 1.4.313.2
  769. strategy:
  770. matrix:
  771. include:
  772. - build: 'cpu-x64 (static)'
  773. arch: 'x64'
  774. 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'
  775. - build: 'openblas-x64'
  776. arch: 'x64'
  777. 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"'
  778. - build: 'vulkan-x64'
  779. arch: 'x64'
  780. 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'
  781. - build: 'llvm-arm64'
  782. arch: 'arm64'
  783. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON'
  784. - build: 'llvm-arm64-opencl-adreno'
  785. arch: 'arm64'
  786. 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'
  787. steps:
  788. - name: Clone
  789. id: checkout
  790. uses: actions/checkout@v4
  791. - name: ccache
  792. uses: ggml-org/ccache-action@v1.2.16
  793. with:
  794. key: windows-latest-cmake-${{ matrix.build }}
  795. variant: ccache
  796. evict-old-files: 1d
  797. - name: Download OpenBLAS
  798. id: get_openblas
  799. if: ${{ matrix.build == 'openblas-x64' }}
  800. run: |
  801. 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"
  802. curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE"
  803. mkdir $env:RUNNER_TEMP/openblas
  804. tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas
  805. $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
  806. $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
  807. $lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe')
  808. & $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll
  809. - name: Install Vulkan SDK
  810. id: get_vulkan
  811. if: ${{ matrix.build == 'vulkan-x64' }}
  812. run: |
  813. 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"
  814. & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
  815. Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
  816. Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
  817. - name: Install Ninja
  818. id: install_ninja
  819. run: |
  820. choco install ninja
  821. - name: Install OpenCL Headers and Libs
  822. id: install_opencl
  823. if: ${{ matrix.build == 'llvm-arm64-opencl-adreno' }}
  824. run: |
  825. git clone https://github.com/KhronosGroup/OpenCL-Headers
  826. cd OpenCL-Headers
  827. cmake -B build `
  828. -DBUILD_TESTING=OFF `
  829. -DOPENCL_HEADERS_BUILD_TESTING=OFF `
  830. -DOPENCL_HEADERS_BUILD_CXX_TESTS=OFF `
  831. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  832. cmake --build build --target install
  833. git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader
  834. cd OpenCL-ICD-Loader
  835. cmake -B build-arm64-release `
  836. -A arm64 `
  837. -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" `
  838. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  839. cmake --build build-arm64-release --target install --config release
  840. - name: Build
  841. id: cmake_build
  842. run: |
  843. cmake -S . -B build ${{ matrix.defines }} `
  844. -DLLAMA_CURL=OFF -DLLAMA_BUILD_BORINGSSL=ON
  845. cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}
  846. - name: Add libopenblas.dll
  847. id: add_libopenblas_dll
  848. if: ${{ matrix.build == 'openblas-x64' }}
  849. run: |
  850. cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll
  851. cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt
  852. - name: Test
  853. id: cmake_test
  854. if: ${{ matrix.arch == 'x64' }}
  855. run: |
  856. cd build
  857. ctest -L main -C Release --verbose --timeout 900
  858. # TODO: disabled for now, consider adding tests for all CPU variants instead
  859. # - name: Test (Intel SDE)
  860. # id: cmake_test_sde
  861. # if: ${{ matrix.build == 'avx512-x64' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation
  862. # run: |
  863. # curl.exe -o $env:RUNNER_TEMP/sde.tar.xz -L "https://downloadmirror.intel.com/813591/sde-external-${env:SDE_VERSION}-win.tar.xz"
  864. # # for some weird reason windows tar doesn't like sde tar.xz
  865. # 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar.xz
  866. # 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar
  867. # $sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe)
  868. # cd build
  869. # $env:LLAMA_SKIP_TESTS_SLOW_ON_EMULATOR = 1
  870. # & $sde -future -- ctest -L main -C Release --verbose --timeout 900
  871. ubuntu-latest-cmake-cuda:
  872. runs-on: ubuntu-latest
  873. container: nvidia/cuda:12.6.2-devel-ubuntu24.04
  874. steps:
  875. - name: Clone
  876. id: checkout
  877. uses: actions/checkout@v4
  878. - name: Install dependencies
  879. env:
  880. DEBIAN_FRONTEND: noninteractive
  881. run: |
  882. apt update
  883. apt install -y cmake build-essential ninja-build libgomp1 git libssl-dev
  884. - name: ccache
  885. uses: ggml-org/ccache-action@v1.2.16
  886. with:
  887. key: ubuntu-latest-cmake-cuda
  888. evict-old-files: 1d
  889. - name: Build with CMake
  890. run: |
  891. cmake -S . -B build -G Ninja \
  892. -DLLAMA_CURL=OFF \
  893. -DLLAMA_OPENSSL=ON \
  894. -DLLAMA_FATAL_WARNINGS=ON \
  895. -DCMAKE_BUILD_TYPE=Release \
  896. -DCMAKE_CUDA_ARCHITECTURES=89-real \
  897. -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined \
  898. -DGGML_NATIVE=OFF \
  899. -DGGML_CUDA=ON
  900. cmake --build build
  901. windows-2022-cmake-cuda:
  902. runs-on: windows-2022
  903. strategy:
  904. matrix:
  905. cuda: ['12.4']
  906. steps:
  907. - name: Clone
  908. id: checkout
  909. uses: actions/checkout@v4
  910. - name: Install ccache
  911. uses: ggml-org/ccache-action@v1.2.16
  912. with:
  913. key: windows-cuda-${{ matrix.cuda }}
  914. variant: ccache
  915. evict-old-files: 1d
  916. - name: Install Cuda Toolkit
  917. uses: ./.github/actions/windows-setup-cuda
  918. with:
  919. cuda_version: ${{ matrix.cuda }}
  920. - name: Install Ninja
  921. id: install_ninja
  922. run: |
  923. choco install ninja
  924. - name: Build
  925. id: cmake_build
  926. shell: cmd
  927. run: |
  928. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
  929. cmake -S . -B build -G "Ninja Multi-Config" ^
  930. -DLLAMA_BUILD_SERVER=ON ^
  931. -DLLAMA_CURL=OFF ^
  932. -DLLAMA_BUILD_BORINGSSL=ON ^
  933. -DGGML_NATIVE=OFF ^
  934. -DGGML_BACKEND_DL=ON ^
  935. -DGGML_CPU_ALL_VARIANTS=ON ^
  936. -DGGML_CUDA=ON ^
  937. -DGGML_RPC=ON
  938. set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
  939. cmake --build build --config Release -j %NINJA_JOBS% -t ggml
  940. cmake --build build --config Release
  941. windows-latest-cmake-sycl:
  942. runs-on: windows-2022
  943. defaults:
  944. run:
  945. shell: bash
  946. env:
  947. 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
  948. WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel
  949. ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI"
  950. steps:
  951. - name: Clone
  952. id: checkout
  953. uses: actions/checkout@v4
  954. - name: ccache
  955. uses: ggml-org/ccache-action@v1.2.16
  956. with:
  957. key: windows-latest-cmake-sycl
  958. variant: ccache
  959. evict-old-files: 1d
  960. - name: Install
  961. run: |
  962. scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
  963. # TODO: add ssl support ; we will also need to modify win-build-sycl.bat to accept user-specified args
  964. - name: Build
  965. id: cmake_build
  966. run: examples/sycl/win-build-sycl.bat
  967. windows-latest-cmake-hip:
  968. runs-on: windows-2022
  969. env:
  970. # The ROCm version must correspond to the version used in the HIP SDK.
  971. ROCM_VERSION: "6.4.2"
  972. # Make sure this is in sync with build-cache.yml
  973. HIPSDK_INSTALLER_VERSION: "25.Q3"
  974. steps:
  975. - name: Clone
  976. id: checkout
  977. uses: actions/checkout@v4
  978. - name: Grab rocWMMA package
  979. id: grab_rocwmma
  980. run: |
  981. 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"
  982. 7z x rocwmma.deb
  983. 7z x data.tar
  984. - name: Use ROCm Installation Cache
  985. uses: actions/cache@v4
  986. id: cache-rocm
  987. with:
  988. path: C:\Program Files\AMD\ROCm
  989. key: rocm-${{ env.HIPSDK_INSTALLER_VERSION }}-${{ runner.os }}
  990. - name: Setup ROCm
  991. if: steps.cache-rocm.outputs.cache-hit != 'true'
  992. uses: ./.github/actions/windows-setup-rocm
  993. with:
  994. version: ${{ env.HIPSDK_INSTALLER_VERSION }}
  995. - name: Verify ROCm
  996. id: verify
  997. run: |
  998. # Find and test ROCm installation
  999. $clangPath = Get-ChildItem 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | Select-Object -First 1
  1000. if (-not $clangPath) {
  1001. Write-Error "ROCm installation not found"
  1002. exit 1
  1003. }
  1004. & $clangPath.FullName --version
  1005. - name: Install ccache
  1006. uses: ggml-org/ccache-action@v1.2.16
  1007. with:
  1008. key: ${{ github.job }}
  1009. evict-old-files: 1d
  1010. - name: Build
  1011. id: cmake_build
  1012. run: |
  1013. $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
  1014. $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
  1015. cmake -G "Unix Makefiles" -B build -S . `
  1016. -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
  1017. -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
  1018. -DCMAKE_CXX_FLAGS="-I$($PWD.Path.Replace('\', '/'))/opt/rocm-${{ env.ROCM_VERSION }}/include/" `
  1019. -DCMAKE_BUILD_TYPE=Release `
  1020. -DLLAMA_CURL=OFF `
  1021. -DLLAMA_BUILD_BORINGSSL=ON `
  1022. -DROCM_DIR="${env:HIP_PATH}" `
  1023. -DGGML_HIP=ON `
  1024. -DGGML_HIP_ROCWMMA_FATTN=ON `
  1025. -DGGML_RPC=ON
  1026. cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
  1027. ios-xcode-build:
  1028. runs-on: macos-latest
  1029. steps:
  1030. - name: Checkout code
  1031. uses: actions/checkout@v4
  1032. - name: Setup Xcode
  1033. uses: maxim-lobanov/setup-xcode@v1
  1034. with:
  1035. xcode-version: latest-stable
  1036. - name: Build
  1037. id: cmake_build
  1038. run: |
  1039. sysctl -a
  1040. cmake -B build -G Xcode \
  1041. -DGGML_METAL_USE_BF16=ON \
  1042. -DGGML_METAL_EMBED_LIBRARY=ON \
  1043. -DLLAMA_CURL=OFF \
  1044. -DLLAMA_BUILD_EXAMPLES=OFF \
  1045. -DLLAMA_BUILD_TOOLS=OFF \
  1046. -DLLAMA_BUILD_TESTS=OFF \
  1047. -DLLAMA_BUILD_SERVER=OFF \
  1048. -DCMAKE_SYSTEM_NAME=iOS \
  1049. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  1050. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  1051. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  1052. - name: xcodebuild for swift package
  1053. id: xcodebuild
  1054. run: |
  1055. ./build-xcframework.sh
  1056. - name: Upload xcframework artifact
  1057. uses: actions/upload-artifact@v4
  1058. with:
  1059. name: llama-xcframework
  1060. path: build-apple/llama.xcframework/
  1061. retention-days: 1
  1062. - name: Build Xcode project
  1063. run: |
  1064. xcodebuild -downloadPlatform iOS
  1065. 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
  1066. android-build:
  1067. runs-on: ubuntu-latest
  1068. steps:
  1069. - name: Clone
  1070. uses: actions/checkout@v4
  1071. # Disabled due to size (400MB) and always 0 cache hits
  1072. # - name: ccache
  1073. # uses: ggml-org/ccache-action@v1.2.16
  1074. # with:
  1075. # key: android-build
  1076. # evict-old-files: 1d
  1077. - name: Set up JDK
  1078. uses: actions/setup-java@v3
  1079. with:
  1080. java-version: 17
  1081. distribution: zulu
  1082. - name: Setup Android SDK
  1083. uses: android-actions/setup-android@v3
  1084. with:
  1085. log-accepted-android-sdk-licenses: false
  1086. - name: Build
  1087. run: |
  1088. cd examples/llama.android
  1089. ./gradlew build --no-daemon
  1090. android-ndk-build:
  1091. runs-on: ubuntu-latest
  1092. env:
  1093. OPENCL_VERSION: 2025.07.22
  1094. strategy:
  1095. matrix:
  1096. include:
  1097. - build: 'arm64-cpu'
  1098. 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'
  1099. - build: 'arm64-snapdragon'
  1100. defines: '--preset arm64-android-snapdragon-release'
  1101. steps:
  1102. - name: Clone
  1103. id: checkout
  1104. uses: actions/checkout@v4
  1105. - name: Install OpenCL Headers and Libs
  1106. id: install_opencl
  1107. if: ${{ matrix.build == 'arm64-snapdragon' }}
  1108. run: |
  1109. mkdir opencl
  1110. curl -L -o opencl/clhpp.tar.gz https://github.com/KhronosGroup/OpenCL-CLHPP/archive/refs/tags/v${OPENCL_VERSION}.tar.gz
  1111. curl -L -o opencl/headers.tar.gz https://github.com/KhronosGroup/OpenCL-Headers/archive/refs/tags/v${OPENCL_VERSION}.tar.gz
  1112. curl -L -o opencl/icd-loader.tar.gz https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/refs/tags/v${OPENCL_VERSION}.tar.gz
  1113. tar -xaf opencl/headers.tar.gz -C opencl
  1114. tar -xaf opencl/clhpp.tar.gz -C opencl
  1115. tar -xaf opencl/icd-loader.tar.gz -C opencl
  1116. sudo cp -r opencl/OpenCL-Headers-${OPENCL_VERSION}/CL ${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include
  1117. sudo cp -r opencl/OpenCL-CLHPP-${OPENCL_VERSION}/include/CL/* ${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/CL
  1118. cd opencl/OpenCL-ICD-Loader-${OPENCL_VERSION}
  1119. 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
  1120. cmake --build build
  1121. sudo cp build/libOpenCL.so ${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android
  1122. rm -rf opencl
  1123. - name: Install Hexagon SDK
  1124. id: install_hexsdk
  1125. if: ${{ matrix.build == 'arm64-snapdragon' }}
  1126. env:
  1127. HEXSDK_VER: 6.4.0.2
  1128. HEXTLS_VER: 19.0.04
  1129. run: |
  1130. 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
  1131. mkdir hex-sdk
  1132. tar -xaf hex-sdk.tar.gz -C hex-sdk
  1133. ls -l hex-sdk
  1134. sudo mv hex-sdk /opt/hexagon
  1135. echo "HEXAGON_SDK_ROOT=/opt/hexagon/$HEXSDK_VER" >> "$GITHUB_ENV"
  1136. echo "HEXAGON_TOOLS_ROOT=/opt/hexagon/$HEXSDK_VER/tools/HEXAGON_Tools/$HEXTLS_VER" >> "$GITHUB_ENV"
  1137. echo "DEFAULT_HLOS_ARCH=64" >> "$GITHUB_ENV"
  1138. echo "DEFAULT_TOOLS_VARIANT=toolv19" >> "$GITHUB_ENV"
  1139. echo "DEFAULT_NO_QURT_INC=0" >> "$GITHUB_ENV"
  1140. echo "DEFAULT_DSP_ARCH=v73" >> "$GITHUB_ENV"
  1141. - name: Update CMake presets
  1142. id: update_presets
  1143. if: ${{ matrix.build == 'arm64-snapdragon' }}
  1144. run: |
  1145. cp docs/backend/hexagon/CMakeUserPresets.json .
  1146. - name: Build
  1147. id: ndk_build
  1148. run: |
  1149. cmake ${{ matrix.defines }} -B build
  1150. cmake --build build
  1151. cmake --install build --prefix pkg-adb/llama.cpp
  1152. - name: Test
  1153. id: cmake_test
  1154. run: |
  1155. echo "FIXME: test on devices"
  1156. openEuler-latest-cmake-cann:
  1157. if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'Ascend NPU') }}
  1158. defaults:
  1159. run:
  1160. shell: bash -el {0}
  1161. strategy:
  1162. matrix:
  1163. arch: [x86, aarch64]
  1164. chip_type: ['910b', '310p']
  1165. build: ['Release']
  1166. runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
  1167. container: ascendai/cann:${{ matrix.chip_type == '910b' && '8.3.rc1.alpha001-910b-openeuler22.03-py3.11' || '8.2.rc1-310p-openeuler22.03-py3.11' }}
  1168. steps:
  1169. - name: Checkout
  1170. uses: actions/checkout@v4
  1171. - name: Dependencies
  1172. run: |
  1173. yum update -y
  1174. yum install -y git gcc gcc-c++ make cmake libcurl-devel
  1175. - name: Build
  1176. run: |
  1177. export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
  1178. cmake -S . -B build \
  1179. -DCMAKE_BUILD_TYPE=${{ matrix.build }} \
  1180. -DGGML_CANN=on \
  1181. -DSOC_TYPE=ascend${{ matrix.chip_type }}
  1182. cmake --build build -j $(nproc)
  1183. # TODO: simplify the following workflows using a matrix
  1184. # TODO: run lighter CI on PRs and the full CI only on master (if needed)
  1185. ggml-ci-x64-cpu-low-perf:
  1186. runs-on: ubuntu-22.04
  1187. steps:
  1188. - name: Clone
  1189. id: checkout
  1190. uses: actions/checkout@v4
  1191. - name: ccache
  1192. uses: ggml-org/ccache-action@v1.2.16
  1193. with:
  1194. key: ggml-ci-x64-cpu-low-perf
  1195. evict-old-files: 1d
  1196. - name: Dependencies
  1197. id: depends
  1198. run: |
  1199. sudo apt-get update
  1200. sudo apt-get install build-essential libcurl4-openssl-dev
  1201. - name: Test
  1202. id: ggml-ci
  1203. run: |
  1204. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_LOW_PERF=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1205. ggml-ci-arm64-cpu-low-perf:
  1206. runs-on: ubuntu-22.04-arm
  1207. steps:
  1208. - name: Clone
  1209. id: checkout
  1210. uses: actions/checkout@v4
  1211. - name: ccache
  1212. uses: ggml-org/ccache-action@v1.2.16
  1213. with:
  1214. key: ggml-ci-arm64-cpu-low-perf
  1215. evict-old-files: 1d
  1216. - name: Dependencies
  1217. id: depends
  1218. run: |
  1219. sudo apt-get update
  1220. sudo apt-get install build-essential libcurl4-openssl-dev
  1221. - name: Test
  1222. id: ggml-ci
  1223. run: |
  1224. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_LOW_PERF=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1225. ggml-ci-x64-cpu-high-perf:
  1226. runs-on: ubuntu-22.04
  1227. steps:
  1228. - name: Clone
  1229. id: checkout
  1230. uses: actions/checkout@v4
  1231. - name: ccache
  1232. uses: ggml-org/ccache-action@v1.2.16
  1233. with:
  1234. key: ggml-ci-x64-cpu-high-perf
  1235. evict-old-files: 1d
  1236. - name: Dependencies
  1237. id: depends
  1238. run: |
  1239. sudo apt-get update
  1240. sudo apt-get install build-essential libcurl4-openssl-dev
  1241. - name: Test
  1242. id: ggml-ci
  1243. run: |
  1244. LLAMA_ARG_THREADS=$(nproc) bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1245. ggml-ci-arm64-cpu-high-perf:
  1246. runs-on: ubuntu-22.04-arm
  1247. steps:
  1248. - name: Clone
  1249. id: checkout
  1250. uses: actions/checkout@v4
  1251. - name: ccache
  1252. uses: ggml-org/ccache-action@v1.2.16
  1253. with:
  1254. key: ggml-ci-arm64-cpu-high-perf
  1255. evict-old-files: 1d
  1256. - name: Dependencies
  1257. id: depends
  1258. run: |
  1259. sudo apt-get update
  1260. sudo apt-get install build-essential libcurl4-openssl-dev
  1261. - name: Test
  1262. id: ggml-ci
  1263. run: |
  1264. 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
  1265. ggml-ci-arm64-cpu-high-perf-sve:
  1266. runs-on: ubuntu-22.04-arm
  1267. steps:
  1268. - name: Clone
  1269. id: checkout
  1270. uses: actions/checkout@v4
  1271. - name: ccache
  1272. uses: ggml-org/ccache-action@v1.2.16
  1273. with:
  1274. key: ggml-ci-arm64-cpu-high-perf-sve
  1275. evict-old-files: 1d
  1276. - name: Dependencies
  1277. id: depends
  1278. run: |
  1279. sudo apt-get update
  1280. sudo apt-get install build-essential libcurl4-openssl-dev
  1281. - name: Test
  1282. id: ggml-ci
  1283. run: |
  1284. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_NO_BF16=1 GG_BUILD_EXTRA_TESTS_0=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1285. ggml-ci-x64-nvidia-cuda:
  1286. runs-on: [self-hosted, Linux, X64, NVIDIA]
  1287. steps:
  1288. - name: Clone
  1289. id: checkout
  1290. uses: actions/checkout@v4
  1291. - name: Test
  1292. id: ggml-ci
  1293. run: |
  1294. nvidia-smi
  1295. GG_BUILD_CUDA=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1296. ggml-ci-x64-nvidia-vulkan-cm:
  1297. runs-on: [self-hosted, Linux, X64, NVIDIA]
  1298. steps:
  1299. - name: Clone
  1300. id: checkout
  1301. uses: actions/checkout@v4
  1302. - name: Test
  1303. id: ggml-ci
  1304. run: |
  1305. vulkaninfo --summary
  1306. GG_BUILD_VULKAN=1 GGML_VK_DISABLE_COOPMAT2=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1307. ggml-ci-x64-nvidia-vulkan-cm2:
  1308. runs-on: [self-hosted, Linux, X64, NVIDIA, COOPMAT2]
  1309. steps:
  1310. - name: Clone
  1311. id: checkout
  1312. uses: actions/checkout@v4
  1313. - name: Test
  1314. id: ggml-ci
  1315. run: |
  1316. vulkaninfo --summary
  1317. GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1318. ggml-ci-x64-cpu-amx:
  1319. runs-on: [self-hosted, Linux, X64, CPU, AMX]
  1320. steps:
  1321. - name: Clone
  1322. id: checkout
  1323. uses: actions/checkout@v4
  1324. - name: Test
  1325. id: ggml-ci
  1326. run: |
  1327. bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1328. ggml-ci-x64-amd-vulkan:
  1329. runs-on: [self-hosted, Linux, X64, AMD]
  1330. steps:
  1331. - name: Clone
  1332. id: checkout
  1333. uses: actions/checkout@v4
  1334. - name: Test
  1335. id: ggml-ci
  1336. run: |
  1337. vulkaninfo --summary
  1338. GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1339. ggml-ci-x64-amd-rocm:
  1340. runs-on: [self-hosted, Linux, X64, AMD]
  1341. steps:
  1342. - name: Clone
  1343. id: checkout
  1344. uses: actions/checkout@v4
  1345. - name: Test
  1346. id: ggml-ci
  1347. run: |
  1348. amd-smi static
  1349. GG_BUILD_ROCM=1 GG_BUILD_AMDGPU_TARGETS="gfx1101" bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1350. ggml-ci-mac-metal:
  1351. runs-on: [self-hosted, macOS, ARM64]
  1352. steps:
  1353. - name: Clone
  1354. id: checkout
  1355. uses: actions/checkout@v4
  1356. - name: Test
  1357. id: ggml-ci
  1358. run: |
  1359. GG_BUILD_METAL=1 bash ./ci/run.sh ~/results/llama.cpp ~/mnt/llama.cpp
  1360. ggml-ci-mac-vulkan:
  1361. runs-on: [self-hosted, macOS, ARM64]
  1362. steps:
  1363. - name: Clone
  1364. id: checkout
  1365. uses: actions/checkout@v4
  1366. - name: Test
  1367. id: ggml-ci
  1368. run: |
  1369. vulkaninfo --summary
  1370. GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp ~/mnt/llama.cpp
  1371. ggml-ci-arm64-cpu-kleidiai:
  1372. runs-on: ubuntu-22.04-arm
  1373. steps:
  1374. - name: Clone
  1375. id: checkout
  1376. uses: actions/checkout@v4
  1377. - name: ccache
  1378. uses: ggml-org/ccache-action@v1.2.16
  1379. with:
  1380. key: ggml-ci-arm64-cpu-kleidiai
  1381. evict-old-files: 1d
  1382. - name: Dependencies
  1383. id: depends
  1384. run: |
  1385. sudo apt-get update
  1386. sudo apt-get install -y build-essential libcurl4-openssl-dev
  1387. - name: Test
  1388. id: ggml-ci
  1389. run: |
  1390. GG_BUILD_KLEIDIAI=1 GG_BUILD_EXTRA_TESTS_0=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1391. ubuntu-cpu-cmake-riscv64-native:
  1392. runs-on: RISCV64
  1393. steps:
  1394. - name: Install dependencies
  1395. run: |
  1396. sudo apt-get update
  1397. # Install necessary packages
  1398. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential libssl-dev wget ccache
  1399. # Set gcc-14 and g++-14 as the default compilers
  1400. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1401. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1402. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1403. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1404. # Install Rust stable version
  1405. rustup install stable
  1406. rustup default stable
  1407. - name: Clone
  1408. id: checkout
  1409. uses: actions/checkout@v4
  1410. - name: Check environment
  1411. run: |
  1412. uname -a
  1413. gcc --version
  1414. g++ --version
  1415. ldd --version
  1416. cmake --version
  1417. rustc --version
  1418. - name: Setup ccache
  1419. run: |
  1420. # Set unique cache directory for this job
  1421. export CCACHE_DIR="$HOME/.ccache/cpu-cmake-rv64-native"
  1422. mkdir -p "$CCACHE_DIR"
  1423. # Configure ccache for optimal performance
  1424. ccache --set-config=max_size=5G
  1425. ccache --set-config=compression=true
  1426. ccache --set-config=compression_level=6
  1427. ccache --set-config=cache_dir="$CCACHE_DIR"
  1428. # Enable more aggressive caching
  1429. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1430. ccache --set-config=hash_dir=false
  1431. # Export for subsequent steps
  1432. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1433. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1434. - name: Build
  1435. id: cmake_build
  1436. run: |
  1437. cmake -B build \
  1438. -DLLAMA_CURL=OFF \
  1439. -DLLAMA_OPENSSL=ON \
  1440. -DCMAKE_BUILD_TYPE=Release \
  1441. -DGGML_OPENMP=OFF \
  1442. -DLLAMA_BUILD_EXAMPLES=ON \
  1443. -DLLAMA_BUILD_TOOLS=ON \
  1444. -DLLAMA_BUILD_TESTS=ON \
  1445. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1446. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1447. -DGGML_RPC=ON \
  1448. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1449. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1450. cmake --build build --config Release -j $(nproc)
  1451. - name: Test
  1452. id: cmake_test
  1453. run: |
  1454. cd build
  1455. ctest -L 'main|curl' --verbose --timeout 900
  1456. - name: Test llama2c conversion
  1457. id: llama2c_test
  1458. run: |
  1459. cd build
  1460. echo "Fetch tokenizer"
  1461. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin
  1462. echo "Fetch llama2c model"
  1463. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin
  1464. ./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf
  1465. ./bin/llama-cli -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
  1466. ubuntu-cmake-sanitizer-riscv64-native:
  1467. runs-on: RISCV64
  1468. continue-on-error: true
  1469. strategy:
  1470. matrix:
  1471. sanitizer: [ADDRESS, THREAD, UNDEFINED]
  1472. build_type: [Debug]
  1473. steps:
  1474. - name: Install dependencies
  1475. run: |
  1476. sudo apt-get update
  1477. # Install necessary packages
  1478. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential wget ccache
  1479. # Set gcc-14 and g++-14 as the default compilers
  1480. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1481. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1482. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1483. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1484. # Install Rust stable version
  1485. rustup install stable
  1486. rustup default stable
  1487. - name: GCC version check
  1488. run: |
  1489. gcc --version
  1490. g++ --version
  1491. - name: Clone
  1492. id: checkout
  1493. uses: actions/checkout@v4
  1494. - name: Setup ccache
  1495. run: |
  1496. # Unique cache directory per matrix combination
  1497. export CCACHE_DIR="$HOME/.ccache/sanitizer-${{ matrix.sanitizer }}-${{ matrix.build_type }}"
  1498. mkdir -p "$CCACHE_DIR"
  1499. # Configure ccache
  1500. ccache --set-config=max_size=5G
  1501. ccache --set-config=compression=true
  1502. ccache --set-config=compression_level=6
  1503. ccache --set-config=cache_dir="$CCACHE_DIR"
  1504. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1505. ccache --set-config=hash_dir=false
  1506. # Export for subsequent steps
  1507. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1508. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1509. - name: Build
  1510. id: cmake_build
  1511. if: ${{ matrix.sanitizer != 'THREAD' }}
  1512. run: |
  1513. cmake -B build \
  1514. -DLLAMA_CURL=OFF \
  1515. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  1516. -DGGML_OPENMP=ON \
  1517. -DLLAMA_BUILD_EXAMPLES=ON \
  1518. -DLLAMA_BUILD_TOOLS=ON \
  1519. -DLLAMA_BUILD_TESTS=OFF \
  1520. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1521. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1522. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  1523. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1524. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1525. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  1526. - name: Build (no OpenMP)
  1527. id: cmake_build_no_openmp
  1528. if: ${{ matrix.sanitizer == 'THREAD' }}
  1529. run: |
  1530. cmake -B build \
  1531. -DLLAMA_CURL=OFF \
  1532. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  1533. -DGGML_OPENMP=OFF \
  1534. -DLLAMA_BUILD_EXAMPLES=ON \
  1535. -DLLAMA_BUILD_TOOLS=ON \
  1536. -DLLAMA_BUILD_TESTS=OFF \
  1537. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1538. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1539. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  1540. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1541. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1542. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  1543. - name: Test
  1544. id: cmake_test
  1545. run: |
  1546. cd build
  1547. ctest -L main --verbose --timeout 900
  1548. ubuntu-llguidance-riscv64-native:
  1549. runs-on: RISCV64
  1550. steps:
  1551. - name: Install dependencies
  1552. run: |
  1553. sudo apt-get update
  1554. # Install necessary packages
  1555. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential wget ccache
  1556. # Set gcc-14 and g++-14 as the default compilers
  1557. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1558. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1559. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1560. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1561. # Install Rust stable version
  1562. rustup install stable
  1563. rustup default stable
  1564. - name: GCC version check
  1565. run: |
  1566. gcc --version
  1567. g++ --version
  1568. - name: Clone
  1569. id: checkout
  1570. uses: actions/checkout@v4
  1571. - name: Setup ccache
  1572. run: |
  1573. export CCACHE_DIR="$HOME/.ccache/llguidance-riscv64"
  1574. mkdir -p "$CCACHE_DIR"
  1575. ccache --set-config=max_size=5G
  1576. ccache --set-config=compression=true
  1577. ccache --set-config=compression_level=6
  1578. ccache --set-config=cache_dir="$CCACHE_DIR"
  1579. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1580. ccache --set-config=hash_dir=false
  1581. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1582. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1583. - name: Build
  1584. id: cmake_build
  1585. run: |
  1586. cmake -B build \
  1587. -DLLAMA_CURL=OFF \
  1588. -DCMAKE_BUILD_TYPE=Release \
  1589. -DGGML_OPENMP=OFF \
  1590. -DLLAMA_BUILD_EXAMPLES=ON \
  1591. -DLLAMA_BUILD_TOOLS=ON \
  1592. -DLLAMA_BUILD_TESTS=OFF \
  1593. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1594. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1595. -DLLAMA_LLGUIDANCE=ON \
  1596. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1597. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1598. cmake --build build --config Release -j $(nproc)
  1599. - name: Test
  1600. id: cmake_test
  1601. run: |
  1602. cd build
  1603. ctest -L main --verbose --timeout 900
  1604. ubuntu-cmake-rpc-riscv64-native:
  1605. runs-on: RISCV64
  1606. continue-on-error: true
  1607. steps:
  1608. - name: Install dependencies
  1609. run: |
  1610. sudo apt-get update
  1611. # Install necessary packages
  1612. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential libssl-dev wget ccache
  1613. # Set gcc-14 and g++-14 as the default compilers
  1614. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1615. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1616. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1617. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1618. # Install Rust stable version
  1619. rustup install stable
  1620. rustup default stable
  1621. - name: GCC version check
  1622. run: |
  1623. gcc --version
  1624. g++ --version
  1625. - name: Clone
  1626. id: checkout
  1627. uses: actions/checkout@v4
  1628. - name: Setup ccache
  1629. run: |
  1630. export CCACHE_DIR="$HOME/.ccache/rpc-riscv64"
  1631. mkdir -p "$CCACHE_DIR"
  1632. ccache --set-config=max_size=5G
  1633. ccache --set-config=compression=true
  1634. ccache --set-config=compression_level=6
  1635. ccache --set-config=cache_dir="$CCACHE_DIR"
  1636. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1637. ccache --set-config=hash_dir=false
  1638. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1639. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1640. - name: Build
  1641. id: cmake_build
  1642. run: |
  1643. cmake -B build \
  1644. -DLLAMA_CURL=OFF \
  1645. -DLLAMA_OPENSSL=ON \
  1646. -DCMAKE_BUILD_TYPE=Release \
  1647. -DGGML_OPENMP=OFF \
  1648. -DLLAMA_BUILD_EXAMPLES=ON \
  1649. -DLLAMA_BUILD_TOOLS=ON \
  1650. -DLLAMA_BUILD_TESTS=ON \
  1651. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1652. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1653. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1654. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14 \
  1655. -DGGML_RPC=ON
  1656. cmake --build build --config Release -j $(nproc)
  1657. - name: Test
  1658. id: cmake_test
  1659. run: |
  1660. cd build
  1661. ctest -L main --verbose
  1662. ggml-ci-arm64-graviton4-kleidiai:
  1663. runs-on: ah-ubuntu_22_04-c8g_8x
  1664. steps:
  1665. - name: Clone
  1666. id: checkout
  1667. uses: actions/checkout@v4
  1668. - name: Dependencies
  1669. id: depends
  1670. run: |
  1671. set -euxo pipefail
  1672. sudo apt-get update
  1673. sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a \
  1674. apt-get install -y \
  1675. build-essential \
  1676. libcurl4-openssl-dev \
  1677. python3-venv \
  1678. gpg \
  1679. wget \
  1680. time \
  1681. git-lfs
  1682. git lfs install
  1683. # install the latest cmake
  1684. sudo install -d /usr/share/keyrings
  1685. wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc \
  1686. | gpg --dearmor \
  1687. | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
  1688. echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' \
  1689. | sudo tee /etc/apt/sources.list.d/kitware.list
  1690. sudo apt-get update
  1691. sudo apt-get install -y cmake
  1692. - name: ccache
  1693. uses: ggml-org/ccache-action@v1.2.16
  1694. with:
  1695. key: ggml-ci-arm64-graviton4-kleidiai
  1696. evict-old-files: 1d
  1697. - name: Test
  1698. id: ggml-ci
  1699. run: |
  1700. GG_BUILD_KLEIDIAI=1 \
  1701. GG_BUILD_EXTRA_TESTS_0=1 \
  1702. bash ./ci/run.sh ./tmp/results ./tmp/mnt