1
0

build.yml 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514
  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-13
  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: Cache Vulkan SDK
  356. id: cache_vulkan_sdk
  357. uses: actions/cache@v4
  358. with:
  359. path: ./vulkan_sdk
  360. key: vulkan-sdk-${{ env.VULKAN_SDK_VERSION }}-${{ runner.os }}
  361. - name: Install Vulkan SDK
  362. if: steps.cache_vulkan_sdk.outputs.cache-hit != 'true'
  363. id: vulkan_sdk_install
  364. run: |
  365. mkdir -p vulkan_sdk
  366. cd vulkan_sdk
  367. curl --no-progress-meter https://sdk.lunarg.com/sdk/download/latest/linux/vulkan_sdk.tar.xz | tar -Jx --strip-components=1
  368. - name: Build
  369. id: cmake_build
  370. run: |
  371. source ./vulkan_sdk/setup-env.sh
  372. cmake -B build \
  373. -DGGML_VULKAN=ON
  374. cmake --build build --config Release -j $(nproc)
  375. - name: Test
  376. id: cmake_test
  377. run: |
  378. cd build
  379. export GGML_VK_VISIBLE_DEVICES=0
  380. export GGML_VK_DISABLE_F16=1
  381. # This is using llvmpipe and runs slower than other backends
  382. ctest -L main --verbose --timeout 4200
  383. ubuntu-22-cmake-webgpu:
  384. runs-on: ubuntu-22.04
  385. steps:
  386. - name: Clone
  387. id: checkout
  388. uses: actions/checkout@v4
  389. - name: ccache
  390. uses: ggml-org/ccache-action@v1.2.16
  391. with:
  392. key: ubuntu-22-cmake-webgpu
  393. evict-old-files: 1d
  394. - name: Vulkan SDK Dependencies
  395. id: vulkan-depends
  396. run: |
  397. wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
  398. sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
  399. sudo apt-get update -y
  400. sudo apt-get install -y build-essential mesa-vulkan-drivers vulkan-sdk libcurl4-openssl-dev
  401. - name: Dawn Dependency
  402. id: dawn-depends
  403. run: |
  404. sudo apt-get install -y libxrandr-dev libxinerama-dev libxcursor-dev mesa-common-dev libx11-xcb-dev libxi-dev
  405. DAWN_VERSION="v1.0.0"
  406. DAWN_OWNER="reeselevine"
  407. DAWN_REPO="dawn"
  408. DAWN_ASSET_NAME="Dawn-a1a6b45cced25a3b7f4fb491e0ae70796cc7f22b-ubuntu-latest-Release.tar.gz"
  409. echo "Fetching release asset from https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  410. curl -L -o artifact.tar.gz \
  411. "https://github.com/${DAWN_OWNER}/${DAWN_REPO}/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}"
  412. mkdir dawn
  413. tar -xvf artifact.tar.gz -C dawn --strip-components=1
  414. - name: Build
  415. id: cmake_build
  416. run: |
  417. export Dawn_DIR=dawn/lib64/cmake/Dawn
  418. cmake -B build -DGGML_WEBGPU=ON
  419. cmake --build build --config Release -j $(nproc)
  420. - name: Test
  421. id: cmake_test
  422. run: |
  423. cd build
  424. # This is using llvmpipe and runs slower than other backends
  425. ctest -L main --verbose --timeout 3600
  426. ubuntu-22-cmake-hip:
  427. runs-on: ubuntu-22.04
  428. container: rocm/dev-ubuntu-22.04:6.1.2
  429. steps:
  430. - name: Clone
  431. id: checkout
  432. uses: actions/checkout@v4
  433. - name: Dependencies
  434. id: depends
  435. run: |
  436. sudo apt-get update
  437. sudo apt-get install -y build-essential git cmake rocblas-dev hipblas-dev libcurl4-openssl-dev rocwmma-dev
  438. - name: ccache
  439. uses: ggml-org/ccache-action@v1.2.16
  440. with:
  441. key: ubuntu-22-cmake-hip
  442. evict-old-files: 1d
  443. - name: Build with native CMake HIP support
  444. id: cmake_build
  445. run: |
  446. cmake -B build -S . \
  447. -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \
  448. -DGGML_HIP_ROCWMMA_FATTN=ON \
  449. -DGGML_HIP=ON
  450. cmake --build build --config Release -j $(nproc)
  451. ubuntu-22-cmake-musa:
  452. runs-on: ubuntu-22.04
  453. container: mthreads/musa:rc4.3.0-devel-ubuntu22.04-amd64
  454. steps:
  455. - name: Clone
  456. id: checkout
  457. uses: actions/checkout@v4
  458. - name: Dependencies
  459. id: depends
  460. run: |
  461. apt-get update
  462. apt-get install -y build-essential git cmake libcurl4-openssl-dev
  463. - name: ccache
  464. uses: ggml-org/ccache-action@v1.2.16
  465. with:
  466. key: ubuntu-22-cmake-musa
  467. evict-old-files: 1d
  468. - name: Build with native CMake MUSA support
  469. id: cmake_build
  470. run: |
  471. cmake -B build -S . \
  472. -DGGML_MUSA=ON
  473. cmake --build build --config Release -j $(nproc)
  474. ubuntu-22-cmake-sycl:
  475. runs-on: ubuntu-22.04
  476. continue-on-error: true
  477. steps:
  478. - uses: actions/checkout@v4
  479. - name: add oneAPI to apt
  480. shell: bash
  481. run: |
  482. cd /tmp
  483. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  484. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  485. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  486. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  487. - name: install oneAPI dpcpp compiler
  488. shell: bash
  489. run: |
  490. sudo apt update
  491. sudo apt install intel-oneapi-compiler-dpcpp-cpp libcurl4-openssl-dev
  492. - name: install oneAPI MKL library
  493. shell: bash
  494. run: |
  495. sudo apt install intel-oneapi-mkl-devel
  496. - name: Clone
  497. id: checkout
  498. uses: actions/checkout@v4
  499. - name: ccache
  500. uses: ggml-org/ccache-action@v1.2.16
  501. with:
  502. key: ubuntu-22-cmake-sycl
  503. evict-old-files: 1d
  504. - name: Build
  505. id: cmake_build
  506. run: |
  507. source /opt/intel/oneapi/setvars.sh
  508. cmake -B build \
  509. -DGGML_SYCL=ON \
  510. -DCMAKE_C_COMPILER=icx \
  511. -DCMAKE_CXX_COMPILER=icpx
  512. cmake --build build --config Release -j $(nproc)
  513. ubuntu-22-cmake-sycl-fp16:
  514. runs-on: ubuntu-22.04
  515. continue-on-error: true
  516. steps:
  517. - uses: actions/checkout@v4
  518. - name: add oneAPI to apt
  519. shell: bash
  520. run: |
  521. cd /tmp
  522. wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  523. sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  524. rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
  525. sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
  526. - name: install oneAPI dpcpp compiler
  527. shell: bash
  528. run: |
  529. sudo apt update
  530. sudo apt install intel-oneapi-compiler-dpcpp-cpp libcurl4-openssl-dev
  531. - name: install oneAPI MKL library
  532. shell: bash
  533. run: |
  534. sudo apt install intel-oneapi-mkl-devel
  535. - name: Clone
  536. id: checkout
  537. uses: actions/checkout@v4
  538. - name: ccache
  539. uses: ggml-org/ccache-action@v1.2.16
  540. with:
  541. key: ubuntu-22-cmake-sycl-fp16
  542. evict-old-files: 1d
  543. - name: Build
  544. id: cmake_build
  545. run: |
  546. source /opt/intel/oneapi/setvars.sh
  547. cmake -B build \
  548. -DGGML_SYCL=ON \
  549. -DCMAKE_C_COMPILER=icx \
  550. -DCMAKE_CXX_COMPILER=icpx \
  551. -DGGML_SYCL_F16=ON
  552. cmake --build build --config Release -j $(nproc)
  553. build-linux-cross:
  554. uses: ./.github/workflows/build-linux-cross.yml
  555. build-cmake-pkg:
  556. uses: ./.github/workflows/build-cmake-pkg.yml
  557. macOS-latest-cmake-ios:
  558. runs-on: macos-latest
  559. steps:
  560. - name: Clone
  561. id: checkout
  562. uses: actions/checkout@v4
  563. - name: ccache
  564. uses: ggml-org/ccache-action@v1.2.16
  565. with:
  566. key: macOS-latest-cmake-ios
  567. evict-old-files: 1d
  568. - name: Dependencies
  569. id: depends
  570. continue-on-error: true
  571. run: |
  572. brew update
  573. - name: Build
  574. id: cmake_build
  575. run: |
  576. sysctl -a
  577. cmake -B build -G Xcode \
  578. -DGGML_METAL_USE_BF16=ON \
  579. -DGGML_METAL_EMBED_LIBRARY=ON \
  580. -DLLAMA_BUILD_COMMON=OFF \
  581. -DLLAMA_BUILD_EXAMPLES=OFF \
  582. -DLLAMA_BUILD_TOOLS=OFF \
  583. -DLLAMA_BUILD_TESTS=OFF \
  584. -DLLAMA_BUILD_SERVER=OFF \
  585. -DCMAKE_SYSTEM_NAME=iOS \
  586. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  587. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  588. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  589. macOS-latest-cmake-tvos:
  590. runs-on: macos-latest
  591. steps:
  592. - name: Clone
  593. id: checkout
  594. uses: actions/checkout@v4
  595. - name: ccache
  596. uses: ggml-org/ccache-action@v1.2.16
  597. with:
  598. key: macOS-latest-cmake-tvos
  599. evict-old-files: 1d
  600. - name: Dependencies
  601. id: depends
  602. continue-on-error: true
  603. run: |
  604. brew update
  605. - name: Build
  606. id: cmake_build
  607. run: |
  608. sysctl -a
  609. cmake -B build -G Xcode \
  610. -DGGML_METAL_USE_BF16=ON \
  611. -DGGML_METAL_EMBED_LIBRARY=ON \
  612. -DLLAMA_BUILD_COMMON=OFF \
  613. -DLLAMA_BUILD_EXAMPLES=OFF \
  614. -DLLAMA_BUILD_TOOLS=OFF \
  615. -DLLAMA_BUILD_TESTS=OFF \
  616. -DLLAMA_BUILD_SERVER=OFF \
  617. -DCMAKE_SYSTEM_NAME=tvOS \
  618. -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
  619. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  620. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  621. macOS-latest-cmake-visionos:
  622. runs-on: macos-latest
  623. steps:
  624. - name: Clone
  625. id: checkout
  626. uses: actions/checkout@v4
  627. - name: Dependencies
  628. id: depends
  629. continue-on-error: true
  630. run: |
  631. brew update
  632. - name: Build
  633. id: cmake_build
  634. run: |
  635. sysctl -a
  636. cmake -B build -G Xcode \
  637. -DGGML_METAL_USE_BF16=ON \
  638. -DGGML_METAL_EMBED_LIBRARY=ON \
  639. -DLLAMA_BUILD_COMMON=OFF \
  640. -DLLAMA_BUILD_EXAMPLES=OFF \
  641. -DLLAMA_BUILD_TOOLS=OFF \
  642. -DLLAMA_BUILD_TESTS=OFF \
  643. -DLLAMA_BUILD_SERVER=OFF \
  644. -DCMAKE_SYSTEM_NAME=visionOS \
  645. -DCMAKE_OSX_DEPLOYMENT_TARGET=1.0 \
  646. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=ggml
  647. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu) -- CODE_SIGNING_ALLOWED=NO
  648. macOS-latest-swift:
  649. runs-on: macos-latest
  650. needs: ios-xcode-build
  651. strategy:
  652. matrix:
  653. destination: ['generic/platform=macOS', 'generic/platform=iOS', 'generic/platform=tvOS']
  654. steps:
  655. - name: Clone
  656. id: checkout
  657. uses: actions/checkout@v4
  658. - name: ccache
  659. uses: ggml-org/ccache-action@v1.2.16
  660. with:
  661. key: macOS-latest-swift
  662. evict-old-files: 1d
  663. - name: Download xcframework artifact
  664. uses: actions/download-artifact@v4
  665. with:
  666. name: llama-xcframework
  667. path: build-apple/llama.xcframework/
  668. - name: Dependencies
  669. id: depends
  670. continue-on-error: true
  671. run: |
  672. brew update
  673. - name: Build llama.cpp with CMake
  674. id: cmake_build
  675. run: |
  676. sysctl -a
  677. cmake -B build -G Xcode \
  678. -DGGML_METAL_USE_BF16=ON \
  679. -DGGML_METAL_EMBED_LIBRARY=ON \
  680. -DLLAMA_CURL=OFF \
  681. -DLLAMA_BUILD_EXAMPLES=OFF \
  682. -DLLAMA_BUILD_TOOLS=OFF \
  683. -DLLAMA_BUILD_TESTS=OFF \
  684. -DLLAMA_BUILD_SERVER=OFF \
  685. -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
  686. cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
  687. windows-msys2:
  688. runs-on: windows-2025
  689. strategy:
  690. fail-fast: false
  691. matrix:
  692. include:
  693. - { sys: UCRT64, env: ucrt-x86_64, build: Release }
  694. - { sys: CLANG64, env: clang-x86_64, build: Release }
  695. steps:
  696. - name: Clone
  697. uses: actions/checkout@v4
  698. - name: ccache
  699. uses: ggml-org/ccache-action@v1.2.16
  700. with:
  701. key: windows-msys2
  702. variant: ccache
  703. evict-old-files: 1d
  704. - name: Setup ${{ matrix.sys }}
  705. uses: msys2/setup-msys2@v2
  706. with:
  707. update: true
  708. msystem: ${{matrix.sys}}
  709. install: >-
  710. base-devel
  711. git
  712. mingw-w64-${{matrix.env}}-toolchain
  713. mingw-w64-${{matrix.env}}-cmake
  714. mingw-w64-${{matrix.env}}-openblas
  715. - name: Build using CMake
  716. shell: msys2 {0}
  717. run: |
  718. cmake -B build
  719. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  720. - name: Clean after building using CMake
  721. shell: msys2 {0}
  722. run: |
  723. rm -rf build
  724. - name: Build using CMake w/ OpenBLAS
  725. shell: msys2 {0}
  726. run: |
  727. cmake -B build -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
  728. cmake --build build --config ${{ matrix.build }} -j $(nproc)
  729. windows-latest-cmake:
  730. runs-on: windows-2025
  731. env:
  732. OPENBLAS_VERSION: 0.3.23
  733. SDE_VERSION: 9.33.0-2024-01-07
  734. VULKAN_VERSION: 1.4.313.2
  735. strategy:
  736. matrix:
  737. include:
  738. - build: 'cpu-x64 (static)'
  739. arch: 'x64'
  740. 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'
  741. - build: 'openblas-x64'
  742. arch: 'x64'
  743. 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"'
  744. - build: 'vulkan-x64'
  745. arch: 'x64'
  746. 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'
  747. - build: 'llvm-arm64'
  748. arch: 'arm64'
  749. defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON'
  750. - build: 'llvm-arm64-opencl-adreno'
  751. arch: 'arm64'
  752. 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'
  753. steps:
  754. - name: Clone
  755. id: checkout
  756. uses: actions/checkout@v4
  757. - name: ccache
  758. uses: ggml-org/ccache-action@v1.2.16
  759. with:
  760. key: windows-latest-cmake-${{ matrix.build }}
  761. variant: ccache
  762. evict-old-files: 1d
  763. - name: Download OpenBLAS
  764. id: get_openblas
  765. if: ${{ matrix.build == 'openblas-x64' }}
  766. run: |
  767. 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"
  768. curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE"
  769. mkdir $env:RUNNER_TEMP/openblas
  770. tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas
  771. $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
  772. $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
  773. $lib = $(join-path $msvc 'bin\Hostx64\x64\lib.exe')
  774. & $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll
  775. - name: Install Vulkan SDK
  776. id: get_vulkan
  777. if: ${{ matrix.build == 'vulkan-x64' }}
  778. run: |
  779. 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"
  780. & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
  781. Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
  782. Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
  783. - name: Install Ninja
  784. id: install_ninja
  785. run: |
  786. choco install ninja
  787. - name: Install OpenCL Headers and Libs
  788. id: install_opencl
  789. if: ${{ matrix.build == 'llvm-arm64-opencl-adreno' }}
  790. run: |
  791. git clone https://github.com/KhronosGroup/OpenCL-Headers
  792. cd OpenCL-Headers
  793. cmake -B build `
  794. -DBUILD_TESTING=OFF `
  795. -DOPENCL_HEADERS_BUILD_TESTING=OFF `
  796. -DOPENCL_HEADERS_BUILD_CXX_TESTS=OFF `
  797. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  798. cmake --build build --target install
  799. git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader
  800. cd OpenCL-ICD-Loader
  801. cmake -B build-arm64-release `
  802. -A arm64 `
  803. -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/opencl-arm64-release" `
  804. -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/opencl-arm64-release"
  805. cmake --build build-arm64-release --target install --config release
  806. - name: libCURL
  807. id: get_libcurl
  808. uses: ./.github/actions/windows-setup-curl
  809. with:
  810. architecture: ${{ matrix.arch == 'x64' && 'win64' || 'win64a' }}
  811. - name: Build
  812. id: cmake_build
  813. env:
  814. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  815. run: |
  816. cmake -S . -B build ${{ matrix.defines }} `
  817. -DCURL_LIBRARY="$env:CURL_PATH/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="$env:CURL_PATH/include"
  818. cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}
  819. cp $env:CURL_PATH/bin/libcurl-*.dll build/bin/Release
  820. - name: Add libopenblas.dll
  821. id: add_libopenblas_dll
  822. if: ${{ matrix.build == 'openblas-x64' }}
  823. run: |
  824. cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll
  825. cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt
  826. - name: Test
  827. id: cmake_test
  828. if: ${{ matrix.arch == 'x64' }}
  829. run: |
  830. cd build
  831. ctest -L main -C Release --verbose --timeout 900
  832. # TODO: disabled for now, consider adding tests for all CPU variants instead
  833. # - name: Test (Intel SDE)
  834. # id: cmake_test_sde
  835. # if: ${{ matrix.build == 'avx512-x64' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation
  836. # run: |
  837. # curl.exe -o $env:RUNNER_TEMP/sde.tar.xz -L "https://downloadmirror.intel.com/813591/sde-external-${env:SDE_VERSION}-win.tar.xz"
  838. # # for some weird reason windows tar doesn't like sde tar.xz
  839. # 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar.xz
  840. # 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar
  841. # $sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe)
  842. # cd build
  843. # $env:LLAMA_SKIP_TESTS_SLOW_ON_EMULATOR = 1
  844. # & $sde -future -- ctest -L main -C Release --verbose --timeout 900
  845. ubuntu-latest-cmake-cuda:
  846. runs-on: ubuntu-latest
  847. container: nvidia/cuda:12.6.2-devel-ubuntu24.04
  848. steps:
  849. - name: Clone
  850. id: checkout
  851. uses: actions/checkout@v4
  852. - name: Install dependencies
  853. env:
  854. DEBIAN_FRONTEND: noninteractive
  855. run: |
  856. apt update
  857. apt install -y cmake build-essential ninja-build libgomp1 git libcurl4-openssl-dev
  858. - name: ccache
  859. uses: ggml-org/ccache-action@v1.2.16
  860. with:
  861. key: ubuntu-latest-cmake-cuda
  862. evict-old-files: 1d
  863. - name: Build with CMake
  864. run: |
  865. cmake -S . -B build -G Ninja \
  866. -DCMAKE_BUILD_TYPE=Release \
  867. -DCMAKE_CUDA_ARCHITECTURES=89-real \
  868. -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined \
  869. -DLLAMA_FATAL_WARNINGS=ON \
  870. -DGGML_NATIVE=OFF \
  871. -DGGML_CUDA=ON
  872. cmake --build build
  873. windows-2022-cmake-cuda:
  874. runs-on: windows-2022
  875. strategy:
  876. matrix:
  877. cuda: ['12.4']
  878. steps:
  879. - name: Clone
  880. id: checkout
  881. uses: actions/checkout@v4
  882. - name: Install ccache
  883. uses: ggml-org/ccache-action@v1.2.16
  884. with:
  885. key: windows-cuda-${{ matrix.cuda }}
  886. variant: ccache
  887. evict-old-files: 1d
  888. - name: Install Cuda Toolkit
  889. uses: ./.github/actions/windows-setup-cuda
  890. with:
  891. cuda_version: ${{ matrix.cuda }}
  892. - name: Install Ninja
  893. id: install_ninja
  894. run: |
  895. choco install ninja
  896. - name: libCURL
  897. id: get_libcurl
  898. uses: ./.github/actions/windows-setup-curl
  899. - name: Build
  900. id: cmake_build
  901. shell: cmd
  902. env:
  903. CURL_PATH: ${{ steps.get_libcurl.outputs.curl_path }}
  904. run: |
  905. call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
  906. cmake -S . -B build -G "Ninja Multi-Config" ^
  907. -DLLAMA_BUILD_SERVER=ON ^
  908. -DGGML_NATIVE=OFF ^
  909. -DGGML_BACKEND_DL=ON ^
  910. -DGGML_CPU_ALL_VARIANTS=ON ^
  911. -DGGML_CUDA=ON ^
  912. -DGGML_RPC=ON ^
  913. -DCURL_LIBRARY="%CURL_PATH%/lib/libcurl.dll.a" -DCURL_INCLUDE_DIR="%CURL_PATH%/include"
  914. set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
  915. cmake --build build --config Release -j %NINJA_JOBS% -t ggml
  916. cmake --build build --config Release
  917. windows-latest-cmake-sycl:
  918. runs-on: windows-2022
  919. defaults:
  920. run:
  921. shell: bash
  922. env:
  923. 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
  924. WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel:intel.oneapi.win.dnnl:intel.oneapi.win.tbb.devel
  925. ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI"
  926. steps:
  927. - name: Clone
  928. id: checkout
  929. uses: actions/checkout@v4
  930. - name: ccache
  931. uses: ggml-org/ccache-action@v1.2.16
  932. with:
  933. key: windows-latest-cmake-sycl
  934. variant: ccache
  935. evict-old-files: 1d
  936. - name: Install
  937. run: |
  938. scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
  939. # TODO: add libcurl support ; we will also need to modify win-build-sycl.bat to accept user-specified args
  940. - name: Build
  941. id: cmake_build
  942. run: examples/sycl/win-build-sycl.bat
  943. windows-latest-cmake-hip:
  944. runs-on: windows-2022
  945. env:
  946. # The ROCm version must correspond to the version used in the HIP SDK.
  947. ROCM_VERSION: "6.4.2"
  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: Cache ROCm Installation
  960. id: cache-rocm
  961. uses: actions/cache@v4
  962. with:
  963. path: C:\Program Files\AMD\ROCm
  964. key: rocm-${{ env.HIPSDK_INSTALLER_VERSION }}-${{ runner.os }}
  965. - name: Install ROCm
  966. if: steps.cache-rocm.outputs.cache-hit != 'true'
  967. id: depends
  968. run: |
  969. $ErrorActionPreference = "Stop"
  970. write-host "Downloading AMD HIP SDK Installer"
  971. Invoke-WebRequest -Uri "https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ env.HIPSDK_INSTALLER_VERSION }}-WinSvr2022-For-HIP.exe" -OutFile "${env:RUNNER_TEMP}\rocm-install.exe"
  972. write-host "Installing AMD HIP SDK"
  973. $proc = Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -PassThru
  974. $completed = $proc.WaitForExit(600000)
  975. if (-not $completed) {
  976. Write-Error "ROCm installation timed out after 10 minutes. Killing the process"
  977. $proc.Kill()
  978. exit 1
  979. }
  980. if ($proc.ExitCode -ne 0) {
  981. Write-Error "ROCm installation failed with exit code $($proc.ExitCode)"
  982. exit 1
  983. }
  984. write-host "Completed AMD HIP SDK installation"
  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