Skip to content

Commit 8743d1e

Browse files
authored
Merge branch 'ggerganov:master' into testing/add-lora-tests-workflow
2 parents d0fbd18 + cc98896 commit 8743d1e

File tree

593 files changed

+108363
-83165
lines changed

Some content is hidden

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

593 files changed

+108363
-83165
lines changed

.clang-format

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
---
2+
Language: Cpp
3+
AlignAfterOpenBracket: Align
4+
AlignArrayOfStructures: Left
5+
AlignConsecutiveAssignments: AcrossComments
6+
AlignConsecutiveBitFields: AcrossComments
7+
AlignConsecutiveDeclarations: AcrossComments
8+
AlignConsecutiveMacros: AcrossComments
9+
# AlignConsecutiveShortCaseStatements: AcrossComments
10+
AlignEscapedNewlines: Left # LeftWithLastLine
11+
AlignOperands: Align
12+
AlignTrailingComments:
13+
Kind: Always
14+
OverEmptyLines: 1
15+
AllowAllArgumentsOnNextLine: true
16+
AllowAllParametersOfDeclarationOnNextLine: false
17+
# AllowBreakBeforeNoexceptSpecifier: OnlyWithParen
18+
AllowShortBlocksOnASingleLine: Never
19+
AllowShortCaseLabelsOnASingleLine: false
20+
AllowShortFunctionsOnASingleLine: Inline
21+
AllowShortIfStatementsOnASingleLine: Never
22+
AllowShortLambdasOnASingleLine: Inline
23+
AllowShortLoopsOnASingleLine: false
24+
AlwaysBreakBeforeMultilineStrings: true
25+
BinPackArguments: true
26+
BinPackParameters: true # OnePerLine
27+
BitFieldColonSpacing: Both
28+
BreakBeforeBraces: Custom # Attach
29+
BraceWrapping:
30+
AfterCaseLabel: true
31+
AfterClass: false
32+
AfterControlStatement: false
33+
AfterEnum: false
34+
AfterFunction: false
35+
AfterNamespace: false
36+
AfterObjCDeclaration: false
37+
AfterStruct: false
38+
AfterUnion: false
39+
AfterExternBlock: false
40+
BeforeCatch: false
41+
BeforeElse: false
42+
BeforeLambdaBody: false
43+
BeforeWhile: false
44+
IndentBraces: false
45+
SplitEmptyFunction: false
46+
SplitEmptyRecord: false
47+
SplitEmptyNamespace: false
48+
# BreakAdjacentStringLiterals: true
49+
BreakAfterAttributes: Never
50+
BreakBeforeBinaryOperators: None
51+
BreakBeforeInlineASMColon: OnlyMultiline
52+
BreakBeforeTernaryOperators: false
53+
# BreakBinaryOperations: Never
54+
BreakConstructorInitializers: AfterColon
55+
# BreakFunctionDefinitionParameters: false
56+
BreakInheritanceList: AfterComma
57+
BreakStringLiterals: true
58+
# BreakTemplateDeclarations: Yes
59+
ColumnLimit: 120
60+
CommentPragmas: '^ IWYU pragma:'
61+
CompactNamespaces: false
62+
ConstructorInitializerIndentWidth: 4
63+
ContinuationIndentWidth: 4
64+
Cpp11BracedListStyle: false
65+
DerivePointerAlignment: false
66+
DisableFormat: false
67+
EmptyLineBeforeAccessModifier: Leave
68+
EmptyLineAfterAccessModifier: Never
69+
ExperimentalAutoDetectBinPacking: false
70+
FixNamespaceComments: true
71+
IncludeBlocks: Regroup
72+
IncludeCategories:
73+
- Regex: '^<.*\.h>'
74+
Priority: 1
75+
SortPriority: 0
76+
- Regex: '^<.*'
77+
Priority: 2
78+
SortPriority: 0
79+
- Regex: '.*'
80+
Priority: 3
81+
SortPriority: 0
82+
IncludeIsMainRegex: '([-_](test|unittest))?$'
83+
IncludeIsMainSourceRegex: ''
84+
IndentAccessModifiers: false
85+
IndentCaseBlocks: true
86+
IndentCaseLabels: true
87+
IndentExternBlock: NoIndent
88+
IndentGotoLabels: false
89+
IndentPPDirectives: AfterHash
90+
IndentWidth: 4
91+
IndentWrappedFunctionNames: false
92+
InsertBraces: true # NOTE: may lead to incorrect formatting
93+
InsertNewlineAtEOF: true
94+
JavaScriptQuotes: Leave
95+
JavaScriptWrapImports: true
96+
KeepEmptyLinesAtTheStartOfBlocks: false
97+
LambdaBodyIndentation: Signature
98+
LineEnding: LF
99+
MacroBlockBegin: ''
100+
MacroBlockEnd: ''
101+
MaxEmptyLinesToKeep: 1
102+
NamespaceIndentation: None
103+
ObjCBinPackProtocolList: Auto
104+
ObjCBlockIndentWidth: 4
105+
ObjCSpaceAfterProperty: true
106+
ObjCSpaceBeforeProtocolList: true
107+
PPIndentWidth: -1
108+
PackConstructorInitializers: CurrentLine
109+
PenaltyBreakAssignment: 2
110+
PenaltyBreakBeforeFirstCallParameter: 1
111+
PenaltyBreakComment: 300
112+
PenaltyBreakFirstLessLess: 120
113+
PenaltyBreakString: 1000
114+
PenaltyBreakTemplateDeclaration: 10
115+
PenaltyExcessCharacter: 1000000
116+
PenaltyReturnTypeOnItsOwnLine: 200
117+
PointerAlignment: Middle
118+
QualifierAlignment: Left
119+
#QualifierOrder: ['static', 'inline', 'friend', 'constexpr', 'const', 'volatile', 'type', 'restrict']
120+
RawStringFormats:
121+
- Language: Cpp
122+
Delimiters:
123+
- cc
124+
- CC
125+
- cpp
126+
- Cpp
127+
- CPP
128+
- 'c++'
129+
- 'C++'
130+
CanonicalDelimiter: ''
131+
ReferenceAlignment: Middle
132+
ReflowComments: false # IndentOnly
133+
SeparateDefinitionBlocks: Always
134+
SortIncludes: CaseInsensitive
135+
SortUsingDeclarations: LexicographicNumeric
136+
SpaceAfterCStyleCast: true
137+
SpaceAfterLogicalNot: false
138+
SpaceAfterTemplateKeyword: true
139+
SpaceBeforeAssignmentOperators: true
140+
SpaceBeforeCpp11BracedList: false
141+
SpaceBeforeCtorInitializerColon: true
142+
SpaceBeforeInheritanceColon: true
143+
SpaceBeforeParens: ControlStatements
144+
SpaceBeforeRangeBasedForLoopColon: true
145+
SpaceInEmptyBlock: false
146+
SpaceInEmptyParentheses: false
147+
SpacesBeforeTrailingComments: 2
148+
SpacesInAngles: Never
149+
SpacesInContainerLiterals: true
150+
SpacesInLineCommentPrefix:
151+
Minimum: 1
152+
Maximum: -1
153+
SpacesInParentheses: false
154+
SpacesInSquareBrackets: false
155+
SpaceBeforeSquareBrackets: false
156+
Standard: c++17
157+
TabWidth: 4
158+
UseTab: Never
159+
WhitespaceSensitiveMacros: ['STRINGIZE']
160+
...
161+

