1
0

build.yml 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062
  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-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. container: ascendai/cann:${{ matrix.chip_type == '910b' && '8.3.rc1.alpha001-910b-openeuler22.03-py3.11' || '8.2.rc1-310p-openeuler22.03-py3.11' }}
  1201. steps:
  1202. - name: Checkout
  1203. uses: actions/checkout@v4
  1204. - name: Dependencies
  1205. run: |
  1206. yum update -y
  1207. yum install -y git gcc gcc-c++ make cmake libcurl-devel
  1208. - name: Build
  1209. run: |
  1210. export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
  1211. cmake -S . -B build \
  1212. -DCMAKE_BUILD_TYPE=${{ matrix.build }} \
  1213. -DGGML_CANN=on \
  1214. -DSOC_TYPE=ascend${{ matrix.chip_type }}
  1215. cmake --build build -j $(nproc)
  1216. # TODO: simplify the following workflows using a matrix
  1217. # TODO: run lighter CI on PRs and the full CI only on master (if needed)
  1218. ggml-ci-x64-cpu-low-perf:
  1219. runs-on: ubuntu-22.04
  1220. steps:
  1221. - name: Clone
  1222. id: checkout
  1223. uses: actions/checkout@v4
  1224. - name: ccache
  1225. uses: ggml-org/ccache-action@v1.2.16
  1226. with:
  1227. key: ggml-ci-x64-cpu-low-perf
  1228. evict-old-files: 1d
  1229. - name: Dependencies
  1230. id: depends
  1231. run: |
  1232. sudo apt-get update
  1233. sudo apt-get install build-essential libcurl4-openssl-dev
  1234. - name: Test
  1235. id: ggml-ci
  1236. run: |
  1237. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_LOW_PERF=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1238. ggml-ci-arm64-cpu-low-perf:
  1239. runs-on: ubuntu-22.04-arm
  1240. steps:
  1241. - name: Clone
  1242. id: checkout
  1243. uses: actions/checkout@v4
  1244. - name: ccache
  1245. uses: ggml-org/ccache-action@v1.2.16
  1246. with:
  1247. key: ggml-ci-arm64-cpu-low-perf
  1248. evict-old-files: 1d
  1249. - name: Dependencies
  1250. id: depends
  1251. run: |
  1252. sudo apt-get update
  1253. sudo apt-get install build-essential libcurl4-openssl-dev
  1254. - name: Test
  1255. id: ggml-ci
  1256. run: |
  1257. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_LOW_PERF=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1258. ggml-ci-x64-cpu-high-perf:
  1259. runs-on: ubuntu-22.04
  1260. steps:
  1261. - name: Clone
  1262. id: checkout
  1263. uses: actions/checkout@v4
  1264. - name: ccache
  1265. uses: ggml-org/ccache-action@v1.2.16
  1266. with:
  1267. key: ggml-ci-x64-cpu-high-perf
  1268. evict-old-files: 1d
  1269. - name: Dependencies
  1270. id: depends
  1271. run: |
  1272. sudo apt-get update
  1273. sudo apt-get install build-essential libcurl4-openssl-dev
  1274. - name: Test
  1275. id: ggml-ci
  1276. run: |
  1277. LLAMA_ARG_THREADS=$(nproc) bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1278. ggml-ci-arm64-cpu-high-perf:
  1279. runs-on: ubuntu-22.04-arm
  1280. steps:
  1281. - name: Clone
  1282. id: checkout
  1283. uses: actions/checkout@v4
  1284. - name: ccache
  1285. uses: ggml-org/ccache-action@v1.2.16
  1286. with:
  1287. key: ggml-ci-arm64-cpu-high-perf
  1288. evict-old-files: 1d
  1289. - name: Dependencies
  1290. id: depends
  1291. run: |
  1292. sudo apt-get update
  1293. sudo apt-get install build-essential libcurl4-openssl-dev
  1294. - name: Test
  1295. id: ggml-ci
  1296. run: |
  1297. 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
  1298. ggml-ci-arm64-cpu-high-perf-sve:
  1299. runs-on: ubuntu-22.04-arm
  1300. steps:
  1301. - name: Clone
  1302. id: checkout
  1303. uses: actions/checkout@v4
  1304. - name: ccache
  1305. uses: ggml-org/ccache-action@v1.2.16
  1306. with:
  1307. key: ggml-ci-arm64-cpu-high-perf-sve
  1308. evict-old-files: 1d
  1309. - name: Dependencies
  1310. id: depends
  1311. run: |
  1312. sudo apt-get update
  1313. sudo apt-get install build-essential libcurl4-openssl-dev
  1314. - name: Test
  1315. id: ggml-ci
  1316. run: |
  1317. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_NO_BF16=1 GG_BUILD_EXTRA_TESTS_0=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1318. ggml-ci-x64-nvidia-cuda:
  1319. runs-on: [self-hosted, Linux, X64, NVIDIA]
  1320. steps:
  1321. - name: Clone
  1322. id: checkout
  1323. uses: actions/checkout@v4
  1324. - name: Test
  1325. id: ggml-ci
  1326. run: |
  1327. nvidia-smi
  1328. GG_BUILD_CUDA=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1329. ggml-ci-x64-nvidia-vulkan-cm:
  1330. runs-on: [self-hosted, Linux, X64, NVIDIA]
  1331. steps:
  1332. - name: Clone
  1333. id: checkout
  1334. uses: actions/checkout@v4
  1335. - name: Test
  1336. id: ggml-ci
  1337. run: |
  1338. vulkaninfo --summary
  1339. GG_BUILD_VULKAN=1 GGML_VK_DISABLE_COOPMAT2=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1340. ggml-ci-x64-nvidia-vulkan-cm2:
  1341. runs-on: [self-hosted, Linux, X64, NVIDIA, COOPMAT2]
  1342. steps:
  1343. - name: Clone
  1344. id: checkout
  1345. uses: actions/checkout@v4
  1346. - name: Test
  1347. id: ggml-ci
  1348. run: |
  1349. vulkaninfo --summary
  1350. GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1351. ggml-ci-x64-cpu-amx:
  1352. runs-on: [self-hosted, Linux, X64, CPU, AMX]
  1353. steps:
  1354. - name: Clone
  1355. id: checkout
  1356. uses: actions/checkout@v4
  1357. - name: Test
  1358. id: ggml-ci
  1359. run: |
  1360. bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1361. ggml-ci-x64-amd-vulkan:
  1362. runs-on: [self-hosted, Linux, X64, AMD]
  1363. steps:
  1364. - name: Clone
  1365. id: checkout
  1366. uses: actions/checkout@v4
  1367. - name: Test
  1368. id: ggml-ci
  1369. run: |
  1370. vulkaninfo --summary
  1371. GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1372. ggml-ci-x64-amd-rocm:
  1373. runs-on: [self-hosted, Linux, X64, AMD]
  1374. steps:
  1375. - name: Clone
  1376. id: checkout
  1377. uses: actions/checkout@v4
  1378. - name: Test
  1379. id: ggml-ci
  1380. run: |
  1381. amd-smi static
  1382. GG_BUILD_ROCM=1 GG_BUILD_AMDGPU_TARGETS="gfx1101" bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1383. ggml-ci-mac-metal:
  1384. runs-on: [self-hosted, macOS, ARM64]
  1385. steps:
  1386. - name: Clone
  1387. id: checkout
  1388. uses: actions/checkout@v4
  1389. - name: Test
  1390. id: ggml-ci
  1391. run: |
  1392. GG_BUILD_METAL=1 bash ./ci/run.sh ~/results/llama.cpp ~/mnt/llama.cpp
  1393. ggml-ci-mac-vulkan:
  1394. runs-on: [self-hosted, macOS, ARM64]
  1395. steps:
  1396. - name: Clone
  1397. id: checkout
  1398. uses: actions/checkout@v4
  1399. - name: Test
  1400. id: ggml-ci
  1401. run: |
  1402. vulkaninfo --summary
  1403. GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp ~/mnt/llama.cpp
  1404. ggml-ci-arm64-cpu-kleidiai:
  1405. runs-on: ubuntu-22.04-arm
  1406. steps:
  1407. - name: Clone
  1408. id: checkout
  1409. uses: actions/checkout@v4
  1410. - name: ccache
  1411. uses: ggml-org/ccache-action@v1.2.16
  1412. with:
  1413. key: ggml-ci-arm64-cpu-kleidiai
  1414. evict-old-files: 1d
  1415. - name: Dependencies
  1416. id: depends
  1417. run: |
  1418. sudo apt-get update
  1419. sudo apt-get install -y build-essential libcurl4-openssl-dev
  1420. - name: Test
  1421. id: ggml-ci
  1422. run: |
  1423. GG_BUILD_KLEIDIAI=1 GG_BUILD_EXTRA_TESTS_0=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1424. ubuntu-cpu-cmake-riscv64-native:
  1425. runs-on: RISCV64
  1426. steps:
  1427. - name: Install dependencies
  1428. run: |
  1429. sudo apt-get update
  1430. # Install necessary packages
  1431. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential libssl-dev wget ccache
  1432. # Set gcc-14 and g++-14 as the default compilers
  1433. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1434. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1435. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1436. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1437. # Install Rust stable version
  1438. rustup install stable
  1439. rustup default stable
  1440. - name: Clone
  1441. id: checkout
  1442. uses: actions/checkout@v4
  1443. - name: Check environment
  1444. run: |
  1445. uname -a
  1446. gcc --version
  1447. g++ --version
  1448. ldd --version
  1449. cmake --version
  1450. rustc --version
  1451. - name: Setup ccache
  1452. run: |
  1453. # Set unique cache directory for this job
  1454. export CCACHE_DIR="$HOME/.ccache/cpu-cmake-rv64-native"
  1455. mkdir -p "$CCACHE_DIR"
  1456. # Configure ccache for optimal performance
  1457. ccache --set-config=max_size=5G
  1458. ccache --set-config=compression=true
  1459. ccache --set-config=compression_level=6
  1460. ccache --set-config=cache_dir="$CCACHE_DIR"
  1461. # Enable more aggressive caching
  1462. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1463. ccache --set-config=hash_dir=false
  1464. # Export for subsequent steps
  1465. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1466. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1467. - name: Build
  1468. id: cmake_build
  1469. run: |
  1470. cmake -B build \
  1471. -DLLAMA_CURL=OFF \
  1472. -DLLAMA_OPENSSL=ON \
  1473. -DCMAKE_BUILD_TYPE=Release \
  1474. -DGGML_OPENMP=OFF \
  1475. -DLLAMA_BUILD_EXAMPLES=ON \
  1476. -DLLAMA_BUILD_TOOLS=ON \
  1477. -DLLAMA_BUILD_TESTS=ON \
  1478. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1479. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1480. -DGGML_RPC=ON \
  1481. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1482. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1483. cmake --build build --config Release -j $(nproc)
  1484. - name: Test
  1485. id: cmake_test
  1486. run: |
  1487. cd build
  1488. ctest -L 'main|curl' --verbose --timeout 900
  1489. - name: Test llama2c conversion
  1490. id: llama2c_test
  1491. run: |
  1492. cd build
  1493. echo "Fetch tokenizer"
  1494. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin
  1495. echo "Fetch llama2c model"
  1496. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin
  1497. ./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf
  1498. ./bin/llama-cli -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
  1499. ubuntu-cmake-sanitizer-riscv64-native:
  1500. runs-on: RISCV64
  1501. continue-on-error: true
  1502. strategy:
  1503. matrix:
  1504. sanitizer: [ADDRESS, THREAD, UNDEFINED]
  1505. build_type: [Debug]
  1506. steps:
  1507. - name: Install dependencies
  1508. run: |
  1509. sudo apt-get update
  1510. # Install necessary packages
  1511. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential wget ccache
  1512. # Set gcc-14 and g++-14 as the default compilers
  1513. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1514. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1515. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1516. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1517. # Install Rust stable version
  1518. rustup install stable
  1519. rustup default stable
  1520. - name: GCC version check
  1521. run: |
  1522. gcc --version
  1523. g++ --version
  1524. - name: Clone
  1525. id: checkout
  1526. uses: actions/checkout@v4
  1527. - name: Setup ccache
  1528. run: |
  1529. # Unique cache directory per matrix combination
  1530. export CCACHE_DIR="$HOME/.ccache/sanitizer-${{ matrix.sanitizer }}-${{ matrix.build_type }}"
  1531. mkdir -p "$CCACHE_DIR"
  1532. # Configure ccache
  1533. ccache --set-config=max_size=5G
  1534. ccache --set-config=compression=true
  1535. ccache --set-config=compression_level=6
  1536. ccache --set-config=cache_dir="$CCACHE_DIR"
  1537. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1538. ccache --set-config=hash_dir=false
  1539. # Export for subsequent steps
  1540. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1541. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1542. - name: Build
  1543. id: cmake_build
  1544. if: ${{ matrix.sanitizer != 'THREAD' }}
  1545. run: |
  1546. cmake -B build \
  1547. -DLLAMA_CURL=OFF \
  1548. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  1549. -DGGML_OPENMP=ON \
  1550. -DLLAMA_BUILD_EXAMPLES=ON \
  1551. -DLLAMA_BUILD_TOOLS=ON \
  1552. -DLLAMA_BUILD_TESTS=OFF \
  1553. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1554. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1555. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  1556. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1557. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1558. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  1559. - name: Build (no OpenMP)
  1560. id: cmake_build_no_openmp
  1561. if: ${{ matrix.sanitizer == 'THREAD' }}
  1562. run: |
  1563. cmake -B build \
  1564. -DLLAMA_CURL=OFF \
  1565. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  1566. -DGGML_OPENMP=OFF \
  1567. -DLLAMA_BUILD_EXAMPLES=ON \
  1568. -DLLAMA_BUILD_TOOLS=ON \
  1569. -DLLAMA_BUILD_TESTS=OFF \
  1570. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1571. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1572. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  1573. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1574. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1575. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  1576. - name: Test
  1577. id: cmake_test
  1578. run: |
  1579. cd build
  1580. ctest -L main --verbose --timeout 900
  1581. ubuntu-llguidance-riscv64-native:
  1582. runs-on: RISCV64
  1583. steps:
  1584. - name: Install dependencies
  1585. run: |
  1586. sudo apt-get update
  1587. # Install necessary packages
  1588. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential wget ccache
  1589. # Set gcc-14 and g++-14 as the default compilers
  1590. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1591. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1592. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1593. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1594. # Install Rust stable version
  1595. rustup install stable
  1596. rustup default stable
  1597. - name: GCC version check
  1598. run: |
  1599. gcc --version
  1600. g++ --version
  1601. - name: Clone
  1602. id: checkout
  1603. uses: actions/checkout@v4
  1604. - name: Setup ccache
  1605. run: |
  1606. export CCACHE_DIR="$HOME/.ccache/llguidance-riscv64"
  1607. mkdir -p "$CCACHE_DIR"
  1608. ccache --set-config=max_size=5G
  1609. ccache --set-config=compression=true
  1610. ccache --set-config=compression_level=6
  1611. ccache --set-config=cache_dir="$CCACHE_DIR"
  1612. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1613. ccache --set-config=hash_dir=false
  1614. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1615. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1616. - name: Build
  1617. id: cmake_build
  1618. run: |
  1619. cmake -B build \
  1620. -DLLAMA_CURL=OFF \
  1621. -DCMAKE_BUILD_TYPE=Release \
  1622. -DGGML_OPENMP=OFF \
  1623. -DLLAMA_BUILD_EXAMPLES=ON \
  1624. -DLLAMA_BUILD_TOOLS=ON \
  1625. -DLLAMA_BUILD_TESTS=OFF \
  1626. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1627. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1628. -DLLAMA_LLGUIDANCE=ON \
  1629. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1630. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14
  1631. cmake --build build --config Release -j $(nproc)
  1632. - name: Test
  1633. id: cmake_test
  1634. run: |
  1635. cd build
  1636. ctest -L main --verbose --timeout 900
  1637. ubuntu-cmake-rpc-riscv64-native:
  1638. runs-on: RISCV64
  1639. continue-on-error: true
  1640. steps:
  1641. - name: Install dependencies
  1642. run: |
  1643. sudo apt-get update
  1644. # Install necessary packages
  1645. sudo apt-get install -y libatomic1 libtsan2 gcc-14 g++-14 rustup cmake build-essential libssl-dev wget ccache
  1646. # Set gcc-14 and g++-14 as the default compilers
  1647. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
  1648. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
  1649. sudo ln -sf /usr/bin/gcc-14 /usr/bin/gcc
  1650. sudo ln -sf /usr/bin/g++-14 /usr/bin/g++
  1651. # Install Rust stable version
  1652. rustup install stable
  1653. rustup default stable
  1654. - name: GCC version check
  1655. run: |
  1656. gcc --version
  1657. g++ --version
  1658. - name: Clone
  1659. id: checkout
  1660. uses: actions/checkout@v4
  1661. - name: Setup ccache
  1662. run: |
  1663. export CCACHE_DIR="$HOME/.ccache/rpc-riscv64"
  1664. mkdir -p "$CCACHE_DIR"
  1665. ccache --set-config=max_size=5G
  1666. ccache --set-config=compression=true
  1667. ccache --set-config=compression_level=6
  1668. ccache --set-config=cache_dir="$CCACHE_DIR"
  1669. ccache --set-config=sloppiness=file_macro,time_macros,include_file_mtime,include_file_ctime
  1670. ccache --set-config=hash_dir=false
  1671. echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV
  1672. echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
  1673. - name: Build
  1674. id: cmake_build
  1675. run: |
  1676. cmake -B build \
  1677. -DLLAMA_CURL=OFF \
  1678. -DLLAMA_OPENSSL=ON \
  1679. -DCMAKE_BUILD_TYPE=Release \
  1680. -DGGML_OPENMP=OFF \
  1681. -DLLAMA_BUILD_EXAMPLES=ON \
  1682. -DLLAMA_BUILD_TOOLS=ON \
  1683. -DLLAMA_BUILD_TESTS=ON \
  1684. -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  1685. -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
  1686. -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \
  1687. -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14 \
  1688. -DGGML_RPC=ON
  1689. cmake --build build --config Release -j $(nproc)
  1690. - name: Test
  1691. id: cmake_test
  1692. run: |
  1693. cd build
  1694. ctest -L main --verbose
  1695. ggml-ci-arm64-graviton4-kleidiai:
  1696. runs-on: ah-ubuntu_22_04-c8g_8x
  1697. steps:
  1698. - name: Clone
  1699. id: checkout
  1700. uses: actions/checkout@v4
  1701. - name: Dependencies
  1702. id: depends
  1703. run: |
  1704. set -euxo pipefail
  1705. sudo apt-get update
  1706. sudo DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a \
  1707. apt-get install -y \
  1708. build-essential \
  1709. libcurl4-openssl-dev \
  1710. python3-venv \
  1711. gpg \
  1712. wget \
  1713. time \
  1714. git-lfs
  1715. git lfs install
  1716. # install the latest cmake
  1717. sudo install -d /usr/share/keyrings
  1718. wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc \
  1719. | gpg --dearmor \
  1720. | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
  1721. echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' \
  1722. | sudo tee /etc/apt/sources.list.d/kitware.list
  1723. sudo apt-get update
  1724. sudo apt-get install -y cmake
  1725. - name: ccache
  1726. uses: ggml-org/ccache-action@v1.2.16
  1727. with:
  1728. key: ggml-ci-arm64-graviton4-kleidiai
  1729. evict-old-files: 1d
  1730. - name: Test
  1731. id: ggml-ci
  1732. run: |
  1733. GG_BUILD_KLEIDIAI=1 \
  1734. GG_BUILD_EXTRA_TESTS_0=1 \
  1735. bash ./ci/run.sh ./tmp/results ./tmp/mnt