-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complete minimum viable WASI wasi_snapshot_preview1 #271
Comments
|
Hi @pims, thanks for the feedback! Could you share some references on how Gain Lang uses |
Given the following grain program:
The following go code: store, err := wazero.NewStoreWithConfig(&wazero.StoreConfig{
ModuleToHostFunctions: map[string]*wazero.HostFunctions{
wasi.ModuleSnapshotPreview1: wazero.WASISnapshotPreview1WithConfig(wasiConfig),
},
})
if err != nil {
log.Fatal(err)
}
// StartWASICommand runs the "_start" function which is what TinyGo compiles "main" to
_, err = wazero.StartWASICommand(store, s.mod)
if err != nil {
log.Fatal(err)
} outputs:
Environment:
Hopefully this helps! Let me know if you'd like me to do more testing. Thanks! |
thanks @pims. are your functions like this running in a single process or shared within a process. If the latter, I suspect we would need to implement #293 to allow safe deinstantiation (without clobbering the host process). We would support both, but curious if you immediately need process-scoped or module-scoped |
@codefromthecrypt right now, I parse the wasm binary file once, and instantiate a new store for each incoming nats.io message I receive. Environment and Args being different for each message. |
thanks @pims, that helps prioritize! |
looks like assemblyscript uses proc_exit to implement its abort handler https://github.com/AssemblyScript/assemblyscript/blob/09beb42dcdec58cda9098abcf4dae80405e58e92/tests/compiler/wasi/abort.untouched.wat#L375-L531 |
Grain seems to import all WASI APIs regardless of them being used or not, so, implementing I've also found that wasmtime nor wasmer implement |
Oh I missed that there are new comment about AssemblyScript on |
@nullpo-head would it make sense to at least have a stub for all wasi preview snapshot_1 functions so Grain/Other compiled wasm files run in wazero? The same Grain program runs fine in wasmtime for instance. |
My 2p is that regardless of whether other compilers actually claim functions they don't use, we can do this for you even if grain addresses the issue. I'll offer the labor. Through this, we may find other users who need something more than stubbing! |
As of last night, all WASI functions are stubbed. |
This formalizes that completing all WASI APIs is an anti-goal as the abstraction includes abandoned features. Fixes #271 Signed-off-by: Adrian Cole <adrian@tetrate.io>
) This formalizes that completing all WASI APIs is an anti-goal as the abstraction includes abandoned features. Fixes #271 Signed-off-by: Adrian Cole <adrian@tetrate.io>
Closing this to the top-level README as it is a non-goal to complete all WASI snapshot APIs. Any APIs folks need should become new issues! Thanks for all the feedback. |
Here is the status of our implementation of wasi_snapshot_preview1
The above should only be checked when all parts of the API are implemented or we know what parts we won't implement. For example, don't tick a box if an API is skipping parameters unless we actively rule out a parameter. Definitely no box can be ticked until it is properly documented and tested in wasi.go and wasi_test.go
Notes: Per #263 there are some problems in
wasi_snapshot_preview1
, so it may not make sense to burn time on implementing all features and constants of it. That said, there are code using it, notably TinyGo, and we should complete a minimum viable subset of the API and its features based on what users want.The text was updated successfully, but these errors were encountered: