Skip to content

Commit 4b93110

Browse files
committed
Remove internal function declarations from wasm_export.h
1 parent 0234fe0 commit 4b93110

6 files changed

Lines changed: 19 additions & 27 deletions

File tree

core/iwasm/common/wasm_runtime_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1697,7 +1697,7 @@ wasm_runtime_instantiation_args_destroy(struct InstantiationArgs2 *p)
16971697
}
16981698

16991699
#if WASM_ENABLE_WASI_NN != 0 || WASM_ENABLE_WASI_EPHEMERAL_NN != 0
1700-
WASINNArguments;
1700+
typedef struct WASINNArguments WASINNArguments;
17011701

17021702
void
17031703
wasm_runtime_wasi_nn_graph_registry_args_set_defaults(WASINNArguments *args)

core/iwasm/common/wasm_runtime_common.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,13 @@ WASM_RUNTIME_API_EXTERN void
14831483
wasm_runtime_set_wasi_nn_global_ctx(WASMModuleInstanceCommon *module_inst,
14841484
WASINNGlobalContext *wasi_ctx);
14851485

1486+
WASM_RUNTIME_API_EXTERN WASINNGlobalContext *
1487+
wasm_runtime_get_wasi_nn_global_ctx(WASMModuleInstanceCommon *module_inst_comm);
1488+
1489+
WASM_RUNTIME_API_EXTERN void
1490+
wasm_runtime_set_wasi_nn_global_ctx(WASMModuleInstanceCommon *module_inst_comm,
1491+
WASINNGlobalContext *wasi_nn_ctx);
1492+
14861493
WASM_RUNTIME_API_EXTERN uint32_t
14871494
wasm_runtime_get_wasi_nn_global_ctx_ngraphs(
14881495
WASINNGlobalContext *wasi_nn_global_ctx);

core/iwasm/include/wasm_export.h

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ typedef struct InstantiationArgs {
291291

292292
struct InstantiationArgs2;
293293
struct WASINNGlobalContext;
294-
typedef struct WASINNGlobalContext *wasi_nn_global_context;
294+
typedef struct WASINNGlobalContext WASINNGlobalContext;
295295

296296
#ifndef WASM_VALKIND_T_DEFINED
297297
#define WASM_VALKIND_T_DEFINED
@@ -798,46 +798,32 @@ wasm_runtime_instantiation_args_set_wasi_ns_lookup_pool(
798798
struct InstantiationArgs2 *p, const char *ns_lookup_pool[],
799799
uint32_t ns_lookup_pool_size);
800800

801-
WASM_RUNTIME_API_EXTERN bool
802-
wasm_runtime_init_wasi_nn_global_ctx(wasm_module_inst_t module_inst,
803-
const char *encoding, const char *target,
804-
const uint32_t n_graphs,
805-
char *graph_paths[], char *error_buf,
806-
uint32_t error_buf_size);
807-
808-
WASM_RUNTIME_API_EXTERN void
809-
wasm_runtime_destroy_wasi_nn_global_ctx(wasm_module_inst_t module_inst);
810-
811-
WASM_RUNTIME_API_EXTERN void
812-
wasm_runtime_set_wasi_nn_global_ctx(wasm_module_inst_t module_inst,
813-
wasi_nn_global_context wasi_ctx);
814-
815-
WASM_RUNTIME_API_EXTERN wasi_nn_global_context
801+
WASM_RUNTIME_API_EXTERN WASINNGlobalContext *
816802
wasm_runtime_get_wasi_nn_global_ctx(const wasm_module_inst_t module_inst);
817803

818804
WASM_RUNTIME_API_EXTERN uint32_t
819805
wasm_runtime_get_wasi_nn_global_ctx_ngraphs(
820-
wasi_nn_global_context wasi_nn_global_ctx);
806+
WASINNGlobalContext * wasi_nn_global_ctx);
821807

822808
WASM_RUNTIME_API_EXTERN char *
823809
wasm_runtime_get_wasi_nn_global_ctx_graph_paths_i(
824-
wasi_nn_global_context wasi_nn_global_ctx, uint32_t idx);
810+
WASINNGlobalContext * wasi_nn_global_ctx, uint32_t idx);
825811

826812
WASM_RUNTIME_API_EXTERN uint32_t
827813
wasm_runtime_get_wasi_nn_global_ctx_loaded_i(
828-
wasi_nn_global_context wasi_nn_global_ctx, uint32_t idx);
814+
WASINNGlobalContext * wasi_nn_global_ctx, uint32_t idx);
829815

830816
WASM_RUNTIME_API_EXTERN uint32_t
831817
wasm_runtime_set_wasi_nn_global_ctx_loaded_i(
832-
wasi_nn_global_context wasi_nn_global_ctx, uint32_t idx, uint32_t value);
818+
WASINNGlobalContext * wasi_nn_global_ctx, uint32_t idx, uint32_t value);
833819

834820
WASM_RUNTIME_API_EXTERN char *
835821
wasm_runtime_get_wasi_nn_global_ctx_encoding(
836-
wasi_nn_global_context wasi_nn_global_ctx);
822+
WASINNGlobalContext * wasi_nn_global_ctx);
837823

838824
WASM_RUNTIME_API_EXTERN char *
839825
wasm_runtime_get_wasi_nn_global_ctx_target(
840-
wasi_nn_global_context wasi_nn_global_ctx);
826+
WASINNGlobalContext * wasi_nn_global_ctx);
841827

842828
/**
843829
* Instantiate a WASM module, with specified instantiation arguments

core/iwasm/libraries/wasi-nn/include/wasi_nn_types.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ typedef enum {
4848
WASI_NN_ERROR_NAME(unsupported_operation),
4949
WASI_NN_ERROR_NAME(too_large),
5050
WASI_NN_ERROR_NAME(not_found),
51-
WASI_NN_ERROR_NAME(not_loaded),
5251

5352
// for WasmEdge-wasi-nn
5453
WASI_NN_ERROR_NAME(end_of_sequence) = 100, // End of Sequence Found.

core/iwasm/libraries/wasi-nn/src/wasi_nn.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ wasi_nn_load_by_name(wasm_exec_env_t exec_env, char *name, uint32_t name_len,
607607
goto fail;
608608
}
609609

610-
wasi_nn_global_context wasi_nn_global_ctx =
610+
WASINNGlobalContext *wasi_nn_global_ctx =
611611
wasm_runtime_get_wasi_nn_global_ctx(instance);
612612
if (!wasi_nn_global_ctx) {
613613
NN_ERR_PRINTF("global context is invalid");
@@ -691,7 +691,7 @@ wasi_nn_load_by_name(wasm_exec_env_t exec_env, char *name, uint32_t name_len,
691691
NN_ERR_PRINTF("Model %s is not loaded, you should pass its path "
692692
"through --wasi-nn-graph",
693693
nul_terminated_name);
694-
res = not_loaded;
694+
res = not_found;
695695
}
696696
goto fail;
697697
}

core/iwasm/libraries/wasi-nn/test/utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ run_inference(float *input, uint32_t *input_size, uint32_t *output_size,
146146

147147
WASI_NN_ERROR_TYPE res = wasm_load_by_name(model_name, &graph);
148148

149-
if (res == WASI_NN_ERROR_NAME(not_loaded)) {
149+
if (res == WASI_NN_ERROR_NAME(not_found)) {
150150
NN_INFO_PRINTF("Model %s is not loaded, you should pass its path "
151151
"through --wasi-nn-graph",
152152
model_name);

0 commit comments

Comments
 (0)