Repository navigation
Attach a persistent CPU threadpool to llama.cpp contexts (llamadart-native v1.1.0-2) - #2393
Merged
Merged
Conversation
…ative v1.1.0-2) Repins the llama.cpp runtime to llamadart-native v1.1.0-2 and calls llama_dart_context_attach_threadpool after each context the service creates, so Android CPU generation on Tensor G6 no longer starts and joins a worker pool for every graph compute.
…solve the Windows wrapper in the bindings probe
Contributor
|
Chat app preview removed for |
This was referenced Nov 29, 2026
leehack
added a commit
that referenced
this pull request
Nov 29, 2026
…vice (#2394) ## Summary - Follow up on #2393. Pass an explicitly empty llama.cpp device list for CPU loads so decode uses the backend that owns the persistent threadpool. This covers explicit CPU selection, forced CPU fallback, refused Android Vulkan drivers, GPU-memory-fit fallback, and CPU drafts. - Keep the CPU row-split rejection and use layer mode for CPU loads requested with tensor split, which need a model device in upstream tensor mode. - Backport after #2393 in the 0.23.x patch plan (#2390). ## Changelog - [core] Run llama.cpp CPU loads, including the automatic CPU fallback on refused Android Vulkan drivers, on the persistent CPU threadpool: the load no longer lists the CPU device, which made llama.cpp compute on a second CPU backend with a per-compute pool. ## Production-readiness scope - **User-facing scope** Native llama.cpp CPU inference uses the existing persistent pool on runtimes that provide it. - **Supported platforms/paths** Native llama.cpp explicit CPU, CPU fallback, and speculative draft loads. The fix uses the pinned runtime and the existing native pool API. - **Unsupported or intentionally unavailable paths** CPU row split still throws `LlamaUnsupportedException` and points to layer mode. The native runtime's existing no-pool path remains available when the attach export or pool is unavailable. - **Out of scope / follow-ups** Physical-device throughput and the 0.23.x backport are tracked by the coordinator under #2390. ## Completeness checklist - [x] Implemented the CPU routing scope. - [x] Preserved the documented CPU row-split error and successful CPU tensor-requested load. - [x] Updated the runtime guide, support matrix, and PR changelog. README, examples, and package skills are N/A because the public API and setup are unchanged. - [x] Covered the original native log and wire values, row/tensor compatibility, and the existing GPU registry fallback. - [x] Validation coverage registry is N/A because this restores an existing capability. - [x] Reviewed log, error, and cache-key changes for secret exposure. The native log capture is confined to a generated test fixture. - [x] Patch sequencing is tracked in #2390. ## PR type guidance - **Bugfix** A listed CPU creates a second CPU backend. The scheduler computes there while the attached pool belongs to llama.cpp's built-in CPU backend. The production load and wire assertions detect the extra CPU device. ## Test Plan - [x] `dart run tool/prepare_workspace.dart` - [x] `python3 tool/ci/check_format.py`, `dart analyze`, and `dart run tool/testing/check_platform_boundaries.dart` - [x] `dart test -p vm -j 1 --exclude-tags local-only` passed in the local coverage run and in PR CI. - [x] Chrome shards passed in PR CI. Local browser validation is N/A for native routing. - [x] `coverage-lib` passed with 93.84% line coverage (37,934 of 40,426 lines). - [x] Docs-site build and focused native CPU, row-split and tensor-split regressions. The full llama.cpp VM directory passed on macOS (1,915 passed, 7 skipped) and Linux arm64 at the final head (1,911 passed, 8 skipped). The registry fixture also passed with an invalid Vulkan ICD. ## Matrix Evidence | Matrix row | Scope covered | Platform / model / backend | Result | Evidence / notes | | --- | --- | --- | --- | --- | | `static-format-analyze` | format, analyzer, web/native import boundaries | macOS arm64, Flutter 3.47.1 | PASS | Workspace preparation and all three checks passed. | | `root-vm` | native-safe unit/integration coverage on the Dart VM | macOS arm64 and Linux arm64, synthetic Llama GGUF, pinned llama.cpp | PASS | Local root VM run had 16,642 passes and 136 skips. Full backend unit suites passed on macOS and Linux arm64, and native CI passed on the final head. | | `root-chrome` | browser-compatible unit/integration coverage | Chrome on GitHub Actions | PASS (CI) | All three Chrome shards passed. | | `coverage-lib` | 70% lib/ line threshold | macOS arm64 | PASS | 93.84% (37,934 of 40,426 lines). | | `gguf-chat-features-smoke` | real GGUF chat, thinking and tool calls | macOS arm64, Qwen3.5-0.8B-Q4_K_M, CPU | PASS | CPU reported for all cases. The native info log contained metadata and no `using device CPU` line. | | `docs-site` | site build and generated links | macOS arm64 | PASS | `./tool/docs/build_site.sh` | | `high-risk-exact-head-independent-qa` | independent review of the exact head and base | native llama.cpp | Pass | Independent auditor-deep review of 563a86f against e95e5c7: no blocking findings; targeted tests and three mutations re-run independently. | ## Review Notes - Independent review completed at 563a86f: no blocking findings. - CI passed at `563a86f30e990b85b6e7daf53e1bf7b1ed8e97f9`. The first head's Linux VM shard found a host Vulkan dependency in the simulated Windows registry tests. The fixture now uses a simulated CUDA device and passes under an invalid Vulkan ICD. ## High-risk regression review - **Classification** high-risk (`backendRuntime`) - **Implementation task** Fix CPU loads listing the CPU device - **Independent blocking QA task** Completed at 563a86f: no blocking findings. - **Exact head / current base** `563a86f30e990b85b6e7daf53e1bf7b1ed8e97f9` / `e95e5c7f8213622f6e5ebe9805ed4fee8068585d` - **Production-branch deletion, bypass, or miswire proof** On the base loader the real synthetic GGUF test captured `llama_prepare_model_devices: using device CPU` and the three original wire assertions saw a single address. Restoring `return [cpuDev]` on Linux failed the five wire cases (refused Android Vulkan, iOS simulator, macOS Intel, memory-fit fallback, and CPU draft) and the native log test. The seven-case filtered command passed with the fixed list. The tensor CPU model load passed on the base and fixed loader. The existing row-split rejection test is unchanged. - **Affected-family real-model/artifact evidence** The pinned `llamadart-native v1.1.0-2` bundle loads the synthetic Llama GGUF and the affected Qwen3.5-0.8B-Q4_K_M family on desktop CPU. The Qwen GGUF SHA-256 is `bd258782e35f7f458f8aced1adc053e6e92e89bc735ba3be89d38a06121dc517`. Both native logs include the metadata positive control without an extra CPU device line on the fixed load. - **Explicit unavailable-family or other N/A evidence** No phone runs in this implementation task. The fixture validates CPU device selection and does not establish Pixel or Studio throughput. - **Known PR-caused P1 regressions** 0 identified in implementation testing. Independent audit: 0 blocking findings. - **Unresolved review threads** 0 at the final GitHub check.
This was referenced Nov 29, 2026
Open
leehack
added a commit
that referenced
this pull request
Nov 29, 2026
…amadart-native v1.1.0-2) (#2442) ## Summary Backport of #2393 (cherry picked from commit e95e5c7) - Repin the llama.cpp runtime from `v1.1.0-1` to [llamadart-native v1.1.0-2](https://github.com/leehack/llamadart-native/releases/tag/v1.1.0-2) ([PR #251](leehack/llamadart-native#251), `b78a2de`): `llamaCppTag`, all 11 bundle SHA-256s, the Windows CUDA sidecar, the XCFramework checksum and the Apple companion `Package.swift` tag/checksum, plus the exact-tag lists and Android qualification pins that follow the pin (as in #2375). `check_native_release_digests.dart` matches `SHA256SUMS` (12 bundles). Same llama.cpp `v1.1.0` commit, so admission is unchanged. Bindings gain `llama_dart_threadpool_api_version` and `llama_dart_context_attach_threadpool`, added by hand: local ffigen on macOS also rewrites the `FILE` types, so I kept only the two additive declarations. A Linux `sync_native_bindings.yml` run was not done; the `native_symbol_integration_test.dart` signature test pins both declarations. - Root cause (plan [#2390](#2390)): llamadart left `llama_context.threadpool` unset, so ggml starts and joins a worker pool for every graph compute; on Tensor G6 (Linux 6.12) the fresh workers stack onto one core and CPU generation drops to about 4 tok/s. - New `lib/src/backends/llama_cpp/context_threadpool_api.dart` (`ContextThreadpoolApi`) resolves the two exports as one unit (version >= 1) and `LlamaCppObjectCalls.attachContextThreadpool` calls it. `_createOwnedContext` attaches after every context it creates, owner-created or not, with poll 50, so it covers the generation, embedding, reranking, TTS/ASR host and decision-encoder contexts. The thread counts are the ones the context was created with (`numberOfThreads`/`numberOfThreadsBatch`, `0` through `resolveCpuThreads`). The speculative draft context is created and attached natively; Dart attaches nothing to it. The pools belong to the wrapper, which frees them after the context, so Dart frees nothing new. - Version skew: a runtime without the exports (a `v1.1.0` or `v1.1.0-1` override) keeps ggml's per-compute pool and loads as before. A status of `0` or `-1` (or a value a later release adds) is logged at debug level and never fails the load. - Companion/Apple: no companion version changed. The pin sync moved `llamaCppAppleCompanionVersion` to `0.23.1` and added `## Unreleased` to the companion changelog. `verify_release_docs_versions.dart` passes with a pending companion bump (same as #2375). `--release-prep` fails by design on three findings: the companion `0.23.0` publishes `v1.1.0-1`; the published `llamadart_llama_cpp_flutter-v0.23.0` pins `v1.1.0-1` which this core accepts no more; and the new pin needs a companion core floor past the rejecting `0.23.0`. The 0.23.1 release prep owns the companion bump and floor ([#2390](#2390)). ## Changelog - [core] llama.cpp contexts now keep a persistent CPU threadpool (`llamadart-native` v1.1.0-2), which fixes CPU generation on Android Tensor G6 (Pixel 11) running at about 4 tokens per second, now about 14x faster. - [packages/llamadart_llama_cpp_flutter] Pin Apple SwiftPM to `leehack/llamadart-native@v1.1.0-2`. ## Production-readiness scope - **User-facing scope:** every llama.cpp context on every native platform gets a persistent ggml CPU threadpool sized by its thread counts, instead of a disposable pool per graph compute. Device runs of the native candidate (Qwen3.5-0.8B Q4_K_M, 4 threads): Pixel 11 / 11 Pro about 4 to about 55 tok/s, Pixel 9 Pro 24 to 37 tok/s (native gate results are in leehack/llamadart-native#251). - **Supported platforms/paths:** all default native bundles, the Windows CUDA sidecar and Apple SwiftPM source. Windows resolves the exports from the wrapper asset. - **Unsupported or intentionally unavailable paths:** a runtime override older than `v1.1.0-2`, or a CPU backend without ggml threadpool exports (`0`), keeps the per-compute pool with a debug log; a refusal (`-1`) is logged and the context still loads. - **Out of scope / follow-ups:** companion bump and core floor (0.23.1 release prep, #2390); a Studio Android APK run on device; Windows/Linux/CUDA smokes (release-plan lanes). ## Completeness checklist - [x] Declared scope is fully implemented. - [x] Unsupported/version-skew path: absent exports, version 0, `0`, `-1`, unknown status; tests below. - [x] README, website docs (known platform issues, performance tuning, native sync), `doc/llama_cpp_exit_teardown.md` and the PR changelog section are updated. `skills/` needs no change: no public API or option changed. - [x] Regression coverage: see Test Plan. - [x] Capability registry: N/A, no public capability. - [x] No secrets, tokens or signed URLs. - [x] Follow-ups tracked in #2390. ## PR type guidance - **Bugfix PR:** root cause above (per-compute worker pools stacking on one core). Regression tests: `context_threadpool_api_test.dart`, `llama_cpp_service_context_threadpool_test.dart`, `native_symbol_integration_test.dart`. Affected platforms: Android arm64 (device-verified natively), all others get the same pool. - **Runtime artifact repin:** digests match `SHA256SUMS`; `check_webgpu_bridge_tag.dart --verify-manifest` passes with bridge assets unchanged at `v0.1.96`. ## Test Plan - [x] `dart run tool/prepare_workspace.dart` - [x] `python3 tool/ci/check_format.py` (0 changed), `dart analyze` (no issues), `check_platform_boundaries.dart` - [x] `dart test -p vm -j 1 --exclude-tags local-only` (isolated TMPDIR, macOS arm64): 16,635 passed, 136 skipped - [x] `dart test -p chrome --exclude-tags local-only`: 5,418 passed, 1 skipped - [ ] `coverage-lib`: not run; the new files are exercised by the new tests except the Windows wrapper-asset branch of `tryResolve`, which only resolves on Windows. - [x] Native Python suites (160 pin, 14 archive, 23 header/bindings, 5 SD bindings), default-consumer fixtures (70), Android `test_prepare.py` (3) and `packages/llamadart_validation` Android tests (27), `check_native_release_digests.dart`, `check_webgpu_bridge_tag.dart --verify-manifest`, `verify_release_docs_versions.dart` (default passes with the pending companion bump; `--release-prep` fails as described), `./tool/docs/build_site.sh` - [x] New tests (fake and real native): attach exactly once per owned context after creation and before the first decode, with the creation thread counts (explicit 2/3 and host-derived), poll 50, on generation, reranking, decision-encoder and worker-owner contexts; absent exports and `0`, `-1` and unknown statuses still load and generate; a failed creation attaches nothing; the real bundle attaches (`1`) and everything is freed once and in order. - [x] Mutation checks, 11 of 11 killed: drop the call; attach to a null context; skip the owner path; treat `-1` as fatal; poll 0; resolve without the exit-teardown API; minimum version 0; ignore the version; unknown status as success; wrong poll argument; wrong batch thread count. - [ ] Local-only real-model check: not added; the repo's thread-list probes are native-repo tests (`llamadart_threadpool_test` in llamadart-native). The Dart tests above run the real runtime on a synthetic model. ## Matrix Evidence | Matrix row | Scope covered | Platform / model / backend | Result | Evidence / notes | | --- | --- | --- | --- | --- | | `static-format-analyze` | format, analyzer, boundaries | macOS arm64 / Flutter 3.47.1 | PASS | No analyzer issues | | `root-vm` | VM suite | macOS arm64, isolated TMPDIR | PASS | 16,635 passed, 136 skipped | | `root-chrome` | browser suite | Chrome | PASS | 5,418 passed, 1 skipped | | `native-release-digests` | archive digest pins | Published v1.1.0-2 | PASS | 12 bundles match `SHA256SUMS` | | `webgpu-bridge-tag-consistency` | pins, provenance | GitHub / npm | PASS | `--verify-manifest` | | `native-sync-python-suites` | sync Python suites | Python 3 | PASS | 160 + 14 + 23 + 5 | | `release-doc-version-consistency` | docs versions | Checkout v1.1.0-2 | PASS (default) | `--release-prep` fails by design, owned by 0.23.1 prep | | `docs-site` | site build, links | Jaspr | PASS | Build exit 0 | | `coverage-lib` | lib coverage | N/A | Not run | See Test Plan | | `native-default-consumer-aot`, `macos-arm64-runtime-smoke`, `native-exit-teardown`, `windows-x64-ci-runtime`, device and web smokes | real-runtime smokes | N/A | Not run | Release-plan lanes under #2390 | | `high-risk-exact-head-independent-qa` | independent blocking review of exact head | Draft PR | Pending | Required before ready | ## Review Notes - Independent review status: pending (auditor-deep, independent of this implementation). - CI status / head SHA: pending / 147afa9. The first head's Linux VM 2/3 and Windows runtime jobs failed on two new tests (an isolate closure that captured the enclosing service, and the bindings probe lacking the Windows wrapper asset); fixed in the tests only, no production change. ## High-risk regression review - **Classification:** high-risk (`artifactConsumer`, `backendRuntime`, `regressionPolicy`) - **Implementation task:** this worker thread - **Independent blocking QA task:** pending - **Exact head / current base:** 147afa9 / bcaaa76 - **Production-branch deletion, bypass, or miswire proof:** pending audit; mutations above show deleting or bypassing the call fails tests - **Affected-family real-model/artifact evidence:** native device gate in llamadart-native#251; here a synthetic model on the real runtime - **Known PR-caused P1 regressions:** 0 - **Unresolved review threads:** 0 Refs #2390.
13 tasks done
leehack
added a commit
that referenced
this pull request
Nov 29, 2026
## Summary Backport of #2394 (cherry picked from commit 672518b) - Follow up on #2393. Pass an explicitly empty llama.cpp device list for CPU loads so decode uses the backend that owns the persistent threadpool. This covers explicit CPU selection, forced CPU fallback, refused Android Vulkan drivers, GPU-memory-fit fallback, and CPU drafts. - Keep the CPU row-split rejection and use layer mode for CPU loads requested with tensor split, which need a model device in upstream tensor mode. - Backport after #2393 in the 0.23.x patch plan (#2390). ## Changelog - [core] Run llama.cpp CPU loads, including the automatic CPU fallback on refused Android Vulkan drivers, on the persistent CPU threadpool: the load no longer lists the CPU device, which made llama.cpp compute on a second CPU backend with a per-compute pool. ## Production-readiness scope - **User-facing scope** Native llama.cpp CPU inference uses the existing persistent pool on runtimes that provide it. - **Supported platforms/paths** Native llama.cpp explicit CPU, CPU fallback, and speculative draft loads. The fix uses the pinned runtime and the existing native pool API. - **Unsupported or intentionally unavailable paths** CPU row split still throws `LlamaUnsupportedException` and points to layer mode. The native runtime's existing no-pool path remains available when the attach export or pool is unavailable. - **Out of scope / follow-ups** Physical-device throughput and the 0.23.x backport are tracked by the coordinator under #2390. ## Completeness checklist - [x] Implemented the CPU routing scope. - [x] Preserved the documented CPU row-split error and successful CPU tensor-requested load. - [x] Updated the runtime guide, support matrix, and PR changelog. README, examples, and package skills are N/A because the public API and setup are unchanged. - [x] Covered the original native log and wire values, row/tensor compatibility, and the existing GPU registry fallback. - [x] Validation coverage registry is N/A because this restores an existing capability. - [x] Reviewed log, error, and cache-key changes for secret exposure. The native log capture is confined to a generated test fixture. - [x] Patch sequencing is tracked in #2390. ## PR type guidance - **Bugfix** A listed CPU creates a second CPU backend. The scheduler computes there while the attached pool belongs to llama.cpp's built-in CPU backend. The production load and wire assertions detect the extra CPU device. ## Test Plan - [x] `dart run tool/prepare_workspace.dart` - [x] `python3 tool/ci/check_format.py`, `dart analyze`, and `dart run tool/testing/check_platform_boundaries.dart` - [x] `dart test -p vm -j 1 --exclude-tags local-only` passed in the local coverage run and in PR CI. - [x] Chrome shards passed in PR CI. Local browser validation is N/A for native routing. - [x] `coverage-lib` passed with 93.84% line coverage (37,934 of 40,426 lines). - [x] Docs-site build and focused native CPU, row-split and tensor-split regressions. The full llama.cpp VM directory passed on macOS (1,915 passed, 7 skipped) and Linux arm64 at the final head (1,911 passed, 8 skipped). The registry fixture also passed with an invalid Vulkan ICD. ## Matrix Evidence | Matrix row | Scope covered | Platform / model / backend | Result | Evidence / notes | | --- | --- | --- | --- | --- | | `static-format-analyze` | format, analyzer, web/native import boundaries | macOS arm64, Flutter 3.47.1 | PASS | Workspace preparation and all three checks passed. | | `root-vm` | native-safe unit/integration coverage on the Dart VM | macOS arm64 and Linux arm64, synthetic Llama GGUF, pinned llama.cpp | PASS | Local root VM run had 16,642 passes and 136 skips. Full backend unit suites passed on macOS and Linux arm64, and native CI passed on the final head. | | `root-chrome` | browser-compatible unit/integration coverage | Chrome on GitHub Actions | PASS (CI) | All three Chrome shards passed. | | `coverage-lib` | 70% lib/ line threshold | macOS arm64 | PASS | 93.84% (37,934 of 40,426 lines). | | `gguf-chat-features-smoke` | real GGUF chat, thinking and tool calls | macOS arm64, Qwen3.5-0.8B-Q4_K_M, CPU | PASS | CPU reported for all cases. The native info log contained metadata and no `using device CPU` line. | | `docs-site` | site build and generated links | macOS arm64 | PASS | `./tool/docs/build_site.sh` | | `high-risk-exact-head-independent-qa` | independent review of the exact head and base | native llama.cpp | Pass | Independent auditor-deep review of 563a86f against e95e5c7: no blocking findings; targeted tests and three mutations re-run independently. | ## Review Notes - Independent review completed at 563a86f: no blocking findings. - CI passed at `563a86f30e990b85b6e7daf53e1bf7b1ed8e97f9`. The first head's Linux VM shard found a host Vulkan dependency in the simulated Windows registry tests. The fixture now uses a simulated CUDA device and passes under an invalid Vulkan ICD. ## High-risk regression review - **Classification** high-risk (`backendRuntime`) - **Implementation task** Fix CPU loads listing the CPU device - **Independent blocking QA task** Completed at 563a86f: no blocking findings. - **Exact head / current base** `563a86f30e990b85b6e7daf53e1bf7b1ed8e97f9` / `e95e5c7f8213622f6e5ebe9805ed4fee8068585d` - **Production-branch deletion, bypass, or miswire proof** On the base loader the real synthetic GGUF test captured `llama_prepare_model_devices: using device CPU` and the three original wire assertions saw a single address. Restoring `return [cpuDev]` on Linux failed the five wire cases (refused Android Vulkan, iOS simulator, macOS Intel, memory-fit fallback, and CPU draft) and the native log test. The seven-case filtered command passed with the fixed list. The tensor CPU model load passed on the base and fixed loader. The existing row-split rejection test is unchanged. - **Affected-family real-model/artifact evidence** The pinned `llamadart-native v1.1.0-2` bundle loads the synthetic Llama GGUF and the affected Qwen3.5-0.8B-Q4_K_M family on desktop CPU. The Qwen GGUF SHA-256 is `bd258782e35f7f458f8aced1adc053e6e92e89bc735ba3be89d38a06121dc517`. Both native logs include the metadata positive control without an extra CPU device line on the fixed load. - **Explicit unavailable-family or other N/A evidence** No phone runs in this implementation task. The fixture validates CPU device selection and does not establish Pixel or Studio throughput. - **Known PR-caused P1 regressions** 0 identified in implementation testing. Independent audit: 0 blocking findings. - **Unresolved review threads** 0 at the final GitHub check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
v1.1.0-1to llamadart-native v1.1.0-2 (PR #251,b78a2de):llamaCppTag, all 11 bundle SHA-256s, the Windows CUDA sidecar, the XCFramework checksum and the Apple companionPackage.swifttag/checksum, plus the exact-tag lists and Android qualification pins that follow the pin (as in Adopt llamadart-native v1.1.0-1 #2375).check_native_release_digests.dartmatchesSHA256SUMS(12 bundles). Same llama.cppv1.1.0commit, so admission is unchanged. Bindings gainllama_dart_threadpool_api_versionandllama_dart_context_attach_threadpool, added by hand: local ffigen on macOS also rewrites theFILEtypes, so I kept only the two additive declarations. A Linuxsync_native_bindings.ymlrun was not done; thenative_symbol_integration_test.dartsignature test pins both declarations.llama_context.threadpoolunset, so ggml starts and joins a worker pool for every graph compute; on Tensor G6 (Linux 6.12) the fresh workers stack onto one core and CPU generation drops to about 4 tok/s.lib/src/backends/llama_cpp/context_threadpool_api.dart(ContextThreadpoolApi) resolves the two exports as one unit (version >= 1) andLlamaCppObjectCalls.attachContextThreadpoolcalls it._createOwnedContextattaches after every context it creates, owner-created or not, with poll 50, so it covers the generation, embedding, reranking, TTS/ASR host and decision-encoder contexts. The thread counts are the ones the context was created with (numberOfThreads/numberOfThreadsBatch,0throughresolveCpuThreads). The speculative draft context is created and attached natively; Dart attaches nothing to it. The pools belong to the wrapper, which frees them after the context, so Dart frees nothing new.v1.1.0orv1.1.0-1override) keeps ggml's per-compute pool and loads as before. A status of0or-1(or a value a later release adds) is logged at debug level and never fails the load.llamaCppAppleCompanionVersionto0.23.1and added## Unreleasedto the companion changelog.verify_release_docs_versions.dartpasses with a pending companion bump (same as Adopt llamadart-native v1.1.0-1 #2375).--release-prepfails by design on three findings: the companion0.23.0publishesv1.1.0-1; the publishedllamadart_llama_cpp_flutter-v0.23.0pinsv1.1.0-1which this core accepts no more; and the new pin needs a companion core floor past the rejecting0.23.0. The 0.23.1 release prep owns the companion bump and floor (#2390).Changelog
llamadart-nativev1.1.0-2), which fixes CPU generation on Android Tensor G6 (Pixel 11) running at about 4 tokens per second, now about 14x faster.leehack/llamadart-native@v1.1.0-2.Production-readiness scope
v1.1.0-2, or a CPU backend without ggml threadpool exports (0), keeps the per-compute pool with a debug log; a refusal (-1) is logged and the context still loads.Completeness checklist
0,-1, unknown status; tests below.doc/llama_cpp_exit_teardown.mdand the PR changelog section are updated.skills/needs no change: no public API or option changed.PR type guidance
context_threadpool_api_test.dart,llama_cpp_service_context_threadpool_test.dart,native_symbol_integration_test.dart. Affected platforms: Android arm64 (device-verified natively), all others get the same pool.SHA256SUMS;check_webgpu_bridge_tag.dart --verify-manifestpasses with bridge assets unchanged atv0.1.96.Test Plan
dart run tool/prepare_workspace.dartpython3 tool/ci/check_format.py(0 changed),dart analyze(no issues),check_platform_boundaries.dartdart test -p vm -j 1 --exclude-tags local-only(isolated TMPDIR, macOS arm64): 16,635 passed, 136 skippeddart test -p chrome --exclude-tags local-only: 5,418 passed, 1 skippedcoverage-lib: not run; the new files are exercised by the new tests except the Windows wrapper-asset branch oftryResolve, which only resolves on Windows.test_prepare.py(3) andpackages/llamadart_validationAndroid tests (27),check_native_release_digests.dart,check_webgpu_bridge_tag.dart --verify-manifest,verify_release_docs_versions.dart(default passes with the pending companion bump;--release-prepfails as described),./tool/docs/build_site.sh0,-1and unknown statuses still load and generate; a failed creation attaches nothing; the real bundle attaches (1) and everything is freed once and in order.-1as fatal; poll 0; resolve without the exit-teardown API; minimum version 0; ignore the version; unknown status as success; wrong poll argument; wrong batch thread count.llamadart_threadpool_testin llamadart-native). The Dart tests above run the real runtime on a synthetic model.Matrix Evidence
static-format-analyzeroot-vmroot-chromenative-release-digestsSHA256SUMSwebgpu-bridge-tag-consistency--verify-manifestnative-sync-python-suitesrelease-doc-version-consistency--release-prepfails by design, owned by 0.23.1 prepdocs-sitecoverage-libnative-default-consumer-aot,macos-arm64-runtime-smoke,native-exit-teardown,windows-x64-ci-runtime, device and web smokeshigh-risk-exact-head-independent-qaReview Notes
High-risk regression review
artifactConsumer,backendRuntime,regressionPolicy)Refs #2390.