Skip to content

Commit f5cb848

Browse files
committed
Merge branch 'master' into cogvlm_support
2 parents 06a0719 + e3af556 commit f5cb848

File tree

1,035 files changed

+121971
-47520
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,035 files changed

+121971
-47520
lines changed

.clang-format

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ AllowShortIfStatementsOnASingleLine: Never
2222
AllowShortLambdasOnASingleLine: Inline
2323
AllowShortLoopsOnASingleLine: false
2424
AlwaysBreakBeforeMultilineStrings: true
25+
# Treat CUDA keywords/attributes as "attribute macros" and avoid breaking lines inside them
26+
AttributeMacros:
27+
- __host__
28+
- __device__
29+
- __global__
30+
- __forceinline__
31+
- __launch_bounds__
2532
BinPackArguments: true
2633
BinPackParameters: false # OnePerLine
2734
BitFieldColonSpacing: Both

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Checks: >
1717
clang-analyzer-*,
1818
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
1919
performance-*,
20+
-performance-enum-size,
2021
portability-*,
2122
-portability-simd-intrinsics,
2223
misc-*,

.devops/intel.Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
ARG ONEAPI_VERSION=2025.1.1-0-devel-ubuntu24.04
1+
ARG ONEAPI_VERSION=2025.2.2-0-devel-ubuntu24.04
22

33
## Build Image
44

5-
FROM intel/oneapi-basekit:$ONEAPI_VERSION AS build
5+
FROM intel/deep-learning-essentials:$ONEAPI_VERSION AS build
66

77
ARG GGML_SYCL_F16=OFF
88
RUN apt-get update && \
@@ -31,7 +31,7 @@ RUN mkdir -p /app/full \
3131
&& cp requirements.txt /app/full \
3232
&& cp .devops/tools.sh /app/full/tools.sh
3333

34-
FROM intel/oneapi-basekit:$ONEAPI_VERSION AS base
34+
FROM intel/deep-learning-essentials:$ONEAPI_VERSION AS base
3535

3636
RUN apt-get update \
3737
&& apt-get install -y libgomp1 curl\

.devops/musa.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG UBUNTU_VERSION=22.04
22
# This needs to generally match the container host's environment.
3-
ARG MUSA_VERSION=rc4.2.0
3+
ARG MUSA_VERSION=rc4.3.0
44
# Target the MUSA build image
55
ARG BASE_MUSA_DEV_CONTAINER=mthreads/musa:${MUSA_VERSION}-devel-ubuntu${UBUNTU_VERSION}-amd64
66

