Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d8bebae
ggml : Fix missing backtrace on Linux (ggml/1228)
danielzgtg May 17, 2025
6c2e5c7
ggml : fix apple OS check in ggml_print_backtrace (ggml/1229)
slaren May 19, 2025
f6e2799
mnist: fix segmentation fault (ggml/1227)
JohannesGaessler May 19, 2025
3970f74
ggml-cpu: Update KleidiAI to v1.6 and fix include directives (llama/1…
eddnjjn May 13, 2025
5b11174
metal : optimize multi-sequence FA vec kernel (llama/13493)
ggerganov May 13, 2025
7cdf758
metal : use FA-vec kernel up to batch size 20 (llama/13496)
ggerganov May 13, 2025
014d860
vulkan: workaround FA compile failures on macos (llama/13517)
jeffbolznv May 14, 2025
bf56189
vulkan: KHR_coopmat flash attention (llama/13506)
jeffbolznv May 14, 2025
4611d55
cmake: simplify vulkan shader test logic (llama/13263)
bandoti May 14, 2025
cc84fce
CUDA: faster Deepseek FA, add Turing support (llama/13435)
JohannesGaessler May 14, 2025
bd65c3b
CUDA: fix crash on large batch size for quant. MoE (llama/13537)
JohannesGaessler May 14, 2025
cd5adba
arm64: optimize q6_k_q8_k kernel with i8mm (llama/13519)
cyb70289 May 14, 2025
0afc371
sycl: use oneDNN for matrices multiplication (llama/12972)
lslusarczyk May 15, 2025
511ae56
sycl: reordered Q4_K MMVQ (llama/13109)
sgeor255 May 15, 2025
4d8d4f8
sycl: simplify bin_bcast_kernel (llama/13383)
AD2605 May 15, 2025
577402d
gguf : use ggml log system (llama/13571)
slaren May 15, 2025
8bfb65c
sycl : fixed compilation warnings (llama/13582)
lslusarczyk May 16, 2025
82f8e5f
metal : add FA-vec kernel for head size 64 (llama/13583)
ggerganov May 16, 2025
798a95c
vulkan: use scalar FA rather than coopmat2 when N==1 (llama/13554)
jeffbolznv May 17, 2025
5378cbb
vulkan: move common FA code to flash_attn_base.comp (llama/13556)
jeffbolznv May 17, 2025
2d07c56
cmake: use the current build config for vulkan-shaders-gen (llama/13595)
giladgd May 17, 2025
6dedddb
CANN: Support MOE Model MUL_MAT_ID (llama/13042)
noemotiovon May 19, 2025
abcf4b2
sync : ggml
ggerganov May 19, 2025
e5ededd
talk-llama : sync llama.cpp
ggerganov May 19, 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
3 changes: 3 additions & 0 deletions examples/talk-llama/llama-arch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,9 @@ static const std::map<llm_arch, std::map<llm_tensor, const char *>> LLM_TENSOR_N
{ LLM_TENSOR_FFN_GATE_EXPS, "blk.%d.ffn_gate_exps" },
{ LLM_TENSOR_FFN_DOWN_EXPS, "blk.%d.ffn_down_exps" },
{ LLM_TENSOR_FFN_UP_EXPS, "blk.%d.ffn_up_exps" },
{ LLM_TENSOR_FFN_GATE_SHEXP, "blk.%d.ffn_gate_shexp" },
{ LLM_TENSOR_FFN_DOWN_SHEXP, "blk.%d.ffn_down_shexp" },
{ LLM_TENSOR_FFN_UP_SHEXP, "blk.%d.ffn_up_shexp" },
},
},
{
Expand Down
6 changes: 4 additions & 2 deletions examples/talk-llama/llama-context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1704,10 +1704,12 @@ size_t llama_context::state_write_data(llama_io_write_i & io) {
}
}

LLAMA_LOG_DEBUG("%s: - writing KV self\n", __func__);
llama_kv_cache * kv_self = static_cast<llama_kv_cache *>(memory.get());

kv_self->state_write(io);
if (kv_self != nullptr) {
LLAMA_LOG_DEBUG("%s: - writing KV self\n", __func__);
kv_self->state_write(io);
}

