Bindings for C/C++
Hi, We have published an experimental version of WASI-NN for WAMR:
- https://github.com/bytecodealliance/wasm-micro-runtime/tree/main/core/iwasm/libraries/wasi-nn
- Current PR: https://github.com/bytecodealliance/wasm-micro-runtime/pull/1834
Since there is no automatic API generation in C from the WIT specification, we have adapted it manually.
Several parts do not translate directly from WIT to C:
-
expectedkeyword. -
list, I translated it as pointer + length.
Questions
- Is there any way to automatically generate bindings for C/C++ from the spec using wit-bindgen or any other tool? As far as I know, this is still an open topic https://github.com/WebAssembly/wasi-nn/issues/24
- How can I validate that the WAMR bindings match the WIT specification?
Proposal
Define the C/C++ in this repository.
My comment in #146 should probably have gone here; I think there's a way to do this more generally, by doing splits in a more general way (in the middle of insts) and leveraging overlap support.
The interesting thing with this issue is that it isn't limited to a single RegClass. If an instruction clobbers/Defs all registers in the Vector class, but has some Uses in the Integer class that are non-fixed, the error TooManyLiveRegisters is still raised. This is really unintuitive because the classes (in my mind) should be entirely disjoint and the constraints on one should not affect another. I confess I'm not familiar enough with the code base to try and tackle this yet though.
Additionally, under similar circumstances I was able to reach the panic here https://github.com/bytecodealliance/regalloc2/blob/main/src/ion/process.rs#L1266