.clang-tidy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ Checks: >
1717
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
1818
performance-*,
1919
portability-*,
20+
-portability-simd-intrinsics,
2021
misc-*,
2122
-misc-const-correctness,
2223
-misc-non-private-member-variables-in-classes,
2324
-misc-no-recursion,
25+
-misc-use-anonymous-namespace,
2426
FormatStyle: none

.devops/full-cuda.Dockerfile

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
ARG UBUNTU_VERSION=22.04
2-
32
# This needs to generally match the container host's environment.
4-
ARG CUDA_VERSION=11.7.1
5-
3+
ARG CUDA_VERSION=12.6.0
64
# Target the CUDA build image
75
ARG BASE_CUDA_DEV_CONTAINER=nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION}
86

97
FROM ${BASE_CUDA_DEV_CONTAINER} AS build
108

11-
# Unless otherwise specified, we make a fat build.
12-
ARG CUDA_DOCKER_ARCH=all
9+
# CUDA architecture to build for (defaults to all supported archs)
10+
ARG CUDA_DOCKER_ARCH=default
1311

1412
RUN apt-get update && \
15-
apt-get install -y build-essential python3 python3-pip git libcurl4-openssl-dev libgomp1
13+
apt-get install -y build-essential cmake python3 python3-pip git libcurl4-openssl-dev libgomp1
1614

