Refactor WASI-NN to simplify the support for multiple frameworks (#1834)

- Reorganize the library structure
- Use the latest version of `wasi-nn` wit (Oct 25, 2022):
    0f77c48ec1/wasi-nn.wit.md
- Split logic that converts WASM structs to native structs in a separate file
- Simplify addition of new frameworks
This commit is contained in:
tonibofarull
2023-01-25 11:32:40 +01:00
committed by GitHub
parent 965edff4df
commit 9eed6686df
24 changed files with 911 additions and 504 deletions

View File

@ -11,6 +11,10 @@
#include "../interpreter/wasm_runtime.h"
#include "../compilation/aot.h"
#if WASM_ENABLE_WASI_NN != 0
#include "../libraries/wasi-nn/src/wasi_nn_private.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
@ -75,6 +79,9 @@ typedef struct AOTFunctionInstance {
typedef struct AOTModuleInstanceExtra {
CApiFuncImport *c_api_func_imports;
#if WASM_ENABLE_WASI_NN != 0
WASINNContext *wasi_nn_ctx;
#endif
} AOTModuleInstanceExtra;
#if defined(OS_ENABLE_HW_BOUND_CHECK) && defined(BH_PLATFORM_WINDOWS)