Skip to content

Web: expose capability-gated JS-backed GGUF and projector staging #2115

Closed

Description

@leehack

User benefit

Let Dart Web apps opt into the bridge's JS-backed model staging to load larger GGUFs on wasm32 and reduce peak WASM linear-memory use on memory64. This is separate from single-thread/no-COOP-COEP core selection in #2090: staging applies to both threaded and single-thread cores.

Verified layers — 2026-11-20

  • Owner source: bridge#227, merged63c26fa7845fb834cf249366d74d50ce67b66188; current bridge main03a010c43553d4d2b3b26aadaf09a78d4cb4d2ec also includes fix: align mtmd fallback bitmap ABI #234. All bundle llama.cpp v1.0.0/b1b770d90d94cad9e9ea5b993bdbc383a522fb28. The opt-in jsBackedModelStaging flag uses chunked JS-backed WASMFS staging for model/projector input, with version3 exports, ownership and typed refusal paths.
  • Published assets: v0.1.86, dd164fb6fa05276e6a1700c563573842831ea362, predates this feature. No containing immutable asset release yet.
  • Local57b8b448, GitHub main5a7e3afe and public core0.20.2 pin86 and do not forward jsBackedModelStaging. No public Dart staging capability is delivered.
  • Recorded source matrix: Qwen3-4B Q4_K_M (~2.5GB) loaded on non-isolated wasm32; memory64 GPU peak WASM heap fell from8.01GiB to656MiB on tested Chromium/AppleMetal. Full model data still occupies JS memory temporarily; these are bounded source/device results, not a zero-copy/direct-to-GPU or general-browser promise.

Bounded consumer work

  1. After a qualified owner asset publication, pin its actual tag/manifest/checksums and mirror core JS interop/worker configuration. Add an explicit opt-in setting through the maintained Web backend API/configuration; leave default behavior unchanged.
  2. Probe the staging API/version and exports; missing/older assets must refuse explicitly. Preserve typed allocation, mount, transfer-length and wasm32 tensor-size errors across direct and worker routes. Never silently downgrade when explicitly requested.
  3. Document total WASM plus JS heap, temporary ownership/release, trade-offs, split/projector behavior and platform limits. Update README, support matrix, Web skill, example, changelog and validation capability mapping together.

Dependencies / acceptance

  • Containing immutable owner assets include JS/worker/wasm32/memory64 files with verified manifest/digest and staging exports. Resolve or explicitly classify owner #229 resume/native-abort safety and CUDA crash during mmproj/clip image encode on discrete NVIDIA GPU #230–Prepare 0.8.4 release #233 lifecycle/diagnostic/test follow-ups; do not treat CI or source closure as publication.
  • Supported, old/missing/version-skew, default-off and explicit-on controls exercise public Dart configuration in direct and worker routes.
  • Repeat bounded checksum-pinned small/large GGUF and projector loads on wasm32/memory64; record actual backend/browser/device, WASM and JS heap, output, cancellation, failure/retry and disposal/reuse. CPU/software fallback is not hardware GPU qualification.
  • Web: opt-in single-threaded bridge core for non-isolated pages (GGUF without COOP/COEP) #2090 remains independent: it gates the _st core URL/thread policy. This issue does not expand its acceptance or assign either feature to0.20.3.

Triage: enhancement/P2, javascript, blocked-runtime. Useful memory/compatibility improvement, not a demonstrated Dart regression. Preparation only; no speculative asset pin, build dispatch, publication or paid/device execution is authorized by this issue.

