koboldcpp/tests
Georgi Gerganov a30273376e
metal : clamp K extent in tensor API mat-mat kernel for K not a multiple of 32 (#27450)
The Tensor API mat-mat path of kernel_mul_mm (GGML_METAL_HAS_TENSOR) fed a
static K=32 tile to the matmul2d op on every iteration. On the last, partial
K tile (ne00 % 32 != 0) the src1 slice extends past the K extent of the
tensor, and the op reads those out-of-bounds elements (undefined behavior per
the MSL specification, section 2.22.2). Depending on stale memory contents,
this corrupted the result or produced NaN.

Make the matmul2d op use dynamic_extent for K, and clamp the K extent of both
operand tensor views to the remaining valid K range (min(32, K - loop_k)) per
iteration, so the op reads exactly the valid K range on every iteration
(mirroring the tail handling of the MPP matmul2d examples). On K-aligned
inputs the clamp degenerates to the full 32-wide tile: the only difference
from the static-K op is that the dynamic-K op derives K from the operand
extents and edge-checks the tile against the tensor extents (a handful of
integer ops per iteration).

Add test-backend-ops MUL_MAT cases with K not a multiple of 32 to exercise
the unaligned K path.

Assisted-by: pi:llama.cpp/Qwen3.8-27B
2026-08-20 21:31:29 +03:00
..
peg-parser common/peg : suppress incomplete escape sequences (#26780) 2026-08-11 07:10:31 +03:00
snapshots tests : avoid building get-model.cpp many times (#26317) 2026-07-30 19:34:04 +03:00
.gitignore
CMakeLists.txt tests: skip test-unicode build on win32/BUILD_SHARED_LIBS (#27336) 2026-08-19 08:50:50 +02:00
gguf-model-data.cpp ci : add [no release] keyword + fix sanitizer builds (#23728) 2026-05-26 19:05:48 +03:00
gguf-model-data.h
test-alloc.cpp tests: Harmonize header use (#25616) 2026-07-13 15:36:51 +03:00
test-arg-parser.cpp llama : support multi-output backend sampling (#25532) 2026-08-10 16:58:56 +03:00
test-autorelease.cpp tests : avoid building get-model.cpp many times (#26317) 2026-07-30 19:34:04 +03:00
test-backend-ops.cpp metal : clamp K extent in tensor API mat-mat kernel for K not a multiple of 32 (#27450) 2026-08-20 21:31:29 +03:00
test-backend-sampler.cpp tests : disable backend sampler hip multi output (#26878) 2026-08-11 07:21:32 +03:00
test-barrier.cpp
test-batch-alloc.cpp llama-batch: add unit test (#25471) 2026-07-10 11:04:31 +08:00
test-c.c
test-chat-auto-parser.cpp model : BailingMoE3 Support (#26608) 2026-08-17 09:49:49 +02:00
test-chat-peg-parser.cpp chat : add qwen3 specialized parser (#26252) 2026-08-02 04:13:20 -05:00
test-chat-template.cpp jinja: add --dump-prog for debugging (#25086) 2026-06-28 15:50:31 +02:00
test-chat.cpp model: add Kimi-K3 text model (#26185) 2026-08-15 17:11:05 +02:00
test-col2im-1d.cpp ggml : add GGML_OP_COL2IM_1D (#24206) 2026-06-09 12:01:37 +03:00
test-double-float.cpp
test-export-graph-ops.cpp tests: export-graph-ops: exit gracefully when called w/o arguments (#25619) 2026-07-14 13:15:41 +03:00
test-gbnf-validator.cpp
test-gguf-model-data.cpp
test-gguf.cpp gguf : harden loader against malformed tensor dims and metadata types (#25596) 2026-08-12 15:07:48 +03:00
test-grammar-integration.cpp
test-grammar-llguidance.cpp
test-grammar-parser.cpp grammar : degrade max repetition >= 2000 to unbounded (#26613) 2026-08-05 07:39:10 -05:00
test-jinja.cpp chat: refactor handling supports_string_content / supports_typed_content (#27130) 2026-08-16 12:45:33 +02:00
test-json-schema-to-grammar.cpp common : gracefully fallback on unsupported regex patterns in JSON schema (#26939) 2026-08-20 06:59:03 -05:00
test-llama-archs.cpp model : GraniteSWAForCausalLM / GraniteMoeSWAForCausalLM (#25505) 2026-08-19 16:53:31 +02:00
test-llama-grammar.cpp
test-log.cpp common: Intentionally leak logger instance to fix hanging on Windows (#22273) 2026-04-29 10:58:43 +03:00
test-lora-conversion-inference.sh
test-model-load-cancel.cpp tests : avoid building get-model.cpp many times (#26317) 2026-07-30 19:34:04 +03:00
test-model-resolution.cpp Mitigate crashing issue on Windows MSYS2 UCRT64 environment (GCC 16.1.0) (#26555) 2026-08-07 11:17:16 +02:00
test-mtmd-c-api.c mtmd: add chunk save/load function (#26645) 2026-08-06 19:46:40 +02:00
test-mtmd-impl.cpp mtmd: add mtmd_bitmap_set_mergeable (#27348) 2026-08-19 13:48:22 +02:00
test-opt.cpp
test-peg-parser.cpp
test-quant-type-selection.cpp tests : avoid building get-model.cpp many times (#26317) 2026-07-30 19:34:04 +03:00
test-quantize-fns.cpp Add Q2_0 quantization: type definition and CPU backend (#24448) 2026-07-07 12:05:47 -07:00
test-quantize-perf.cpp
test-quantize-stats.cpp cmake : introduce semantic versioning (#26839) 2026-08-12 14:15:03 +02:00
test-reasoning-budget.cpp common : add support for multiple end sequences in the reasoning budget sampler (#25544) 2026-07-25 11:58:09 +02:00
test-recurrent-state-rollback.cpp DeepseekV4 MTP + DSpark (#25784) 2026-08-02 20:55:34 +08:00
test-rope.cpp
test-rset-release.cpp tests : avoid building get-model.cpp many times (#26317) 2026-07-30 19:34:04 +03:00
test-sampling.cpp llama : support multi-output backend sampling (#25532) 2026-08-10 16:58:56 +03:00
test-save-load-state.cpp tests : remove unnecessary sync in test-save-load-state (#26166) 2026-07-27 13:11:20 +03:00
test-state-restore-fragmented.cpp common : only load backends when required (#22290) 2026-05-05 09:23:50 +02:00
test-thread-safety.cpp tests : synchronize contexts at end of test-thread-safety (#24935) 2026-06-25 09:22:51 +03:00
test-tokenizer-0.cpp
test-tokenizer-0.py
test-tokenizer-0.sh
test-tokenizer-1-bpe.cpp
test-tokenizer-1-spm.cpp
test-tokenizer-random.py
test-tokenizers-repo.sh
test-unicode.cpp unicode : include '~' in collapsed symbol class (#26972) 2026-08-18 15:15:22 +02:00
testing.h chat: refactor handling supports_string_content / supports_typed_content (#27130) 2026-08-16 12:45:33 +02:00