diff --git a/AGENTS.md b/AGENTS.md index 2dac5169..bd44be62 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -60,9 +60,10 @@ See `docs/v080_qualification.md` for the v0.8.0 candidate, its wrapper gate, carried-patch status and consumer ABI delta. See `docs/v080_android_isa_qualification.md` for the v0.8.0/KleidiAI v1.32.0 source pair, its SVE I8MM-gated Q8 kernels and remaining gates. -See `docs/v090_qualification.md` for the v0.9.0 candidate, retired patch 0004 -and consumer ABI delta, and `docs/v090_android_isa_qualification.md` for its -source pair and ggml SVE256 repack paths. +See `docs/v090_qualification.md` for the v0.9.0 candidate, patches 0003 and +0004 (kept for the older rows, not applied to v0.9.0) and consumer ABI delta, +and `docs/v090_android_isa_qualification.md` for its source pair and ggml +SVE256 repack paths. See `docs/v080_1_wrapper_rebuild.md` for the `v0.8.0-1` Metal kernel patch and the OS floor check `metal_os_floor.yml`, which runs on `macos-15`, `macos-26` and the oldest iOS simulator because ggml compiles Metal source on the user's diff --git a/CMakeLists.txt b/CMakeLists.txt index c2a3ad60..e83caa85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -808,6 +808,8 @@ if (LLAMADART_BUILD_TTS_SMOKE) add_executable(llamadart_tts_voice_smoke tools/tts_voice_smoke.cpp) target_compile_features(llamadart_tts_voice_smoke PRIVATE cxx_std_17) target_link_libraries(llamadart_tts_voice_smoke PRIVATE llamadart_lib) + target_compile_definitions(llamadart_tts_voice_smoke PRIVATE + LLAMADART_MTMD_HAS_GEN_VOICES=$) target_include_directories(llamadart_tts_voice_smoke PRIVATE third_party/llama.cpp/include third_party/llama.cpp/tools/mtmd diff --git a/README.md b/README.md index 0977b5c0..a3d504d6 100644 --- a/README.md +++ b/README.md @@ -520,8 +520,10 @@ PCM. `LLAMA_DEFAULT_SEED` draws one random seed per task for both samplers. The talker sampler gives the GGUF's `tokenizer.ggml.suppress_tokens` a `-inf` bias, as upstream `common_sampler` does. For Qwen3-TTS these are the codec's control tokens, which code2wav rejects as out-of-range codes, failing the -synthesis. Earlier wrappers did not apply them, so a fixed seed can give -different PCM where a control token reached the sampled candidates. +synthesis. Earlier wrappers did not apply them. A fixed seed still gives the same PCM +at default settings, `top_k 1` and `temp 0`; at high temperature with `top_k 0` +(for example `temp 2.5`) PCM can differ even when no control token is drawn, +because `dist` renormalizes without the suppressed mass. The local smoke target is opt-in because it requires large model artifacts: diff --git a/docs/native174_f16_dot_accumulation.md b/docs/native174_f16_dot_accumulation.md index 6bcbf1f9..c217df27 100644 --- a/docs/native174_f16_dot_accumulation.md +++ b/docs/native174_f16_dot_accumulation.md @@ -95,10 +95,11 @@ measured on that hardware. overflow, 8/16/32-column GEMM cases, F32 controls, and ordinary and flash attention over 16 keys for one and eight queries with an unsaturated softmax. For 0006 it adds GEMM blocks whose F16 lane sums end exactly at - 65504 and at 65536 (overflow), sums that are exact in F16 within one block - but not across two (catches a longer or missing block), block tails, and an - overflow confined to part of one tile away from the origin (catches a - partial finiteness check or a misplaced recompute). Weight rows are followed + 65504 and at 65536 (overflow), lane sums of 2047 that are exact in F16 within + one block but not with a 65th product (catches a longer block), block tails, + and overflow confined to single cells of tiles away from the origin, among + them only the last row and only the last column of a tile (catches a partial + finiteness check or a misplaced recompute). Weight rows are followed by NaN padding, so a read past the row fails; in 0006 the recompute hides an over-read that reaches only the padding, and the attention case catches one that reaches the next row. It reports every failing check. The macOS diff --git a/docs/v090_qualification.md b/docs/v090_qualification.md index fa497899..d96ac1cd 100644 --- a/docs/v090_qualification.md +++ b/docs/v090_qualification.md @@ -24,10 +24,6 @@ The wrapper builds against v0.9.0 without source changes, and every - `MTMD_GEN_AUDIO_TYPE_CHATTERBOX` maps to `LLAMA_DART_TTS_MODEL_TYPE_UNKNOWN`, so the TTS entry points report it unsupported. Chatterbox and the new predefined-voice API are not wrapped. -- The TTS talker sampler now applies the GGUF's suppress tokens. A fixed - Qwen3-TTS seed can give different PCM from v0.8.0 wrappers where a codec - control token reached the sampled candidates; with the ggml-org 1.7B Base - Q4_K_M GGUF, 40 seed and sampling combinations gave identical PCM. Evidence, 2026-11-06, Apple M4 Max, macOS arm64, Metal on, Release, `LLAMADART_BUILD_TESTS=ON`, `LLAMADART_BUILD_TTS_SMOKE=ON`: native CTest @@ -38,6 +34,16 @@ Evidence, 2026-11-06, Apple M4 Max, macOS arm64, Metal on, Release, `llamadart_f16_dot_accumulation_test`; the same export and `check-apple` checks pass. +## TTS sampler behavior + +Separately from the v0.9.0 build, the TTS talker sampler applies the GGUF's +suppress tokens, which earlier wrappers did not. A fixed Qwen3-TTS seed gives +the same PCM as before at default settings, `top_k 1` and `temp 0`, which +the ggml-org 1.7B Base Q4_K_M GGUF confirmed over 40 seed and sampling +combinations. At high temperature with `top_k 0` (for example `temp 2.5`), PCM +can differ even when no control token is drawn, because `dist` renormalizes +without the suppressed mass. + ## Carried patches Reviewed 2026-11-07 against v0.9.0 and upstream `master` diff --git a/patches/llama.cpp/README.md b/patches/llama.cpp/README.md index b015983f..239fedb0 100644 --- a/patches/llama.cpp/README.md +++ b/patches/llama.cpp/README.md @@ -71,7 +71,8 @@ library lacks the `text` of an `android_markers` entry. It reads the built library, so it does not matter why the patch is missing. The release runs it on every Android bundle and `validate_wrapper.yml` on the pinned upstream, so a patch that upstream has outgrown fails the pull request that moves the -upstream, or the release, the automatic stable release included. Check then +upstream, or the manually dispatched release (`native_release.yml`, or +`auto_native_release.yml` for a new stable upstream tag). Check then whether upstream fixed the defect, and refresh the patch or delete it. For that reason every patch must have at least one marker, and so must change diff --git a/tests/f16_dot_accumulation_test.cpp b/tests/f16_dot_accumulation_test.cpp index b4d338ea..88b96042 100644 --- a/tests/f16_dot_accumulation_test.cpp +++ b/tests/f16_dot_accumulation_test.cpp @@ -85,7 +85,8 @@ enum class Pattern { block_maximum, // As block_maximum but each lane sums to 65536, which overflows in F16. block_overflow, - // Lane sums stay exact in F16 within a block but not over two blocks. + // Each lane sums 64 products to 2047, exact in F16; a 65th product of 32 + // gives the odd 2079, which F16 cannot hold. block_exact, }; @@ -129,7 +130,7 @@ void dot_case(ggml_backend_t backend, int width, float magnitude, qv = 2048.0f / gemm_block_steps - (pattern == Pattern::block_maximum && last_step ? 1.0f : 0.0f); } else if (pattern == Pattern::block_exact) { - kv = 2048.0f / gemm_block_steps - 1.0f; + kv = (i % gemm_block) / 8 == 1 ? 31.0f : 32.0f; qv = 1.0f; } for (int r = 0; r < rows; ++r) { @@ -163,8 +164,11 @@ void dot_case(ggml_backend_t backend, int width, float magnitude, } // Sixteen weight rows times twelve query columns with exact integer products. -// In the K tail after one GEMM block, rows 5-6 times columns 8-9 overflow F16: -// part of the 4x6 tile at rows 4-7 and columns 6-11, which alone is redone in F32. +// In the K tail after one GEMM block, lane 0 overflows F16 for rows 5-6 times +// columns 8-9 and lane 1 for rows 1 and 7 times columns 2 and 11. The 4x6 tiles +// sit at rows 4i..4i+3 and columns 6j..6j+5, so tile (4-7, 0-5) overflows only +// in its last row (7, 2), tile (0-3, 6-11) only in its last column (1, 11), and +// the finiteness check must see every cell to redo each tile in F32. void gemm_tile_case(ggml_backend_t backend) { constexpr int rows = 16; constexpr int cols = 12; @@ -182,10 +186,14 @@ void gemm_tile_case(ggml_backend_t backend) { std::vector keys(static_cast(stride) * rows, ggml_fp32_to_fp16(NAN)); std::vector queries(static_cast(width) * cols); auto key = [](int r, int i) { - return i >= gemm_block && (r == 5 || r == 6) ? 4096.0f : 1.0f + r % 3; + const int lane = i - gemm_block; + const bool large = (lane == 0 && (r == 5 || r == 6)) || (lane == 1 && (r == 1 || r == 7)); + return large ? 4096.0f : 1.0f + r % 3; }; auto query = [](int c, int i) { - return i >= gemm_block ? (c == 8 || c == 9 ? 16.0f : 1.0f) : 1.0f + c % 4; + const int lane = i - gemm_block; + const bool large = (lane == 0 && (c == 8 || c == 9)) || (lane == 1 && (c == 2 || c == 11)); + return large ? 16.0f : i >= gemm_block ? 1.0f : 1.0f + c % 4; }; for (int r = 0; r < rows; ++r) { for (int i = 0; i < width; ++i) { diff --git a/tests/test_android_cpu_isa.py b/tests/test_android_cpu_isa.py index 2ff20766..2e326fc3 100644 --- a/tests/test_android_cpu_isa.py +++ b/tests/test_android_cpu_isa.py @@ -100,23 +100,16 @@ def test_tree_hash_binds_names_contents_and_new_callers(self): self.assertNotEqual(original, audit.tree_digest(root)) def test_exact_reviewed_source_pairs_are_required(self): - expected = frozenset((ggml, "64189fc613c1c4c3aaeeb6bb12b38d85dd6728cafd2261a5a88f1b77b10fe59c") - for ggml in ( - "c4dc92a7d95ebfad7f5f55e75be2ae773b7d95faf72a9581c9479c42bc41bca0", - "dcb0f04ebb9654b1fe5ac7cc45737c79e62b116a2063ceda81a7ec1ddb1b20e2", - "bf7ae6d2ea861ce6cd4b56afce154a45461df79b46c02e340d1adfe0075467b5", - "68d5bc369749e78545f50dd5107368ec7ee1874619794795cd142b0043c747f6", - "adc8d989599211a4b789b2c595b2ae52335c5a390e6c4972171c46589aa05e7e", - )) | frozenset({( - "b571df853210d243a83b1ec34a6936f147916f0369d792f8bb0d17f37fc7894b", - "deb324dbcf8c952ec149433ab58cbed0b2ab2374a557f0a4eea575b2da761377", - ), ( - "0b14cd6eac9832e7e50cee546495581c0067e7bca5c0db1dee6c3f7c0f7cf1f3", - "fd5b9ca98d07b81671eca377c258da74e72173f92f3cab0acdf6c17ab870bd9d", - ), ( - "fead7601e3b35651ee62764c76f28b50ee564160b543ff79be6fcc81837216c4", - "fd5b9ca98d07b81671eca377c258da74e72173f92f3cab0acdf6c17ab870bd9d", - )}) + expected = frozenset({( + "b571df853210d243a83b1ec34a6936f147916f0369d792f8bb0d17f37fc7894b", + "deb324dbcf8c952ec149433ab58cbed0b2ab2374a557f0a4eea575b2da761377", + ), ( + "0b14cd6eac9832e7e50cee546495581c0067e7bca5c0db1dee6c3f7c0f7cf1f3", + "fd5b9ca98d07b81671eca377c258da74e72173f92f3cab0acdf6c17ab870bd9d", + ), ( + "fead7601e3b35651ee62764c76f28b50ee564160b543ff79be6fcc81837216c4", + "fd5b9ca98d07b81671eca377c258da74e72173f92f3cab0acdf6c17ab870bd9d", + )}) self.assertEqual(audit.SOURCE_PAIRS, expected) for ggml, kai in expected: with self.subTest(ggml=ggml): @@ -144,7 +137,7 @@ def test_cli_binds_exact_function_ranges_to_the_reviewed_source_pair(self): audit.V080_SOURCE_PAIR: audit.DISPATCHED_FUNCTIONS_V080, audit.V090_SOURCE_PAIR: audit.DISPATCHED_FUNCTIONS_V080} for pair in audit.SOURCE_PAIRS: - allowed = allowed_by_pair.get(pair, audit.DISPATCHED_FUNCTIONS) + allowed = allowed_by_pair[pair] for artifact_ranges in (audit.DISPATCHED_FUNCTIONS, audit.DISPATCHED_FUNCTIONS_V070, audit.DISPATCHED_FUNCTIONS_V080): names = sorted(artifact_ranges) diff --git a/tools/tts_voice_smoke.cpp b/tools/tts_voice_smoke.cpp index 3c05393d..4c41b8da 100644 --- a/tools/tts_voice_smoke.cpp +++ b/tools/tts_voice_smoke.cpp @@ -168,6 +168,11 @@ static bool list_voices(mtmd_context *mtmd, uint32_t bit, std::vector