diff --git a/.clang-format b/.clang-format
new file mode 100644
index 000000000..45232b80e
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,161 @@
+---
+Language: Cpp
+AlignAfterOpenBracket: Align
+AlignArrayOfStructures: Left
+AlignConsecutiveAssignments: AcrossComments
+AlignConsecutiveBitFields: AcrossComments
+AlignConsecutiveDeclarations: AcrossComments
+AlignConsecutiveMacros: AcrossComments
+# AlignConsecutiveShortCaseStatements: AcrossComments
+AlignEscapedNewlines: Left # LeftWithLastLine
+AlignOperands: Align
+AlignTrailingComments:
+ Kind: Always
+ OverEmptyLines: 1
+AllowAllArgumentsOnNextLine: true
+AllowAllParametersOfDeclarationOnNextLine: false
+# AllowBreakBeforeNoexceptSpecifier: OnlyWithParen
+AllowShortBlocksOnASingleLine: Never
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: Inline
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLambdasOnASingleLine: Inline
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakBeforeMultilineStrings: true
+BinPackArguments: true
+BinPackParameters: true # OnePerLine
+BitFieldColonSpacing: Both
+BreakBeforeBraces: Custom # Attach
+BraceWrapping:
+ AfterCaseLabel: true
+ AfterClass: false
+ AfterControlStatement: false
+ AfterEnum: false
+ AfterFunction: false
+ AfterNamespace: false
+ AfterObjCDeclaration: false
+ AfterStruct: false
+ AfterUnion: false
+ AfterExternBlock: false
+ BeforeCatch: false
+ BeforeElse: false
+ BeforeLambdaBody: false
+ BeforeWhile: false
+ IndentBraces: false
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+ SplitEmptyNamespace: false
+# BreakAdjacentStringLiterals: true
+BreakAfterAttributes: Never
+BreakBeforeBinaryOperators: None
+BreakBeforeInlineASMColon: OnlyMultiline
+BreakBeforeTernaryOperators: false
+# BreakBinaryOperations: Never
+BreakConstructorInitializers: AfterColon
+# BreakFunctionDefinitionParameters: false
+BreakInheritanceList: AfterComma
+BreakStringLiterals: true
+# BreakTemplateDeclarations: Yes
+ColumnLimit: 120
+CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: false
+DerivePointerAlignment: false
+DisableFormat: false
+EmptyLineBeforeAccessModifier: Leave
+EmptyLineAfterAccessModifier: Never
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+IncludeBlocks: Regroup
+IncludeCategories:
+ - Regex: '^<.*\.h>'
+ Priority: 1
+ SortPriority: 0
+ - Regex: '^<.*'
+ Priority: 2
+ SortPriority: 0
+ - Regex: '.*'
+ Priority: 3
+ SortPriority: 0
+IncludeIsMainRegex: '([-_](test|unittest))?$'
+IncludeIsMainSourceRegex: ''
+IndentAccessModifiers: false
+IndentCaseBlocks: true
+IndentCaseLabels: true
+IndentExternBlock: NoIndent
+IndentGotoLabels: false
+IndentPPDirectives: AfterHash
+IndentWidth: 4
+IndentWrappedFunctionNames: false
+InsertBraces: true # NOTE: may lead to incorrect formatting
+InsertNewlineAtEOF: true
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: Signature
+LineEnding: LF
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBinPackProtocolList: Auto
+ObjCBlockIndentWidth: 4
+ObjCSpaceAfterProperty: true
+ObjCSpaceBeforeProtocolList: true
+PPIndentWidth: -1
+PackConstructorInitializers: CurrentLine
+PenaltyBreakAssignment: 2
+PenaltyBreakBeforeFirstCallParameter: 1
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 200
+PointerAlignment: Middle
+QualifierAlignment: Left
+#QualifierOrder: ['static', 'inline', 'friend', 'constexpr', 'const', 'volatile', 'type', 'restrict']
+RawStringFormats:
+ - Language: Cpp
+ Delimiters:
+ - cc
+ - CC
+ - cpp
+ - Cpp
+ - CPP
+ - 'c++'
+ - 'C++'
+ CanonicalDelimiter: ''
+ReferenceAlignment: Middle
+ReflowComments: false # IndentOnly
+SeparateDefinitionBlocks: Always
+SortIncludes: CaseInsensitive
+SortUsingDeclarations: LexicographicNumeric
+SpaceAfterCStyleCast: true
+SpaceAfterLogicalNot: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceInEmptyBlock: false
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 2
+SpacesInAngles: Never
+SpacesInContainerLiterals: true
+SpacesInLineCommentPrefix:
+ Minimum: 1
+ Maximum: -1
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+SpaceBeforeSquareBrackets: false
+Standard: c++17
+TabWidth: 4
+UseTab: Never
+WhitespaceSensitiveMacros: ['STRINGIZE']
+...
+
diff --git a/.github/ISSUE_TEMPLATE/01-bug-low.yml b/.github/ISSUE_TEMPLATE/01-bug-low.yml
deleted file mode 100644
index 54785854f..000000000
--- a/.github/ISSUE_TEMPLATE/01-bug-low.yml
+++ /dev/null
@@ -1,50 +0,0 @@
-name: Low Severity Bugs
-description: Used to report low severity bugs in llama.cpp (e.g. cosmetic issues, non critical UI glitches)
-title: "Bug: "
-labels: ["bug-unconfirmed", "low severity"]
-body:
- - type: markdown
- attributes:
- value: |
- Thanks for taking the time to fill out this bug report!
- Please include information about your system, the steps to reproduce the bug,
- and the version of llama.cpp that you are using.
- If possible, please provide a minimal code example that reproduces the bug.
- - type: textarea
- id: what-happened
- attributes:
- label: What happened?
- description: Also tell us, what did you expect to happen?
- placeholder: Tell us what you see!
- validations:
- required: true
- - type: textarea
- id: version
- attributes:
- label: Name and Version
- description: Which executable and which version of our software are you running? (use `--version` to get a version string)
- placeholder: |
- $./llama-cli --version
- version: 2999 (42b4109e)
- built with cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 for x86_64-linux-gnu
- validations:
- required: true
- - type: dropdown
- id: operating-system
- attributes:
- label: What operating system are you seeing the problem on?
- multiple: true
- options:
- - Linux
- - Mac
- - Windows
- - BSD
- - Other? (Please let us know in description)
- validations:
- required: false
- - type: textarea
- id: logs
- attributes:
- label: Relevant log output
- description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
- render: shell
diff --git a/.github/ISSUE_TEMPLATE/010-bug-compilation.yml b/.github/ISSUE_TEMPLATE/010-bug-compilation.yml
new file mode 100644
index 000000000..550ee1b49
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/010-bug-compilation.yml
@@ -0,0 +1,73 @@
+name: Bug (compilation)
+description: Something goes wrong when trying to compile llama.cpp.
+title: "Compile bug: "
+labels: ["bug-unconfirmed", "compilation"]
+body:
+ - type: markdown
+ attributes:
+ value: >
+ Thanks for taking the time to fill out this bug report!
+ This issue template is intended for bug reports where the compilation of llama.cpp fails.
+ Before opening an issue, please confirm that the compilation still fails with `-DGGML_CCACHE=OFF`.
+ If the compilation succeeds with ccache disabled you should be able to permanently fix the issue
+ by clearing `~/.cache/ccache` (on Linux).
+ - type: textarea
+ id: commit
+ attributes:
+ label: Git commit
+ description: Which commit are you trying to compile?
+ placeholder: |
+ $git rev-parse HEAD
+ 84a07a17b1b08cf2b9747c633a2372782848a27f
+ validations:
+ required: true
+ - type: dropdown
+ id: operating-system
+ attributes:
+ label: Which operating systems do you know to be affected?
+ multiple: true
+ options:
+ - Linux
+ - Mac
+ - Windows
+ - BSD
+ - Other? (Please let us know in description)
+ validations:
+ required: true
+ - type: dropdown
+ id: backends
+ attributes:
+ label: GGML backends
+ description: Which GGML backends do you know to be affected?
+ options: [AMX, BLAS, CPU, CUDA, HIP, Kompute, Metal, Musa, RPC, SYCL, Vulkan]
+ multiple: true
+ - type: textarea
+ id: steps_to_reproduce
+ attributes:
+ label: Steps to Reproduce
+ description: >
+ Please tell us how to reproduce the bug and any additional information that you think could be useful for fixing it.
+ If you can narrow down the bug to specific compile flags, that information would be very much appreciated by us.
+ placeholder: >
+ Here are the exact commands that I used: ...
+ validations:
+ required: true
+ - type: textarea
+ id: first_bad_commit
+ attributes:
+ label: First Bad Commit
+ description: >
+ If the bug was not present on an earlier version: when did it start appearing?
+ If possible, please do a git bisect and identify the exact commit that introduced the bug.
+ validations:
+ required: false
+ - type: textarea
+ id: logs
+ attributes:
+ label: Relevant log output
+ description: >
+ Please copy and paste any relevant log output, including the command that you entered and any generated text.
+ This will be automatically formatted into code, so no need for backticks.
+ render: shell
+ validations:
+ required: true
diff --git a/.github/ISSUE_TEMPLATE/011-bug-results.yml b/.github/ISSUE_TEMPLATE/011-bug-results.yml
new file mode 100644
index 000000000..1adb162b7
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/011-bug-results.yml
@@ -0,0 +1,98 @@
+name: Bug (model use)
+description: Something goes wrong when using a model (in general, not specific to a single llama.cpp module).
+title: "Eval bug: "
+labels: ["bug-unconfirmed", "model evaluation"]
+body:
+ - type: markdown
+ attributes:
+ value: >
+ Thanks for taking the time to fill out this bug report!
+ This issue template is intended for bug reports where the model evaluation results
+ (i.e. the generated text) are incorrect or llama.cpp crashes during model evaluation.
+ If you encountered the issue while using an external UI (e.g. ollama),
+ please reproduce your issue using one of the examples/binaries in this repository.
+ The `llama-cli` binary can be used for simple and reproducible model inference.
+ - type: textarea
+ id: version
+ attributes:
+ label: Name and Version
+ description: Which version of our software are you running? (use `--version` to get a version string)
+ placeholder: |
+ $./llama-cli --version
+ version: 2999 (42b4109e)
+ built with cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 for x86_64-linux-gnu
+ validations:
+ required: true
+ - type: dropdown
+ id: operating-system
+ attributes:
+ label: Which operating systems do you know to be affected?
+ multiple: true
+ options:
+ - Linux
+ - Mac
+ - Windows
+ - BSD
+ - Other? (Please let us know in description)
+ validations:
+ required: true
+ - type: dropdown
+ id: backends
+ attributes:
+ label: GGML backends
+ description: Which GGML backends do you know to be affected?
+ options: [AMX, BLAS, CPU, CUDA, HIP, Kompute, Metal, Musa, RPC, SYCL, Vulkan]
+ multiple: true
+ - type: textarea
+ id: hardware
+ attributes:
+ label: Hardware
+ description: Which CPUs/GPUs are you using?
+ placeholder: >
+ e.g. Ryzen 5950X + 2x RTX 4090
+ validations:
+ required: true
+ - type: textarea
+ id: model
+ attributes:
+ label: Model
+ description: >
+ Which model at which quantization were you using when encountering the bug?
+ If you downloaded a GGUF file off of Huggingface, please provide a link.
+ placeholder: >
+ e.g. Meta LLaMA 3.1 Instruct 8b q4_K_M
+ validations:
+ required: false
+ - type: textarea
+ id: steps_to_reproduce
+ attributes:
+ label: Steps to Reproduce
+ description: >
+ Please tell us how to reproduce the bug and any additional information that you think could be useful for fixing it.
+ If you can narrow down the bug to specific hardware, compile flags, or command line arguments,
+ that information would be very much appreciated by us.
+ placeholder: >
+ e.g. when I run llama-cli with -ngl 99 I get garbled outputs.
+ When I use -ngl 0 it works correctly.
+ Here are the exact commands that I used: ...
+ validations:
+ required: true
+ - type: textarea
+ id: first_bad_commit
+ attributes:
+ label: First Bad Commit
+ description: >
+ If the bug was not present on an earlier version: when did it start appearing?
+ If possible, please do a git bisect and identify the exact commit that introduced the bug.
+ validations:
+ required: false
+ - type: textarea
+ id: logs
+ attributes:
+ label: Relevant log output
+ description: >
+ Please copy and paste any relevant log output, including the command that you entered and any generated text.
+ This will be automatically formatted into code, so no need for backticks.
+ render: shell
+ validations:
+ required: true
diff --git a/.github/ISSUE_TEMPLATE/019-bug-misc.yml b/.github/ISSUE_TEMPLATE/019-bug-misc.yml
new file mode 100644
index 000000000..124cdee91
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/019-bug-misc.yml
@@ -0,0 +1,78 @@
+name: Bug (misc.)
+description: Something is not working the way it should (and it's not covered by any of the above cases).
+title: "Misc. bug: "
+labels: ["bug-unconfirmed"]
+body:
+ - type: markdown
+ attributes:
+ value: >
+ Thanks for taking the time to fill out this bug report!
+ This issue template is intended for miscellaneous bugs that don't fit into any other category.
+ If you encountered the issue while using an external UI (e.g. ollama),
+ please reproduce your issue using one of the examples/binaries in this repository.
+ - type: textarea
+ id: version
+ attributes:
+ label: Name and Version
+ description: Which version of our software are you running? (use `--version` to get a version string)
+ placeholder: |
+ $./llama-cli --version
+ version: 2999 (42b4109e)
+ built with cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 for x86_64-linux-gnu
+ validations:
+ required: true
+ - type: dropdown
+ id: operating-system
+ attributes:
+ label: Which operating systems do you know to be affected?
+ multiple: true
+ options:
+ - Linux
+ - Mac
+ - Windows
+ - BSD
+ - Other? (Please let us know in description)
+ validations:
+ required: true
+ - type: dropdown
+ id: module
+ attributes:
+ label: Which llama.cpp modules do you know to be affected?
+ multiple: true
+ options:
+ - libllama (core library)
+ - llama-cli
+ - llama-server
+ - llama-bench
+ - llama-quantize
+ - Python/Bash scripts
+ - Other (Please specify in the next section)
+ validations:
+ required: true
+ - type: textarea
+ id: steps_to_reproduce
+ attributes:
+ label: Steps to Reproduce
+ description: >
+ Please tell us how to reproduce the bug and any additional information that you think could be useful for fixing it.
+ validations:
+ required: true
+ - type: textarea
+ id: first_bad_commit
+ attributes:
+ label: First Bad Commit
+ description: >
+ If the bug was not present on an earlier version: when did it start appearing?
+ If possible, please do a git bisect and identify the exact commit that introduced the bug.
+ validations:
+ required: false
+ - type: textarea
+ id: logs
+ attributes:
+ label: Relevant log output
+ description: >
+ Please copy and paste any relevant log output, including the command that you entered and any generated text.
+ This will be automatically formatted into code, so no need for backticks.
+ render: shell
+ validations:
+ required: true
diff --git a/.github/ISSUE_TEMPLATE/02-bug-medium.yml b/.github/ISSUE_TEMPLATE/02-bug-medium.yml
deleted file mode 100644
index a6285c6f0..000000000
--- a/.github/ISSUE_TEMPLATE/02-bug-medium.yml
+++ /dev/null
@@ -1,50 +0,0 @@
-name: Medium Severity Bug
-description: Used to report medium severity bugs in llama.cpp (e.g. Malfunctioning Features but generally still useable)
-title: "Bug: "
-labels: ["bug-unconfirmed", "medium severity"]
-body:
- - type: markdown
- attributes:
- value: |
- Thanks for taking the time to fill out this bug report!
- Please include information about your system, the steps to reproduce the bug,
- and the version of llama.cpp that you are using.
- If possible, please provide a minimal code example that reproduces the bug.
- - type: textarea
- id: what-happened
- attributes:
- label: What happened?
- description: Also tell us, what did you expect to happen?
- placeholder: Tell us what you see!
- validations:
- required: true
- - type: textarea
- id: version
- attributes:
- label: Name and Version
- description: Which executable and which version of our software are you running? (use `--version` to get a version string)
- placeholder: |
- $./llama-cli --version
- version: 2999 (42b4109e)
- built with cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 for x86_64-linux-gnu
- validations:
- required: true
- - type: dropdown
- id: operating-system
- attributes:
- label: What operating system are you seeing the problem on?
- multiple: true
- options:
- - Linux
- - Mac
- - Windows
- - BSD
- - Other? (Please let us know in description)
- validations:
- required: false
- - type: textarea
- id: logs
- attributes:
- label: Relevant log output
- description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
- render: shell
diff --git a/.github/ISSUE_TEMPLATE/05-enhancement.yml b/.github/ISSUE_TEMPLATE/020-enhancement.yml
similarity index 97%
rename from .github/ISSUE_TEMPLATE/05-enhancement.yml
rename to .github/ISSUE_TEMPLATE/020-enhancement.yml
index 58fca7318..02dd4f575 100644
--- a/.github/ISSUE_TEMPLATE/05-enhancement.yml
+++ b/.github/ISSUE_TEMPLATE/020-enhancement.yml
@@ -1,5 +1,5 @@
name: Enhancement
-description: Used to request enhancements for llama.cpp
+description: Used to request enhancements for llama.cpp.
title: "Feature Request: "
labels: ["enhancement"]
body:
diff --git a/.github/ISSUE_TEMPLATE/03-bug-high.yml b/.github/ISSUE_TEMPLATE/03-bug-high.yml
deleted file mode 100644
index ff816b937..000000000
--- a/.github/ISSUE_TEMPLATE/03-bug-high.yml
+++ /dev/null
@@ -1,50 +0,0 @@
-name: High Severity Bug
-description: Used to report high severity bugs in llama.cpp (e.g. Malfunctioning features hindering important common workflow)
-title: "Bug: "
-labels: ["bug-unconfirmed", "high severity"]
-body:
- - type: markdown
- attributes:
- value: |
- Thanks for taking the time to fill out this bug report!
- Please include information about your system, the steps to reproduce the bug,
- and the version of llama.cpp that you are using.
- If possible, please provide a minimal code example that reproduces the bug.
- - type: textarea
- id: what-happened
- attributes:
- label: What happened?
- description: Also tell us, what did you expect to happen?
- placeholder: Tell us what you see!
- validations:
- required: true
- - type: textarea
- id: version
- attributes:
- label: Name and Version
- description: Which executable and which version of our software are you running? (use `--version` to get a version string)
- placeholder: |
- $./llama-cli --version
- version: 2999 (42b4109e)
- built with cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 for x86_64-linux-gnu
- validations:
- required: true
- - type: dropdown
- id: operating-system
- attributes:
- label: What operating system are you seeing the problem on?
- multiple: true
- options:
- - Linux
- - Mac
- - Windows
- - BSD
- - Other? (Please let us know in description)
- validations:
- required: false
- - type: textarea
- id: logs
- attributes:
- label: Relevant log output
- description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
- render: shell
diff --git a/.github/ISSUE_TEMPLATE/06-research.yml b/.github/ISSUE_TEMPLATE/030-research.yml
similarity index 97%
rename from .github/ISSUE_TEMPLATE/06-research.yml
rename to .github/ISSUE_TEMPLATE/030-research.yml
index 3ae4e9f8c..18975dbbf 100644
--- a/.github/ISSUE_TEMPLATE/06-research.yml
+++ b/.github/ISSUE_TEMPLATE/030-research.yml
@@ -1,5 +1,5 @@
name: Research
-description: Track new technical research area
+description: Track new technical research area.
title: "Research: "
labels: ["research 🔬"]
body:
diff --git a/.github/ISSUE_TEMPLATE/04-bug-critical.yml b/.github/ISSUE_TEMPLATE/04-bug-critical.yml
deleted file mode 100644
index 7af42a80b..000000000
--- a/.github/ISSUE_TEMPLATE/04-bug-critical.yml
+++ /dev/null
@@ -1,50 +0,0 @@
-name: Critical Severity Bug
-description: Used to report critical severity bugs in llama.cpp (e.g. Crashing, Corrupted, Dataloss)
-title: "Bug: "
-labels: ["bug-unconfirmed", "critical severity"]
-body:
- - type: markdown
- attributes:
- value: |
- Thanks for taking the time to fill out this bug report!
- Please include information about your system, the steps to reproduce the bug,
- and the version of llama.cpp that you are using.
- If possible, please provide a minimal code example that reproduces the bug.
- - type: textarea
- id: what-happened
- attributes:
- label: What happened?
- description: Also tell us, what did you expect to happen?
- placeholder: Tell us what you see!
- validations:
- required: true
- - type: textarea
- id: version
- attributes:
- label: Name and Version
- description: Which executable and which version of our software are you running? (use `--version` to get a version string)
- placeholder: |
- $./llama-cli --version
- version: 2999 (42b4109e)
- built with cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 for x86_64-linux-gnu
- validations:
- required: true
- - type: dropdown
- id: operating-system
- attributes:
- label: What operating system are you seeing the problem on?
- multiple: true
- options:
- - Linux
- - Mac
- - Windows
- - BSD
- - Other? (Please let us know in description)
- validations:
- required: false
- - type: textarea
- id: logs
- attributes:
- label: Relevant log output
- description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
- render: shell
diff --git a/.github/ISSUE_TEMPLATE/07-refactor.yml b/.github/ISSUE_TEMPLATE/040-refactor.yml
similarity index 95%
rename from .github/ISSUE_TEMPLATE/07-refactor.yml
rename to .github/ISSUE_TEMPLATE/040-refactor.yml
index 3a68d3d53..b6e6ab36d 100644
--- a/.github/ISSUE_TEMPLATE/07-refactor.yml
+++ b/.github/ISSUE_TEMPLATE/040-refactor.yml
@@ -1,5 +1,5 @@
name: Refactor (Maintainers)
-description: Used to track refactoring opportunities
+description: Used to track refactoring opportunities.
title: "Refactor: "
labels: ["refactor"]
body:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 6ef0770f3..572f91643 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -986,13 +986,14 @@ jobs:
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
run: |
echo "cp oneAPI running time dll files in ${{ env.ONEAPI_ROOT }} to ./build/bin"
- cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_sycl_blas.4.dll" ./build/bin
+ cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_sycl_blas.5.dll" ./build/bin
cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_core.2.dll" ./build/bin
cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_tbb_thread.2.dll" ./build/bin
- cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/pi_win_proxy_loader.dll" ./build/bin
- cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/pi_level_zero.dll" ./build/bin
- cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/sycl7.dll" ./build/bin
+ cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_loader.dll" ./build/bin
+ cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_win_proxy_loader.dll" ./build/bin
+ cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/ur_adapter_level_zero.dll" ./build/bin
+ cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/sycl8.dll" ./build/bin
cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/svml_dispmd.dll" ./build/bin
cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/libmmd.dll" ./build/bin
cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/libiomp5md.dll" ./build/bin
diff --git a/cmake/llama-config.cmake.in b/cmake/llama-config.cmake.in
index 28a8c18b6..5c55bc6b8 100644
--- a/cmake/llama-config.cmake.in
+++ b/cmake/llama-config.cmake.in
@@ -3,12 +3,60 @@ set(LLAMA_BUILD_COMMIT @LLAMA_BUILD_COMMIT@)
set(LLAMA_BUILD_NUMBER @LLAMA_BUILD_NUMBER@)
set(LLAMA_SHARED_LIB @BUILD_SHARED_LIBS@)
+set(GGML_STATIC @GGML_STATIC@)
+set(GGML_NATIVE @GGML_NATIVE@)
+set(GGML_LTO @GGML_LTO@)
+set(GGML_CCACHE @GGML_CCACHE@)
+set(GGML_AVX @GGML_AVX@)
+set(GGML_AVX2 @GGML_AVX2@)
+set(GGML_AVX512 @GGML_AVX512@)
+set(GGML_AVX512_VBMI @GGML_AVX512_VBMI@)
+set(GGML_AVX512_VNNI @GGML_AVX512_VNNI@)
+set(GGML_AVX512_BF16 @GGML_AVX512_BF16@)
+set(GGML_AMX_TILE @GGML_AMX_TILE@)
+set(GGML_AMX_INT8 @GGML_AMX_INT8@)
+set(GGML_AMX_BF16 @GGML_AMX_BF16@)
+set(GGML_FMA @GGML_FMA@)
+set(GGML_LASX @GGML_LASX@)
+set(GGML_LSX @GGML_LSX@)
+set(GGML_RVV @GGML_RVV@)
+set(GGML_SVE @GGML_SVE@)
+
set(GGML_ACCELERATE @GGML_ACCELERATE@)
+set(GGML_OPENMP @GGML_OPENMP@)
+set(GGML_CPU_HBM @GGML_CPU_HBM@)
+set(GGML_BLAS_VENDOR @GGML_BLAS_VENDOR@)
+
+set(GGML_CUDA_FORCE_MMQ @GGML_CUDA_FORCE_MMQ@)
+set(GGML_CUDA_FORCE_CUBLAS @GGML_CUDA_FORCE_CUBLAS@)
+set(GGML_CUDA_F16 @GGML_CUDA_F16@)
+set(GGML_CUDA_PEER_MAX_BATCH_SIZE @GGML_CUDA_PEER_MAX_BATCH_SIZE@)
+set(GGML_CUDA_NO_PEER_COPY @GGML_CUDA_NO_PEER_COPY@)
+set(GGML_CUDA_NO_VMM @GGML_CUDA_NO_VMM@)
+set(GGML_CUDA_FA_ALL_QUANTS @GGML_CUDA_FA_ALL_QUANTS@)
+set(GGML_CUDA_GRAPHS @GGML_CUDA_GRAPHS@)
+
+set(GGML_HIP_UMA @GGML_HIP_UMA@)
+
set(GGML_VULKAN_CHECK_RESULTS @GGML_VULKAN_CHECK_RESULTS@)
-set(GGML_VULKAN_DEBUG @GGML_VULKAN_DEBUG@)
-set(GGML_VULKAN_MEMORY_DEBUG @GGML_VULKAN_MEMORY_DEBUG@)
-set(GGML_VULKAN_VALIDATE @GGML_VULKAN_VALIDATE@)
-set(GGML_OPENMP @GGML_OPENMP@)
+set(GGML_VULKAN_DEBUG @GGML_VULKAN_DEBUG@)
+set(GGML_VULKAN_MEMORY_DEBUG @GGML_VULKAN_MEMORY_DEBUG@)
+set(GGML_VULKAN_SHADER_DEBUG_INFO @GGML_VULKAN_SHADER_DEBUG_INFO@)
+set(GGML_VULKAN_PERF @GGML_VULKAN_PERF@)
+set(GGML_VULKAN_VALIDATE @GGML_VULKAN_VALIDATE@)
+set(GGML_VULKAN_RUN_TESTS @GGML_VULKAN_RUN_TESTS@)
+
+set(GGML_METAL_USE_BF16 @GGML_METAL_USE_BF16@)
+set(GGML_METAL_NDEBUG @GGML_METAL_NDEBUG@)
+set(GGML_METAL_SHADER_DEBUG @GGML_METAL_SHADER_DEBUG@)
+set(GGML_METAL_EMBED_LIBRARY @GGML_METAL_EMBED_LIBRARY@)
+set(GGML_METAL_MACOSX_VERSION_MIN @GGML_METAL_MACOSX_VERSION_MIN@)
+set(GGML_METAL_STD @GGML_METAL_STD@)
+
+set(GGML_SYCL_F16 @GGML_SYCL_F16@)
+set(GGML_SYCL_TARGET @GGML_SYCL_TARGET@)
+set(GGML_SYCL_DEVICE_ARCH @GGML_SYCL_DEVICE_ARCH@)
+
@PACKAGE_INIT@
@@ -20,6 +68,7 @@ find_package(Threads REQUIRED)
set(_llama_transient_defines "@GGML_TRANSIENT_DEFINES@")
set(_llama_link_deps "")
+set(_llama_link_opts "")
foreach(_ggml_lib ggml ggml-base)
string(REPLACE "-" "_" _ggml_lib_var "${_ggml_lib}_LIBRARY")
find_library(${_ggml_lib_var} ${_ggml_lib}
@@ -49,41 +98,63 @@ foreach(backend amx blas cann cpu cuda hip kompute metal musa rpc sycl vulkan)
endif()
endforeach()
-if (APPLE AND GGML_ACCELERATE)
- find_library(ACCELERATE_FRAMEWORK Accelerate REQUIRED)
-endif()
+if (NOT LLAMA_SHARED_LIB)
+ if (APPLE AND GGML_ACCELERATE)
+ find_library(ACCELERATE_FRAMEWORK Accelerate REQUIRED)
+ list(APPEND _llama_link_deps ${ACCELERATE_FRAMEWORK})
+ endif()
-if (GGML_BLAS)
- find_package(BLAS REQUIRED)
-endif()
+ if (GGML_OPENMP)
+ find_package(OpenMP REQUIRED)
+ list(APPEND _llama_link_deps OpenMP::OpenMP_C OpenMP::OpenMP_CXX)
+ endif()
-if (GGML_CUDA)
- find_package(CUDAToolkit REQUIRED)
-endif()
+ if (GGML_CPU_HBM)
+ find_library(memkind memkind REQUIRED)
+ list(APPEND _llama_link_deps memkind)
+ endif()
-if (GGML_METAL)
- find_library(FOUNDATION_LIBRARY Foundation REQUIRED)
- find_library(METAL_FRAMEWORK Metal REQUIRED)
- find_library(METALKIT_FRAMEWORK MetalKit REQUIRED)
-endif()
+ if (GGML_BLAS)
+ find_package(BLAS REQUIRED)
+ list(APPEND _llama_link_deps ${BLAS_LIBRARIES})
+ list(APPEND _llama_link_opts ${BLAS_LINKER_FLAGS})
+ endif()
-if (GGML_VULKAN)
- find_package(Vulkan REQUIRED)
-endif()
+ if (GGML_CUDA)
+ find_package(CUDAToolkit REQUIRED)
+ endif()
-if (GGML_HIP)
- find_package(hip REQUIRED)
- find_package(hipblas REQUIRED)
- find_package(rocblas REQUIRED)
-endif()
+ if (GGML_METAL)
+ find_library(FOUNDATION_LIBRARY Foundation REQUIRED)
+ find_library(METAL_FRAMEWORK Metal REQUIRED)
+ find_library(METALKIT_FRAMEWORK MetalKit REQUIRED)
+ list(APPEND _llama_link_deps ${FOUNDATION_LIBRARY}
+ ${METAL_FRAMEWORK} ${METALKIT_FRAMEWORK})
+ endif()
-if (GGML_SYCL)
- find_package(IntelSYCL REQUIRED)
- find_package(MKL REQUIRED)
-endif()
+ if (GGML_VULKAN)
+ find_package(Vulkan REQUIRED)
+ list(APPEND _llama_link_deps Vulkan::Vulkan)
+ endif()
-if (GGML_OPENMP)
- find_package(OpenMP REQUIRED)
+ if (GGML_HIP)
+ find_package(hip REQUIRED)
+ find_package(hipblas REQUIRED)
+ find_package(rocblas REQUIRED)
+ list(APPEND _llama_link_deps hip::host roc::rocblas roc::hipblas)
+ endif()
+
+ if (GGML_SYCL)
+ find_package(DNNL)
+ if (${DNNL_FOUND} AND GGML_SYCL_TARGET STREQUAL "INTEL")
+ list(APPEND _llama_link_deps DNNL::dnnl)
+ endif()
+ if (WIN32)
+ find_package(IntelSYCL REQUIRED)
+ find_package(MKL REQUIRED)
+ list(APPEND _llama_link_deps IntelSYCL::SYCL_CXX MKL::MKL MKL::MKL_SYCL)
+ endif()
+ endif()
endif()
find_library(llama_LIBRARY llama
@@ -97,6 +168,7 @@ set_target_properties(llama
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LLAMA_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${_llama_link_deps}"
+ INTERFACE_LINK_OPTIONS "${_llama_link_opts}"
INTERFACE_COMPILE_DEFINITIONS "${_llama_transient_defines}"
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${llama_LIBRARY}"
diff --git a/docs/backend/SYCL.md b/docs/backend/SYCL.md
index e431f51f1..8d8312e91 100644
--- a/docs/backend/SYCL.md
+++ b/docs/backend/SYCL.md
@@ -34,9 +34,10 @@ The SYCL backend would be broken by some PRs due to no online CI.
The following release is verified with good quality:
-|Commit ID|Tag|Release|Verified Platform|
-|-|-|-|-|
-|fb76ec31a9914b7761c1727303ab30380fd4f05c|b3038 |[llama-b3038-bin-win-sycl-x64.zip](https://github.com/ggerganov/llama.cpp/releases/download/b3038/llama-b3038-bin-win-sycl-x64.zip) |Arc770/Linux/oneAPI 2024.1
MTL Arc GPU/Windows 11/oneAPI 2024.1|
+|Commit ID|Tag|Release|Verified Platform| Update date|
+|-|-|-|-|-|
+|3bcd40b3c593d14261fb2abfabad3c0fb5b9e318|b4040 |[llama-b4040-bin-win-sycl-x64.zip](https://github.com/ggerganov/llama.cpp/releases/download/b4040/llama-b4040-bin-win-sycl-x64.zip) |Arc770/Linux/oneAPI 2024.1
MTL Arc GPU/Windows 11/oneAPI 2024.1| 2024-11-19|
+|fb76ec31a9914b7761c1727303ab30380fd4f05c|b3038 |[llama-b3038-bin-win-sycl-x64.zip](https://github.com/ggerganov/llama.cpp/releases/download/b3038/llama-b3038-bin-win-sycl-x64.zip) |Arc770/Linux/oneAPI 2024.1
MTL Arc GPU/Windows 11/oneAPI 2024.1||
## News
diff --git a/examples/llama-bench/llama-bench.cpp b/examples/llama-bench/llama-bench.cpp
index 8f4e0e206..3dc84a75c 100644
--- a/examples/llama-bench/llama-bench.cpp
+++ b/examples/llama-bench/llama-bench.cpp
@@ -6,28 +6,28 @@
#include
#include
#include
+#include
#include
#include
-#include
#include
#include