wasm-micro-runtime/core/iwasm
YAMAMOTO Takashi ea408ab6c0
wasi-nn: add minimum serialization on WASINNContext (#4387)
currently this is not necessary because context (WASINNContext) is
local to instance. (wasm_module_instance_t)

i plan to make a context shared among instances in a cluster when
fixing https://github.com/bytecodealliance/wasm-micro-runtime/issues/4313.
this is a preparation for that direction.

an obvious alternative is to tweak the module instance context APIs
to allow declaring some kind of contexts instance-local. but i feel,
in this particular case, it's more natural to make "wasi-nn handles"
shared among threads within a "process".

note that, spec-wise, how wasi-nn behaves wrt threads is not defined
at all because wasi officially doesn't have threads yet. i suppose, at
this point, that how wasi-nn interacts with wasi-threads is something
we need to define by ourselves, especially when we are using an outdated
wasi-nn version.

with this change, if a thread attempts to access a context while
another thread is using it, we simply make the operation fail with
the "busy" error. this is intended for the mimimum serialization to
avoid problems like crashes/leaks/etc. this is not intended to allow
parallelism or such.

no functional changes are intended at this point yet.

cf.
https://github.com/bytecodealliance/wasm-micro-runtime/issues/4313
https://github.com/bytecodealliance/wasm-micro-runtime/issues/2430
2025-06-20 09:48:55 +08:00
..
aot add validation for array type in load_init_expr(GC only) (#4370) 2025-06-17 11:01:38 +08:00
common Collective fix for typos and minor bugs (#4369) 2025-06-17 09:26:00 +08:00
compilation Modify AOT static PGO to conform to llvm-18 and add a CI job to test static PGO on the coremark benchmark (#4345) 2025-06-12 16:57:11 +08:00
doc Fix some more spelling issues (#3393) 2024-05-08 09:30:29 +08:00
fast-jit Keep fix the CMake compatibility issue (#4180) 2025-04-15 12:51:19 +08:00
include feat: Add instruction metering for interpreter (#4122) 2025-05-26 16:16:42 +08:00
interpreter Collective fix for typos and minor bugs (#4369) 2025-06-17 09:26:00 +08:00
libraries wasi-nn: add minimum serialization on WASINNContext (#4387) 2025-06-20 09:48:55 +08:00
README.md Add architecture diagram for wasm globals and classic-interp stack frame (#2058) 2023-03-25 09:39:20 +08:00