Repository navigation
Fail fast without cross-origin isolation; keep WebGPU out of 0-layer loads - #219
Merged
Merged
Conversation
…er loads A page that cannot post shared memory to workers now rejects a load at once with CrossOriginIsolationError instead of waiting for the core init timeout, and the dead threads_capped_no_coi note is removed. A load with nGpuLayers 0 passes an empty device list so Firefox's 100 ms WebGPU queue ticks no longer gate every CPU sync. Fixes #215 Fixes #218
… layers, explain GPU fallback allowSingleThreadCore lets a core built without pthreads load on a page that is not cross-origin isolated, capped to one thread. A zero-layer load with splitMode TENSOR falls back to LAYER because the CPU-only device list is empty. A load with nGpuLayers > 0 that runs on the CPU adds gpu_unavailable:<reason> and one warning.
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.
Part of leehack/llamadart#1025 (0.19.10 plan leehack/llamadart#1995). Fixes #215 and #218. #216 (memory64 reason) and #217 (Safari GPU cap/probe) stay open.
Changes
_ensureCoreprobesMessageChannel.postMessage(new WebAssembly.Memory({shared:true}))before loading acoreModuleUrlcore. When it throws, the load rejects at once withCrossOriginIsolationError(code: 'CROSS_ORIGIN_ISOLATION_REQUIRED'), naming COOP/COEPrequire-corpand thatcredentiallessdoes not isolate Safari. The error survives the worker protocol. It probes the post, notcrossOriginIsolated, so Chrome with SharedArrayBuffer enabled by flag still loads.allowSingleThreadCore: trueis for a core built without pthreads (WEBGPU_BRIDGE_PTHREADS=0). It loads on a non-isolated page, capped to one thread, with thethreads_capped_no_coinote. A customcoreModuleFactoryskips the gate, so a custom pthread core still waits forcoreInitTimeoutMs(documented).load_model_internalpasses an emptydeviceslist whenn_gpu_layers == 0, so the model and context never get the WebGPU backend.splitMode: 3(TENSOR) falls back to LAYER there, since the empty list has no device.nGpuLayers > 0that ends on the CPU addsgpu_unavailable:<reason>(no_webgpu,no_adapter,adapter_missing_shader_f16,unknown) and one warning. Chrome hidesshader-f16on NVIDIA drivers older than 615.71 and ggml-webgpu then registers no device.CrossOriginIsolationErrorandallowSingleThreadCoreexported/declared;docs/api.mdand changelog updated.Validation
npm run check:jscross_origin_isolation_test.mjs,cpu_only_devices_native_test.mjs,gpu_unavailable_reason_test.mjs; each failed before its fixstate_persistence.mjswasm32 and wasm64CrossOriginIsolationErrorat 0.09-0.16 sallowSingleThreadCoresplitMode: 3at 0 layersAudits (local evidence): first audit at 515582e and delta re-audit at efbf0ae, both no-block, in
llamadart-evidence/bridge-pr-219/andllamadart-evidence/bridge-pr-219/delta-efbf0aea/.