Closed yamt closed 1 year ago
I guess implicitly they are tied to a WebAssembly instance. For users that may want instances that outlive the graph and execution context handles, however, it does make sense to add a way to close them. I briefly considered whether resource destruction should be handled at some other level (e.g., canonical ABI) but with the help of this presentation came to the conclusion that the destructors should be explicit. @sunfishcode, is my understanding of those slides still correct?
wit-bindgen c -i
generates wasi_nn_graph_free
, which calls canonical_abi.resource_drop_graph
.
ditto for graph-execution-context
.
is it supposed to serve the purpose?
Hm, that sounds like it validates my earlier hunch; maybe the slides are out of date!
With wit-bindgen-cli 0.3.0 (04da8c228 2022-12-12)
if I execute wit-bindgen guest c wasi-nn.wit
I get the following error:
failed to parse wit file
wasi-nn.wit
Caused by: expected
default
,world
orinterface
, found keywordtype
--> wasi-nn.wit:5:1 | 5 | type tensor-dimensions = list| ^--- error: Invalid value 'wasi-nn.wit' for ' ': failed to parse wit file wasi-nn.wit
how long will handles (graphs and execution context) be valid? there seems to be no way to
close
them explicitly. otoh, keeping them forever is not desirable i guess.