wasm-micro-runtime/core
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
..
deps Separate app-manager and app-framework from WAMR (#3129) 2024-02-20 18:12:36 +08:00
iwasm wasi-nn: add minimum serialization on WASINNContext (#4387) 2025-06-20 09:48:55 +08:00
shared Collective fix for typos and minor bugs (#4369) 2025-06-17 09:26:00 +08:00
config.h feat: Add instruction metering for interpreter (#4122) 2025-05-26 16:16:42 +08:00
version.h Bump version to 2.3.1 and update release notes (#4303) 2025-06-02 10:45:50 +08:00
version.h.in Add version.h and update versioning documentation for embedded platforms 2025-02-05 10:31:20 +00:00