return io.n_bytes();
}
Expand Down
8 changes: 8 additions & 0 deletions examples/talk-llama/llama-kv-cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,13 @@ void llama_kv_cache_unified::defrag_sched(float thold) {

void llama_kv_cache_unified::set_full() {
n = size;

// when simulating a full KV cache, the specific value of the "head" pointer is not important because it does not
// affect the shapes of the tensors in the compute graph - it only affects the offsets of the K/V views.
// we should only guarantee that the head position won't cause out-of-bounds view of the K, V tensors, so
// setting it to 0 is the simplest way to achieve that
// ref: https://github.com/ggml-org/llama.cpp/issues/13359
head = 0;
}

llama_sbatch llama_kv_cache_unified::sbatch_init(
Expand Down Expand Up @@ -1712,6 +1719,7 @@ void llama_kv_cache_recurrent::defrag_sched(float thold) {

void llama_kv_cache_recurrent::set_full() {
n = size;
head = 0;
}

llama_sbatch llama_kv_cache_recurrent::sbatch_init(
Expand Down
14 changes: 4 additions & 10 deletions examples/talk-llama/llama-kv-cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,8 @@ class llama_kv_cache_unified : public llama_kv_cache {
void state_write(llama_io_write_i & io, llama_seq_id seq_id = -1) const override;
void state_read (llama_io_read_i & io, llama_seq_id seq_id = -1) override;

// Note: The value of head isn't only used to optimize searching
// for a free KV slot. llama_decode_impl also uses it, so it
// cannot be freely changed after a slot has been allocated.
uint32_t head = 0;
uint32_t size = 0;
uint32_t head = 0; // the location where the batch will be placed in the cache (see find_slot())
uint32_t size = 0; // total number of cells, shared across all sequences
uint32_t used = 0; // used cells (i.e. at least one seq_id)

// computed before each graph build
Expand Down Expand Up @@ -343,11 +340,8 @@ class llama_kv_cache_recurrent : public llama_kv_cache {
void state_write(llama_io_write_i & io, llama_seq_id seq_id = -1) const override;
void state_read (llama_io_read_i & io, llama_seq_id seq_id = -1) override;

// Note: The value of head isn't only used to optimize searching
// for a free KV slot. llama_decode_impl also uses it, so it
// cannot be freely changed after a slot has been allocated.
uint32_t head = 0;
uint32_t size = 0;
uint32_t head = 0; // the location where the batch will be placed in the cache (see find_slot())
uint32_t size = 0; // total number of cells, shared across all sequences
uint32_t used = 0; // used cells (i.e. at least one seq_id)

// computed before each graph build
Expand Down
19 changes: 12 additions & 7 deletions examples/talk-llama/llama-model-loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ llama_model_loader::llama_model_loader(

meta.reset(gguf_init_from_file(fname.c_str(), params));
if (!meta) {
throw std::runtime_error(format("%s: failed to load model from %s\n", __func__, fname.c_str()));
throw std::runtime_error(format("%s: failed to load model from %s", __func__, fname.c_str()));
}

get_key(llm_kv(LLM_KV_GENERAL_ARCHITECTURE), arch_name, false);
Expand Down Expand Up @@ -528,7 +528,7 @@ llama_model_loader::llama_model_loader(
};
gguf_context_ptr ctx_gguf { gguf_init_from_file(fname_split, split_params) };
if (!ctx_gguf) {
throw std::runtime_error(format("%s: failed to load GGUF split from %s\n", __func__, fname_split));
throw std::runtime_error(format("%s: failed to load GGUF split from %s", __func__, fname_split));
}

// check idx
Expand Down Expand Up @@ -822,13 +822,18 @@ void llama_model_loader::init_mappings(bool prefetch, llama_mlocks * mlock_mmaps
mappings.reserve(files.size());
mmaps_used.reserve(files.size());
for (const auto & file : files) {
auto * reg = ggml_backend_dev_backend_reg(ggml_backend_dev_by_type(GGML_BACKEND_DEVICE_TYPE_CPU));
if (!reg) {
throw std::runtime_error(format("%s: no CPU backend found", __func__));
bool is_numa = false;

auto * dev = ggml_backend_dev_by_type(GGML_BACKEND_DEVICE_TYPE_CPU);
if (dev) {
auto * reg = ggml_backend_dev_backend_reg(dev);
auto * is_numa_fn = (decltype(ggml_is_numa) *) ggml_backend_reg_get_proc_address(reg, "ggml_backend_cpu_is_numa");
if (is_numa_fn) {
is_numa = is_numa_fn();
}
}

auto * is_numa_fn = (decltype(ggml_is_numa) *) ggml_backend_reg_get_proc_address(reg, "ggml_backend_cpu_is_numa");
std::unique_ptr<llama_mmap> mapping = std::make_unique<llama_mmap>(file.get(), prefetch ? -1 : 0, is_numa_fn());
std::unique_ptr<llama_mmap> mapping = std::make_unique<llama_mmap>(file.get(), prefetch ? -1 : 0, is_numa);
mmaps_used.emplace_back(mapping->size(), 0);
if (mlock_mmaps) {
std::unique_ptr<llama_mlock> mlock_mmap(new llama_mlock());
Expand Down
Loading
Loading