Update autofix and presets (#1867)

* Add configuration files for format, presets and examples

* add clang in pre-commit config

* remove clang configurations

* Refactor .gitignore for consistency in formatting
This commit is contained in:
Samuel Oliveira Alves 2026-05-24 01:30:44 -03:00 committed by GitHub
parent 0c45696db4
commit 9f7ba245ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 200 additions and 101 deletions

View File

@ -10,8 +10,10 @@ exclude =
.git, .git,
# There's no value in checking cache directories # There's no value in checking cache directories
__pycache__, __pycache__,
# No need to include the build path # No need to include generated build directories
build, build,
build_*,
build-*,
# This contains builds that we don't want to check # This contains builds that we don't want to check
dist # This is generated with `python build .` for package releases dist # This is generated with `python build .` for package releases
# max-complexity = 10 # max-complexity = 10

107
.gitignore vendored
View File

@ -3,6 +3,7 @@
*.a *.a
*.bat *.bat
*.bin *.bin
*.d
*.dll *.dll
*.dot *.dot
*.etag *.etag
@ -19,13 +20,13 @@
*.so *.so
*.swp *.swp
*.tmp *.tmp
*.DS_Store
# IDE / OS # IDE / OS
.cache/ .cache/
.ccls-cache/ .ccls-cache/
.direnv/ .direnv/
.DS_Store
.envrc .envrc
.idea/ .idea/
.swiftpm .swiftpm
@ -33,7 +34,6 @@
.vscode/ .vscode/
nppBackup nppBackup
# Coverage # Coverage
gcovr-report/ gcovr-report/
@ -41,29 +41,22 @@ lcov-report/
# Build Artifacts # Build Artifacts
tags /tags
.build/ /.build/
build* /build*
!build-info.cmake /cmake-build-*
!build-info.cpp.in /release
!build-info.sh /debug
!build.zig /CMakeSettings.json
!docs/build.md /compile_commands.json
!scripts/build-*.sh
!scripts/build-*.bat
/libllama.so /libllama.so
/llama-* /llama-*
/vulkan-shaders-gen /vulkan-shaders-gen
android-ndk-*
arm_neon.h
cmake-build-*
CMakeSettings.json
compile_commands.json
ggml-metal-embed.metal
llama-batched-swift
/rpc-server /rpc-server
out/ /out/
tmp/ /tmp/
/autogen-*.md
/common/build-info.cpp
# Deprecated # Deprecated
@ -72,38 +65,43 @@ tmp/
# CI # CI
!.github/workflows/*.yml !/.github/workflows/*.yml
# Models # Models
models/* /models/*
models-mnt /models-mnt
!models/.editorconfig !/models/.editorconfig
!models/ggml-vocab-*.gguf* !/models/ggml-vocab-*.gguf*
!/models/templates
# Zig # Zig
zig-out/
zig-cache/
# Logs /zig-out/
/zig-cache/
ppl-*.txt
qnt-*.txt
perf-*.txt
# Examples # Examples
examples/jeopardy/results.txt /examples/jeopardy/results.txt
examples/server/*.css.hpp /examples/server/*.css.hpp
examples/server/*.html.hpp /examples/server/*.html.hpp
examples/server/*.js.hpp /examples/server/*.js.hpp
examples/server/*.mjs.hpp /examples/server/*.mjs.hpp
!build_64.sh /examples/server/*.gz.hpp
!examples/*.bat !/build_64.sh
!examples/*/*.kts !/examples/*.bat
!examples/*/*/*.kts !/examples/*/*.kts
!examples/sycl/*.bat !/examples/*/*/*.kts
!examples/sycl/*.sh !/examples/sycl/*.bat
!/examples/sycl/*.sh
# Server Web UI temporary files
/examples/server/webui_llamacpp/.svelte-kit
/examples/server/webui_llamacpp/node_modules
/examples/server/webui_llamacpp/build
/examples/server/webui_llamacpp/test-results
/examples/server/webui_llamacpp/storybook-static
# Python # Python
@ -111,11 +109,16 @@ examples/server/*.mjs.hpp
__pycache__/ __pycache__/
*/poetry.lock */poetry.lock
poetry.toml poetry.toml
poetry.lock
uv.lock
# Nix # Nix
flake.lock
/result /result
# Test binaries # Test binaries
/tests/test-backend-ops /tests/test-backend-ops
/tests/test-double-float /tests/test-double-float
/tests/test-grad0 /tests/test-grad0
@ -131,17 +134,31 @@ poetry.toml
/tests/test-tokenizer-1-spm /tests/test-tokenizer-1-spm
# Scripts # Scripts
!/scripts/install-oneapi.bat !/scripts/install-oneapi.bat
/examples/server/webui_llamacpp/.gitignore
# Generated by scripts
/hellaswag_val_full.txt
/winogrande-debiased-eval.csv
/wikitext-2-raw/
# Test models for lora adapters # Test models for lora adapters
/lora-tests /lora-tests
# Local scripts # Local scripts
/run-vim.sh /run-vim.sh
/run-chat.sh /run-chat.sh
/run-spec.sh
.ccache/ .ccache/
# IDE # IDE
*.code-workspace *.code-workspace
.windsurf/ .windsurf/
# emscripten
a.out
a.out.*
.dev
.github

View File

@ -9,8 +9,9 @@ repos:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: check-yaml - id: check-yaml
- id: check-added-large-files - id: check-added-large-files
- repo: https://github.com/PyCQA/flake8 - repo: https://github.com/PyCQA/flake8
rev: 7.0.0 rev: 7.0.0
hooks: hooks:
- id: flake8 - id: flake8
additional_dependencies: [flake8-no-print] additional_dependencies: [flake8-print]

View File

@ -2,64 +2,143 @@
"version": 4, "version": 4,
"configurePresets": [ "configurePresets": [
{ {
"name": "base", "name": "base",
"hidden": true, "hidden": true,
"generator": "Ninja", "generator": "Ninja",
"binaryDir": "${sourceDir}/build-${presetName}", "binaryDir": "${sourceDir}/build-${presetName}",
"cacheVariables": { "cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON", "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_INSTALL_RPATH": "$ORIGIN;$ORIGIN/.." "CMAKE_INSTALL_RPATH": "$ORIGIN;$ORIGIN/.."
} }
}, },
{ {
"name": "sycl-base", "name": "debug",
"hidden": true, "hidden": true,
"generator": "Ninja", "cacheVariables": {
"binaryDir": "${sourceDir}/build-${presetName}", "CMAKE_BUILD_TYPE": "Debug"
"cacheVariables": { }
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_CXX_COMPILER": "icx",
"CMAKE_C_COMPILER": "cl",
"GGML_SYCL": "ON",
"CMAKE_INSTALL_RPATH": "$ORIGIN;$ORIGIN/.."
}
}, },
{ "name": "debug", "hidden": true, "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" } },
{ "name": "release", "hidden": true, "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } },
{ "name": "reldbg", "hidden": true, "cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" } },
{ "name": "static", "hidden": true, "cacheVariables": { "GGML_STATIC": "ON" } },
{ {
"name": "arm64-windows-msvc", "hidden": true, "name": "release",
"architecture": { "value": "arm64", "strategy": "external" }, "hidden": true,
"toolset": { "value": "host=x86_64", "strategy": "external" }, "cacheVariables": {
"cacheVariables": { "CMAKE_BUILD_TYPE": "Release"
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/arm64-windows-msvc.cmake" }
}
}, },
{ {
"name": "arm64-windows-llvm", "hidden": true, "name": "reldbg",
"architecture": { "value": "arm64", "strategy": "external" }, "hidden": true,
"toolset": { "value": "host=x86_64", "strategy": "external" }, "cacheVariables": {
"cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo"
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/arm64-windows-llvm.cmake" }
}
}, },
{
{ "name": "arm64-windows-llvm-debug" , "inherits": [ "base", "arm64-windows-llvm", "debug" ] }, "name": "cpu-avx2-base",
{ "name": "arm64-windows-llvm-release", "inherits": [ "base", "arm64-windows-llvm", "reldbg" ] }, "hidden": true,
{ "name": "arm64-windows-llvm+static-release", "inherits": [ "base", "arm64-windows-llvm", "reldbg", "static" ] }, "inherits": "base",
"cacheVariables": {
{ "name": "arm64-windows-msvc-debug" , "inherits": [ "base", "arm64-windows-msvc", "debug" ] }, "GGML_NATIVE": "OFF",
{ "name": "arm64-windows-msvc-release", "inherits": [ "base", "arm64-windows-msvc", "reldbg" ] }, "GGML_AVX": "ON",
{ "name": "arm64-windows-msvc+static-release", "inherits": [ "base", "arm64-windows-msvc", "reldbg", "static" ] }, "GGML_AVX2": "ON",
"GGML_FMA": "ON",
{ "name": "x64-windows-msvc-debug" , "inherits": [ "base", "debug" ] }, "GGML_F16C": "ON",
{ "name": "x64-windows-msvc-release", "inherits": [ "base", "reldbg" ] }, "GGML_BLAS": "OFF",
{ "name": "x64-windows-msvc+static-release", "inherits": [ "base", "reldbg", "static" ] }, "GGML_CUDA": "OFF"
}
{ "name": "x64-windows-sycl-debug" , "inherits": [ "sycl-base", "debug" ] }, },
{ "name": "x64-windows-sycl-release", "inherits": [ "sycl-base", "release" ] } {
"name": "cuda-base",
"hidden": true,
"inherits": "base",
"cacheVariables": {
"GGML_CUDA": "ON",
"GGML_BLAS": "OFF"
}
},
{
"name": "cpu-avx2-debug",
"inherits": [
"cpu-avx2-base",
"debug"
],
"binaryDir": "${sourceDir}/build_cpu_avx2_debug"
},
{
"name": "cpu-avx2-release",
"inherits": [
"cpu-avx2-base",
"release"
],
"binaryDir": "${sourceDir}/build_cpu_avx2_release"
},
{
"name": "cpu-avx2-reldbg",
"inherits": [
"cpu-avx2-base",
"reldbg"
],
"binaryDir": "${sourceDir}/build_cpu_avx2_reldbg"
},
{
"name": "cuda-debug",
"inherits": [
"cuda-base",
"debug"
],
"binaryDir": "${sourceDir}/build_debug"
},
{
"name": "cuda-release",
"inherits": [
"cuda-base",
"release"
],
"binaryDir": "${sourceDir}/build_release"
},
{
"name": "cuda-reldbg",
"inherits": [
"cuda-base",
"reldbg"
],
"binaryDir": "${sourceDir}/build_cuda_reldbg"
}
],
"buildPresets": [
{
"name": "parallel-build",
"hidden": true,
"jobs": 0
},
{
"name": "cpu-avx2-debug",
"configurePreset": "cpu-avx2-debug",
"inherits": "parallel-build"
},
{
"name": "cpu-avx2-release",
"configurePreset": "cpu-avx2-release",
"inherits": "parallel-build"
},
{
"name": "cpu-avx2-reldbg",
"configurePreset": "cpu-avx2-reldbg",
"inherits": "parallel-build"
},
{
"name": "cuda-debug",
"configurePreset": "cuda-debug",
"inherits": "parallel-build"
},
{
"name": "cuda-release",
"configurePreset": "cuda-release",
"inherits": "parallel-build"
},
{
"name": "cuda-reldbg",
"configurePreset": "cuda-reldbg",
"inherits": "parallel-build"
}
] ]
} }

View File

@ -1,5 +1,5 @@
set(ARCH_FLAGS "") set(ARCH_FLAGS "")
if (NOT MSVC) if (NOT MSVC AND GGML_NATIVE)
list(APPEND ARCH_FLAGS -march=native) list(APPEND ARCH_FLAGS -march=native)
endif() endif()
message(STATUS "ARCH_FLAGS = ${ARCH_FLAGS}") message(STATUS "ARCH_FLAGS = ${ARCH_FLAGS}")