Skip to content

Commit 500c066

Browse files
Merge branch 'ggml-org:master' into i8mm-ci
2 parents e211822 + f40a2e5 commit 500c066

File tree

886 files changed

+198196
-64940
lines changed

Some content is hidden

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

886 files changed

+198196
-64940
lines changed

.devops/cann.Dockerfile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
# ==============================================================================
44

55
# Define the CANN base image for easier version updates later
6-
ARG CANN_BASE_IMAGE=quay.io/ascend/cann:8.1.rc1-910b-openeuler22.03-py3.10
6+
ARG CHIP_TYPE=910b
7+
ARG CANN_BASE_IMAGE=quay.io/ascend/cann:8.3.rc1.alpha001-${CHIP_TYPE}-openeuler22.03-py3.11
78

89
# ==============================================================================
910
# BUILD STAGE
1011
# Compile all binary files and libraries
1112
# ==============================================================================
1213
FROM ${CANN_BASE_IMAGE} AS build
1314

14-
# Define the Ascend chip model for compilation. Default is Ascend910B3
15-
ARG ASCEND_SOC_TYPE=Ascend910B3
16-
1715
# -- Install build dependencies --
1816
RUN yum install -y gcc g++ cmake make git libcurl-devel python3 python3-pip && \
1917
yum clean all && \
@@ -36,20 +34,21 @@ ENV LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/runtime/lib64/stub:$LD_LIBRARY_PATH
3634
# For brevity, only core variables are listed here. You can paste the original ENV list here.
3735

3836
# -- Build llama.cpp --
39-
# Use the passed ASCEND_SOC_TYPE argument and add general build options
37+
# Use the passed CHIP_TYPE argument and add general build options
38+
ARG CHIP_TYPE
4039
RUN source /usr/local/Ascend/ascend-toolkit/set_env.sh --force \
4140
&& \
4241
cmake -B build \
4342
-DGGML_CANN=ON \
4443
-DCMAKE_BUILD_TYPE=Release \
45-
-DSOC_TYPE=${ASCEND_SOC_TYPE} \
44+
-DSOC_TYPE=ascend${CHIP_TYPE} \
4645
. && \
4746
cmake --build build --config Release -j$(nproc)
4847

4948
# -- Organize build artifacts for copying in later stages --
5049
# Create a lib directory to store all .so files
5150
RUN mkdir -p /app/lib && \
52-
find build -name "*.so" -exec cp {} /app/lib \;
51+
find build -name "*.so*" -exec cp -P {} /app/lib \;
5352

5453
# Create a full directory to store all executables and Python scripts
5554
RUN mkdir -p /app/full && \

.devops/cpu.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ RUN if [ "$TARGETARCH" = "amd64" ] || [ "$TARGETARCH" = "arm64" ]; then \
2020
cmake --build build -j $(nproc)
2121

2222
RUN mkdir -p /app/lib && \
23-
find build -name "*.so" -exec cp {} /app/lib \;
23+
find build -name "*.so*" -exec cp -P {} /app/lib \;
2424

2525
RUN mkdir -p /app/full \
2626
&& cp build/bin/* /app/full \

.devops/cuda.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ RUN if [ "${CUDA_DOCKER_ARCH}" != "default" ]; then \
2525
cmake --build build --config Release -j$(nproc)
2626

2727
RUN mkdir -p /app/lib && \
28-
find build -name "*.so" -exec cp {} /app/lib \;
28+
find build -name "*.so*" -exec cp -P {} /app/lib \;
2929

3030
RUN mkdir -p /app/full \
3131
&& cp build/bin/* /app/full \

.devops/intel.Dockerfile

Lines changed: 4 additions & 4 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 && \
@@ -21,7 +21,7 @@ RUN if [ "${GGML_SYCL_F16}" = "ON" ]; then \
2121
cmake --build build --config Release -j$(nproc)
2222

2323
RUN mkdir -p /app/lib && \
24-
find build -name "*.so" -exec cp {} /app/lib \;
24+
find build -name "*.so*" -exec cp -P {} /app/lib \;
2525

2626
RUN mkdir -p /app/full \
2727
&& cp build/bin/* /app/full \
@@ -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: 2 additions & 2 deletions
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

@@ -32,7 +32,7 @@ RUN if [ "${MUSA_DOCKER_ARCH}" != "default" ]; then \
3232
cmake --build build --config Release -j$(nproc)
3333

3434
RUN mkdir -p /app/lib && \
35-
find build -name "*.so" -exec cp {} /app/lib \;
35+
find build -name "*.so*" -exec cp -P {} /app/lib \;
3636

3737
RUN mkdir -p /app/full \
3838
&& cp build/bin/* /app/full \

.devops/nix/package.nix

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
rocmGpuTargets ? builtins.concatStringsSep ";" rocmPackages.clr.gpuTargets,
3535
enableCurl ? true,
3636
useVulkan ? false,
37+
useRpc ? false,
3738
llamaVersion ? "0.0.0", # Arbitrary version, substituted by the flake
3839

3940
# It's necessary to consistently use backendStdenv when building with CUDA support,
@@ -128,10 +129,6 @@ effectiveStdenv.mkDerivation (finalAttrs: {
128129
};
129130

130131
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\";"
135132
'';
136133

137134
# With PR#6015 https://github.com/ggml-org/llama.cpp/pull/6015,
@@ -179,6 +176,7 @@ effectiveStdenv.mkDerivation (finalAttrs: {
179176
(cmakeBool "GGML_METAL" useMetalKit)
180177
(cmakeBool "GGML_VULKAN" useVulkan)
181178
(cmakeBool "GGML_STATIC" enableStatic)
179+
(cmakeBool "GGML_RPC" useRpc)
182180
]
183181
++ optionals useCuda [
184182
(

.devops/rocm.Dockerfile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
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

77
# Target the ROCm build image
88
ARG BASE_ROCM_DEV_CONTAINER=rocm/dev-ubuntu-${UBUNTU_VERSION}:${ROCM_VERSION}-complete
@@ -13,9 +13,8 @@ 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.4.1/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

2019
ARG ROCM_DOCKER_ARCH='gfx803;gfx900;gfx906;gfx908;gfx90a;gfx942;gfx1010;gfx1030;gfx1032;gfx1100;gfx1101;gfx1102;gfx1200;gfx1201;gfx1151'
2120
#ARG ROCM_DOCKER_ARCH='gfx1151'
@@ -36,20 +35,17 @@ WORKDIR /app
3635

3736
COPY . .
3837

39-
RUN git clone https://github.com/rocm/rocwmma --branch develop --depth 1
40-
4138
RUN HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
4239
cmake -S . -B build \
4340
-DGGML_HIP=ON \
4441
-DGGML_HIP_ROCWMMA_FATTN=ON \
45-
-DCMAKE_HIP_FLAGS="-I$(pwd)/rocwmma/library/include/" \
4642
-DAMDGPU_TARGETS="$ROCM_DOCKER_ARCH" \
4743
-DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON \
4844
-DCMAKE_BUILD_TYPE=Release -DLLAMA_BUILD_TESTS=OFF \
4945
&& cmake --build build --config Release -j$(nproc)
5046

5147
RUN mkdir -p /app/lib \
52-
&& find build -name "*.so" -exec cp {} /app/lib \;
48+
&& find build -name "*.so*" -exec cp -P {} /app/lib \;
5349

5450
RUN mkdir -p /app/full \
5551
&& cp build/bin/* /app/full \

.devops/s390x.Dockerfile

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ ARG GCC_VERSION=15.2.0
22
ARG UBUNTU_VERSION=24.04
33

44
### Build Llama.cpp stage
5-
FROM --platform=linux/s390x gcc:${GCC_VERSION} AS build
5+
FROM gcc:${GCC_VERSION} AS build
66

7-
RUN --mount=type=cache,target=/var/cache/apt \
8-
--mount=type=cache,target=/var/lib/apt/lists \
7+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
8+
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
99
apt update -y && \
1010
apt upgrade -y && \
1111
apt install -y --no-install-recommends \
@@ -24,8 +24,9 @@ RUN --mount=type=cache,target=/root/.ccache \
2424
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
2525
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
2626
-DLLAMA_BUILD_TESTS=OFF \
27-
-DGGML_BACKEND_DL=OFF \
2827
-DGGML_NATIVE=OFF \
28+
-DGGML_BACKEND_DL=ON \
29+
-DGGML_CPU_ALL_VARIANTS=ON \
2930
-DGGML_BLAS=ON \
3031
-DGGML_BLAS_VENDOR=OpenBLAS && \
3132
cmake --build build --config Release -j $(nproc) && \
@@ -40,7 +41,7 @@ COPY requirements /opt/llama.cpp/gguf-py/requirements
4041

4142

4243
### Collect all llama.cpp binaries, libraries and distro libraries
43-
FROM --platform=linux/s390x scratch AS collector
44+
FROM scratch AS collector
4445

4546
# Copy llama.cpp binaries and libraries
4647
COPY --from=build /opt/llama.cpp/bin /llama.cpp/bin
@@ -49,13 +50,14 @@ COPY --from=build /opt/llama.cpp/gguf-py /llama.cpp/gguf-py
4950

5051

5152
### Base image
52-
FROM --platform=linux/s390x ubuntu:${UBUNTU_VERSION} AS base
53+
FROM ubuntu:${UBUNTU_VERSION} AS base
5354

54-
RUN --mount=type=cache,target=/var/cache/apt \
55-
--mount=type=cache,target=/var/lib/apt/lists \
55+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
56+
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
5657
apt update -y && \
5758
apt install -y --no-install-recommends \
5859
# WARNING: Do not use libopenblas-openmp-dev. libopenblas-dev is faster.
60+
# See: https://github.com/ggml-org/llama.cpp/pull/15915#issuecomment-3317166506
5961
curl libgomp1 libopenblas-dev && \
6062
apt autoremove -y && \
6163
apt clean -y && \
@@ -68,13 +70,13 @@ COPY --from=collector /llama.cpp/lib /usr/lib/s390x-linux-gnu
6870

6971

7072
### Full
71-
FROM --platform=linux/s390x base AS full
73+
FROM base AS full
7274

7375
ENV PATH="/root/.cargo/bin:${PATH}"
7476
WORKDIR /app
7577

76-
RUN --mount=type=cache,target=/var/cache/apt \
77-
--mount=type=cache,target=/var/lib/apt/lists \
78+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
79+
--mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
7880
apt update -y && \
7981
apt install -y \
8082
git cmake libjpeg-dev \
@@ -97,24 +99,26 @@ ENTRYPOINT [ "/app/tools.sh" ]
9799

98100

99101
### CLI Only
100-
FROM --platform=linux/s390x base AS light
102+
FROM base AS light
101103

102104
WORKDIR /llama.cpp/bin
103105

104106
# Copy llama.cpp binaries and libraries
107+
COPY --from=collector /llama.cpp/bin/*.so /llama.cpp/bin
105108
COPY --from=collector /llama.cpp/bin/llama-cli /llama.cpp/bin
106109

107110
ENTRYPOINT [ "/llama.cpp/bin/llama-cli" ]
108111

109112

110113
### Server
111-
FROM --platform=linux/s390x base AS server
114+
FROM base AS server
112115

113116
ENV LLAMA_ARG_HOST=0.0.0.0
114117

115118
WORKDIR /llama.cpp/bin
116119

117120
# Copy llama.cpp binaries and libraries
121+
COPY --from=collector /llama.cpp/bin/*.so /llama.cpp/bin
118122
COPY --from=collector /llama.cpp/bin/llama-server /llama.cpp/bin
119123

120124
EXPOSE 8080

.devops/vulkan.Dockerfile

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG UBUNTU_VERSION=24.04
1+
ARG UBUNTU_VERSION=25.10
22

33
FROM ubuntu:$UBUNTU_VERSION AS build
44

@@ -7,36 +7,20 @@ FROM ubuntu:$UBUNTU_VERSION AS build
77
# Install build tools
88
RUN apt update && apt install -y git build-essential cmake wget xz-utils
99

10-
# Install Vulkan SDK
11-
ARG VULKAN_VERSION=1.4.321.1
12-
RUN ARCH=$(uname -m) && \
13-
wget -qO /tmp/vulkan-sdk.tar.xz https://sdk.lunarg.com/sdk/download/${VULKAN_VERSION}/linux/vulkan-sdk-linux-${ARCH}-${VULKAN_VERSION}.tar.xz && \
14-
mkdir -p /opt/vulkan && \
15-
tar -xf /tmp/vulkan-sdk.tar.xz -C /tmp --strip-components=1 && \
16-
mv /tmp/${ARCH}/* /opt/vulkan/ && \
17-
rm -rf /tmp/*
18-
1910
# Install cURL and Vulkan SDK dependencies
2011
RUN apt install -y libcurl4-openssl-dev curl \
21-
libxcb-xinput0 libxcb-xinerama0 libxcb-cursor-dev
22-
23-
# Set environment variables
24-
ENV VULKAN_SDK=/opt/vulkan
25-
ENV PATH=$VULKAN_SDK/bin:$PATH
26-
ENV LD_LIBRARY_PATH=$VULKAN_SDK/lib:$LD_LIBRARY_PATH
27-
ENV CMAKE_PREFIX_PATH=$VULKAN_SDK:$CMAKE_PREFIX_PATH
28-
ENV PKG_CONFIG_PATH=$VULKAN_SDK/lib/pkgconfig:$PKG_CONFIG_PATH
12+
libxcb-xinput0 libxcb-xinerama0 libxcb-cursor-dev libvulkan-dev glslc
2913

3014
# Build it
3115
WORKDIR /app
3216

3317
COPY . .
3418

35-
RUN cmake -B build -DGGML_NATIVE=OFF -DGGML_VULKAN=1 -DLLAMA_BUILD_TESTS=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON && \
19+
RUN cmake -B build -DGGML_NATIVE=OFF -DGGML_VULKAN=ON -DLLAMA_BUILD_TESTS=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON && \
3620
cmake --build build --config Release -j$(nproc)
3721

3822
RUN mkdir -p /app/lib && \
39-
find build -name "*.so" -exec cp {} /app/lib \;
23+
find build -name "*.so*" -exec cp -P {} /app/lib \;
4024

4125
RUN mkdir -p /app/full \
4226
&& cp build/bin/* /app/full \
@@ -50,7 +34,7 @@ RUN mkdir -p /app/full \
5034
FROM ubuntu:$UBUNTU_VERSION AS base
5135

5236
RUN apt-get update \
53-
&& apt-get install -y libgomp1 curl libvulkan-dev \
37+
&& apt-get install -y libgomp1 curl libvulkan1 mesa-vulkan-drivers \
5438
&& apt autoremove -y \
5539
&& apt clean -y \
5640
&& rm -rf /tmp/* /var/tmp/* \

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,11 @@ end_of_line = unset
6060
charset = unset
6161
trim_trailing_whitespace = unset
6262
insert_final_newline = unset
63+
64+
[benches/**]
65+
indent_style = unset
66+
indent_size = unset
67+
end_of_line = unset
68+
charset = unset
69+
trim_trailing_whitespace = unset
70+
insert_final_newline = unset

0 commit comments

Comments
 (0)