WebAssembly / wasi-nn

Neural Network proposal for WASI
470 stars 36 forks source link

Return errors as records, not resources #75

Open abrown opened 3 months ago

abrown commented 3 months ago

This change migrates the error type to return as a record instead of a resource. The previous logic behind #64, IIRC, is that users that may not wish to copy the potentially-large data string across the canonical ABI would not have to--they could call the data method on the resource if they really needed it.

Technical complexity during implementation is making me reconsider this decision. While implementing this in Wasmtime, I realized that after an error happens, the current "error as resource" scheme results in a multi-step failure algorithm:

This complexity does not mean necessarily that the spec must be changed; I believe there is a way to "make it work." But if users end up troubleshooting a resource failure that happens during a wasi-nn failure, we risk making things a bit too complex for them. And, if indeed the original argument for using resources was avoiding performance overhead, there is a case to be made that in failure modes performance is not the most critical for users.

I'll open this seeking feedback, not to merge immediately.

abrown commented 3 months ago

cc: @shschaefer