wasi-nn: move some host-only things out of wasi_nn_types.h (#4334)

cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/4324
This commit is contained in:
YAMAMOTO Takashi 2025-06-06 16:07:29 +09:00 committed by GitHub
parent 350af77b03
commit 769d16eaab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 29 deletions

View File

@ -131,35 +131,6 @@ typedef uint32_t graph_execution_context;
/* Definition of 'wasi_nn.h' structs in WASM app format (using offset) */ /* Definition of 'wasi_nn.h' structs in WASM app format (using offset) */
typedef wasi_nn_error (*LOAD)(void *, graph_builder_array *, graph_encoding,
execution_target, graph *);
typedef wasi_nn_error (*LOAD_BY_NAME)(void *, const char *, uint32_t, graph *);
typedef wasi_nn_error (*LOAD_BY_NAME_WITH_CONFIG)(void *, const char *,
uint32_t, void *, uint32_t,
graph *);
typedef wasi_nn_error (*INIT_EXECUTION_CONTEXT)(void *, graph,
graph_execution_context *);
typedef wasi_nn_error (*SET_INPUT)(void *, graph_execution_context, uint32_t,
tensor *);
typedef wasi_nn_error (*COMPUTE)(void *, graph_execution_context);
typedef wasi_nn_error (*GET_OUTPUT)(void *, graph_execution_context, uint32_t,
tensor_data, uint32_t *);
/* wasi-nn general APIs */
typedef wasi_nn_error (*BACKEND_INITIALIZE)(void **);
typedef wasi_nn_error (*BACKEND_DEINITIALIZE)(void *);
typedef struct {
LOAD load;
LOAD_BY_NAME load_by_name;
LOAD_BY_NAME_WITH_CONFIG load_by_name_with_config;
INIT_EXECUTION_CONTEXT init_execution_context;
SET_INPUT set_input;
COMPUTE compute;
GET_OUTPUT get_output;
BACKEND_INITIALIZE init;
BACKEND_DEINITIALIZE deinit;
} api_function;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -15,4 +15,33 @@ typedef struct {
void *backend_ctx; void *backend_ctx;
} WASINNContext; } WASINNContext;
typedef wasi_nn_error (*LOAD)(void *, graph_builder_array *, graph_encoding,
execution_target, graph *);
typedef wasi_nn_error (*LOAD_BY_NAME)(void *, const char *, uint32_t, graph *);
typedef wasi_nn_error (*LOAD_BY_NAME_WITH_CONFIG)(void *, const char *,
uint32_t, void *, uint32_t,
graph *);
typedef wasi_nn_error (*INIT_EXECUTION_CONTEXT)(void *, graph,
graph_execution_context *);
typedef wasi_nn_error (*SET_INPUT)(void *, graph_execution_context, uint32_t,
tensor *);
typedef wasi_nn_error (*COMPUTE)(void *, graph_execution_context);
typedef wasi_nn_error (*GET_OUTPUT)(void *, graph_execution_context, uint32_t,
tensor_data, uint32_t *);
/* wasi-nn general APIs */
typedef wasi_nn_error (*BACKEND_INITIALIZE)(void **);
typedef wasi_nn_error (*BACKEND_DEINITIALIZE)(void *);
typedef struct {
LOAD load;
LOAD_BY_NAME load_by_name;
LOAD_BY_NAME_WITH_CONFIG load_by_name_with_config;
INIT_EXECUTION_CONTEXT init_execution_context;
SET_INPUT set_input;
COMPUTE compute;
GET_OUTPUT get_output;
BACKEND_INITIALIZE init;
BACKEND_DEINITIALIZE deinit;
} api_function;
#endif #endif