build.yml 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543
  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: Dependencies
  65. id: depends
  66. continue-on-error: true
  67. run: |
  68. brew update
  69. brew install curl
  70. - name: Build
  71. id: cmake_build
  72. run: |
  73. sysctl -a
  74. cmake -B build \
  75. -DCMAKE_BUILD_RPATH="@loader_path" \
  76. -DLLAMA_FATAL_WARNINGS=ON \
  77. -DGGML_METAL_USE_BF16=ON \
  78. -DGGML_METAL_EMBED_LIBRARY=OFF \
  79. -DGGML_METAL_SHADER_DEBUG=ON \
  80. -DGGML_RPC=ON
  81. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  82. 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
  83. - name: Test
  84. id: cmake_test
  85. run: |
  86. cd build
  87. ctest -L 'main|curl' --verbose --timeout 900
  88. macOS-latest-cmake-x64:
  89. runs-on: macos-15-intel
  90. steps:
  91. - name: Clone
  92. id: checkout
  93. uses: actions/checkout@v4
  94. - name: ccache
  95. uses: ggml-org/ccache-action@v1.2.16
  96. with:
  97. key: macOS-latest-cmake-x64
  98. evict-old-files: 1d
  99. - name: Dependencies
  100. id: depends
  101. continue-on-error: true
  102. run: |
  103. brew update
  104. brew install curl
  105. - name: Build
  106. id: cmake_build
  107. run: |
  108. sysctl -a
  109. # Metal is disabled due to intermittent failures with Github runners not having a GPU:
  110. # https://github.com/ggml-org/llama.cpp/actions/runs/8635935781/job/23674807267#step:5:2313
  111. cmake -B build \
  112. -DCMAKE_BUILD_RPATH="@loader_path" \
  113. -DLLAMA_FATAL_WARNINGS=ON \
  114. -DGGML_METAL=OFF \
  115. -DGGML_RPC=ON \
  116. -DCMAKE_OSX_DEPLOYMENT_TARGET=13.3
  117. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  118. - name: Test
  119. id: cmake_test
  120. run: |
  121. cd build
  122. ctest -L main --verbose --timeout 900
  123. macOS-latest-cmake-arm64-webgpu:
  124. runs-on: macos-latest
  125. steps:
  126. - name: Clone
  127. id: checkout
  128. uses: actions/checkout@v4
  129. - name: ccache
  130. uses: ggml-org/ccache-action@v1.2.16
  131. with:
  132. key: macOS-latest-cmake-arm64-webgpu
  133. evict-old-files: 1d
  134. - name: Dependencies
  135. id: depends
  136. continue-on-error: true
  137. run: |
  138. brew update
  139. brew install curl
  140. - name: Dawn Dependency
  141. id: dawn-depends
  142. run: |
  143. DAWN_VERSION="v1.0.0"
  144. DAWN_OWNER="reeselevine"
  145. DAWN_REPO="dawn"
  146. DAWN_ASSET_NAME="Dawn-a1a6b45cced25a3b7f4fb491e0ae70796cc7f22b-macos-latest-Release.tar.gz"
  147. echo "Fetching release asset from https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  148. curl -L -o artifact.tar.gz \
  149. "https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  150. mkdir dawn
  151. tar -xvf artifact.tar.gz -C dawn --strip-components=1
  152. - name: Build
  153. id: cmake_build
  154. run: |
  155. export CMAKE_PREFIX_PATH=dawn
  156. cmake -B build -DGGML_WEBGPU=ON -DGGML_METAL=OFF -DGGML_BLAS=OFF
  157. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  158. - name: Test
  159. id: cmake_test
  160. run: |
  161. cd build
  162. ctest -L main --verbose --timeout 900
  163. ubuntu-cpu-cmake:
  164. strategy:
  165. matrix:
  166. include:
  167. - build: 'x64'
  168. os: ubuntu-22.04
  169. - build: 'arm64'
  170. os: ubuntu-22.04-arm
  171. - build: 's390x'
  172. os: ubuntu-24.04-s390x
  173. - build: 'ppc64le'
  174. os: ubuntu-24.04-ppc64le
  175. runs-on: ${{ matrix.os }}
  176. steps:
  177. - name: Clone
  178. id: checkout
  179. uses: actions/checkout@v4
  180. - name: ccache
  181. uses: ggml-org/ccache-action@v1.2.16
  182. with:
  183. key: ubuntu-cpu-cmake-${{ matrix.build }}
  184. evict-old-files: 1d
  185. - name: Build Dependencies
  186. id: build_depends
  187. run: |
  188. sudo apt-get update
  189. sudo apt-get install -y --no-install-recommends \
  190. python3 python3-pip python3-dev \
  191. libjpeg-dev build-essential libcurl4-openssl-dev \
  192. git-lfs
  193. - name: Python Dependencies
  194. id: python_depends
  195. run: |
  196. python3 -m pip install --upgrade pip
  197. pip3 install ./gguf-py
  198. - name: Swap Endianness
  199. id: endianness
  200. if: ${{ matrix.build == 's390x' }}
  201. run: |
  202. for f in models/*.gguf; do
  203. echo YES | python3 gguf-py/gguf/scripts/gguf_convert_endian.py $f big
  204. done
  205. - name: Build
  206. id: cmake_build
  207. run: |
  208. cmake -B build \
  209. -DLLAMA_FATAL_WARNINGS=ON \
  210. -DGGML_RPC=ON
  211. cmake --build build --config Release -j $(nproc)
  212. - name: Test
  213. id: cmake_test
  214. run: |
  215. cd build
  216. ctest -L 'main|curl' --verbose --timeout 900
  217. - name: Test llama2c conversion
  218. id: llama2c_test
  219. if: ${{ matrix.build != 's390x' }}
  220. run: |
  221. cd build
  222. echo "Fetch tokenizer"
  223. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin
  224. echo "Fetch llama2c model"
  225. wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin
  226. ./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf
  227. ./bin/llama-cli -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
  228. - name: Test llama2c (s390x)
  229. id: llama2c_test_s390x
  230. if: ${{ matrix.build == 's390x' }}
  231. run: |
  232. cd build
  233. echo "Fetch llama2c big-endian model"
  234. wget https://huggingface.co/ggml-org/models/resolve/main/tinyllamas/stories260K-be.gguf
  235. ./bin/llama-cli -m stories260K-be.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
  236. ubuntu-latest-cmake-sanitizer:
  237. runs-on: ubuntu-latest
  238. continue-on-error: true
  239. strategy:
  240. matrix:
  241. sanitizer: [ADDRESS, THREAD, UNDEFINED]
  242. build_type: [Debug]
  243. steps:
  244. - name: Clone
  245. id: checkout
  246. uses: actions/checkout@v4
  247. - name: ccache
  248. uses: ggml-org/ccache-action@v1.2.16
  249. with:
  250. key: ubuntu-latest-cmake-sanitizer-${{ matrix.sanitizer }}
  251. evict-old-files: 1d
  252. - name: Dependencies
  253. id: depends
  254. run: |
  255. sudo apt-get update
  256. sudo apt-get install build-essential libcurl4-openssl-dev
  257. - name: Build
  258. id: cmake_build
  259. if: ${{ matrix.sanitizer != 'THREAD' }}
  260. run: |
  261. cmake -B build \
  262. -DLLAMA_FATAL_WARNINGS=ON \
  263. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  264. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
  265. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  266. - name: Build (no OpenMP)
  267. id: cmake_build_no_openmp
  268. if: ${{ matrix.sanitizer == 'THREAD' }}
  269. run: |
  270. cmake -B build \
  271. -DLLAMA_FATAL_WARNINGS=ON \
  272. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON \
  273. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
  274. -DGGML_OPENMP=OFF
  275. cmake --build build --config ${{ matrix.build_type }} -j $(nproc)
  276. - name: Test
  277. id: cmake_test
  278. run: |
  279. cd build
  280. ctest -L main --verbose --timeout 900
  281. ubuntu-latest-llguidance:
  282. runs-on: ubuntu-latest
  283. steps:
  284. - name: Clone
  285. id: checkout
  286. uses: actions/checkout@v4
  287. - name: Dependencies
  288. id: depends
  289. run: |
  290. sudo apt-get update
  291. sudo apt-get install build-essential libcurl4-openssl-dev
  292. - name: Build
  293. id: cmake_build
  294. run: |
  295. mkdir build
  296. cd build
  297. cmake .. \
  298. -DLLAMA_FATAL_WARNINGS=ON \
  299. -DLLAMA_LLGUIDANCE=ON
  300. cmake --build . --config Release -j $(nproc)
  301. - name: Test
  302. id: cmake_test
  303. run: |
  304. cd build
  305. ctest -L main --verbose --timeout 900
  306. ubuntu-latest-cmake-rpc:
  307. runs-on: ubuntu-latest
  308. continue-on-error: true
  309. steps:
  310. - name: Clone
  311. id: checkout
  312. uses: actions/checkout@v4
  313. # - name: ccache
  314. # uses: ggml-org/ccache-action@v1.2.16
  315. # with:
  316. # key: ubuntu-latest-cmake-rpc
  317. # evict-old-files: 1d
  318. - name: Dependencies
  319. id: depends
  320. run: |
  321. sudo apt-get update
  322. sudo apt-get install build-essential libcurl4-openssl-dev
  323. - name: Build
  324. id: cmake_build
  325. run: |
  326. cmake -B build \
  327. -DGGML_RPC=ON
  328. cmake --build build --config Release -j $(nproc)
  329. - name: Test
  330. id: cmake_test
  331. run: |
  332. cd build
  333. ctest -L main --verbose
  334. ubuntu-24-cmake-vulkan:
  335. runs-on: ubuntu-24.04
  336. steps:
  337. - name: Clone
  338. id: checkout
  339. uses: actions/checkout@v4
  340. - name: ccache
  341. uses: ggml-org/ccache-action@v1.2.16
  342. with:
  343. key: ubuntu-24-cmake-vulkan
  344. evict-old-files: 1d
  345. - name: Dependencies
  346. id: depends
  347. run: |
  348. sudo add-apt-repository -y ppa:kisak/kisak-mesa
  349. sudo apt-get update -y
  350. sudo apt-get install -y build-essential mesa-vulkan-drivers libxcb-xinput0 libxcb-xinerama0 libxcb-cursor-dev libcurl4-openssl-dev
  351. - name: Get latest Vulkan SDK version
  352. id: vulkan_sdk_version
  353. run: |
  354. echo "VULKAN_SDK_VERSION=$(curl https://vulkan.lunarg.com/sdk/latest/linux.txt)" >> "$GITHUB_ENV"
  355. - name: Use Vulkan SDK Cache
  356. uses: actions/cache@v4
  357. id: cache-sdk
  358. with:
  359. path: ./vulkan_sdk
  360. key: vulkan-sdk-${{ env.VULKAN_SDK_VERSION }}-${{ runner.os }}
  361. - name: Setup Vulkan SDK
  362. if: steps.cache-sdk.outputs.cache-hit != 'true'
  363. uses: ./.github/actions/linux-setup-vulkan
  364. with:
  365. path: ./vulkan_sdk
  366. version: ${{ env.VULKAN_SDK_VERSION }}
  367. - name: Build
  368. id: cmake_build
  369. run: |
  370. source ./vulkan_sdk/setup-env.sh
  371. cmake -B build \
  372. -DGGML_VULKAN=ON
  373. cmake --build build --config Release -j $(nproc)
  374. - name: Test
  375. id: cmake_test
  376. run: |
  377. cd build
  378. export GGML_VK_VISIBLE_DEVICES=0
  379. export GGML_VK_DISABLE_F16=1
  380. # This is using llvmpipe and runs slower than other backends
  381. ctest -L main --verbose --timeout 4200
  382. ubuntu-24-cmake-webgpu:
  383. runs-on: ubuntu-24.04
  384. steps:
  385. - name: Clone
  386. id: checkout
  387. uses: actions/checkout@v4
  388. - name: ccache
  389. uses: ggml-org/ccache-action@v1.2.16
  390. with:
  391. key: ubuntu-24-cmake-webgpu
  392. evict-old-files: 1d
  393. - name: Dependencies
  394. id: depends
  395. run: |
  396. sudo add-apt-repository -y ppa:kisak/kisak-mesa
  397. sudo apt-get update -y
  398. sudo apt-get install -y build-essential mesa-vulkan-drivers libxcb-xinput0 libxcb-xinerama0 libxcb-cursor-dev libcurl4-openssl-dev
  399. - name: Get latest Vulkan SDK version
  400. id: vulkan_sdk_version
  401. run: |
  402. echo "VULKAN_SDK_VERSION=$(curl https://vulkan.lunarg.com/sdk/latest/linux.txt)" >> "$GITHUB_ENV"
  403. - name: Use Vulkan SDK Cache
  404. uses: actions/cache@v4
  405. id: cache-sdk
  406. with:
  407. path: ./vulkan_sdk
  408. key: vulkan-sdk-${{ env.VULKAN_SDK_VERSION }}-${{ runner.os }}
  409. - name: Setup Vulkan SDK
  410. if: steps.cache-sdk.outputs.cache-hit != 'true'
  411. uses: ./.github/actions/linux-setup-vulkan
  412. with:
  413. path: ./vulkan_sdk
  414. version: ${{ env.VULKAN_SDK_VERSION }}
  415. - name: Dawn Dependency
  416. id: dawn-depends
  417. run: |
  418. sudo apt-get install -y libxrandr-dev libxinerama-dev libxcursor-dev mesa-common-dev libx11-xcb-dev libxi-dev
  419. DAWN_VERSION="v1.0.0"
  420. DAWN_OWNER="reeselevine"
  421. DAWN_REPO="dawn"
  422. DAWN_ASSET_NAME="Dawn-a1a6b45cced25a3b7f4fb491e0ae70796cc7f22b-ubuntu-latest-Release.tar.gz"
  423. echo "Fetching release asset from https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  424. curl -L -o artifact.tar.gz \
  425. "https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  426. mkdir dawn
  427. tar -xvf artifact.tar.gz -C dawn --strip-components=1
  428. - name: Build
  429. id: cmake_build
  430. run: |
  431. export Dawn_DIR=dawn/lib64/cmake/Dawn
  432. cmake -B build -DGGML_WEBGPU=ON
  433. cmake --build build --config Release -j $(nproc)
  434. - name: Test
  435. id: cmake_test
  436. run: |
  437. cd build
  438. # This is using llvmpipe and runs slower than other backends
  439. ctest -L main --verbose --timeout 3600
  440. ubuntu-22-cmake-hip:
  441. runs-on: ubuntu-22.04
  442. container: rocm/dev-ubuntu-22.04:6.1.2
  443. steps:
  444. - name: Clone
  445. id: checkout
  446. uses: actions/checkout@v4
  447. - name: Dependencies
  448. id: depends
  449. run: |
  450. sudo apt-get update
  451. sudo apt-get install -y build-essential git cmake rocblas-dev hipblas-dev libcurl4-openssl-dev rocwmma-dev
  452. - name: ccache
  453. uses: ggml-org/ccache-action@v1.2.16
  454. with:
  455. key: ubuntu-22-cmake-hip
  456. evict-old-files: 1d
  457. - name: Build with native CMake HIP support
  458. id: cmake_build
  459. run: |
  460. cmake -B build -S . \
  461. -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \
  462. -DGGML_HIP_ROCWMMA_FATTN=ON \
  463. -DGGML_HIP=ON
  464. cmake --build build --config Release -j $(nproc)
  465. ubuntu-22-cmake-musa:
  466. runs-on: ubuntu-22.04
  467. container: mthreads/musa:rc4.3.0-devel-ubuntu22.04-amd64
  468. steps:
  469. - name: Clone
  470. id: checkout
  471. uses: actions/checkout@v4
  472. - name: Dependencies
  473. id: depends
  474. run: |
  475. apt-get update
  476. apt-get install -y build-essential git cmake libcurl4-openssl-dev
  477. - name: ccache
  478. uses: ggml-org/ccache-action@v1.2.16
  479. with:
  480. key: ubuntu-22-cmake-musa
  481. evict-old-files: 1d
  482. - name: Build with native CMake MUSA support
  483. id: cmake_build
  484. run: |
  485. cmake -B build -S . \
  486. -DGGML_MUSA=ON
  487. cmake --build build --config Release -j $(nproc)
  488. ubuntu-22-cmake-sycl:
  489. runs-on: ubuntu-22.04
  490. continue-on-error: true
  491. steps:
  492. - uses: actions/checkout@v4
  493. - name: add oneAPI to apt
  494. shell: bash
  495. run: |
  496. cd /tmp
  497. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  498. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  499. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  500. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  501. - name: install oneAPI dpcpp compiler
  502. shell: bash
  503. run: |
  504. sudo apt update
  505. sudo apt install intel-oneapi-compiler-dpcpp-cpp libcurl4-openssl-dev
  506. - name: install oneAPI MKL library
  507. shell: bash
  508. run: |
  509. sudo apt install intel-oneapi-mkl-devel
  510. - name: Clone
  511. id: checkout
  512. uses: actions/checkout@v4
  513. - name: ccache
  514. uses: ggml-org/ccache-action@v1.2.16
  515. with:
  516. key: ubuntu-22-cmake-sycl
  517. evict-old-files: 1d
  518. - name: Build
  519. id: cmake_build
  520. run: |
  521. source /opt/intel/oneapi/setvars.sh
  522. cmake -B build \
  523. -DGGML_SYCL=ON \
  524. -DCMAKE_C_COMPILER=icx \
  525. -DCMAKE_CXX_COMPILER=icpx
  526. cmake --build build --config Release -j $(nproc)
  527. ubuntu-22-cmake-sycl-fp16:
  528. runs-on: ubuntu-22.04
  529. continue-on-error: true
  530. steps:
  531. - uses: actions/checkout@v4
  532. - name: add oneAPI to apt
  533. shell: bash
  534. run: |
  535. cd /tmp
  536. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  537. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  538. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  539. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  540. - name: install oneAPI dpcpp compiler
  541. shell: bash
  542. run: |
  543. sudo apt update
  544. sudo apt install intel-oneapi-compiler-dpcpp-cpp libcurl4-openssl-dev
  545. - name: install oneAPI MKL library
  546. shell: bash
  547. run: |
  548. sudo apt install intel-oneapi-mkl-devel
  549. - name: Clone
  550. id: checkout
  551. uses: actions/checkout@v4
  552. - name: ccache
  553. uses: ggml-org/ccache-action@v1.2.16
  554. with:
  555. key: ubuntu-22-cmake-sycl-fp16
  556. evict-old-files: 1d
  557. - name: Build
  558. id: cmake_build
  559. run: |
  560. source /opt/intel/oneapi/setvars.sh
  561. cmake -B build \
  562. -DGGML_SYCL=ON \
  563. -DCMAKE_C_COMPILER=icx \
  564. -DCMAKE_CXX_COMPILER=icpx \
  565. -DGGML_SYCL_F16=ON
  566. cmake --build build --config Release -j $(nproc)
  567. build-linux-cross:
  568. uses: ./.github/workflows/build-linux-cross.yml
  569. build-cmake-pkg:
  570. uses: ./.github/workflows/build-cmake-pkg.yml
  571. macOS-latest-cmake-ios:
  572. runs-on: macos-latest
  573. steps:
  574. - name: Clone
  575. id: checkout
  576. uses: actions/checkout@v4
  577. - name: ccache
  578. uses: ggml-org/ccache-action@v1.2.16
  579. with:
  580. key: macOS-latest-cmake-ios
  581. evict-old-files: 1d
  582. - name: Dependencies
  583. id: depends
  584. continue-on-error: true
  585. run: |
  586. brew update
  587. - name: Build
  588. id: cmake_build
  589. run: |
  590. sysctl -a
  591. cmake -B build -G Xcode \
  592. -DGGML_METAL_USE_BF16=ON \
  593. -DGGML_METAL_EMBED_LIBRARY=ON \
  594. -DLLAMA_BUILD_COMMON=OFF \
  595. -DLLAMA_BUILD_EXAMPLES=OFF \
  596. -DLLAMA_BUILD_TOOLS=OFF \
  597. -DLLAMA_BUILD_TESTS=OFF \
  598. -DLLAMA_BUILD_SERVER=OFF \
  599. -DCMAKE_SYSTEM_NAME=iOS \
  600. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  601. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  602. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  603. macOS-latest-cmake-tvos:
  604. runs-on: macos-latest
  605. steps:
  606. - name: Clone
  607. id: checkout
  608. uses: actions/checkout@v4
  609. - name: ccache
  610. uses: ggml-org/ccache-action@v1.2.16
  611. with:
  612. key: macOS-latest-cmake-tvos
  613. evict-old-files: 1d
  614. - name: Dependencies
  615. id: depends
  616. continue-on-error: true
  617. run: |
  618. brew update
  619. - name: Build
  620. id: cmake_build
  621. run: |
  622. sysctl -a
  623. cmake -B build -G Xcode \
  624. -DGGML_METAL_USE_BF16=ON \
  625. -DGGML_METAL_EMBED_LIBRARY=ON \
  626. -DLLAMA_BUILD_COMMON=OFF \
  627. -DLLAMA_BUILD_EXAMPLES=OFF \
  628. -DLLAMA_BUILD_TOOLS=OFF \
  629. -DLLAMA_BUILD_TESTS=OFF \
  630. -DLLAMA_BUILD_SERVER=OFF \
  631. -DCMAKE_SYSTEM_NAME=tvOS \
  632. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  633. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  634. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  635. macOS-latest-cmake-visionos:
  636. runs-on: macos-latest
  637. steps:
  638. - name: Clone
  639. id: checkout
  640. uses: actions/checkout@v4
  641. - name: Dependencies
  642. id: depends
  643. continue-on-error: true
  644. run: |
  645. brew update
  646. - name: Build
  647. id: cmake_build
  648. run: |
  649. sysctl -a
  650. cmake -B build -G Xcode \
  651. -DGGML_METAL_USE_BF16=ON \
  652. -DGGML_METAL_EMBED_LIBRARY=ON \
  653. -DLLAMA_BUILD_COMMON=OFF \
  654. -DLLAMA_BUILD_EXAMPLES=OFF \
  655. -DLLAMA_BUILD_TOOLS=OFF \
  656. -DLLAMA_BUILD_TESTS=OFF \
  657. -DLLAMA_BUILD_SERVER=OFF \
  658. -DCMAKE_SYSTEM_NAME=visionOS \
  659. -DCMAKE_OSX_DEPLOYMENT_TARGET=1.0 \
  660. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  661. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  662. macOS-latest-swift:
  663. runs-on: macos-latest
  664. needs: ios-xcode-build
  665. strategy:
  666. matrix:
  667. destination: ['generic/platform=macOS', 'generic/platform=iOS', 'generic/platform=tvOS']
  668. steps:
  669. - name: Clone
  670. id: checkout
  671. uses: actions/checkout@v4
  672. - name: ccache
  673. uses: ggml-org/ccache-action@v1.2.16
  674. with:
  675. key: macOS-latest-swift
  676. evict-old-files: 1d
  677. - name: Download xcframework artifact
  678. uses: actions/download-artifact@v4
  679. with:
  680. name: llama-xcframework
  681. path: build-apple/llama.xcframework/
  682. - name: Dependencies
  683. id: depends
  684. continue-on-error: true
  685. run: |
  686. brew update
  687. - name: Build llama.cpp with CMake
  688. id: cmake_build
  689. run: |
  690. sysctl -a
  691. cmake -B build -G Xcode \
  692. -DGGML_METAL_USE_BF16=ON \
  693. -DGGML_METAL_EMBED_LIBRARY=ON \
  694. -DLLAMA_CURL=OFF \
  695. -DLLAMA_BUILD_EXAMPLES=OFF \
  696. -DLLAMA_BUILD_TOOLS=OFF \
  697. -DLLAMA_BUILD_TESTS=OFF \
  698. -DLLAMA_BUILD_SERVER=OFF \
  699. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
  700. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  701. windows-msys2:
  702. runs-on: windows-2025
  703. strategy:
  704. fail-fast: false
  705. matrix:
  706. include:
  707. - { sys: UCRT64, env: ucrt-x86_64, build: Release }
  708. - { sys: CLANG64, env: clang-x86_64, build: Release }
  709. steps:
  710. - name: Clone
  711. uses: actions/checkout@v4
  712. - name: ccache
  713. uses: ggml-org/ccache-action@v1.2.16
  714. with:
  715. key: windows-msys2
  716. variant: ccache
  717. evict-old-files: 1d
  718. - name: Setup ${{ matrix.sys }}
  719. uses: msys2/setup-msys2@v2
  720. with:
  721. update: true
  722. msystem: ${{matrix.sys}}
  723. install: >-
  724. base-devel
  725. git
  726. mingw-w64-${{matrix.env}}-toolchain
  727. mingw-w64-${{matrix.env}}-cmake
  728. mingw-w64-${{matrix.env}}-openblas
  729. - name: Build using CMake
  730. shell: msys2 {0}
  731. run: |
  732. cmake -B build
  733. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  734. - name: Clean after building using CMake
  735. shell: msys2 {0}
  736. run: |
  737. rm -rf build
  738. - name: Build using CMake w/ OpenBLAS
  739. shell: msys2 {0}
  740. run: |
  741. cmake -B build -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
  742. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  743. windows-latest-cmake:
  744. runs-on: windows-2025
  745. env:
  746. OPENBLAS_VERSION: 0.3.23
  747. SDE_VERSION: 9.33.0-2024-01-07
  748. VULKAN_VERSION: 1.4.313.2
  749. strategy:
  750. matrix:
  751. include:
  752. - build: 'cpu-x64 (static)'
  753. arch: 'x64'
  754. 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'
  755. - build: 'openblas-x64'
  756. arch: 'x64'
  757. 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"'
  758. - build: 'vulkan-x64'
  759. arch: 'x64'
  760. 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'
  761. - build: 'llvm-arm64'
  762. arch: 'arm64'
  763. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON'
  764. - build: 'llvm-arm64-opencl-adreno'
  765. arch: 'arm64'
  766. 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'
  767. steps:
  768. - name: Clone
  769. id: checkout
  770. uses: actions/checkout@v4
  771. - name: ccache
  772. uses: ggml-org/ccache-action@v1.2.16
  773. with:
  774. key: windows-latest-cmake-${{ matrix.build }}
  775. variant: ccache
  776. evict-old-files: 1d
  777. - name: Download OpenBLAS
  778. id: get_openblas
  779. if: ${{ matrix.build == 'openblas-x64' }}
  780. run: |
  781. 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"
  782. curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE"
  783. mkdir $env:RUNNER_TEMP/openblas
  784. tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas
  785. $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
  786. $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
  787. $lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe')
  788. & $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll
  789. - name: Install Vulkan SDK
  790. id: get_vulkan
  791. if: ${{ matrix.build == 'vulkan-x64' }}
  792. run: |
  793. 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"
  794. & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
  795. Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
  796. Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
  797. - name: Install Ninja
  798. id: install_ninja
  799. run: |
  800. choco install ninja
  801. - name: Install OpenCL Headers and Libs
  802. id: install_opencl
  803. if: ${{ matrix.build == 'llvm-arm64-opencl-adreno' }}
  804. run: |
  805. git clone https://github.com/KhronosGroup/OpenCL-Headers
  806. cd OpenCL-Headers
  807. cmake -B build `
  808. -DBUILD_TESTING=OFF `
  809. -DOPENCL_HEADERS_BUILD_TESTING=OFF `
  810. -DOPENCL_HEADERS_BUILD_CXX_TESTS=OFF `
  811. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  812. cmake --build build --target install
  813. git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader
  814. cd OpenCL-ICD-Loader
  815. cmake -B build-arm64-release `
  816. -A arm64 `
  817. -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" `
  818. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  819. cmake --build build-arm64-release --target install --config release
  820. - name: libCURL
  821. id: get_libcurl
  822. uses: ./.github/actions/windows-setup-curl
  823. with:
  824. architecture: ${{ matrix.arch == 'x64' && 'win64' || 'win64a' }}
  825. - name: Build
  826. id: cmake_build
  827. env:
  828. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  829. run: |
  830. cmake -S . -B build ${{ matrix.defines }} `
  831. -DCURL_LIBRARY="$env:CURL_PATH/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:CURL_PATH/include"
  832. cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}
  833. cp $env:CURL_PATH/bin/libcurl-*.dll build/bin/Release
  834. - name: Add libopenblas.dll
  835. id: add_libopenblas_dll
  836. if: ${{ matrix.build == 'openblas-x64' }}
  837. run: |
  838. cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll
  839. cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt
  840. - name: Test
  841. id: cmake_test
  842. if: ${{ matrix.arch == 'x64' }}
  843. run: |
  844. cd build
  845. ctest -L main -C Release --verbose --timeout 900
  846. # TODO: disabled for now, consider adding tests for all CPU variants instead
  847. # - name: Test (Intel SDE)
  848. # id: cmake_test_sde
  849. # if: ${{ matrix.build == 'avx512-x64' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation
  850. # run: |
  851. # curl.exe -o $env:RUNNER_TEMP/sde.tar.xz -L "https://downloadmirror.intel.com/813591/sde-external-${env:SDE_VERSION}-win.tar.xz"
  852. # # for some weird reason windows tar doesn't like sde tar.xz
  853. # 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar.xz
  854. # 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar
  855. # $sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe)
  856. # cd build
  857. # $env:LLAMA_SKIP_TESTS_SLOW_ON_EMULATOR = 1
  858. # & $sde -future -- ctest -L main -C Release --verbose --timeout 900
  859. ubuntu-latest-cmake-cuda:
  860. runs-on: ubuntu-latest
  861. container: nvidia/cuda:12.6.2-devel-ubuntu24.04
  862. steps:
  863. - name: Clone
  864. id: checkout
  865. uses: actions/checkout@v4
  866. - name: Install dependencies
  867. env:
  868. DEBIAN_FRONTEND: noninteractive
  869. run: |
  870. apt update
  871. apt install -y cmake build-essential ninja-build libgomp1 git libcurl4-openssl-dev
  872. - name: ccache
  873. uses: ggml-org/ccache-action@v1.2.16
  874. with:
  875. key: ubuntu-latest-cmake-cuda
  876. evict-old-files: 1d
  877. - name: Build with CMake
  878. run: |
  879. cmake -S . -B build -G Ninja \
  880. -DCMAKE_BUILD_TYPE=Release \
  881. -DCMAKE_CUDA_ARCHITECTURES=89-real \
  882. -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined \
  883. -DLLAMA_FATAL_WARNINGS=ON \
  884. -DGGML_NATIVE=OFF \
  885. -DGGML_CUDA=ON
  886. cmake --build build
  887. windows-2022-cmake-cuda:
  888. runs-on: windows-2022
  889. strategy:
  890. matrix:
  891. cuda: ['12.4']
  892. steps:
  893. - name: Clone
  894. id: checkout
  895. uses: actions/checkout@v4
  896. - name: Install ccache
  897. uses: ggml-org/ccache-action@v1.2.16
  898. with:
  899. key: windows-cuda-${{ matrix.cuda }}
  900. variant: ccache
  901. evict-old-files: 1d
  902. - name: Install Cuda Toolkit
  903. uses: ./.github/actions/windows-setup-cuda
  904. with:
  905. cuda_version: ${{ matrix.cuda }}
  906. - name: Install Ninja
  907. id: install_ninja
  908. run: |
  909. choco install ninja
  910. - name: libCURL
  911. id: get_libcurl
  912. uses: ./.github/actions/windows-setup-curl
  913. - name: Build
  914. id: cmake_build
  915. shell: cmd
  916. env:
  917. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  918. run: |
  919. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
  920. cmake -S . -B build -G "Ninja Multi-Config" ^
  921. -DLLAMA_BUILD_SERVER=ON ^
  922. -DGGML_NATIVE=OFF ^
  923. -DGGML_BACKEND_DL=ON ^
  924. -DGGML_CPU_ALL_VARIANTS=ON ^
  925. -DGGML_CUDA=ON ^
  926. -DGGML_RPC=ON ^
  927. -DCURL_LIBRARY="%CURL_PATH%/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="%CURL_PATH%/include"
  928. set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
  929. cmake --build build --config Release -j %NINJA_JOBS% -t ggml
  930. cmake --build build --config Release
  931. windows-latest-cmake-sycl:
  932. runs-on: windows-2022
  933. defaults:
  934. run:
  935. shell: bash
  936. env:
  937. 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
  938. WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel
  939. ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI"
  940. steps:
  941. - name: Clone
  942. id: checkout
  943. uses: actions/checkout@v4
  944. - name: ccache
  945. uses: ggml-org/ccache-action@v1.2.16
  946. with:
  947. key: windows-latest-cmake-sycl
  948. variant: ccache
  949. evict-old-files: 1d
  950. - name: Install
  951. run: |
  952. scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
  953. # TODO: add libcurl support ; we will also need to modify win-build-sycl.bat to accept user-specified args
  954. - name: Build
  955. id: cmake_build
  956. run: examples/sycl/win-build-sycl.bat
  957. windows-latest-cmake-hip:
  958. runs-on: windows-2022
  959. env:
  960. # The ROCm version must correspond to the version used in the HIP SDK.
  961. ROCM_VERSION: "6.4.2"
  962. # Make sure this is in sync with build-cache.yml
  963. HIPSDK_INSTALLER_VERSION: "25.Q3"
  964. steps:
  965. - name: Clone
  966. id: checkout
  967. uses: actions/checkout@v4
  968. - name: Grab rocWMMA package
  969. id: grab_rocwmma
  970. run: |
  971. 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"
  972. 7z x rocwmma.deb
  973. 7z x data.tar
  974. - name: Use ROCm Installation Cache
  975. uses: actions/cache@v4
  976. id: cache-rocm
  977. with:
  978. path: C:\Program Files\AMD\ROCm
  979. key: rocm-${{ env.HIPSDK_INSTALLER_VERSION }}-${{ runner.os }}
  980. - name: Setup ROCm
  981. if: steps.cache-rocm.outputs.cache-hit != 'true'
  982. uses: ./.github/actions/windows-setup-rocm
  983. with:
  984. version: ${{ env.HIPSDK_INSTALLER_VERSION }}
  985. - name: Verify ROCm
  986. id: verify
  987. run: |
  988. # Find and test ROCm installation
  989. $clangPath = Get-ChildItem 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | Select-Object -First 1
  990. if (-not $clangPath) {
  991. Write-Error "ROCm installation not found"
  992. exit 1
  993. }
  994. & $clangPath.FullName --version
  995. - name: Install ccache
  996. uses: ggml-org/ccache-action@v1.2.16
  997. with:
  998. key: ${{ github.job }}
  999. evict-old-files: 1d
  1000. - name: libCURL
  1001. id: get_libcurl
  1002. uses: ./.github/actions/windows-setup-curl
  1003. - name: Build
  1004. id: cmake_build
  1005. env:
  1006. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  1007. run: |
  1008. $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
  1009. $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
  1010. cmake -G "Unix Makefiles" -B build -S . `
  1011. -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
  1012. -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
  1013. -DCMAKE_CXX_FLAGS="-I$($PWD.Path.Replace('\', '/'))/opt/rocm-${{ env.ROCM_VERSION }}/include/" `
  1014. -DCMAKE_BUILD_TYPE=Release `
  1015. -DROCM_DIR="${env:HIP_PATH}" `
  1016. -DGGML_HIP=ON `
  1017. -DGGML_HIP_ROCWMMA_FATTN=ON `
  1018. -DGGML_RPC=ON `
  1019. -DCURL_LIBRARY="$env:CURL_PATH/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:CURL_PATH/include"
  1020. cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
  1021. ios-xcode-build:
  1022. runs-on: macos-latest
  1023. steps:
  1024. - name: Checkout code
  1025. uses: actions/checkout@v4
  1026. - name: Setup Xcode
  1027. uses: maxim-lobanov/setup-xcode@v1
  1028. with:
  1029. xcode-version: latest-stable
  1030. - name: Build
  1031. id: cmake_build
  1032. run: |
  1033. sysctl -a
  1034. cmake -B build -G Xcode \
  1035. -DGGML_METAL_USE_BF16=ON \
  1036. -DGGML_METAL_EMBED_LIBRARY=ON \
  1037. -DLLAMA_CURL=OFF \
  1038. -DLLAMA_BUILD_EXAMPLES=OFF \
  1039. -DLLAMA_BUILD_TOOLS=OFF \
  1040. -DLLAMA_BUILD_TESTS=OFF \
  1041. -DLLAMA_BUILD_SERVER=OFF \
  1042. -DCMAKE_SYSTEM_NAME=iOS \
  1043. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  1044. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  1045. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  1046. - name: xcodebuild for swift package
  1047. id: xcodebuild
  1048. run: |
  1049. ./build-xcframework.sh
  1050. - name: Upload xcframework artifact
  1051. uses: actions/upload-artifact@v4
  1052. with:
  1053. name: llama-xcframework
  1054. path: build-apple/llama.xcframework/
  1055. retention-days: 1
  1056. - name: Build Xcode project
  1057. run: |
  1058. xcodebuild -downloadPlatform iOS
  1059. 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
  1060. android-build:
  1061. runs-on: ubuntu-latest
  1062. steps:
  1063. - name: Clone
  1064. uses: actions/checkout@v4
  1065. # Disabled due to size (400MB) and always 0 cache hits
  1066. # - name: ccache
  1067. # uses: ggml-org/ccache-action@v1.2.16
  1068. # with:
  1069. # key: android-build
  1070. # evict-old-files: 1d
  1071. - name: Set up JDK
  1072. uses: actions/setup-java@v3
  1073. with:
  1074. java-version: 17
  1075. distribution: zulu
  1076. - name: Setup Android SDK
  1077. uses: android-actions/setup-android@v3
  1078. with:
  1079. log-accepted-android-sdk-licenses: false
  1080. - name: Build
  1081. run: |
  1082. cd examples/llama.android
  1083. ./gradlew build --no-daemon
  1084. openEuler-latest-cmake-cann:
  1085. if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'Ascend NPU') }}
  1086. defaults:
  1087. run:
  1088. shell: bash -el {0}
  1089. strategy:
  1090. matrix:
  1091. arch: [x86, aarch64]
  1092. cann:
  1093. - '8.1.RC1.alpha001-910b-openeuler22.03-py3.10'
  1094. device:
  1095. - 'ascend910b3'
  1096. build:
  1097. - 'Release'
  1098. runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
  1099. container: ascendai/cann:${{ matrix.cann }}
  1100. steps:
  1101. - name: Checkout
  1102. uses: actions/checkout@v4
  1103. - name: Dependencies
  1104. run: |
  1105. yum update -y
  1106. yum install -y git gcc gcc-c++ make cmake libcurl-devel
  1107. - name: Build
  1108. run: |
  1109. export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
  1110. cmake -S . -B build \
  1111. -DCMAKE_BUILD_TYPE=${{ matrix.build }} \
  1112. -DGGML_CANN=on \
  1113. -DSOC_TYPE=${{ matrix.device }}
  1114. cmake --build build -j $(nproc)
  1115. # TODO: simplify the following workflows using a matrix
  1116. # TODO: run lighter CI on PRs and the full CI only on master (if needed)
  1117. ggml-ci-x64-cpu-low-perf:
  1118. runs-on: ubuntu-22.04
  1119. steps:
  1120. - name: Clone
  1121. id: checkout
  1122. uses: actions/checkout@v4
  1123. - name: ccache
  1124. uses: ggml-org/ccache-action@v1.2.16
  1125. with:
  1126. key: ggml-ci-x64-cpu-low-perf
  1127. evict-old-files: 1d
  1128. - name: Dependencies
  1129. id: depends
  1130. run: |
  1131. sudo apt-get update
  1132. sudo apt-get install build-essential libcurl4-openssl-dev
  1133. - name: Test
  1134. id: ggml-ci
  1135. run: |
  1136. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_LOW_PERF=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1137. ggml-ci-arm64-cpu-low-perf:
  1138. runs-on: ubuntu-22.04-arm
  1139. steps:
  1140. - name: Clone
  1141. id: checkout
  1142. uses: actions/checkout@v4
  1143. - name: ccache
  1144. uses: ggml-org/ccache-action@v1.2.16
  1145. with:
  1146. key: ggml-ci-arm64-cpu-low-perf
  1147. evict-old-files: 1d
  1148. - name: Dependencies
  1149. id: depends
  1150. run: |
  1151. sudo apt-get update
  1152. sudo apt-get install build-essential libcurl4-openssl-dev
  1153. - name: Test
  1154. id: ggml-ci
  1155. run: |
  1156. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_LOW_PERF=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1157. ggml-ci-x64-cpu-high-perf:
  1158. runs-on: ubuntu-22.04
  1159. steps:
  1160. - name: Clone
  1161. id: checkout
  1162. uses: actions/checkout@v4
  1163. - name: ccache
  1164. uses: ggml-org/ccache-action@v1.2.16
  1165. with:
  1166. key: ggml-ci-x64-cpu-high-perf
  1167. evict-old-files: 1d
  1168. - name: Dependencies
  1169. id: depends
  1170. run: |
  1171. sudo apt-get update
  1172. sudo apt-get install build-essential libcurl4-openssl-dev
  1173. - name: Test
  1174. id: ggml-ci
  1175. run: |
  1176. LLAMA_ARG_THREADS=$(nproc) bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1177. ggml-ci-arm64-cpu-high-perf:
  1178. runs-on: ubuntu-22.04-arm
  1179. steps:
  1180. - name: Clone
  1181. id: checkout
  1182. uses: actions/checkout@v4
  1183. - name: ccache
  1184. uses: ggml-org/ccache-action@v1.2.16
  1185. with:
  1186. key: ggml-ci-arm64-cpu-high-perf
  1187. evict-old-files: 1d
  1188. - name: Dependencies
  1189. id: depends
  1190. run: |
  1191. sudo apt-get update
  1192. sudo apt-get install build-essential libcurl4-openssl-dev
  1193. - name: Test
  1194. id: ggml-ci
  1195. run: |
  1196. 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
  1197. ggml-ci-arm64-cpu-high-perf-sve:
  1198. runs-on: ubuntu-22.04-arm
  1199. steps:
  1200. - name: Clone
  1201. id: checkout
  1202. uses: actions/checkout@v4
  1203. - name: ccache
  1204. uses: ggml-org/ccache-action@v1.2.16
  1205. with:
  1206. key: ggml-ci-arm64-cpu-high-perf-sve
  1207. evict-old-files: 1d
  1208. - name: Dependencies
  1209. id: depends
  1210. run: |
  1211. sudo apt-get update
  1212. sudo apt-get install build-essential libcurl4-openssl-dev
  1213. - name: Test
  1214. id: ggml-ci
  1215. run: |
  1216. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_NO_BF16=1 GG_BUILD_EXTRA_TESTS_0=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1217. ggml-ci-x64-nvidia-cuda:
  1218. runs-on: [self-hosted, Linux, X64, NVIDIA]
  1219. steps:
  1220. - name: Clone
  1221. id: checkout
  1222. uses: actions/checkout@v4
  1223. - name: Test
  1224. id: ggml-ci
  1225. run: |
  1226. nvidia-smi
  1227. GG_BUILD_CUDA=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1228. ggml-ci-x64-nvidia-vulkan-cm:
  1229. runs-on: [self-hosted, Linux, X64, NVIDIA]
  1230. steps:
  1231. - name: Clone
  1232. id: checkout
  1233. uses: actions/checkout@v4
  1234. - name: Test
  1235. id: ggml-ci
  1236. run: |
  1237. vulkaninfo --summary
  1238. GG_BUILD_VULKAN=1 GGML_VK_DISABLE_COOPMAT2=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1239. ggml-ci-x64-nvidia-vulkan-cm2:
  1240. runs-on: [self-hosted, Linux, X64, NVIDIA, COOPMAT2]
  1241. steps:
  1242. - name: Clone
  1243. id: checkout
  1244. uses: actions/checkout@v4
  1245. - name: Test
  1246. id: ggml-ci
  1247. run: |
  1248. vulkaninfo --summary
  1249. GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1250. ggml-ci-x64-cpu-amx:
  1251. runs-on: [self-hosted, Linux, X64, CPU, AMX]
  1252. steps:
  1253. - name: Clone
  1254. id: checkout
  1255. uses: actions/checkout@v4
  1256. - name: Test
  1257. id: ggml-ci
  1258. run: |
  1259. bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1260. ggml-ci-mac-metal:
  1261. runs-on: [self-hosted, macOS, ARM64]
  1262. steps:
  1263. - name: Clone
  1264. id: checkout
  1265. uses: actions/checkout@v4
  1266. - name: Test
  1267. id: ggml-ci
  1268. run: |
  1269. GG_BUILD_METAL=1 bash ./ci/run.sh ~/results/llama.cpp ~/mnt/llama.cpp
  1270. ggml-ci-mac-vulkan:
  1271. runs-on: [self-hosted, macOS, ARM64]
  1272. steps:
  1273. - name: Clone
  1274. id: checkout
  1275. uses: actions/checkout@v4
  1276. - name: Test
  1277. id: ggml-ci
  1278. run: |
  1279. vulkaninfo --summary
  1280. GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp ~/mnt/llama.cpp
  1281. ggml-ci-arm64-cpu-kleidiai:
  1282. runs-on: ubuntu-22.04-arm
  1283. steps:
  1284. - name: Clone
  1285. id: checkout
  1286. uses: actions/checkout@v4
  1287. - name: ccache
  1288. uses: ggml-org/ccache-action@v1.2.16
  1289. with:
  1290. key: ggml-ci-arm64-cpu-kleidiai
  1291. evict-old-files: 1d
  1292. - name: Dependencies
  1293. id: depends
  1294. run: |
  1295. sudo apt-get update
  1296. sudo apt-get install -y build-essential libcurl4-openssl-dev
  1297. - name: Test
  1298. id: ggml-ci
  1299. run: |
  1300. GG_BUILD_KLEIDIAI=1 GG_BUILD_EXTRA_TESTS_0=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt