build.yml 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499
  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-22-cmake-webgpu:
  383. runs-on: ubuntu-22.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-22-cmake-webgpu
  392. evict-old-files: 1d
  393. - name: Vulkan SDK Dependencies
  394. id: vulkan-depends
  395. run: |
  396. wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
  397. sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
  398. sudo apt-get update -y
  399. sudo apt-get install -y build-essential mesa-vulkan-drivers vulkan-sdk libcurl4-openssl-dev
  400. - name: Dawn Dependency
  401. id: dawn-depends
  402. run: |
  403. sudo apt-get install -y libxrandr-dev libxinerama-dev libxcursor-dev mesa-common-dev libx11-xcb-dev libxi-dev
  404. DAWN_VERSION="v1.0.0"
  405. DAWN_OWNER="reeselevine"
  406. DAWN_REPO="dawn"
  407. DAWN_ASSET_NAME="Dawn-a1a6b45cced25a3b7f4fb491e0ae70796cc7f22b-ubuntu-latest-Release.tar.gz"
  408. echo "Fetching release asset from https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  409. curl -L -o artifact.tar.gz \
  410. "https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  411. mkdir dawn
  412. tar -xvf artifact.tar.gz -C dawn --strip-components=1
  413. - name: Build
  414. id: cmake_build
  415. run: |
  416. export Dawn_DIR=dawn/lib64/cmake/Dawn
  417. cmake -B build -DGGML_WEBGPU=ON
  418. cmake --build build --config Release -j $(nproc)
  419. - name: Test
  420. id: cmake_test
  421. run: |
  422. cd build
  423. # This is using llvmpipe and runs slower than other backends
  424. ctest -L main --verbose --timeout 3600
  425. ubuntu-22-cmake-hip:
  426. runs-on: ubuntu-22.04
  427. container: rocm/dev-ubuntu-22.04:6.1.2
  428. steps:
  429. - name: Clone
  430. id: checkout
  431. uses: actions/checkout@v4
  432. - name: Dependencies
  433. id: depends
  434. run: |
  435. sudo apt-get update
  436. sudo apt-get install -y build-essential git cmake rocblas-dev hipblas-dev libcurl4-openssl-dev rocwmma-dev
  437. - name: ccache
  438. uses: ggml-org/ccache-action@v1.2.16
  439. with:
  440. key: ubuntu-22-cmake-hip
  441. evict-old-files: 1d
  442. - name: Build with native CMake HIP support
  443. id: cmake_build
  444. run: |
  445. cmake -B build -S . \
  446. -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \
  447. -DGGML_HIP_ROCWMMA_FATTN=ON \
  448. -DGGML_HIP=ON
  449. cmake --build build --config Release -j $(nproc)
  450. ubuntu-22-cmake-musa:
  451. runs-on: ubuntu-22.04
  452. container: mthreads/musa:rc4.3.0-devel-ubuntu22.04-amd64
  453. steps:
  454. - name: Clone
  455. id: checkout
  456. uses: actions/checkout@v4
  457. - name: Dependencies
  458. id: depends
  459. run: |
  460. apt-get update
  461. apt-get install -y build-essential git cmake libcurl4-openssl-dev
  462. - name: ccache
  463. uses: ggml-org/ccache-action@v1.2.16
  464. with:
  465. key: ubuntu-22-cmake-musa
  466. evict-old-files: 1d
  467. - name: Build with native CMake MUSA support
  468. id: cmake_build
  469. run: |
  470. cmake -B build -S . \
  471. -DGGML_MUSA=ON
  472. cmake --build build --config Release -j $(nproc)
  473. ubuntu-22-cmake-sycl:
  474. runs-on: ubuntu-22.04
  475. continue-on-error: true
  476. steps:
  477. - uses: actions/checkout@v4
  478. - name: add oneAPI to apt
  479. shell: bash
  480. run: |
  481. cd /tmp
  482. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  483. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  484. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  485. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  486. - name: install oneAPI dpcpp compiler
  487. shell: bash
  488. run: |
  489. sudo apt update
  490. sudo apt install intel-oneapi-compiler-dpcpp-cpp libcurl4-openssl-dev
  491. - name: install oneAPI MKL library
  492. shell: bash
  493. run: |
  494. sudo apt install intel-oneapi-mkl-devel
  495. - name: Clone
  496. id: checkout
  497. uses: actions/checkout@v4
  498. - name: ccache
  499. uses: ggml-org/ccache-action@v1.2.16
  500. with:
  501. key: ubuntu-22-cmake-sycl
  502. evict-old-files: 1d
  503. - name: Build
  504. id: cmake_build
  505. run: |
  506. source /opt/intel/oneapi/setvars.sh
  507. cmake -B build \
  508. -DGGML_SYCL=ON \
  509. -DCMAKE_C_COMPILER=icx \
  510. -DCMAKE_CXX_COMPILER=icpx
  511. cmake --build build --config Release -j $(nproc)
  512. ubuntu-22-cmake-sycl-fp16:
  513. runs-on: ubuntu-22.04
  514. continue-on-error: true
  515. steps:
  516. - uses: actions/checkout@v4
  517. - name: add oneAPI to apt
  518. shell: bash
  519. run: |
  520. cd /tmp
  521. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  522. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  523. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  524. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  525. - name: install oneAPI dpcpp compiler
  526. shell: bash
  527. run: |
  528. sudo apt update
  529. sudo apt install intel-oneapi-compiler-dpcpp-cpp libcurl4-openssl-dev
  530. - name: install oneAPI MKL library
  531. shell: bash
  532. run: |
  533. sudo apt install intel-oneapi-mkl-devel
  534. - name: Clone
  535. id: checkout
  536. uses: actions/checkout@v4
  537. - name: ccache
  538. uses: ggml-org/ccache-action@v1.2.16
  539. with:
  540. key: ubuntu-22-cmake-sycl-fp16
  541. evict-old-files: 1d
  542. - name: Build
  543. id: cmake_build
  544. run: |
  545. source /opt/intel/oneapi/setvars.sh
  546. cmake -B build \
  547. -DGGML_SYCL=ON \
  548. -DCMAKE_C_COMPILER=icx \
  549. -DCMAKE_CXX_COMPILER=icpx \
  550. -DGGML_SYCL_F16=ON
  551. cmake --build build --config Release -j $(nproc)
  552. build-linux-cross:
  553. uses: ./.github/workflows/build-linux-cross.yml
  554. build-cmake-pkg:
  555. uses: ./.github/workflows/build-cmake-pkg.yml
  556. macOS-latest-cmake-ios:
  557. runs-on: macos-latest
  558. steps:
  559. - name: Clone
  560. id: checkout
  561. uses: actions/checkout@v4
  562. - name: ccache
  563. uses: ggml-org/ccache-action@v1.2.16
  564. with:
  565. key: macOS-latest-cmake-ios
  566. evict-old-files: 1d
  567. - name: Dependencies
  568. id: depends
  569. continue-on-error: true
  570. run: |
  571. brew update
  572. - name: Build
  573. id: cmake_build
  574. run: |
  575. sysctl -a
  576. cmake -B build -G Xcode \
  577. -DGGML_METAL_USE_BF16=ON \
  578. -DGGML_METAL_EMBED_LIBRARY=ON \
  579. -DLLAMA_BUILD_COMMON=OFF \
  580. -DLLAMA_BUILD_EXAMPLES=OFF \
  581. -DLLAMA_BUILD_TOOLS=OFF \
  582. -DLLAMA_BUILD_TESTS=OFF \
  583. -DLLAMA_BUILD_SERVER=OFF \
  584. -DCMAKE_SYSTEM_NAME=iOS \
  585. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  586. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  587. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  588. macOS-latest-cmake-tvos:
  589. runs-on: macos-latest
  590. steps:
  591. - name: Clone
  592. id: checkout
  593. uses: actions/checkout@v4
  594. - name: ccache
  595. uses: ggml-org/ccache-action@v1.2.16
  596. with:
  597. key: macOS-latest-cmake-tvos
  598. evict-old-files: 1d
  599. - name: Dependencies
  600. id: depends
  601. continue-on-error: true
  602. run: |
  603. brew update
  604. - name: Build
  605. id: cmake_build
  606. run: |
  607. sysctl -a
  608. cmake -B build -G Xcode \
  609. -DGGML_METAL_USE_BF16=ON \
  610. -DGGML_METAL_EMBED_LIBRARY=ON \
  611. -DLLAMA_BUILD_COMMON=OFF \
  612. -DLLAMA_BUILD_EXAMPLES=OFF \
  613. -DLLAMA_BUILD_TOOLS=OFF \
  614. -DLLAMA_BUILD_TESTS=OFF \
  615. -DLLAMA_BUILD_SERVER=OFF \
  616. -DCMAKE_SYSTEM_NAME=tvOS \
  617. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  618. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  619. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  620. macOS-latest-cmake-visionos:
  621. runs-on: macos-latest
  622. steps:
  623. - name: Clone
  624. id: checkout
  625. uses: actions/checkout@v4
  626. - name: Dependencies
  627. id: depends
  628. continue-on-error: true
  629. run: |
  630. brew update
  631. - name: Build
  632. id: cmake_build
  633. run: |
  634. sysctl -a
  635. cmake -B build -G Xcode \
  636. -DGGML_METAL_USE_BF16=ON \
  637. -DGGML_METAL_EMBED_LIBRARY=ON \
  638. -DLLAMA_BUILD_COMMON=OFF \
  639. -DLLAMA_BUILD_EXAMPLES=OFF \
  640. -DLLAMA_BUILD_TOOLS=OFF \
  641. -DLLAMA_BUILD_TESTS=OFF \
  642. -DLLAMA_BUILD_SERVER=OFF \
  643. -DCMAKE_SYSTEM_NAME=visionOS \
  644. -DCMAKE_OSX_DEPLOYMENT_TARGET=1.0 \
  645. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  646. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  647. macOS-latest-swift:
  648. runs-on: macos-latest
  649. needs: ios-xcode-build
  650. strategy:
  651. matrix:
  652. destination: ['generic/platform=macOS', 'generic/platform=iOS', 'generic/platform=tvOS']
  653. steps:
  654. - name: Clone
  655. id: checkout
  656. uses: actions/checkout@v4
  657. - name: ccache
  658. uses: ggml-org/ccache-action@v1.2.16
  659. with:
  660. key: macOS-latest-swift
  661. evict-old-files: 1d
  662. - name: Download xcframework artifact
  663. uses: actions/download-artifact@v4
  664. with:
  665. name: llama-xcframework
  666. path: build-apple/llama.xcframework/
  667. - name: Dependencies
  668. id: depends
  669. continue-on-error: true
  670. run: |
  671. brew update
  672. - name: Build llama.cpp with CMake
  673. id: cmake_build
  674. run: |
  675. sysctl -a
  676. cmake -B build -G Xcode \
  677. -DGGML_METAL_USE_BF16=ON \
  678. -DGGML_METAL_EMBED_LIBRARY=ON \
  679. -DLLAMA_CURL=OFF \
  680. -DLLAMA_BUILD_EXAMPLES=OFF \
  681. -DLLAMA_BUILD_TOOLS=OFF \
  682. -DLLAMA_BUILD_TESTS=OFF \
  683. -DLLAMA_BUILD_SERVER=OFF \
  684. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
  685. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  686. windows-msys2:
  687. runs-on: windows-2025
  688. strategy:
  689. fail-fast: false
  690. matrix:
  691. include:
  692. - { sys: UCRT64, env: ucrt-x86_64, build: Release }
  693. - { sys: CLANG64, env: clang-x86_64, build: Release }
  694. steps:
  695. - name: Clone
  696. uses: actions/checkout@v4
  697. - name: ccache
  698. uses: ggml-org/ccache-action@v1.2.16
  699. with:
  700. key: windows-msys2
  701. variant: ccache
  702. evict-old-files: 1d
  703. - name: Setup ${{ matrix.sys }}
  704. uses: msys2/setup-msys2@v2
  705. with:
  706. update: true
  707. msystem: ${{matrix.sys}}
  708. install: >-
  709. base-devel
  710. git
  711. mingw-w64-${{matrix.env}}-toolchain
  712. mingw-w64-${{matrix.env}}-cmake
  713. mingw-w64-${{matrix.env}}-openblas
  714. - name: Build using CMake
  715. shell: msys2 {0}
  716. run: |
  717. cmake -B build
  718. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  719. - name: Clean after building using CMake
  720. shell: msys2 {0}
  721. run: |
  722. rm -rf build
  723. - name: Build using CMake w/ OpenBLAS
  724. shell: msys2 {0}
  725. run: |
  726. cmake -B build -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
  727. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  728. windows-latest-cmake:
  729. runs-on: windows-2025
  730. env:
  731. OPENBLAS_VERSION: 0.3.23
  732. SDE_VERSION: 9.33.0-2024-01-07
  733. VULKAN_VERSION: 1.4.313.2
  734. strategy:
  735. matrix:
  736. include:
  737. - build: 'cpu-x64 (static)'
  738. arch: 'x64'
  739. 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'
  740. - build: 'openblas-x64'
  741. arch: 'x64'
  742. 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"'
  743. - build: 'vulkan-x64'
  744. arch: 'x64'
  745. 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'
  746. - build: 'llvm-arm64'
  747. arch: 'arm64'
  748. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON'
  749. - build: 'llvm-arm64-opencl-adreno'
  750. arch: 'arm64'
  751. 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'
  752. steps:
  753. - name: Clone
  754. id: checkout
  755. uses: actions/checkout@v4
  756. - name: ccache
  757. uses: ggml-org/ccache-action@v1.2.16
  758. with:
  759. key: windows-latest-cmake-${{ matrix.build }}
  760. variant: ccache
  761. evict-old-files: 1d
  762. - name: Download OpenBLAS
  763. id: get_openblas
  764. if: ${{ matrix.build == 'openblas-x64' }}
  765. run: |
  766. 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"
  767. curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE"
  768. mkdir $env:RUNNER_TEMP/openblas
  769. tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas
  770. $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
  771. $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
  772. $lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe')
  773. & $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll
  774. - name: Install Vulkan SDK
  775. id: get_vulkan
  776. if: ${{ matrix.build == 'vulkan-x64' }}
  777. run: |
  778. 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"
  779. & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
  780. Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
  781. Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
  782. - name: Install Ninja
  783. id: install_ninja
  784. run: |
  785. choco install ninja
  786. - name: Install OpenCL Headers and Libs
  787. id: install_opencl
  788. if: ${{ matrix.build == 'llvm-arm64-opencl-adreno' }}
  789. run: |
  790. git clone https://github.com/KhronosGroup/OpenCL-Headers
  791. cd OpenCL-Headers
  792. cmake -B build `
  793. -DBUILD_TESTING=OFF `
  794. -DOPENCL_HEADERS_BUILD_TESTING=OFF `
  795. -DOPENCL_HEADERS_BUILD_CXX_TESTS=OFF `
  796. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  797. cmake --build build --target install
  798. git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader
  799. cd OpenCL-ICD-Loader
  800. cmake -B build-arm64-release `
  801. -A arm64 `
  802. -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" `
  803. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  804. cmake --build build-arm64-release --target install --config release
  805. - name: libCURL
  806. id: get_libcurl
  807. uses: ./.github/actions/windows-setup-curl
  808. with:
  809. architecture: ${{ matrix.arch == 'x64' && 'win64' || 'win64a' }}
  810. - name: Build
  811. id: cmake_build
  812. env:
  813. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  814. run: |
  815. cmake -S . -B build ${{ matrix.defines }} `
  816. -DCURL_LIBRARY="$env:CURL_PATH/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:CURL_PATH/include"
  817. cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}
  818. cp $env:CURL_PATH/bin/libcurl-*.dll build/bin/Release
  819. - name: Add libopenblas.dll
  820. id: add_libopenblas_dll
  821. if: ${{ matrix.build == 'openblas-x64' }}
  822. run: |
  823. cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll
  824. cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt
  825. - name: Test
  826. id: cmake_test
  827. if: ${{ matrix.arch == 'x64' }}
  828. run: |
  829. cd build
  830. ctest -L main -C Release --verbose --timeout 900
  831. # TODO: disabled for now, consider adding tests for all CPU variants instead
  832. # - name: Test (Intel SDE)
  833. # id: cmake_test_sde
  834. # if: ${{ matrix.build == 'avx512-x64' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation
  835. # run: |
  836. # curl.exe -o $env:RUNNER_TEMP/sde.tar.xz -L "https://downloadmirror.intel.com/813591/sde-external-${env:SDE_VERSION}-win.tar.xz"
  837. # # for some weird reason windows tar doesn't like sde tar.xz
  838. # 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar.xz
  839. # 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar
  840. # $sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe)
  841. # cd build
  842. # $env:LLAMA_SKIP_TESTS_SLOW_ON_EMULATOR = 1
  843. # & $sde -future -- ctest -L main -C Release --verbose --timeout 900
  844. ubuntu-latest-cmake-cuda:
  845. runs-on: ubuntu-latest
  846. container: nvidia/cuda:12.6.2-devel-ubuntu24.04
  847. steps:
  848. - name: Clone
  849. id: checkout
  850. uses: actions/checkout@v4
  851. - name: Install dependencies
  852. env:
  853. DEBIAN_FRONTEND: noninteractive
  854. run: |
  855. apt update
  856. apt install -y cmake build-essential ninja-build libgomp1 git libcurl4-openssl-dev
  857. - name: ccache
  858. uses: ggml-org/ccache-action@v1.2.16
  859. with:
  860. key: ubuntu-latest-cmake-cuda
  861. evict-old-files: 1d
  862. - name: Build with CMake
  863. run: |
  864. cmake -S . -B build -G Ninja \
  865. -DCMAKE_BUILD_TYPE=Release \
  866. -DCMAKE_CUDA_ARCHITECTURES=89-real \
  867. -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined \
  868. -DLLAMA_FATAL_WARNINGS=ON \
  869. -DGGML_NATIVE=OFF \
  870. -DGGML_CUDA=ON
  871. cmake --build build
  872. windows-2022-cmake-cuda:
  873. runs-on: windows-2022
  874. strategy:
  875. matrix:
  876. cuda: ['12.4']
  877. steps:
  878. - name: Clone
  879. id: checkout
  880. uses: actions/checkout@v4
  881. - name: Install ccache
  882. uses: ggml-org/ccache-action@v1.2.16
  883. with:
  884. key: windows-cuda-${{ matrix.cuda }}
  885. variant: ccache
  886. evict-old-files: 1d
  887. - name: Install Cuda Toolkit
  888. uses: ./.github/actions/windows-setup-cuda
  889. with:
  890. cuda_version: ${{ matrix.cuda }}
  891. - name: Install Ninja
  892. id: install_ninja
  893. run: |
  894. choco install ninja
  895. - name: libCURL
  896. id: get_libcurl
  897. uses: ./.github/actions/windows-setup-curl
  898. - name: Build
  899. id: cmake_build
  900. shell: cmd
  901. env:
  902. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  903. run: |
  904. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
  905. cmake -S . -B build -G "Ninja Multi-Config" ^
  906. -DLLAMA_BUILD_SERVER=ON ^
  907. -DGGML_NATIVE=OFF ^
  908. -DGGML_BACKEND_DL=ON ^
  909. -DGGML_CPU_ALL_VARIANTS=ON ^
  910. -DGGML_CUDA=ON ^
  911. -DGGML_RPC=ON ^
  912. -DCURL_LIBRARY="%CURL_PATH%/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="%CURL_PATH%/include"
  913. set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
  914. cmake --build build --config Release -j %NINJA_JOBS% -t ggml
  915. cmake --build build --config Release
  916. windows-latest-cmake-sycl:
  917. runs-on: windows-2022
  918. defaults:
  919. run:
  920. shell: bash
  921. env:
  922. 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
  923. WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel
  924. ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI"
  925. steps:
  926. - name: Clone
  927. id: checkout
  928. uses: actions/checkout@v4
  929. - name: ccache
  930. uses: ggml-org/ccache-action@v1.2.16
  931. with:
  932. key: windows-latest-cmake-sycl
  933. variant: ccache
  934. evict-old-files: 1d
  935. - name: Install
  936. run: |
  937. scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
  938. # TODO: add libcurl support ; we will also need to modify win-build-sycl.bat to accept user-specified args
  939. - name: Build
  940. id: cmake_build
  941. run: examples/sycl/win-build-sycl.bat
  942. windows-latest-cmake-hip:
  943. runs-on: windows-2022
  944. env:
  945. # The ROCm version must correspond to the version used in the HIP SDK.
  946. ROCM_VERSION: "6.4.2"
  947. # Make sure this is in sync with build-cache.yml
  948. HIPSDK_INSTALLER_VERSION: "25.Q3"
  949. steps:
  950. - name: Clone
  951. id: checkout
  952. uses: actions/checkout@v4
  953. - name: Grab rocWMMA package
  954. id: grab_rocwmma
  955. run: |
  956. 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"
  957. 7z x rocwmma.deb
  958. 7z x data.tar
  959. - name: Use ROCm Installation Cache
  960. uses: actions/cache@v4
  961. id: cache-rocm
  962. with:
  963. path: C:\Program Files\AMD\ROCm
  964. key: rocm-${{ env.HIPSDK_INSTALLER_VERSION }}-${{ runner.os }}
  965. - name: Setup ROCm
  966. if: steps.cache-rocm.outputs.cache-hit != 'true'
  967. uses: ./.github/actions/windows-setup-rocm
  968. with:
  969. version: ${{ env.HIPSDK_INSTALLER_VERSION }}
  970. - name: Verify ROCm
  971. id: verify
  972. run: |
  973. # Find and test ROCm installation
  974. $clangPath = Get-ChildItem 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | Select-Object -First 1
  975. if (-not $clangPath) {
  976. Write-Error "ROCm installation not found"
  977. exit 1
  978. }
  979. & $clangPath.FullName --version
  980. - name: Install ccache
  981. uses: ggml-org/ccache-action@v1.2.16
  982. with:
  983. key: ${{ github.job }}
  984. evict-old-files: 1d
  985. - name: libCURL
  986. id: get_libcurl
  987. uses: ./.github/actions/windows-setup-curl
  988. - name: Build
  989. id: cmake_build
  990. env:
  991. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  992. run: |
  993. $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
  994. $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
  995. cmake -G "Unix Makefiles" -B build -S . `
  996. -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" `
  997. -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
  998. -DCMAKE_CXX_FLAGS="-I$($PWD.Path.Replace('\', '/'))/opt/rocm-${{ env.ROCM_VERSION }}/include/" `
  999. -DCMAKE_BUILD_TYPE=Release `
  1000. -DROCM_DIR="${env:HIP_PATH}" `
  1001. -DGGML_HIP=ON `
  1002. -DGGML_HIP_ROCWMMA_FATTN=ON `
  1003. -DGGML_RPC=ON `
  1004. -DCURL_LIBRARY="$env:CURL_PATH/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:CURL_PATH/include"
  1005. cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
  1006. ios-xcode-build:
  1007. runs-on: macos-latest
  1008. steps:
  1009. - name: Checkout code
  1010. uses: actions/checkout@v4
  1011. - name: Setup Xcode
  1012. uses: maxim-lobanov/setup-xcode@v1
  1013. with:
  1014. xcode-version: latest-stable
  1015. - name: Build
  1016. id: cmake_build
  1017. run: |
  1018. sysctl -a
  1019. cmake -B build -G Xcode \
  1020. -DGGML_METAL_USE_BF16=ON \
  1021. -DGGML_METAL_EMBED_LIBRARY=ON \
  1022. -DLLAMA_CURL=OFF \
  1023. -DLLAMA_BUILD_EXAMPLES=OFF \
  1024. -DLLAMA_BUILD_TOOLS=OFF \
  1025. -DLLAMA_BUILD_TESTS=OFF \
  1026. -DLLAMA_BUILD_SERVER=OFF \
  1027. -DCMAKE_SYSTEM_NAME=iOS \
  1028. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  1029. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  1030. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  1031. - name: xcodebuild for swift package
  1032. id: xcodebuild
  1033. run: |
  1034. ./build-xcframework.sh
  1035. - name: Upload xcframework artifact
  1036. uses: actions/upload-artifact@v4
  1037. with:
  1038. name: llama-xcframework
  1039. path: build-apple/llama.xcframework/
  1040. retention-days: 1
  1041. - name: Build Xcode project
  1042. run: |
  1043. xcodebuild -downloadPlatform iOS
  1044. 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
  1045. android-build:
  1046. runs-on: ubuntu-latest
  1047. steps:
  1048. - name: Clone
  1049. uses: actions/checkout@v4
  1050. # Disabled due to size (400MB) and always 0 cache hits
  1051. # - name: ccache
  1052. # uses: ggml-org/ccache-action@v1.2.16
  1053. # with:
  1054. # key: android-build
  1055. # evict-old-files: 1d
  1056. - name: Set up JDK
  1057. uses: actions/setup-java@v3
  1058. with:
  1059. java-version: 17
  1060. distribution: zulu
  1061. - name: Setup Android SDK
  1062. uses: android-actions/setup-android@v3
  1063. with:
  1064. log-accepted-android-sdk-licenses: false
  1065. - name: Build
  1066. run: |
  1067. cd examples/llama.android
  1068. ./gradlew build --no-daemon
  1069. openEuler-latest-cmake-cann:
  1070. if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'Ascend NPU') }}
  1071. defaults:
  1072. run:
  1073. shell: bash -el {0}
  1074. strategy:
  1075. matrix:
  1076. arch: [x86, aarch64]
  1077. cann:
  1078. - '8.1.RC1.alpha001-910b-openeuler22.03-py3.10'
  1079. device:
  1080. - 'ascend910b3'
  1081. build:
  1082. - 'Release'
  1083. runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
  1084. container: ascendai/cann:${{ matrix.cann }}
  1085. steps:
  1086. - name: Checkout
  1087. uses: actions/checkout@v4
  1088. - name: Dependencies
  1089. run: |
  1090. yum update -y
  1091. yum install -y git gcc gcc-c++ make cmake libcurl-devel
  1092. - name: Build
  1093. run: |
  1094. export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
  1095. cmake -S . -B build \
  1096. -DCMAKE_BUILD_TYPE=${{ matrix.build }} \
  1097. -DGGML_CANN=on \
  1098. -DSOC_TYPE=${{ matrix.device }}
  1099. cmake --build build -j $(nproc)
  1100. # TODO: simplify the following workflows using a matrix
  1101. # TODO: run lighter CI on PRs and the full CI only on master (if needed)
  1102. ggml-ci-x64-cpu-low-perf:
  1103. runs-on: ubuntu-22.04
  1104. steps:
  1105. - name: Clone
  1106. id: checkout
  1107. uses: actions/checkout@v4
  1108. - name: ccache
  1109. uses: ggml-org/ccache-action@v1.2.16
  1110. with:
  1111. key: ggml-ci-x64-cpu-low-perf
  1112. evict-old-files: 1d
  1113. - name: Dependencies
  1114. id: depends
  1115. run: |
  1116. sudo apt-get update
  1117. sudo apt-get install build-essential libcurl4-openssl-dev
  1118. - name: Test
  1119. id: ggml-ci
  1120. run: |
  1121. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_LOW_PERF=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1122. ggml-ci-arm64-cpu-low-perf:
  1123. runs-on: ubuntu-22.04-arm
  1124. steps:
  1125. - name: Clone
  1126. id: checkout
  1127. uses: actions/checkout@v4
  1128. - name: ccache
  1129. uses: ggml-org/ccache-action@v1.2.16
  1130. with:
  1131. key: ggml-ci-arm64-cpu-low-perf
  1132. evict-old-files: 1d
  1133. - name: Dependencies
  1134. id: depends
  1135. run: |
  1136. sudo apt-get update
  1137. sudo apt-get install build-essential libcurl4-openssl-dev
  1138. - name: Test
  1139. id: ggml-ci
  1140. run: |
  1141. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_LOW_PERF=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1142. ggml-ci-x64-cpu-high-perf:
  1143. runs-on: ubuntu-22.04
  1144. steps:
  1145. - name: Clone
  1146. id: checkout
  1147. uses: actions/checkout@v4
  1148. - name: ccache
  1149. uses: ggml-org/ccache-action@v1.2.16
  1150. with:
  1151. key: ggml-ci-x64-cpu-high-perf
  1152. evict-old-files: 1d
  1153. - name: Dependencies
  1154. id: depends
  1155. run: |
  1156. sudo apt-get update
  1157. sudo apt-get install build-essential libcurl4-openssl-dev
  1158. - name: Test
  1159. id: ggml-ci
  1160. run: |
  1161. LLAMA_ARG_THREADS=$(nproc) bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1162. ggml-ci-arm64-cpu-high-perf:
  1163. runs-on: ubuntu-22.04-arm
  1164. steps:
  1165. - name: Clone
  1166. id: checkout
  1167. uses: actions/checkout@v4
  1168. - name: ccache
  1169. uses: ggml-org/ccache-action@v1.2.16
  1170. with:
  1171. key: ggml-ci-arm64-cpu-high-perf
  1172. evict-old-files: 1d
  1173. - name: Dependencies
  1174. id: depends
  1175. run: |
  1176. sudo apt-get update
  1177. sudo apt-get install build-essential libcurl4-openssl-dev
  1178. - name: Test
  1179. id: ggml-ci
  1180. run: |
  1181. 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
  1182. ggml-ci-arm64-cpu-high-perf-sve:
  1183. runs-on: ubuntu-22.04-arm
  1184. steps:
  1185. - name: Clone
  1186. id: checkout
  1187. uses: actions/checkout@v4
  1188. - name: ccache
  1189. uses: ggml-org/ccache-action@v1.2.16
  1190. with:
  1191. key: ggml-ci-arm64-cpu-high-perf-sve
  1192. evict-old-files: 1d
  1193. - name: Dependencies
  1194. id: depends
  1195. run: |
  1196. sudo apt-get update
  1197. sudo apt-get install build-essential libcurl4-openssl-dev
  1198. - name: Test
  1199. id: ggml-ci
  1200. run: |
  1201. LLAMA_ARG_THREADS=$(nproc) GG_BUILD_NO_BF16=1 GG_BUILD_EXTRA_TESTS_0=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt
  1202. ggml-ci-x64-nvidia-cuda:
  1203. runs-on: [self-hosted, Linux, X64, NVIDIA]
  1204. steps:
  1205. - name: Clone
  1206. id: checkout
  1207. uses: actions/checkout@v4
  1208. - name: Test
  1209. id: ggml-ci
  1210. run: |
  1211. nvidia-smi
  1212. GG_BUILD_CUDA=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1213. ggml-ci-x64-nvidia-vulkan-cm:
  1214. runs-on: [self-hosted, Linux, X64, NVIDIA]
  1215. steps:
  1216. - name: Clone
  1217. id: checkout
  1218. uses: actions/checkout@v4
  1219. - name: Test
  1220. id: ggml-ci
  1221. run: |
  1222. vulkaninfo --summary
  1223. GG_BUILD_VULKAN=1 GGML_VK_DISABLE_COOPMAT2=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1224. ggml-ci-x64-nvidia-vulkan-cm2:
  1225. runs-on: [self-hosted, Linux, X64, NVIDIA, COOPMAT2]
  1226. steps:
  1227. - name: Clone
  1228. id: checkout
  1229. uses: actions/checkout@v4
  1230. - name: Test
  1231. id: ggml-ci
  1232. run: |
  1233. vulkaninfo --summary
  1234. GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1235. ggml-ci-x64-cpu-amx:
  1236. runs-on: [self-hosted, Linux, X64, CPU, AMX]
  1237. steps:
  1238. - name: Clone
  1239. id: checkout
  1240. uses: actions/checkout@v4
  1241. - name: Test
  1242. id: ggml-ci
  1243. run: |
  1244. bash ./ci/run.sh ~/results/llama.cpp /mnt/llama.cpp
  1245. ggml-ci-mac-metal:
  1246. runs-on: [self-hosted, macOS, ARM64]
  1247. steps:
  1248. - name: Clone
  1249. id: checkout
  1250. uses: actions/checkout@v4
  1251. - name: Test
  1252. id: ggml-ci
  1253. run: |
  1254. GG_BUILD_METAL=1 bash ./ci/run.sh ~/results/llama.cpp ~/mnt/llama.cpp
  1255. ggml-ci-mac-vulkan:
  1256. runs-on: [self-hosted, macOS, ARM64]
  1257. steps:
  1258. - name: Clone
  1259. id: checkout
  1260. uses: actions/checkout@v4
  1261. - name: Test
  1262. id: ggml-ci
  1263. run: |
  1264. vulkaninfo --summary
  1265. GG_BUILD_VULKAN=1 bash ./ci/run.sh ~/results/llama.cpp ~/mnt/llama.cpp