.devops/nix/package.nix

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,6 @@ effectiveStdenv.mkDerivation (finalAttrs: {
128128
};
129129

130130
postPatch = ''
131-
substituteInPlace ./ggml/src/ggml-metal/ggml-metal.m \
132-
--replace '[bundle pathForResource:@"ggml-metal" ofType:@"metal"];' "@\"$out/bin/ggml-metal.metal\";"
133-
substituteInPlace ./ggml/src/ggml-metal/ggml-metal.m \
134-
--replace '[bundle pathForResource:@"default" ofType:@"metallib"];' "@\"$out/bin/default.metallib\";"
135131
'';
136132

137133
# With PR#6015 https://github.com/ggml-org/llama.cpp/pull/6015,

.devops/rocm.Dockerfile

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
ARG UBUNTU_VERSION=24.04
22

33
# This needs to generally match the container host's environment.
4-
ARG ROCM_VERSION=6.4
5-
ARG AMDGPU_VERSION=6.4
4+
ARG ROCM_VERSION=7.0
5+
ARG AMDGPU_VERSION=7.0
66

7-
# Target the CUDA build image
7+
# Target the ROCm build image
88
ARG BASE_ROCM_DEV_CONTAINER=rocm/dev-ubuntu-${UBUNTU_VERSION}:${ROCM_VERSION}-complete
99

1010
### Build image
@@ -13,18 +13,14 @@ FROM ${BASE_ROCM_DEV_CONTAINER} AS build
1313
# Unless otherwise specified, we make a fat build.
1414
# List from https://github.com/ggml-org/llama.cpp/pull/1087#issuecomment-1682807878
1515
# This is mostly tied to rocBLAS supported archs.
16-
# gfx803, gfx900, gfx1032, gfx1101, gfx1102,not officialy supported
17-
# gfx906 is deprecated
18-
#check https://rocm.docs.amd.com/projects/install-on-linux/en/docs-6.2.4/reference/system-requirements.html
16+
# gfx803, gfx900, gfx906, gfx1032, gfx1101, gfx1102,not officialy supported
17+
# check https://rocm.docs.amd.com/projects/install-on-linux/en/docs-6.4.1/reference/system-requirements.html
1918

20-
ARG ROCM_DOCKER_ARCH='gfx803,gfx900,gfx906,gfx908,gfx90a,gfx942,gfx1010,gfx1030,gfx1032,gfx1100,gfx1101,gfx1102'
21-
#ARG ROCM_DOCKER_ARCH=gfx1100
19+
ARG ROCM_DOCKER_ARCH='gfx803;gfx900;gfx906;gfx908;gfx90a;gfx942;gfx1010;gfx1030;gfx1032;gfx1100;gfx1101;gfx1102;gfx1200;gfx1201;gfx1151'
20+
#ARG ROCM_DOCKER_ARCH='gfx1151'
2221

23-
# Set nvcc architectured
22+
# Set ROCm architectures
2423
ENV AMDGPU_TARGETS=${ROCM_DOCKER_ARCH}
25-
# Enable ROCm
26-
# ENV CC=/opt/rocm/llvm/bin/clang
27-
# ENV CXX=/opt/rocm/llvm/bin/clang++
2824

2925
RUN apt-get update \
3026
&& apt-get install -y \
@@ -40,7 +36,12 @@ WORKDIR /app
4036
COPY . .
4137

4238
RUN HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
43-
cmake -S . -B build -DGGML_HIP=ON -DAMDGPU_TARGETS=$ROCM_DOCKER_ARCH -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DCMAKE_BUILD_TYPE=Release -DLLAMA_BUILD_TESTS=OFF \
39+
cmake -S . -B build \
40+
-DGGML_HIP=ON \
41+
-DGGML_HIP_ROCWMMA_FATTN=ON \
42+
-DAMDGPU_TARGETS="$ROCM_DOCKER_ARCH" \
43+
-DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON \
44+
-DCMAKE_BUILD_TYPE=Release -DLLAMA_BUILD_TESTS=OFF \
4445
&& cmake --build build --config Release -j$(nproc)
4546

4647
RUN mkdir -p /app/lib \

.devops/s390x.Dockerfile

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
ARG GCC_VERSION=15.2.0
2+
ARG UBUNTU_VERSION=24.04
3+
4+
### Build Llama.cpp stage
5+
FROM gcc:${GCC_VERSION} AS build
6+
7+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
8+
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
9+
apt update -y && \
10+
apt upgrade -y && \
11+
apt install -y --no-install-recommends \
12+
git cmake ccache ninja-build \
13+
# WARNING: Do not use libopenblas-openmp-dev. libopenblas-dev is faster.
14+
libopenblas-dev libcurl4-openssl-dev && \
15+
rm -rf /var/lib/apt/lists/*
16+
17+
WORKDIR /app
18+
COPY . .
19+
20+
RUN --mount=type=cache,target=/root/.ccache \
21+
--mount=type=cache,target=/app/build \
22+
cmake -S . -B build -G Ninja \
23+
-DCMAKE_BUILD_TYPE=Release \
24+
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
25+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
26+
-DLLAMA_BUILD_TESTS=OFF \
27+
-DGGML_BACKEND_DL=OFF \
28+
-DGGML_NATIVE=OFF \
29+
-DGGML_BLAS=ON \
30+
-DGGML_BLAS_VENDOR=OpenBLAS && \
31+
cmake --build build --config Release -j $(nproc) && \
32+
cmake --install build --prefix /opt/llama.cpp
33+
34+
COPY *.py /opt/llama.cpp/bin
35+
COPY .devops/tools.sh /opt/llama.cpp/bin
36+
37+
COPY gguf-py /opt/llama.cpp/gguf-py
38+
COPY requirements.txt /opt/llama.cpp/gguf-py
39+
COPY requirements /opt/llama.cpp/gguf-py/requirements
40+
41+
42+
### Collect all llama.cpp binaries, libraries and distro libraries
43+
FROM scratch AS collector
44+
45+
# Copy llama.cpp binaries and libraries
46+
COPY --from=build /opt/llama.cpp/bin /llama.cpp/bin
47+
COPY --from=build /opt/llama.cpp/lib /llama.cpp/lib
48+
COPY --from=build /opt/llama.cpp/gguf-py /llama.cpp/gguf-py
49+
50+
51+
### Base image
52+
FROM ubuntu:${UBUNTU_VERSION} AS base
53+
54+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
55+
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
56+
apt update -y && \
57+
apt install -y --no-install-recommends \
58+
# WARNING: Do not use libopenblas-openmp-dev. libopenblas-dev is faster.
59+
# See: https://github.com/ggml-org/llama.cpp/pull/15915#issuecomment-3317166506
60+
curl libgomp1 libopenblas-dev && \
61+
apt autoremove -y && \
62+
apt clean -y && \
63+
rm -rf /tmp/* /var/tmp/* && \
64+
find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete && \
65+
find /var/cache -type f -delete
66+
67+
# Copy llama.cpp libraries
68+
COPY --from=collector /llama.cpp/lib /usr/lib/s390x-linux-gnu
69+
70+
71+
### Full
72+
FROM base AS full
73+
74+
ENV PATH="/root/.cargo/bin:${PATH}"
75+
WORKDIR /app
76+
77+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
78+
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
79+
apt update -y && \
80+
apt install -y \
81+
git cmake libjpeg-dev \
82+
python3 python3-pip python3-dev && \
83+
apt autoremove -y && \
84+
apt clean -y && \
85+
rm -rf /tmp/* /var/tmp/* && \
86+
find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete && \
87+
find /var/cache -type f -delete
88+
89+
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
90+
91+
COPY --from=collector /llama.cpp/bin /app
92+
COPY --from=collector /llama.cpp/gguf-py /app/gguf-py
93+
94+
RUN pip install --no-cache-dir --break-system-packages \
95+
-r /app/gguf-py/requirements.txt
96+
97+
ENTRYPOINT [ "/app/tools.sh" ]
98+
99+
100+
### CLI Only
101+
FROM base AS light
102+
103+
WORKDIR /llama.cpp/bin
104+
105+
# Copy llama.cpp binaries and libraries
106+
COPY --from=collector /llama.cpp/bin/llama-cli /llama.cpp/bin
107+
108+
ENTRYPOINT [ "/llama.cpp/bin/llama-cli" ]
109+
110+
111+
### Server
112+
FROM base AS server
113+
114+
ENV LLAMA_ARG_HOST=0.0.0.0
115+
116+
WORKDIR /llama.cpp/bin
117+
118+
# Copy llama.cpp binaries and libraries
119+
COPY --from=collector /llama.cpp/bin/llama-server /llama.cpp/bin
120+
121+
EXPOSE 8080
122+
123+
ENTRYPOINT [ "/llama.cpp/bin/llama-server" ]

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,11 @@ insert_final_newline = unset
5252
[vendor/miniaudio/miniaudio.h]
5353
trim_trailing_whitespace = unset
5454
insert_final_newline = unset
55+
56+
[tools/server/webui/**]
57+
indent_style = unset
58+
indent_size = unset
59+
end_of_line = unset
60+
charset = unset
61+
trim_trailing_whitespace = unset
62+
insert_final_newline = unset
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "Install exe"
2+
description: "Download and install exe"
3+
inputs:
4+
url:
5+
description: "URL of the exe installer"
6+
required: true
7+
args:
8+
description: "Installer arguments"
9+
required: true
10+
timeout:
11+
description: "Timeout (in ms)"
12+
required: false
13+
default: "600000"
14+
15+
runs:
16+
using: "composite"
17+
steps:
18+
- name: Install EXE
19+
shell: pwsh
20+
run: |
21+
$ErrorActionPreference = "Stop"
22+
write-host "Downloading Installer EXE"
23+
Invoke-WebRequest -Uri "${{ inputs.url }}" -OutFile "${env:RUNNER_TEMP}\temp-install.exe"
24+
write-host "Installing"
25+
$proc = Start-Process "${env:RUNNER_TEMP}\temp-install.exe" -ArgumentList '${{ inputs.args }}' -NoNewWindow -PassThru
26+
$completed = $proc.WaitForExit(${{ inputs.timeout }})
27+
if (-not $completed) {
28+
Write-Error "Installer timed out. Killing the process"
29+
$proc.Kill()
30+
exit 1
31+
}
32+
if ($proc.ExitCode -ne 0) {
33+
Write-Error "Installer failed with exit code $($proc.ExitCode)"
34+
exit 1
35+
}
36+
write-host "Completed installation"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "Linux - Setup SpacemiT Toolchain"
2+
description: "Setup SpacemiT Toolchain for Linux"
3+
inputs:
4+
path:
5+
description: "Installation path"
6+
required: true
7+
version:
8+
description: "SpacemiT toolchain version"
9+
required: true
10+
11+
runs:
12+
using: "composite"
13+
steps:
14+
- name: Setup SpacemiT Toolchain
15+
id: setup
16+
uses: ./.github/actions/unarchive-tar
17+
with:
18+
url: https://archive.spacemit.com/toolchain/spacemit-toolchain-linux-glibc-x86_64-v${{ inputs.version }}.tar.xz
19+
path: ${{ inputs.path }}
20+
strip: 1

0 commit comments

Comments
 (0)