InsightSoftwareConsortium / ITK-Wasm

High performance spatial analysis in a web browser and across programming languages and hardware architectures
https://wasm.itk.org
Apache License 2.0
193 stars 49 forks source link

Support an `actor` mode for pipelines #760

Open thewtex opened 1 year ago

thewtex commented 1 year ago

This mode would enable working with pipelines following the Actor Model in addition to use as a pure function.

For Emscripten:

For WASI:

floryst commented 1 year ago

Should we expect pipelines operating in such fashion to call into main()? Or should we ccall into some other entrypoint we define? The former handles allocating args, while I'm not sure about the latter.

thewtex commented 1 year ago

Yes, actors can allocate their own internal memory and manage their own internal state. For reasons of efficiency and safety, inputs and outputs are allocated, "lowered" and "lifted" by itk-wasm bindgen or, eventually, wit bindgen.

floryst commented 11 months ago

Update: I encountered the stack leak behavior in itk-wasm@1.0.0-b.141 when calling readImageBlob many times using the same webworker. I fixed it by patching the itk-image-io files to call stackSave/stackRestore inside callMain(). I haven't evaluated this yet in VolView.