1715
COPY requirements.txt requirements.txt
1816
COPY requirements requirements
@@ -24,13 +22,12 @@ WORKDIR /app
2422

2523
COPY . .
2624

27-
# Set nvcc architecture
28-
ENV CUDA_DOCKER_ARCH=${CUDA_DOCKER_ARCH}
29-
# Enable CUDA
30-
ENV GGML_CUDA=1
31-
# Enable cURL
32-
ENV LLAMA_CURL=1
33-
34-
RUN make -j$(nproc)
25+
# Use the default CUDA archs if not specified
26+
RUN if [ "${CUDA_DOCKER_ARCH}" != "default" ]; then \
27+
export CMAKE_ARGS="-DCMAKE_CUDA_ARCHITECTURES=${CUDA_DOCKER_ARCH}"; \
28+
fi && \
29+
cmake -B build -DGGML_NATIVE=OFF -DGGML_CUDA=ON -DLLAMA_CURL=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
30+
cmake --build build --config Release -j$(nproc) && \
31+
cp build/bin/* .
3532

3633
ENTRYPOINT ["/app/.devops/tools.sh"]

.devops/full-musa.Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
ARG UBUNTU_VERSION=22.04
2+
# This needs to generally match the container host's environment.
3+
ARG MUSA_VERSION=rc3.1.0
4+
# Target the MUSA build image
5+
ARG BASE_MUSA_DEV_CONTAINER=mthreads/musa:${MUSA_VERSION}-devel-ubuntu${UBUNTU_VERSION}
6+
7+
FROM ${BASE_MUSA_DEV_CONTAINER} AS build
8+
9+
# MUSA architecture to build for (defaults to all supported archs)
10+
ARG MUSA_DOCKER_ARCH=default
11+
12+
RUN apt-get update && \
13+
apt-get install -y build-essential cmake python3 python3-pip git libcurl4-openssl-dev libgomp1
14+
15+
COPY requirements.txt requirements.txt
16+
COPY requirements requirements
17+
18+
RUN pip install --upgrade pip setuptools wheel \
19+
&& pip install -r requirements.txt
20+
21+
WORKDIR /app
22+
23+
COPY . .
24+
25+
# Use the default MUSA archs if not specified
26+
RUN if [ "${MUSA_DOCKER_ARCH}" != "default" ]; then \
27+
export CMAKE_ARGS="-DMUSA_ARCHITECTURES=${MUSA_DOCKER_ARCH}"; \
28+
fi && \
29+
cmake -B build -DGGML_NATIVE=OFF -DGGML_MUSA=ON -DLLAMA_CURL=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
30+
cmake --build build --config Release -j$(nproc) && \
31+
cp build/bin/* .
32+
33+
ENTRYPOINT ["/app/.devops/tools.sh"]

.devops/full-rocm.Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ FROM ${BASE_ROCM_DEV_CONTAINER} AS build
1111
# Unless otherwise specified, we make a fat build.
1212
# List from https://github.com/ggerganov/llama.cpp/pull/1087#issuecomment-1682807878
1313
# This is mostly tied to rocBLAS supported archs.
14-
ARG ROCM_DOCKER_ARCH=\
14+
ARG ROCM_DOCKER_ARCH="\
1515
gfx803 \
1616
gfx900 \
1717
gfx906 \
@@ -21,7 +21,7 @@ ARG ROCM_DOCKER_ARCH=\
2121
gfx1030 \
2222
gfx1100 \
2323
gfx1101 \
24-
gfx1102
24+
gfx1102"
2525

2626
COPY requirements.txt requirements.txt
2727
COPY requirements requirements
@@ -34,7 +34,7 @@ WORKDIR /app
3434
COPY . .
3535

3636
# Set nvcc architecture
37-
ENV GPU_TARGETS=${ROCM_DOCKER_ARCH}
37+
ENV AMDGPU_TARGETS=${ROCM_DOCKER_ARCH}
3838
# Enable ROCm
3939
ENV GGML_HIPBLAS=1
4040
ENV CC=/opt/rocm/llvm/bin/clang

.devops/llama-cli-cann.Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG ASCEND_VERSION=8.0.rc2.alpha003-910b-openeuler22.03-py3.8
22

3-
FROM cosdt/cann:$ASCEND_VERSION AS build
3+
FROM ascendai/cann:$ASCEND_VERSION AS build
44

55
WORKDIR /app
66

@@ -22,11 +22,11 @@ ENV LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/runtime/lib64/stub:$LD_LIBRARY_PATH
2222

2323
RUN echo "Building with static libs" && \
2424
source /usr/local/Ascend/ascend-toolkit/set_env.sh --force && \
25-
cmake -B build -DGGML_CANN=ON -DBUILD_SHARED_LIBS=OFF && \
25+
cmake -B build -DGGML_NATIVE=OFF -DGGML_CANN=ON -DBUILD_SHARED_LIBS=OFF && \
2626
cmake --build build --config Release --target llama-cli
2727

2828
# TODO: use image with NNRT
29-
FROM cosdt/cann:$ASCEND_VERSION AS runtime
29+
FROM ascendai/cann:$ASCEND_VERSION AS runtime
3030
COPY --from=build /app/build/bin/llama-cli /llama-cli
3131

3232
ENV LC_ALL=C.utf8

.devops/llama-cli-cuda.Dockerfile

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
ARG UBUNTU_VERSION=22.04
22
# This needs to generally match the container host's environment.
3-
ARG CUDA_VERSION=11.7.1
3+
ARG CUDA_VERSION=12.6.0
44
# Target the CUDA build image
55
ARG BASE_CUDA_DEV_CONTAINER=nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION}
66
# Target the CUDA runtime image
77
ARG BASE_CUDA_RUN_CONTAINER=nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu${UBUNTU_VERSION}
88

99
FROM ${BASE_CUDA_DEV_CONTAINER} AS build
1010

11-
# Unless otherwise specified, we make a fat build.
12-
ARG CUDA_DOCKER_ARCH=all
11+
# CUDA architecture to build for (defaults to all supported archs)
12+
ARG CUDA_DOCKER_ARCH=default
1313

1414
RUN apt-get update && \
15-
apt-get install -y build-essential git
15+
apt-get install -y build-essential git cmake
1616

1717
WORKDIR /app
1818

1919
COPY . .
2020

21-
# Set nvcc architecture
22-
ENV CUDA_DOCKER_ARCH=${CUDA_DOCKER_ARCH}
23-
# Enable CUDA
24-
ENV GGML_CUDA=1
25-
26-
RUN make -j$(nproc) llama-cli
21+
# Use the default CUDA archs if not specified
22+
RUN if [ "${CUDA_DOCKER_ARCH}" != "default" ]; then \
23+
export CMAKE_ARGS="-DCMAKE_CUDA_ARCHITECTURES=${CUDA_DOCKER_ARCH}"; \
24+
fi && \
25+
cmake -B build -DGGML_NATIVE=OFF -DGGML_CUDA=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
26+
cmake --build build --config Release --target llama-cli -j$(nproc) && \
27+
mkdir -p /app/lib && \
28+
find build -name "*.so" -exec cp {} /app/lib \;
2729

2830
FROM ${BASE_CUDA_RUN_CONTAINER} AS runtime
2931

3032
RUN apt-get update && \
3133
apt-get install -y libgomp1
3234

33-
COPY --from=build /app/llama-cli /llama-cli
35+
COPY --from=build /app/lib/ /
36+
COPY --from=build /app/build/bin/llama-cli /
3437

3538
ENTRYPOINT [ "/llama-cli" ]

.devops/llama-cli-intel.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG ONEAPI_VERSION=2024.1.1-devel-ubuntu22.04
1+
ARG ONEAPI_VERSION=2025.0.0-0-devel-ubuntu22.04
22

33
FROM intel/oneapi-basekit:$ONEAPI_VERSION AS build
44

@@ -15,7 +15,7 @@ RUN if [ "${GGML_SYCL_F16}" = "ON" ]; then \
1515
export OPT_SYCL_F16="-DGGML_SYCL_F16=ON"; \
1616
fi && \
1717
echo "Building with static libs" && \
18-
cmake -B build -DGGML_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx \
18+
cmake -B build -DGGML_NATIVE=OFF -DGGML_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx \
1919
${OPT_SYCL_F16} -DBUILD_SHARED_LIBS=OFF && \
2020
cmake --build build --config Release --target llama-cli
2121

0 commit comments

Comments
 (0)