Skip to content

Commit 1ee6c48

Browse files
committed
Merge branch 'master' into compilade/mamba2
2 parents b4e9c59 + a9a678a commit 1ee6c48

File tree

343 files changed

+61982
-31050
lines changed

Some content is hidden

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

343 files changed

+61982
-31050
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+

.devops/full-cuda.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ COPY . .
2626
RUN if [ "${CUDA_DOCKER_ARCH}" != "default" ]; then \
2727
export CMAKE_ARGS="-DCMAKE_CUDA_ARCHITECTURES=${CUDA_DOCKER_ARCH}"; \
2828
fi && \
29-
cmake -B build -DGGML_CUDA=ON -DLLAMA_CURL=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
29+
cmake -B build -DGGML_NATIVE=OFF -DGGML_CUDA=ON -DLLAMA_CURL=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
3030
cmake --build build --config Release -j$(nproc) && \
3131
cp build/bin/* .
3232

.devops/full-musa.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ WORKDIR /app
1919

2020
COPY . .
2121

22-
RUN cmake -B build -DGGML_MUSA=ON -DLLAMA_CURL=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
22+
RUN cmake -B build -DGGML_NATIVE=OFF -DGGML_MUSA=ON -DLLAMA_CURL=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
2323
cmake --build build --config Release -j$(nproc) && \
2424
cp build/bin/* .
2525

.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: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,17 @@ COPY . .
2222
RUN if [ "${CUDA_DOCKER_ARCH}" != "default" ]; then \
2323
export CMAKE_ARGS="-DCMAKE_CUDA_ARCHITECTURES=${CUDA_DOCKER_ARCH}"; \
2424
fi && \
25-
cmake -B build -DGGML_CUDA=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
26-
cmake --build build --config Release --target llama-cli -j$(nproc)
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/build/ggml/src/libggml.so /libggml.so
34-
COPY --from=build /app/build/src/libllama.so /libllama.so
35-
COPY --from=build /app/build/bin/llama-cli /llama-cli
35+
COPY --from=build /app/lib/ /
36+
COPY --from=build /app/build/bin/llama-cli /
3637

3738
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

.devops/llama-cli-musa.Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ WORKDIR /app
1515

1616
COPY . .
1717

18-
RUN cmake -B build -DGGML_MUSA=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
19-
cmake --build build --config Release --target llama-cli -j$(nproc)
18+
RUN cmake -B build -DGGML_NATIVE=OFF -DGGML_MUSA=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
19+
cmake --build build --config Release --target llama-cli -j$(nproc) && \
20+
mkdir -p /app/lib && \
21+
find build -name "*.so" -exec cp {} /app/lib \;
2022

2123
FROM ${BASE_MUSA_RUN_CONTAINER} AS runtime
2224

2325
RUN apt-get update && \
2426
apt-get install -y libgomp1
2527

26-
COPY --from=build /app/build/ggml/src/libggml.so /libggml.so
27-
COPY --from=build /app/build/src/libllama.so /libllama.so
28+
COPY --from=build /app/lib/ /
2829
COPY --from=build /app/build/bin/llama-cli /llama-cli
2930

3031
ENTRYPOINT [ "/llama-cli" ]

.devops/llama-cli-vulkan.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | apt-key
1414
# Build it
1515
WORKDIR /app
1616
COPY . .
17-
RUN cmake -B build -DGGML_VULKAN=1 && \
17+
RUN cmake -B build -DGGML_NATIVE=OFF -DGGML_VULKAN=1 && \
1818
cmake --build build --config Release --target llama-cli
1919

2020
# Clean up

.devops/llama-server-cuda.Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,17 @@ COPY . .
2222
RUN if [ "${CUDA_DOCKER_ARCH}" != "default" ]; then \
2323
export CMAKE_ARGS="-DCMAKE_CUDA_ARCHITECTURES=${CUDA_DOCKER_ARCH}"; \
2424
fi && \
25-
cmake -B build -DGGML_CUDA=ON -DLLAMA_CURL=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
26-
cmake --build build --config Release --target llama-server -j$(nproc)
25+
cmake -B build -DGGML_NATIVE=OFF -DGGML_CUDA=ON -DLLAMA_CURL=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
26+
cmake --build build --config Release --target llama-server -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 libcurl4-openssl-dev libgomp1 curl
3234

33-
COPY --from=build /app/build/ggml/src/libggml.so /libggml.so
34-
COPY --from=build /app/build/src/libllama.so /libllama.so
35+
COPY --from=build /app/lib/ /
3536
COPY --from=build /app/build/bin/llama-server /llama-server
3637

3738
# Must be set to 0.0.0.0 so it can listen to requests from host machine

.devops/llama-server-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 dynamic libs" && \
18-
cmake -B build -DGGML_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DLLAMA_CURL=ON ${OPT_SYCL_F16} && \
18+
cmake -B build -DGGML_NATIVE=OFF -DGGML_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DLLAMA_CURL=ON ${OPT_SYCL_F16} && \
1919
cmake --build build --config Release --target llama-server
2020

2121
FROM intel/oneapi-basekit:$ONEAPI_VERSION AS runtime

.devops/llama-server-musa.Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ WORKDIR /app
1515

1616
COPY . .
1717

18-
RUN cmake -B build -DGGML_MUSA=ON -DLLAMA_CURL=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
19-
cmake --build build --config Release --target llama-server -j$(nproc)
18+
RUN cmake -B build -DGGML_NATIVE=OFF -DGGML_MUSA=ON -DLLAMA_CURL=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
19+
cmake --build build --config Release --target llama-server -j$(nproc) && \
20+
mkdir -p /app/lib && \
21+
find build -name "*.so" -exec cp {} /app/lib \;
2022

2123
FROM ${BASE_MUSA_RUN_CONTAINER} AS runtime
2224

2325
RUN apt-get update && \
2426
apt-get install -y libcurl4-openssl-dev libgomp1 curl
2527

26-
COPY --from=build /app/build/ggml/src/libggml.so /libggml.so
27-
COPY --from=build /app/build/src/libllama.so /libllama.so
28+
COPY --from=build /app/lib/ /
2829
COPY --from=build /app/build/bin/llama-server /llama-server
2930

3031
# Must be set to 0.0.0.0 so it can listen to requests from host machine

.devops/llama-server-vulkan.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | apt-key
1414
# Build it
1515
WORKDIR /app
1616
COPY . .
17-
RUN cmake -B build -DGGML_VULKAN=1 -DLLAMA_CURL=1 && \
17+
RUN cmake -B build -DGGML_NATIVE=OFF -DGGML_VULKAN=1 -DLLAMA_CURL=1 && \
1818
cmake --build build --config Release --target llama-server
1919

2020
# Clean up

.devops/nix/package.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ effectiveStdenv.mkDerivation (finalAttrs: {
126126
};
127127

128128
postPatch = ''
129-
substituteInPlace ./ggml/src/ggml-metal.m \
129+
substituteInPlace ./ggml/src/ggml-metal/ggml-metal.m \
130130
--replace '[bundle pathForResource:@"ggml-metal" ofType:@"metal"];' "@\"$out/bin/ggml-metal.metal\";"
131-
substituteInPlace ./ggml/src/ggml-metal.m \
131+
substituteInPlace ./ggml/src/ggml-metal/ggml-metal.m \
132132
--replace '[bundle pathForResource:@"default" ofType:@"metallib"];' "@\"$out/bin/default.metallib\";"
133133
'';
134134

@@ -173,7 +173,7 @@ effectiveStdenv.mkDerivation (finalAttrs: {
173173
(cmakeBool "GGML_NATIVE" false)
174174
(cmakeBool "GGML_BLAS" useBlas)
175175
(cmakeBool "GGML_CUDA" useCuda)
176-
(cmakeBool "GGML_HIPBLAS" useRocm)
176+
(cmakeBool "GGML_HIP" useRocm)
177177
(cmakeBool "GGML_METAL" useMetalKit)
178178
(cmakeBool "GGML_VULKAN" useVulkan)
179179
(cmakeBool "GGML_STATIC" enableStatic)

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ insert_final_newline = unset
2424
[examples/server/public/*]
2525
indent_size = 2
2626

27+
[examples/server/public/deps_*]
28+
trim_trailing_whitespace = unset
29+
indent_style = unset
30+
indent_size = unset
31+
32+
[examples/server/deps_*]
33+
trim_trailing_whitespace = unset
34+
indent_style = unset
35+
indent_size = unset
36+
2737
[examples/llama.swiftui/llama.swiftui.xcodeproj/*]
2838
indent_style = tab
2939

0 commit comments

Comments
 (0)