wasi-nn icon indicating copy to clipboard operation
wasi-nn copied to clipboard

Bindings for C/C++

Open tonibofarull opened this issue 3 years ago • 2 comments

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:

  • expected keyword.
  • list, I translated it as pointer + length.

Questions

  1. 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
  2. How can I validate that the WAMR bindings match the WIT specification?

Proposal

Define the C/C++ in this repository.

tonibofarull avatar Dec 31 '22 14:12 tonibofarull

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.

cfallin avatar Jun 27 '23 02:06 cfallin

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

Iizerd avatar Jul 19 '24 16:07 Iizerd