Fast local LLM inference on plain CPUs. No GPU, 8 GB of RAM. OpenAI-compatible server.
Python aiavx512cpu-inferenceedge-aiggufinference-enginellama-cppllmllm-inferencelocal-ailocal-llmno-gpuon-device-aiopenai-apiopenai-compatiblequantizationqwenself-hostedspeculative-decodingternary
diff --git a/common/arg.cpp b/common/arg.cpp
index 94dead3..eef8b99 100644
--- a/common/arg.cpp
+++ b/common/arg.cpp
@@ -311,6 +311,7 @@ const std::vector<ggml_type> kv_cache_types = {
GGML_TYPE_IQ4_NL,
GGML_TYPE_Q5_0,
GGML_TYPE_Q5_1,
+ GGML_TYPE_Q8_K, // int8 rows with one f32 scale each; CPU attention kernel only (release/kernels/attn-fast.inc)
};
static ggml_type kv_cache_type_from_str(const std::string & s) {
diff --git a/ggml/src/ggml-cpu/ggml-cpu.c b/ggml/src/ggml-cpu/ggml-cpu.c
--- a/ggml/src/ggml-cpu/ggml-cpu.c
+++ b/ggml/src/ggml-cpu/ggml-cpu.c
@@ -3021,7 +3021,17 @@ struct ggml_cplan ggml_graph_plan(
size_t n_chunks = n_tasks;
size_t decode = sizeof(float)*(neq2*n_chunks*(2+DV) + n_tasks*(DK + 2*DV));
-
+
- cur += MAX(prefill, decode);
+ // attn-fast.inc splits small query groups over canonical 1024-key chunks.
+ // Reserve their partials in this graph's workspace, not a process-global buffer.
+ const int64_t neq1 = node->src[0]->ne[1];
+ const int64_t nek1 = node->src[1]->ne[1];
+ const int64_t nek2 = node->src[1]->ne[2];
+ size_t grouped = 0;
+ if (nek2 > 0 && neq2 % nek2 == 0 && neq1 * (neq2 / nek2) <= 48) {
+ grouped = sizeof(float)*neq1*neq2*((nek1 + 1023)/1024)*(2+DV) + 63;
+ }
+
+ cur += MAX(MAX(prefill, decode), grouped);
} break;
case GGML_OP_FLASH_ATTN_BACK:
{
diff --git a/ggml/src/ggml-cpu/ops.cpp b/ggml/src/ggml-cpu/ops.cpp
index 6884720..12f84df 100644
--- a/ggml/src/ggml-cpu/ops.cpp
+++ b/ggml/src/ggml-cpu/ops.cpp
@@ -9442,9 +9442,14 @@ static void ggml_compute_forward_flash_attn_ext_f16(
}
}
+#include "attn-fast.inc" // GGML_ATTN: fused GQA attention, any M, F16 / Q8_K KV (release/kernels)
+
void ggml_compute_forward_flash_attn_ext(
const ggml_compute_params * params,
ggml_tensor * dst) {
+ if (attnf_forward(params, dst)) {
+ return;
+ }
switch (dst->op_params[3]) {
case GGML_PREC_DEFAULT:
case GGML_PREC_F32: