Skip to content

QVAC-4552: Sync port with upstream version b5932 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 182 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
182 commits
Select commit Hold shift + click to select a range
2bf9d53
sycl: GGML_SYCL_DISABLE_OPT on by default for all Intel Devices (#13973)
ShanoToni Jun 25, 2025
b193d53
ggml : do not output unprintable characters on GGUF load failure (#14…
CISC Jun 25, 2025
60ef23d
ggml-cpu: enable IBM NNPA Vector Intrinsics (#14317)
taronaeo Jun 25, 2025
716301d
musa: enable fp16 mma (all) and cublas on qy2 (#13842)
yeahdongcn Jun 26, 2025
bf5bcd0
docs: update s390x documentation + add faq (#14389)
taronaeo Jun 26, 2025
5783ae4
metal : batch rows copy in a single threadgroup (#14384)
ggerganov Jun 26, 2025
e8215db
metal : add special-case mat-vec mul for ne00 == 4 (#14385)
ggerganov Jun 26, 2025
b253462
llama : return mistral-v7-tekken as default template only (#14390)
CISC Jun 26, 2025
a01047b
cmake: regen vulkan shaders when shaders-gen sources change (#14398)
bandoti Jun 26, 2025
8846aac
model : gemma3n text-only (#14400)
ngxson Jun 26, 2025
f667f1e
convert : fix broken sentencepiece vocab (#14416)
CISC Jun 27, 2025
8d94219
ggml : add ggml_set_rows (#14274)
rgerganov Jun 27, 2025
4367806
recurrent : call balloc split_reset() in init_batch() (#14414)
ggerganov Jun 27, 2025
72babea
graph : make llm_graph_context destructor virtual (#14410)
ggerganov Jun 27, 2025
ceb1bf5
vulkan: Fix GGML_VULKAN_SHADER_DEBUG_INFO (#14427)
jeffbolznv Jun 28, 2025
6609507
ci : fix windows build and release (#14431)
CISC Jun 28, 2025
b25e927
fix async_mode bug (#14432)
bachelor-dou Jun 28, 2025
566c16f
model : add support for ERNIE 4.5 0.3B model (#14408)
ownia Jun 28, 2025
00d5282
vulkan: lock accesses of pinned_memory vector (#14333)
jeffbolznv Jun 28, 2025
63a7bb3
vulkan: handle noncontig in the final case of ggml_vk_get_cpy_pipelin…
jeffbolznv Jun 28, 2025
27208bf
CUDA: add bf16 and f32 support to cublas_mul_mat_batched (#14361)
am17an Jun 28, 2025
bd9c981
vulkan: Add fusion support for RMS_NORM+MUL (#14366)
jeffbolznv Jun 29, 2025
a0535ff
ggml : implement REGLU/GEGLU/SWIGLU ops (#14158)
CISC Jun 29, 2025
a5d1fb6
ggml : fix unmerged GGML_FPxx_TO_FPxx refactoring (#14443)
CISC Jun 29, 2025
f47c1d7
SYCL: disable faulty fp16 exp kernel (#14395)
qnixsynapse Jun 29, 2025
83790b0
server : fix appearance of the chats list context menu for Safari (#1…
rntk Jun 29, 2025
caf5681
server : support jinja extra template kwargs (Qwen3 enable_thinking f…
matteoserva Jun 29, 2025
e9b6350
scripts : make the shell scripts cross-platform (#14341)
vedranmiletic Jun 30, 2025
c839a2d
cmake : Remove redundant include path in CMakeLists.txt (#14452)
xiaobing318 Jun 30, 2025
eb3fa29
test-backend-ops : disable llama test (#14461)
slaren Jun 30, 2025
a7417f5
ggml-cpu: sycl: Re-enable exp f16 (#14462)
Rbiessy Jun 30, 2025
5dd942d
metal : disable fast-math for some cpy kernels (#14460)
ggerganov Jun 30, 2025
745f11f
memory : correctly handle failure in apply() (#14438)
ggerganov Jun 30, 2025
0a5a3b5
Add Conv2d for CPU (#14388)
am17an Jun 30, 2025
79b33b2
opencl : add GEGLU, REGLU, SWIGLU (#14456)
lhez Jul 1, 2025
497be7c
ggml-quants : rename best_mad to best_error (ggml/1283)
danbev Jun 24, 2025
431b2c2
ggml-cpu : "align corners" for bilinear upscale/downscale (ggml/1285)
Acly Jul 1, 2025
f61c05d
sync : ggml
ggerganov Jul 1, 2025
a6a4795
ggml : remove trailing whitespace (#0)
ggerganov Jul 1, 2025
eff5e45
add GELU_ERF (#14455)
CISC Jul 1, 2025
6a746cf
vulkan: Split large mul_mat_id to fit in shared memory (#14451)
jeffbolznv Jul 1, 2025
343b6e9
CANN: update aclnnGroupedMatmulV2 to aclnnGroupedMatmulV3 (#14411)
noemotiovon Jul 1, 2025
1b2aaf2
Add Vulkan images to docker.md (#14472)
xek Jul 1, 2025
de56944
ci : disable fast-math for Metal GHA CI (#14478)
ggerganov Jul 1, 2025
68b3cd6
ggml : Callback before abort (#14481)
ScaledLizard Jul 2, 2025
85841e1
github : add OpenCL backend to issue templates (#14492)
EZForever Jul 2, 2025
611ba4b
ci : add OpenCL to labeler workflow (#14496)
CISC Jul 2, 2025
603e43d
opencl : update upscale to support align corners (#14488)
lhez Jul 2, 2025
c8a4e47
opencl : skip empty nodes on cgraph compute (#14491)
EZForever Jul 2, 2025
d7f5f4e
simple-chat : fix context-exceeded condition (#14494)
ggerganov Jul 2, 2025
307e79d
opencl : fix possible buffer overflow in dump_tensor (#14490)
jeffzhou2000 Jul 2, 2025
ec68e84
ggml : support bcast ggml_soft_max_ext, ggml_flash_attn_ext (#14435)
ggerganov Jun 27, 2025
8875523
vulkan: support softmax/FA batch and broadcast (#14449)
jeffbolznv Jul 1, 2025
12a81af
CUDA: broadcasting for FlashAttention mask (#14500)
JohannesGaessler Jul 2, 2025
55a1c5a
CUDA: add softmax broadcast (#14475)
am17an Jul 2, 2025
f3ed38d
Set RPATH to "@loader_path" / "$ORIGIN" to ensure executables and dyn…
rotemdan Jul 2, 2025
c46944a
ggml : add version function to get lib version (ggml/1286)
danbev Jul 2, 2025
e17991c
sync : ggml
ggerganov Jul 2, 2025
5d46bab
llama : initial Mamba-2 support (#9126)
compilade Jul 2, 2025
e75ba4c
gguf-py : add support for chat template jinja files (#14508)
CISC Jul 2, 2025
55c2646
CUDA: add dynamic shared mem to softmax, refactor general usage (#14497)
am17an Jul 2, 2025
d4cdd9c
ggml : remove kompute backend (#14501)
ggerganov Jul 3, 2025
9067487
ggml : fix FA mask dim 2 and 3 (#14505)
ggerganov Jul 3, 2025
a70c8a0
kv-cache : use ggml_set_rows (#14285)
ggerganov Jul 3, 2025
0c2ee38
convert : correct gemma 3n conversion (#14450)
ngxson Jul 3, 2025
7b63a71
Fix conditional enabling following arch checks for ggml-sycl (#14504)
s-Nick Jul 3, 2025
c8c4495
ggml: backward pass for split swiglu (#14483)
JohannesGaessler Jul 3, 2025
2b72bed
vulkan: support mixed/deepseekR1 FA head sizes (#14509)
jeffbolznv Jul 3, 2025
bee2842
opencl : broadcast for soft_max (#14510)
lhez Jul 3, 2025
28657a8
ggml : implement GEGLU_ERF and GEGLU_QUICK ops (#14445)
CISC Jul 3, 2025
499a8f5
CANN: Replace aclrtMemsetSync with aclnnInplaceZero operator (#14002)
luyhcsu Jul 4, 2025
c79184d
batch : add n_used count (#14512)
ggerganov Jul 4, 2025
7b50f7c
graph : prepare for 4D mask (#14515)
ggerganov Jul 4, 2025
67d1ef2
batch : add optional for sequential equal split (#14511)
ggerganov Jul 4, 2025
ef797db
metal : disable fast math in all quantize kernels (#14528)
ggerganov Jul 4, 2025
b81510a
test-backend-ops: add support for specifying output format (#14368)
yeahdongcn Jul 5, 2025
bac8bed
eval-callback : check for empty input (#14539)
ggerganov Jul 5, 2025
6681688
opencl: add GELU_ERF (#14476)
CISC Jul 5, 2025
ddef995
server : fix assistant prefilling when content is an array (#14360)
CISC Jul 5, 2025
a0374a6
vulkan: Handle updated FA dim2/3 definition (#14518)
jeffbolznv Jul 5, 2025
e592be1
vulkan: fix rms_norm+mul fusion (#14545)
jeffbolznv Jul 6, 2025
6491d6e
vulkan: increase LOAD_VEC_A to 8 (IQ1/IQ2) or 4 (IQ3) (#14485)
netrunnereve Jul 6, 2025
b9c3eef
CUDA: add bf16 and i32 to getrows (#14529)
am17an Jul 7, 2025
12f55c3
llama : remove ggml_cont where possible (#14568)
CISC Jul 7, 2025
e1a7059
llama : fix incorrect minicpm3 v_states shape (#14571)
CISC Jul 7, 2025
68155c6
musa: fix build warnings (unused variable) (#14561)
yeahdongcn Jul 7, 2025
75c91de
CUDA: add bilinear interpolation for upscale (#14563)
am17an Jul 8, 2025
4d0dcd4
cuda : fix rope with partial rotation and non-cont src (#14580)
ggerganov Jul 8, 2025
53903ae
vulkan: increase timeout for CI (#14574)
jeffbolznv Jul 8, 2025
8f22dc0
model : add hunyuan moe (#14425)
ngxson Jul 8, 2025
17a1f0d
server: Add ability to mount server at prefix (#14544)
oluwandabira Jul 8, 2025
b8eeb87
vulkan : fix rope with partial rotation and non-cont src (#14582)
jeffbolznv Jul 8, 2025
bb4f7a9
memory : fix broken batch splits for recurrent cache (#14575)
compilade Jul 8, 2025
0838286
model : add SmolLM3 (#14581)
ngxson Jul 8, 2025
699f439
model : fix hunyuan moe chat template (#14584)
stevenkuang-tencent Jul 8, 2025
6efcd65
vulkan: optimize flash attention split_k_reduce (#14554)
jeffbolznv Jul 8, 2025
20b7bf8
convert : fix smollm3 jinja template (#14586)
ngxson Jul 9, 2025
0465506
model : add support for Falcon-H1 family (#14534)
ibrahimkhadraoui Jul 9, 2025
1055545
llama : remove unintended whitespace (#14592)
CISC Jul 9, 2025
ffd59e7
model : add skt/A.X-4.0 model vocabulary (#14589)
Bing-su Jul 9, 2025
26a48ad
ggml : prevent integer overflow in gguf tensor size calculation (#14595)
Yuuoniy Jul 9, 2025
98bab63
ggml : add ggml_scale_bias (#14417)
ngxson Jul 9, 2025
4a5686d
llama : support Jamba hybrid Transformer-Mamba models (#7531)
compilade Jul 9, 2025
cb9178f
llama : remove llm_graph_input_one (#14603)
ngxson Jul 9, 2025
a57d1bc
cuda : support Falcon-H1 state size for SSM_SCAN (#14602)
compilade Jul 10, 2025
ac44eb6
cmake : llguidance build parser library only (#14608)
EZForever Jul 10, 2025
f9a867f
cmake : bump llguidance version to v1.0.1 (#14609)
EZForever Jul 10, 2025
435a6d1
llama : minor coding style fix for smollm3 (#14605)
ngxson Jul 10, 2025
704bb7a
SYCL: Initial set_rows kernel implementation (#14562)
qnixsynapse Jul 10, 2025
a457551
cmake : do not search for curl libraries by ourselves (#14613)
EZForever Jul 10, 2025
11ee0fe
Docs: script to auto-generate ggml operations docs (#14598)
am17an Jul 10, 2025
4bb625b
Smoldocling support (#14597)
ryan-mangeno Jul 10, 2025
0b88557
opencl: add `set_rows` for `f16` and `f32` (#14547)
lhez Jul 10, 2025
6bdda13
opencl: add tiled mul_mat_f16_f32 (#14535)
rmatif Jul 10, 2025
0aedae0
model : Granite Four (#13550)
gabe-l-hart Jul 11, 2025
576c82e
vocab : add midm-2.0 model pre-tokenizer (#14626)
Bing-su Jul 11, 2025
0d5375d
llama : move enum llama_vocab_pre_type to implementation (#14631)
ggerganov Jul 11, 2025
aaa088d
readme : add hot PRs (#14636)
ggerganov Jul 11, 2025
756aa10
HIP : Add HIP 7.0+ compatibility for hipBLAS compute types (#14634)
slojosic-amd Jul 11, 2025
f5e96b3
model : support LiquidAI LFM2 hybrid family (#14620)
tdakhran Jul 11, 2025
98197e5
vulkan: optimizations for deepseek prompt processing (#14555)
jeffbolznv Jul 12, 2025
b3ad3a0
vulkan: support SET_ROWS (#14587)
jeffbolznv Jul 12, 2025
0c1df14
server : fix pooled embedding output (#14645)
iamlemec Jul 12, 2025
3e303b1
vulkan : implement ggml_roll (ggml/1290)
Acly Jul 12, 2025
74bb294
vulkan : implement bilinear interpolation (ggml/1291)
Acly Jul 12, 2025
2155357
sync : ggml
ggerganov Jul 12, 2025
3120413
vulkan : remove unused vars (#0)
ggerganov Jul 12, 2025
8eff955
sync : ggml
ggerganov Jul 12, 2025
7de5c7c
CUDA: add set rows for f32 and f16 (#14551)
am17an Jul 12, 2025
67eade1
docs : add LFM2 to models section (#14650)
tdakhran Jul 12, 2025
c31e606
tests : cover lfm2 cases in test_ssm_conv (#14651)
tdakhran Jul 12, 2025
84b396e
cmake : Add CMake presets for Linux and GCC (#14656)
YavorGIvanov Jul 13, 2025
dcf7f2e
metal : Add missing unary ops Metal support (#14660)
YavorGIvanov Jul 13, 2025
05fec5b
ggml : add build-time message to remind about ggml_set_rows (#14661)
ggerganov Jul 13, 2025
e743cdd
cuda : add ELU support (#14657)
YavorGIvanov Jul 13, 2025
923e3ea
cuda : add set rows for bf16 (#14664)
CISC Jul 13, 2025
982e347
quantize : fix minor logic flaw in --tensor-type (#14572)
EAddario Jul 13, 2025
0d92267
llama : add jinja template for rwkv-world (#14665)
MollySophia Jul 13, 2025
65a3ebb
sycl: Batched mulmat rework for oneDNN dispatch (#14617)
ShanoToni Jul 14, 2025
0f4c6ec
SYCL: use 1D kernel for set_rows (#14618)
qnixsynapse Jul 14, 2025
494c589
scripts: benchmark for HTTP server throughput (#14668)
JohannesGaessler Jul 14, 2025
9c9e4fc
llama-context: add ability to get logits (#14672)
am17an Jul 14, 2025
55c509d
ggml : refactor llamafile_sgemm PPC code (#14673)
shalinib-ibm Jul 14, 2025
bdca383
sycl: Hotfix for non dnnl codepath (#14677)
ShanoToni Jul 14, 2025
cbc68be
cuda: fix build warnings in set-rows.cu (unused variable) (#14687)
yeahdongcn Jul 15, 2025
68e37a6
model : add PLaMo-2 support (#14560)
mitmul Jul 15, 2025
10a0351
vulkan: add RTE variants for glu/add/sub/mul/div (#14653)
jeffbolznv Jul 15, 2025
ba1ceb3
vulkan: fix noncontig check for mat_mul_id splitting (#14683)
jeffbolznv Jul 15, 2025
4a4f426
model : add Kimi-K2 support (#14654)
gabriellarson Jul 15, 2025
c81f419
gguf-py : dump bpw per layer and model in markdown mode (#14703)
EAddario Jul 15, 2025
79e0b68
llama: add LLAMA_API to deprecated llama_kv_self_seq_div (#14708)
Min-Hua Jul 16, 2025
cf91f21
convert : add pre-computed hashes first to prevent order mishaps (#14…
CISC Jul 16, 2025
4b91d6f
convert : only check for tokenizer folder if we need it (#14704)
CISC Jul 16, 2025
5cae766
scripts: synthetic prompt mode for server-bench.py (#14695)
JohannesGaessler Jul 16, 2025
538cc77
server : fix handling of the ignore_eos flag (#14710)
ggerganov Jul 16, 2025
e4841d2
llama : fix parallel processing for plamo2 (#14716)
mitmul Jul 16, 2025
6ffd4e9
server : pre-calculate EOG logit biases (#14721)
ggerganov Jul 16, 2025
6497834
ggml : add asserts (#14720)
ggerganov Jul 16, 2025
ab14019
Support diffusion models: Add Dream 7B (#14644)
am17an Jul 16, 2025
225e7a1
llama : add high-throughput mode (#14363)
ggerganov Jul 16, 2025
b0f0ecc
model : support output bias for qwen2 (#14711)
tempstudio Jul 16, 2025
21c0217
ggml: Add initial WebGPU backend (#14521)
reeselevine Jul 16, 2025
496957e
llama : fix parameter order for hybrid memory initialization (#14725)
dinerburger Jul 16, 2025
19e5943
convert : make hf token optional (#14717)
CISC Jul 16, 2025
1ba45d4
ci : disable failing vulkan crossbuilds (#14723)
CISC Jul 16, 2025
ad57d3e
batch : fix uninitialized has_cpl flag (#14733)
ggerganov Jul 17, 2025
d9b6910
kv-cache : opt mask set input (#14600)
ggerganov Jul 17, 2025
086cf81
llama : fix parallel processing for lfm2 (#14705)
tdakhran Jul 17, 2025
01612b7
llama : reuse compute graphs (#14482)
ggerganov Jul 17, 2025
d6fb3f6
kv-cache : fix k-shift for multiple streams (#14742)
ggerganov Jul 17, 2025
cb887f1
model: add Ernie 4.5 MoE support (#14658)
pwilkin Jul 17, 2025
760b448
nix : use optionalAttrs for env mkDerivation attrset argument (#14726)
amozeo Jul 17, 2025
670e136
convert : fix Ernie4.5 MoE without shared experts (#14746)
pwilkin Jul 17, 2025
349ea79
use max work group size for device to replace the magic number (#14732)
NeoZhangJianyu Jul 18, 2025
09651d0
graph : Pass the graph placeholder message in debug mode (#14748)
Nexesenex Jul 18, 2025
8f974bc
graph : refactor context to not pass gf explicitly (#14629)
ggerganov Jul 18, 2025
f9a31ee
CUDA: set_rows + cpy.cu refactor (#14712)
am17an Jul 18, 2025
e0cb5c5
model : add EXAONE 4.0 support (#14630)
lgai-exaone Jul 18, 2025
eacdeb5
model : fix build after merge conflict (#14754)
ggerganov Jul 18, 2025
3c9c254
Merge remote-tracking branch 'tetherto/master' into QVAC-4552
jpgaribotti Aug 15, 2025
ab5cdba
Applied port patches
jpgaribotti Aug 13, 2025
ce64880
Export mtmd target
jpgaribotti Aug 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 40 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ endif()
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

set(LLAMA_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Location of header files")
set(LLAMA_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/llama CACHE PATH "Location of header files")
set(LLAMA_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Location of library files")
set(LLAMA_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Location of binary files")

Expand All @@ -225,15 +225,46 @@ set_target_properties(llama
PROPERTIES
PUBLIC_HEADER "${LLAMA_PUBLIC_HEADERS}")

install(TARGETS llama LIBRARY PUBLIC_HEADER)
install(
TARGETS llama
EXPORT llama-targets
PUBLIC_HEADER
DESTINATION ${LLAMA_INCLUDE_INSTALL_DIR})

if (LLAMA_BUILD_COMMON)

install(
TARGETS common build_info
EXPORT llama-targets
PUBLIC_HEADER
DESTINATION ${LLAMA_INCLUDE_INSTALL_DIR}/common)

endif()

if (LLAMA_BUILD_TOOLS)

install(
TARGETS mtmd
EXPORT llama-targets
PUBLIC_HEADER
DESTINATION ${LLAMA_INCLUDE_INSTALL_DIR}/mtmd)

endif()

install(
EXPORT llama-targets
FILE llama-targets.cmake
NAMESPACE llama::
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/llama)

install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/llama-config.cmake
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/llama)

configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/llama-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/llama-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/llama
PATH_VARS LLAMA_INCLUDE_INSTALL_DIR
LLAMA_LIB_INSTALL_DIR
LLAMA_BIN_INSTALL_DIR )
${CMAKE_CURRENT_SOURCE_DIR}/cmake/llama-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/llama-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/llama)

write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/llama-version.cmake
Expand All @@ -242,7 +273,7 @@ write_basic_package_version_file(

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/llama-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/llama-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/llama)
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/llama)

install(
FILES convert_hf_to_gguf.py
Expand Down
25 changes: 4 additions & 21 deletions cmake/llama-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,9 @@ set(LLAMA_SHARED_LIB @BUILD_SHARED_LIBS@)

@PACKAGE_INIT@

set_and_check(LLAMA_INCLUDE_DIR "@PACKAGE_LLAMA_INCLUDE_INSTALL_DIR@")
set_and_check(LLAMA_LIB_DIR "@PACKAGE_LLAMA_LIB_INSTALL_DIR@")
set_and_check(LLAMA_BIN_DIR "@PACKAGE_LLAMA_BIN_INSTALL_DIR@")
include(CMakeFindDependencyMacro)
find_dependency(ggml CONFIG REQUIRED)

find_package(ggml REQUIRED HINTS ${LLAMA_LIB_DIR}/cmake)
include("${CMAKE_CURRENT_LIST_DIR}/llama-targets.cmake")

find_library(llama_LIBRARY llama
REQUIRED
HINTS ${LLAMA_LIB_DIR}
NO_CMAKE_FIND_ROOT_PATH
)

add_library(llama UNKNOWN IMPORTED)
set_target_properties(llama
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LLAMA_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "ggml::ggml;ggml::ggml-base;"
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${llama_LIBRARY}"
INTERFACE_COMPILE_FEATURES c_std_90
POSITION_INDEPENDENT_CODE ON)

check_required_components(Llama)
check_required_components(llama)
40 changes: 27 additions & 13 deletions common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,34 +44,43 @@ endif()

set(TARGET common)

set(${TARGET}_HEADERS
arg.h
base64.hpp
chat-parser.h
chat.h
common.h
console.h
json-partial.h
json-schema-to-grammar.h
log.h
ngram-cache.h
regex-partial.h
sampling.h
speculative.h
)

list(TRANSFORM ${TARGET}_HEADERS PREPEND ${CMAKE_SOURCE_DIR}/common/)

add_library(${TARGET} STATIC
arg.cpp
arg.h
base64.hpp
chat-parser.cpp
chat-parser.h
chat.cpp
chat.h
common.cpp
common.h
console.cpp
console.h
json-partial.cpp
json-partial.h
json-schema-to-grammar.cpp
llguidance.cpp
log.cpp
log.h
ngram-cache.cpp
ngram-cache.h
regex-partial.cpp
regex-partial.h
sampling.cpp
sampling.h
speculative.cpp
speculative.h
${${TARGET}_HEADERS}
)

set_target_properties(${TARGET} PROPERTIES PUBLIC_HEADER "${${TARGET}_HEADERS}")

if (BUILD_SHARED_LIBS)
set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
Expand Down Expand Up @@ -133,7 +142,12 @@ if (LLAMA_LLGUIDANCE)
set(LLAMA_COMMON_EXTRA_LIBS ${LLAMA_COMMON_EXTRA_LIBS} llguidance ${LLGUIDANCE_PLATFORM_LIBS})
endif ()

target_include_directories(${TARGET} PUBLIC . ../vendor)
target_include_directories(
${TARGET}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/common$<SEMICOLON>${CMAKE_SOURCE_DIR}/vendor>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

target_compile_features (${TARGET} PUBLIC cxx_std_17)
target_link_libraries (${TARGET} PRIVATE ${LLAMA_COMMON_EXTRA_LIBS} PUBLIC llama Threads::Threads)

Expand Down
16 changes: 11 additions & 5 deletions ggml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,15 @@ set_target_properties(ggml PROPERTIES PUBLIC_HEADER "${GGML_PUBLIC_HEADERS}")
#if (GGML_METAL)
# set_target_properties(ggml PROPERTIES RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/src/ggml-metal.metal")
#endif()
install(TARGETS ggml LIBRARY PUBLIC_HEADER)
install(TARGETS ggml-base LIBRARY)
install(
TARGETS ggml ggml-base
EXPORT ggml-targets)

install(
EXPORT ggml-targets
FILE ggml-targets.cmake
NAMESPACE ggml::
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ggml)

if (GGML_STANDALONE)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ggml.pc.in
Expand Down Expand Up @@ -351,7 +358,7 @@ set(GGML_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Location of
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/ggml-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/ggml-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ggml
INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ggml
PATH_VARS GGML_INCLUDE_INSTALL_DIR
GGML_LIB_INSTALL_DIR
GGML_BIN_INSTALL_DIR)
Expand All @@ -370,8 +377,7 @@ message(STATUS "ggml commit: ${GGML_BUILD_COMMIT}")

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ggml-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/ggml-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ggml)

DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ggml)
if (MSVC)
set(MSVC_WARNING_FLAGS
/wd4005 # Macro redefinition
Expand Down
7 changes: 7 additions & 0 deletions ggml/cmake/ggml-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ if (NOT GGML_SHARED_LIB)
list(APPEND GGML_SYCL_INTERFACE_LINK_LIBRARIES IntelSYCL::SYCL_CXX MKL::MKL MKL::MKL_SYCL)
endif()
endif()

if (GGML_OPENCL)
find_package(PkgConfig REQUIRED)
pkg_check_modules(OpenCL REQUIRED IMPORTED_TARGET OpenCL)
list(APPEND GGML_OPENCL_INTERFACE_LINK_LIBRARIES PkgConfig::OpenCL)
endif()

endif()

set(_ggml_all_targets "")
Expand Down
2 changes: 1 addition & 1 deletion ggml/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ function(ggml_add_backend_library backend)
else()
add_library(${backend} ${ARGN})
target_link_libraries(ggml PUBLIC ${backend})
install(TARGETS ${backend} LIBRARY)
install(TARGETS ${backend} EXPORT ggml-targets)
endif()

target_link_libraries(${backend} PRIVATE ggml-base)
Expand Down
33 changes: 23 additions & 10 deletions ggml/src/ggml-vulkan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ cmake_policy(SET CMP0114 NEW)

find_package(Vulkan COMPONENTS glslc REQUIRED)

# Add options to disable cooperative matrix support
option(GGML_VULKAN_DISABLE_COOPMAT "Disable VK_KHR_cooperative_matrix support" OFF)
option(GGML_VULKAN_DISABLE_COOPMAT2 "Disable VK_NV_cooperative_matrix2 support" OFF)

function(detect_host_compiler)
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
find_program(HOST_C_COMPILER NAMES cl gcc clang NO_CMAKE_FIND_ROOT_PATH)
Expand Down Expand Up @@ -52,17 +56,25 @@ if (Vulkan_FOUND)
set(VULKAN_SHADER_GEN_CMAKE_ARGS "")

# Test all shader extensions
test_shader_extension_support(
"GL_KHR_cooperative_matrix"
"${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/test_coopmat_support.comp"
"GGML_VULKAN_COOPMAT_GLSLC_SUPPORT"
)
if (NOT GGML_VULKAN_DISABLE_COOPMAT)
test_shader_extension_support(
"GL_KHR_cooperative_matrix"
"${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/test_coopmat_support.comp"
"GGML_VULKAN_COOPMAT_GLSLC_SUPPORT"
)
else()
message(STATUS "VK_KHR_cooperative_matrix support disabled by GGML_VULKAN_DISABLE_COOPMAT")
endif()

test_shader_extension_support(
"GL_NV_cooperative_matrix2"
"${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/test_coopmat2_support.comp"
"GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT"
)
if (NOT GGML_VULKAN_DISABLE_COOPMAT2)
test_shader_extension_support(
"GL_NV_cooperative_matrix2"
"${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/test_coopmat2_support.comp"
"GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT"
)
else()
message(STATUS "VK_NV_cooperative_matrix2 support disabled by GGML_VULKAN_DISABLE_COOPMAT2")
endif()

test_shader_extension_support(
"GL_EXT_integer_dot_product"
Expand All @@ -78,6 +90,7 @@ if (Vulkan_FOUND)

target_link_libraries(ggml-vulkan PRIVATE Vulkan::Vulkan)
target_include_directories(ggml-vulkan PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(ggml-vulkan PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/vulkan_cpp_wrapper/include")

# Workaround to the "can't dereference invalidated vector iterator" bug in clang-cl debug build
# Posssibly relevant: https://stackoverflow.com/questions/74748276/visual-studio-no-displays-the-correct-length-of-stdvector
Expand Down
9 changes: 6 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ llama_add_compile_flags()
# llama

add_library(llama
../include/llama.h
llama.cpp
llama-adapter.cpp
llama-arch.cpp
Expand All @@ -34,11 +33,15 @@ add_library(llama
llama-vocab.cpp
unicode-data.cpp
unicode.cpp
unicode.h
)

target_include_directories(llama PRIVATE .)
target_include_directories(llama PUBLIC ../include)
target_include_directories(
llama
PUBLIC
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/llama>)

target_compile_features (llama PRIVATE cxx_std_17) # don't bump

target_link_libraries(llama PUBLIC ggml)
Expand Down
9 changes: 6 additions & 3 deletions tools/mtmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ add_library(mtmd

target_link_libraries (mtmd PUBLIC ggml llama)
target_link_libraries (mtmd PRIVATE Threads::Threads)
target_include_directories(mtmd PUBLIC .)
target_include_directories(
mtmd
PUBLIC
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_include_directories(mtmd PRIVATE ../..)
target_include_directories(mtmd PRIVATE ../../vendor)
target_compile_features (mtmd PRIVATE cxx_std_17)
Expand All @@ -35,8 +40,6 @@ set_target_properties(mtmd
PROPERTIES
PUBLIC_HEADER "${MTMD_PUBLIC_HEADERS}")

install(TARGETS mtmd LIBRARY PUBLIC_HEADER)

if (NOT MSVC)
# for stb_image.h and miniaudio.h
target_compile_options(mtmd PRIVATE -Wno-cast-qual)
Expand Down
Loading