Activity

  1. added
    enhancement
    javascript
    blocked-runtime
    priority:P2
    on Nov 20, 2026
  2. leehack commented on Nov 21, 2026

    @leehack
    OwnerAuthor

    2026-11-21 owner artifact is now published: assets v0.1.87, bridge3cf2aaed/upstreamb1b770d9, contains #227 JS-backed model/projector staging and the new cores. Manifest SHA256922574bd6389f9ec8ce1ba41d291ba80b1d9f50906f860e8c74f7a9997c0edf9. Main3f05a377 consumes87 for #1949, while public0.20.3/local57b8b448 remain86. Publication changes the first dependency checkbox's evidence; it does not complete the consumer acceptance.

    Dart still does not pass jsBackedModelStaging. Remove only blocked-runtime; retain enhancement/javascript/P2/open. Next bounded work is explicit configuration and capability/export/version-skew checks, typed direct/worker errors, model/projector ownership/cancel/dispose/reuse controls, docs/examples/skills/coverage and representative WASM+JS heap measurements. Existing owner safety/lifecycle follow-ups must retain their actual source/artifact containment and dispositions; no universal browser/GPU or zero-copy claim. #2090 remains a separate single-thread policy issue; neither is automatically in0.20.4. No implementation, publication or device execution.

  3. removed
    blocked-runtime
    on Nov 21, 2026
  4. leehack commented on Nov 22, 2026

    @leehack
    OwnerAuthor

    Status 2026-11-22: llamadart 0.20.5 (published) pins bridge assets v0.1.90 (#2145), which include #227's JS-backed model and projector staging. Dart still doesn't pass jsBackedModelStaging. In the 0.20.6 plan #2149, this lane stacks on #2090's branch because both change the bridge config and load paths.

  5. leehack commented on Nov 22, 2026

    @leehack
    OwnerAuthor

    Blocked on the detection design, 2026-11-22. The pinned bridge v0.1.90 has no public probe for jsBackedModelStaging; its check runs only during a load, and an older JS bridge silently ignores the option. Staging is also on by default on supported WebKit cores, so Dart has to tell an omitted setting apart from false. A planner is choosing between an owner-side probe (possibly in bridge v0.1.91) and Dart-side detection. Plan: llamadart-evidence/release-0.20.6/plan-2115/plan.md.

  6. leehack commented on Nov 22, 2026

    @leehack
    OwnerAuthor

    Decision 2026-11-22: owner-side probe. Bridge adds a static supportsJsBackedModelStaging and a matching worker ready field, shipping in bridge v0.1.92 (v0.1.91 was already published without it). llamadart then pins v0.1.92 and adds bool? jsBackedModelStaging; null keeps the WebKit default. The user chose to keep this in 0.20.6. On older bridges, an explicit false is forwarded and checked after load (the user's choice: "Allow, verify after load"). Plan: llamadart-evidence/release-0.20.6/plan-2115/plan.md.

  7. leehack commented on Nov 22, 2026

    @leehack
    OwnerAuthor

    2026-11-22 blocker refinement/triage: owner#320 has now merged as990d40033735753fc4d7fe9b202f5a67744d0c03, adding static supportsJsBackedModelStaging and the worker-ready declaration. Latest published assets91 still binds earlierf266d06c and lacks that probe; publiccore0.20.5/main pin90. Existing staging functionality is published, but the newly selected truthful capability contract is source-only. Re-add only blocked-runtime for this NEW publication dependency; keepP2/enhancement/javascript/open and the maintainer's nullable/default/older-bridge policy unchanged.

    Preparation may proceed against the chosen contract; do not merge a speculative92 URL/checksum or publish until an actual containing immutable artifact is verified. Then adopt its manifest/JS/worker/core inventories, wire bool? jsBackedModelStaging/null WebKit-default semantics, explicit-on/false/older/version-skew direct-worker controls, docs/skills/example/capability coverage and bounded real-model memory/lifecycle tests. Owner#325 is a separate P3 durability-test follow-up, not a demonstrated current failure or new release blocker. No source/pin/job changes by this scan.

  8. added
    blocked-runtime
    on Nov 22, 2026
  9. leehack commented on Nov 22, 2026

    @leehack
    OwnerAuthor

    Blocked 2026-11-22 on a bridge-side retry. A worker projector load that fails with ModelTransferLengthError is retried (worker restart plus a second load) and ends as a generic Error with no code, so Dart can't keep the typed failure. I asked the bridge owner to make these errors non-retryable in v0.1.92. Repro: llamadart-evidence/release-0.20.6/plan-2115/w2115-transfer-repro.mjs.

  10. leehack commented on Nov 23, 2026

    @leehack
    OwnerAuthor

    2026-11-23 published delivery: #2165 merged99cb4291da4eb304258083ed3fab3a1c61e93006 and first ships in core0.20.6, source55df3a630981db52bf196cae950b0ff62420e8ba. The actual pub archive pins bridge92, manifest SHA2564f2fb82d55a932e9182e703d5265f3fc5875f808d4d9aa0ba18a0585d0d7784b, and exports ModelParams.jsBackedModelStaging. All three Apple companions0.20.6 are published, without a new native ABI.

    Remove only the now-stale blocked-runtime label; keep the maintainer's closed status and P2 history. true requires supported staging, false disables it, null preserves the browser default. Missing/old bridge or worker capability, incompatible core and forced-fetch combinations retain typed refusal. The linked PR documents direct/worker Chromium CPU controls and larger-model/projector memory trade-offs—not hardware WebGPU or physical Safari/iOS qualification.

    Driver#2171 remains a separate unmerged validation-tooling follow-up, and pre-existing load-cancel behavior #2166 remains open. Main91bdb8dd already moves to bridge93, but public0.20.6 is still92; no further pin/code work is needed merely to use this released staging option.

  11. removed
    blocked-runtime
    on Nov 23, 2026
  12. added a commit that references this issue on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementjavascriptpriority:P2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions