Skip to content

Commit 61f6429

Browse files
committed
Merge branch 'master' into compilade/test-model-random
2 parents 8fe213a + fb85a28 commit 61f6429

28 files changed

+496
-356
lines changed

.devops/intel.Dockerfile

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,23 @@ COPY --from=build /app/full /app
4949

5050
WORKDIR /app
5151

52-
RUN apt-get update \
53-
&& apt-get install -y \
54-
git \
55-
python3 \
56-
python3-pip \
57-
&& pip install --upgrade pip setuptools wheel \
58-
&& pip install -r requirements.txt \
59-
&& apt autoremove -y \
60-
&& apt clean -y \
61-
&& rm -rf /tmp/* /var/tmp/* \
62-
&& find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \
63-
&& find /var/cache -type f -delete
64-
52+
RUN apt-get update && \
53+
apt-get install -y \
54+
git \
55+
python3 \
56+
python3-pip \
57+
python3-venv && \
58+
python3 -m venv /opt/venv && \
59+
. /opt/venv/bin/activate && \
60+
pip install --upgrade pip setuptools wheel && \
61+
pip install -r requirements.txt && \
62+
apt autoremove -y && \
63+
apt clean -y && \
64+
rm -rf /tmp/* /var/tmp/* && \
65+
find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete && \
66+
find /var/cache -type f -delete
67+
68+
ENV PATH="/opt/venv/bin:$PATH"
6569

6670
ENTRYPOINT ["/app/tools.sh"]
6771

CMakeLists.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ option(LLAMA_LLGUIDANCE "llama-common: include LLGuidance library for structured
8989
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/build-info.cmake)
9090
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/common.cmake)
9191

92+
if (NOT DEFINED LLAMA_BUILD_NUMBER)
93+
set(LLAMA_BUILD_NUMBER ${BUILD_NUMBER})
94+
endif()
95+
if (NOT DEFINED LLAMA_BUILD_COMMIT)
96+
set(LLAMA_BUILD_COMMIT ${BUILD_COMMIT})
97+
endif()
98+
set(LLAMA_INSTALL_VERSION 0.0.${BUILD_NUMBER})
99+
92100
# override ggml options
93101
set(GGML_ALL_WARNINGS ${LLAMA_ALL_WARNINGS})
94102
set(GGML_FATAL_WARNINGS ${LLAMA_FATAL_WARNINGS})
@@ -155,6 +163,8 @@ if (LLAMA_USE_SYSTEM_GGML)
155163
endif()
156164

157165
if (NOT TARGET ggml AND NOT LLAMA_USE_SYSTEM_GGML)
166+
set(GGML_BUILD_NUMBER ${LLAMA_BUILD_NUMBER})
167+
set(GGML_BUILD_COMMIT ${LLAMA_BUILD_COMMIT})
158168
add_subdirectory(ggml)
159169
# ... otherwise assume ggml is added by a parent CMakeLists.txt
160170
endif()
@@ -204,10 +214,6 @@ endif()
204214
include(GNUInstallDirs)
205215
include(CMakePackageConfigHelpers)
206216

207-
set(LLAMA_BUILD_NUMBER ${BUILD_NUMBER})
208-
set(LLAMA_BUILD_COMMIT ${BUILD_COMMIT})
209-
set(LLAMA_INSTALL_VERSION 0.0.${BUILD_NUMBER})
210-
211217
set(LLAMA_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Location of header files")
212218
set(LLAMA_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Location of library files")
213219
set(LLAMA_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Location of binary files")

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Release](https://img.shields.io/github/v/release/ggml-org/llama.cpp)](https://github.com/ggml-org/llama.cpp/releases)
77
[![Server](https://github.com/ggml-org/llama.cpp/actions/workflows/server.yml/badge.svg)](https://github.com/ggml-org/llama.cpp/actions/workflows/server.yml)
88

9-
[Roadmap](https://github.com/users/ggerganov/projects/7) / [Project status](https://github.com/ggml-org/llama.cpp/discussions/3471) / [Manifesto](https://github.com/ggml-org/llama.cpp/discussions/205) / [ggml](https://github.com/ggml-org/ggml)
9+
[Roadmap](https://github.com/users/ggerganov/projects/7) / [Manifesto](https://github.com/ggml-org/llama.cpp/discussions/205) / [ggml](https://github.com/ggml-org/ggml)
1010

1111
Inference of Meta's [LLaMA](https://arxiv.org/abs/2302.13971) model (and others) in pure C/C++
1212

@@ -18,7 +18,6 @@ Inference of Meta's [LLaMA](https://arxiv.org/abs/2302.13971) model (and others)
1818
## Hot topics
1919

2020
- 🔥 Multimodal support arrived in `llama-server`: [#12898](https://github.com/ggml-org/llama.cpp/pull/12898) | [documentation](./docs/multimodal.md)
21-
- **GGML developer experience survey (organized and reviewed by NVIDIA):** [link](https://forms.gle/Gasw3cRgyhNEnrwK9)
2221
- A new binary `llama-mtmd-cli` is introduced to replace `llava-cli`, `minicpmv-cli`, `gemma3-cli` ([#13012](https://github.com/ggml-org/llama.cpp/pull/13012)) and `qwen2vl-cli` ([#13141](https://github.com/ggml-org/llama.cpp/pull/13141)), `libllava` will be deprecated
2322
- VS Code extension for FIM completions: https://github.com/ggml-org/llama.vscode
2423
- Universal [tool call support](./docs/function-calling.md) in `llama-server` https://github.com/ggml-org/llama.cpp/pull/9639

common/CMakeLists.txt

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,21 @@ if(EXISTS "${PROJECT_SOURCE_DIR}/.git")
2323
endif()
2424

2525
if(EXISTS "${GIT_DIR}/index")
26-
set(GIT_INDEX "${GIT_DIR}/index")
26+
# For build-info.cpp below
27+
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${GIT_DIR}/index")
2728
else()
2829
message(WARNING "Git index not found in git repository.")
29-
set(GIT_INDEX "")
3030
endif()
3131
else()
3232
message(WARNING "Git repository not found; to enable automatic generation of build info, make sure Git is installed and the project is a Git repository.")
33-
set(GIT_INDEX "")
3433
endif()
3534

36-
# Add a custom command to rebuild build-info.cpp when .git/index changes
37-
add_custom_command(
38-
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/build-info.cpp"
39-
COMMENT "Generating build details from Git"
40-
COMMAND ${CMAKE_COMMAND} -DMSVC=${MSVC} -DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION}
41-
-DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} -DCMAKE_VS_PLATFORM_NAME=${CMAKE_VS_PLATFORM_NAME}
42-
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
43-
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}
44-
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/build-info-gen-cpp.cmake"
45-
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
46-
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/build-info.cpp.in" ${GIT_INDEX}
47-
VERBATIM
48-
)
35+
set(TEMPLATE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/build-info.cpp.in")
36+
set(OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/build-info.cpp")
37+
configure_file(${TEMPLATE_FILE} ${OUTPUT_FILE})
38+
4939
set(TARGET build_info)
50-
add_library(${TARGET} OBJECT build-info.cpp)
40+
add_library(${TARGET} OBJECT ${OUTPUT_FILE})
5141
if (BUILD_SHARED_LIBS)
5242
set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
5343
endif()

common/build-info.cpp.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
int LLAMA_BUILD_NUMBER = @BUILD_NUMBER@;
2-
char const *LLAMA_COMMIT = "@BUILD_COMMIT@";
1+
int LLAMA_BUILD_NUMBER = @LLAMA_BUILD_NUMBER@;
2+
char const *LLAMA_COMMIT = "@LLAMA_BUILD_COMMIT@";
33
char const *LLAMA_COMPILER = "@BUILD_COMPILER@";
44
char const *LLAMA_BUILD_TARGET = "@BUILD_TARGET@";

common/cmake/build-info-gen-cpp.cmake

Lines changed: 0 additions & 24 deletions
This file was deleted.

docs/multimodal.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,7 @@ NOTE: some models may require large context window, for example: `-c 8192`
107107
(tool_name) -hf ggml-org/Qwen2.5-Omni-3B-GGUF
108108
(tool_name) -hf ggml-org/Qwen2.5-Omni-7B-GGUF
109109
```
110+
111+
## Finding more models:
112+
113+
GGUF models on Huggingface with vision capabilities can be found here: https://huggingface.co/models?pipeline_tag=image-text-to-text&sort=trending&search=gguf

ggml/src/ggml-metal/CMakeLists.txt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,22 @@ if (GGML_METAL_EMBED_LIBRARY)
4444
set(METALLIB_SOURCE_EMBED_TMP "${CMAKE_BINARY_DIR}/autogenerated/ggml-metal-embed.metal.tmp")
4545

4646
add_custom_command(
47-
OUTPUT ${METALLIB_EMBED_ASM}
47+
OUTPUT "${METALLIB_EMBED_ASM}"
4848
COMMAND echo "Embedding Metal library"
49-
COMMAND sed -e '/__embed_ggml-common.h__/r ${METALLIB_COMMON}' -e '/__embed_ggml-common.h__/d' < ${METALLIB_SOURCE} > ${METALLIB_SOURCE_EMBED_TMP}
50-
COMMAND sed -e '/\#include \"ggml-metal-impl.h\"/r ${METALLIB_IMPL}' -e '/\#include \"ggml-metal-impl.h\"/d' < ${METALLIB_SOURCE_EMBED_TMP} > ${METALLIB_SOURCE_EMBED}
51-
COMMAND echo ".section __DATA,__ggml_metallib" > ${METALLIB_EMBED_ASM}
52-
COMMAND echo ".globl _ggml_metallib_start" >> ${METALLIB_EMBED_ASM}
53-
COMMAND echo "_ggml_metallib_start:" >> ${METALLIB_EMBED_ASM}
54-
COMMAND echo ".incbin \\\"${METALLIB_SOURCE_EMBED}\\\"" >> ${METALLIB_EMBED_ASM}
55-
COMMAND echo ".globl _ggml_metallib_end" >> ${METALLIB_EMBED_ASM}
56-
COMMAND echo "_ggml_metallib_end:" >> ${METALLIB_EMBED_ASM}
49+
COMMAND sed -e "/__embed_ggml-common.h__/r ${METALLIB_COMMON}" -e "/__embed_ggml-common.h__/d" < "${METALLIB_SOURCE}" > "${METALLIB_SOURCE_EMBED_TMP}"
50+
COMMAND sed -e "/\#include \"ggml-metal-impl.h\"/r ${METALLIB_IMPL}" -e "/\#include \"ggml-metal-impl.h\"/d" < "${METALLIB_SOURCE_EMBED_TMP}" > "${METALLIB_SOURCE_EMBED}"
51+
COMMAND echo ".section __DATA,__ggml_metallib" > "${METALLIB_EMBED_ASM}"
52+
COMMAND echo ".globl _ggml_metallib_start" >> "${METALLIB_EMBED_ASM}"
53+
COMMAND echo "_ggml_metallib_start:" >> "${METALLIB_EMBED_ASM}"
54+
COMMAND echo .incbin "\"${METALLIB_SOURCE_EMBED}\"" >> "${METALLIB_EMBED_ASM}"
55+
COMMAND echo ".globl _ggml_metallib_end" >> "${METALLIB_EMBED_ASM}"
56+
COMMAND echo "_ggml_metallib_end:" >> "${METALLIB_EMBED_ASM}"
5757
DEPENDS ../ggml-common.h ggml-metal.metal ggml-metal-impl.h
5858
COMMENT "Generate assembly for embedded Metal library"
59+
VERBATIM
5960
)
6061

61-
target_sources(ggml-metal PRIVATE ${METALLIB_EMBED_ASM})
62+
target_sources(ggml-metal PRIVATE "${METALLIB_EMBED_ASM}")
6263
else()
6364
if (GGML_METAL_SHADER_DEBUG)
6465
# custom command to do the following:

ggml/src/ggml-sycl/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ else()
142142
FetchContent_Declare(
143143
ONEMATH
144144
GIT_REPOSITORY https://github.com/uxlfoundation/oneMath.git
145-
GIT_TAG c255b1b4c41e2ee3059455c1f96a965d6a62568a
145+
GIT_TAG 8efe85f5aaebb37f1d8c503b7af66315feabf142
146146
)
147147
FetchContent_MakeAvailable(ONEMATH)
148148
# Create alias to match with find_package targets name

ggml/src/ggml-sycl/common.hpp

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,9 @@ constexpr size_t ceil_div(const size_t m, const size_t n) {
513513

514514
bool gpu_has_xmx(sycl::device &dev);
515515

516-
template <int N, class T> void debug_print_array(const std::string & prefix, const T array[N]) {
516+
template <int N, class T> std::string debug_get_array_str(const std::string & prefix, const T array[N]) {
517517
if (LIKELY(!g_ggml_sycl_debug)) {
518-
return;
518+
return "";
519519
}
520520
std::stringstream ss;
521521
ss << prefix << "=[";
@@ -526,29 +526,26 @@ template <int N, class T> void debug_print_array(const std::string & prefix, con
526526
ss << array[N - 1];
527527
}
528528
ss << "]";
529-
GGML_SYCL_DEBUG("%s", ss.str().c_str());
529+
return ss.str();
530530
}
531531

532-
inline void debug_print_tensor(const std::string & prefix, const ggml_tensor * tensor,
533-
const std::string & suffix = "") {
534-
if (LIKELY(!g_ggml_sycl_debug)) {
535-
return;
536-
}
537-
GGML_SYCL_DEBUG("%s=", prefix.c_str());
532+
inline std::string debug_get_tensor_str(const std::string &prefix,
533+
const ggml_tensor *tensor, const std::string &suffix = "") {
534+
std::stringstream ss;
535+
if (LIKELY(!g_ggml_sycl_debug)) { return ss.str(); }
536+
ss << prefix.c_str() << "=";
538537
if (tensor) {
539-
GGML_SYCL_DEBUG("'%s':type=%s", tensor->name, ggml_type_name(tensor->type));
540-
debug_print_array<GGML_MAX_DIMS>(";ne", tensor->ne);
541-
debug_print_array<GGML_MAX_DIMS>(";nb", tensor->nb);
542-
if (!ggml_is_contiguous(tensor)) {
543-
GGML_SYCL_DEBUG(";strided");
544-
}
545-
if (ggml_is_permuted(tensor)) {
546-
GGML_SYCL_DEBUG(";permuted");
547-
}
538+
ss << "'" << tensor->name << "':type=" << ggml_type_name(tensor->type);
539+
ss << debug_get_array_str<GGML_MAX_DIMS>(";ne", tensor->ne);
540+
ss << debug_get_array_str<GGML_MAX_DIMS>(";nb", tensor->nb);
541+
542+
if (!ggml_is_contiguous(tensor)) { ss << ";strided"; }
543+
if (ggml_is_permuted(tensor)) { ss << ";permuted"; }
548544
} else {
549-
GGML_SYCL_DEBUG("nullptr");
545+
ss << "nullptr";
550546
}
551-
GGML_SYCL_DEBUG("%s", suffix.c_str());
547+
ss << suffix;
548+
return ss.str();
552549
}
553550

554551
// Use scope_op_debug_print to log operations coming from running a model
@@ -564,10 +561,10 @@ struct scope_op_debug_print {
564561
return;
565562
}
566563
GGML_SYCL_DEBUG("[SYCL][OP] call %s%s:", func.data(), func_suffix.data());
567-
debug_print_tensor(" dst", dst);
564+
GGML_SYCL_DEBUG("%s", debug_get_tensor_str(" dst", dst).c_str());
568565
if (dst) {
569566
for (std::size_t i = 0; i < num_src; ++i) {
570-
debug_print_tensor("\tsrc" + std::to_string(i), dst->src[i]);
567+
GGML_SYCL_DEBUG("%s", debug_get_tensor_str("\tsrc" + std::to_string(i), dst->src[i]).c_str());
571568
}
572569
}
573570
GGML_SYCL_DEBUG("%s\n", suffix.data());

0 commit comments

Comments
 (0)