Repository navigation
Conversation
LiteRT-LM's Linux GPU backend runs Dawn on Vulkan and accepts a Mesa llvmpipe adapter, where small models can return wrong text. Probe the system Vulkan loader before a GPU load: when every physical device is VK_PHYSICAL_DEVICE_TYPE_CPU, an explicit GPU load throws LlamaUnsupportedException and a GPU hint under ComputeDevice.auto loads on the CPU with a warning. A host with any hardware device, no listed device or an unavailable loader keeps the previous behavior. Fixes #572
Select the default system probe from liteRtLmGateAbi() and let tests replace the system probe, so the Linux, non-Linux and injected-client selections are tested without probing the host. Cover a partial VK_INCOMPLETE device list, and say that a GPU hint under auto runs on the CPU in the support matrix.
VK_INCOMPLETE on the second vkEnumeratePhysicalDevices call means more devices exist than were written, so the partial list could wrongly look software-only for the rest of the process. Name the gate ABI in the refusal message.
L4 hardware Vulkan check: PASS (head
|
| Platform | Backend | Model (sha256) | Head | Result |
|---|---|---|---|---|
Linux x64 + L4, g2-standard-8, Ubuntu 24.04, NVIDIA 580.178.04. Default ICD discovery: Vulkan sees NVIDIA L4 (type 2, discrete) and Mesa llvmpipe (type 4, CPU) |
explicit ComputeDevice.gpu, ×2 |
Qwen3-0.6B 555579ff2f4fd13379abe69c1c3ab5200f7338bc92471557f1d6614a6e5ab0b4 |
e51e76cb |
PASS: probe softwareOnly=false, Selected adapter: NVIDIA L4 … backend=Vulkan, adapterType=Discrete GPU, backend LiteRT-LM gpu, text "France's capital is Paris." (2/2) |
| same host | preferredBackend: GpuBackend.vulkan (auto) and ComputeDevice.cpu |
same | e51e76cb |
PASS: auto runs on LiteRT-LM gpu (NVIDIA L4 Vulkan); CPU runs on LiteRT-LM cpu; same text |
same host, VK_ICD_FILENAMES/VK_DRIVER_FILES = Mesa lvp_icd.json (llvmpipe only) |
explicit ComputeDevice.gpu |
same | e51e76cb |
Rejected as designed: probe softwareOnly=true; LlamaUnsupportedException "LiteRT-LM GPU on linux_x64 needs a hardware Vulkan device, but every Vulkan device here is a software rasterizer (VK_PHYSICAL_DEVICE_TYPE_CPU: "llvmpipe (LLVM 20.1.2, 256 bits)") …" |
| same lavapipe-only environment | preferredBackend: GpuBackend.vulkan (auto) |
same | e51e76cb |
PASS: falls back to LiteRT-LM cpu and logs the "found only software Vulkan devices … running on the CPU" warning; same text |
The probe does not reject a host with hardware Vulkan, even with llvmpipe also installed, and it still rejects a llvmpipe-only loader environment. No crash or Dawn error on any run. Cleanup: the VM and the job bucket were deleted, and gcloud compute instances list is empty.
…embeddings (#1830) Squash of #1830 at 0296fd5 against merge-base b78008c. Conflict resolutions: - website/docs/platforms/known-platform-issues.md, "## Linux and Windows", custom-runtime bullet tail and the Linux x64 GPU bullet (vs #1831): #1830's embeddings-marker paragraph replaces the legacy `v0.18.x` refusal paragraph, followed by #1831's rewritten Linux x64 software-Vulkan GPU bullet (replacing the old llvmpipe-crash bullet).
|
Landed via batch integration PR #1843 (rebase merge), one commit per constituent. |
|
Chat app preview removed for |
* Raise the Apple companions' Flutter floor to 3.38.6 (#1834) (#1841) Squash of #1841 at 345ada9 against merge-base ec4bf4f. * Explain which chat template LiteRT-LM bundles render (#1836) (#1842) Squash of #1842 at 278b8db against merge-base ec4bf4f. * Record LiteRT-LM thinking as N/A for bundle templates that cannot think (#1833) Squash of #1833 at eda933e against merge-base ec4bf4f. * Pin Windows pending-delete removal for remove and prune (#1837) (#1839) Squash of #1839 at 403835b against merge-base b78008c. * Pin Chrome supervisor exit precedence and post-done wait (#1837 a-d) (#1840) Squash of #1840 at 73c66a0 against merge-base ec4bf4f. * Refuse LiteRT-LM GPU on Linux when every Vulkan device is software (#1831) Squash of #1831 at e51e76c against merge-base ec4bf4f. * Require the in-process LiteRT marker for Linux and Windows LiteRT-LM embeddings (#1830) Squash of #1830 at 0296fd5 against merge-base b78008c. Conflict resolutions: - website/docs/platforms/known-platform-issues.md, "## Linux and Windows", custom-runtime bullet tail and the Linux x64 GPU bullet (vs #1831): #1830's embeddings-marker paragraph replaces the legacy `v0.18.x` refusal paragraph, followed by #1831's rewritten Linux x64 software-Vulkan GPU bullet (replacing the old llvmpipe-crash bullet). * Prepare 0.19.1 release * State the desktop LiteRT-LM embeddings runtime floor for 0.19.1
Summary
libvulkan.so.1, Dart FFI, Vulkan 1.0 entry points). If every device isVK_PHYSICAL_DEVICE_TYPE_CPU(Mesa llvmpipe/lavapipe, SwiftShader), the GPU backend could only pick a software adapter. An explicit GPU load (ComputeDevice.gpu,LiteRtLmBackendPreference.gpu, the deprecatedpreferredBackend: 'gpu') now throwsLlamaUnsupportedException, and a GPU hint underComputeDevice.autoloads on the CPU with a warning.Selected adapter: llvmpipe ... adapterType=CPU / Software). The C API does not expose the selected adapter, and llamadart did not check one, so small models ran on llvmpipe and could return wrong text.VK_INCOMPLETE(partial) list, or a loader that can't be opened or queried keeps the old behavior: the runtime reportsNo adapters foundas a typed engine-create error itself. The llama.cpp backend'sVulkanDeviceProbereads through libllamadart, which a LiteRT-LM-only app may not load, so it isn't reused here.liteRtLmGateAbi()), and only when a GPU engine is about to be used. Service tests inject it; a service built with an injected client factory skips it.debugLiteRtLmSystemVulkanAdaptersOverridereplaces the system probe so the default selection is tested without probing the host.Fixes #572
Production-readiness scope
autowith a GPU hint runs on the CPU.LlamaUnsupportedException("LiteRT-LM GPU on linux_x64 needs a hardware Vulkan device, but every Vulkan device here is a software rasterizer (VK_PHYSICAL_DEVICE_TYPE_CPU: "llvmpipe ...") ...").checkLoadopens no driver, so it still reports such a load as supported (documented in known issues).Completeness checklist
validation_coverage_test.dartpasses.PR type guidance
litert_lm_gpu_adapter_test.dart(FFI struct reading through fake loader functions, software-only rule, unavailable loader) and theGPU loads on software Vulkan adaptersgroup inlitert_lm_service_test.dart(refused for 3 explicit selectors, auto falls back to CPU with warning, hardware beside llvmpipe / empty list / unavailable probe start a GPU engine, CPU load never probes). Thedefault probe selectiontests cover the production wiring: a Linux service with the production client probes, while macOS, Windows, or an injected legacy or runtime client factory does not. AVK_INCOMPLETElist (a spec-conformant fake fills its capacity and returns 5) isunavailable, so the load proceeds. Mutations killed: the gate result replaced bynull;false &&/true &&in the default selection; dropping theclientFactory == nullcheck; acceptingVK_INCOMPLETEas a complete list.Test Plan
dart run tool/prepare_workspace.dartdart format --output=none --set-exit-if-changed .dart analyzedart test -p vm -j 1 --exclude-tags local-only(CI; locally rantest/unit/backends/litert_lm/,test/unit/tooling/,test/unit/test_structure/)dart test -p chrome --exclude-tags local-onlyN/A: native-only change (dart:ffi), no Web path touched; CI runs it.coverage-libmatrix row: 93.62% lib line coverage (threshold 70);litert_lm_gpu_adapter.dart52/56 lines. The local macOS run also failedwindows_registry_qualification_test.dartand four/varvs/private/vartmpdir assertions inmodel_download_manager_io_concurrency_test.dart; the Windows test also fails withorigin/main'slib/andtest/.Matrix Evidence
coverage-libLlamaEngine(LlamaBackend())load/generatePHYSICAL_DEVICE_TYPE_CPU, LLVM 20.1.2), LiteRT-LM v0.19.1-1, SmolLM2-135M.litertlmccdc5c85…, head1d0231af3(the head only adds@TestOn('vm')to the new test after that)gpu:LlamaUnsupportedExceptionnaming"llvmpipe (LLVM 20.1.2, 256 bits)";auto+GpuBackend.vulkan: warning,LiteRT-LM cpu, "The capital of France is Paris.";cpu: same text1c93ead8…= pin), Qwen3-0.6B555579ff…, heade51e76cbgpu2/2 and auto+GpuBackend.vulkanrun onLiteRT-LM gpu(NVIDIA L4 … backend=Vulkan). The probe givessoftwareOnly=false. With the loader limited tolvp_icd.json, explicitgputhrowsLlamaUnsupportedExceptionand auto falls back to CPU. resultshigh-risk-exact-head-independent-qae51e76cbvs baseec4bf4f8release-metadata-verificationstructured-output-adversariallitert-lm-v1-public-direct/-service/-speechlitert-lm-json-schemaReview Notes
e51e76cb(earlier passes at4b542ac1andd2baf301); draft until the maintainer mergese51e76cbdef304939837c0e640e8d05372538302(merge oforigin/mainec4bf4f89intob4347c5a1; no conflicts, Refuse LiteRT-LM GPU on Linux when every Vulkan device is software #1831's own diff unchanged)High-risk regression review
backendRuntime)e51e76cbagainst baseec4bf4f8: no P1/P2. These mutations were all killed: acceptingVK_INCOMPLETE,false &&/true &&on the Linux check, droppingclientFactory == null, droppingruntimeClientFactory == null. Themainmerge is clean, and the changelogs only gain the LiteRT-LM GPU accepts a Mesa llvmpipe software adapter on Linux (no crash on v0.19.x; small models can return wrong text) #572 bullet under Unreleased. P3s are filed on #1837. Earlier: the audit PASSED at4b542ac1(struct layouts checked againstvulkan_core.h, real-loader container runs). Its follow-ups (M1 and M4 mutation gaps, support-matrix wording) are fixed atd2baf301c. The re-audit PASSED atd2baf301c(no P1/P2). Its P3 is fixed atb4347c5a1: aVK_INCOMPLETElist is nowunavailableinstead of a possibly truncated software-only list, and the refusal names the gate ABIe51e76cbdef304939837c0e640e8d05372538302/ec4bf4f89dc224296ec0c8e6201ff13a3339e51e(base is an ancestor of head)nullin_gpuBackendForAdaptersfails theGPU loads on software Vulkan adaptersgroup. The default-wiring mutations (false &&,true &&, dropping theclientFactory == nullcheck) each fail at least one test (audit M1, fixed atd2baf301c). AcceptingVK_INCOMPLETEas a complete list failsis unavailable when the loader reports VK_INCOMPLETE(re-audit P3, fixed atb4347c5a1)e51e76cb(results): with NVIDIA L4 + llvmpipe installed,softwareOnly=falseand explicitgpuruns 2/2 on Vulkan through the publicLlamaEnginewith Qwen3-0.6B. With llvmpipe only (VK_ICD_FILENAMES=lvp_icd.json), explicitgputhrowsLlamaUnsupportedExceptionnaming llvmpipe andautofalls back to the CPU. Also the llvmpipe-only GCE n2 run at1d0231af(SmolLM2-135M.litertlm, LiteRT-LM v0.19.1-1)tool/testing/high_risk_readiness.darton heade51e76cb/ baseec4bf4f8exits 2 withunverifiedPrerequisites/externalPrerequisitesUnavailable(repository-local evidence internally consistent; external auditor/App/ruleset prerequisites unavailable, as designed)