Skip to content

How does TaskQueue/TaskWorklet tie into WASM threads? #9

Open

Description

@pshihn

With threads in WASM coming up, there may be some merit to tying them with Task Queues

Activity

  1. developit commented on Nov 15, 2018

    @developit
    Owner

    I think right now there isn't really an interaction between the two. The polyfill would allow WASM as it is implemented using Workers for the threadpool, however the proposal (publishing soon) and our experimental implementation in Chromium use a proper Worklet backing in the pool and thus don't allow for WASM usage.

  2. chicoxyzzy commented on Nov 16, 2018

    @chicoxyzzy

    It's possible to use WebAssembly in AudioWorklet in stable Chrome so it's confusing that it's not the case for TaskWorklet

  3. chicoxyzzy commented on Nov 16, 2018

    @chicoxyzzy

    Basically it should be possible to load js module via Worklet.addModule and load+compile+instantiate wasm in this module

  4. chicoxyzzy commented on Nov 19, 2018

    @chicoxyzzy

    Also just found this reference that WebAssembly namespace should be exposed to window, worker and worklet

  5. developit commented on Nov 21, 2018

    @developit
    Owner

    @chicoxyzzy you're right, I'm not sure why I implied WASM couldn't be used - there's no reason it can't here.

    const wasm = WebAssembly.instantiateStreaming(fetch('worklet.wasm'));
    
    class WasmDemoProcessor {
      async process(data) {
        const { instance } = await wasm;
        return instance.exports.doThing(data);
      }
    }
    
    registerTask('wasm-demo', WasmDemoProcessor);
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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions