@@ -66,7 +66,6 @@ wasi_nn_ctx_destroy(WASINNContext *wasi_nn_ctx)
66
66
}
67
67
NN_DBG_PRINTF ("[WASI NN] DEINIT..." );
68
68
NN_DBG_PRINTF ("Freeing wasi-nn" );
69
- NN_DBG_PRINTF ("-> is_model_loaded: %d" , wasi_nn_ctx -> is_model_loaded );
70
69
NN_DBG_PRINTF ("-> current_encoding: %d" , wasi_nn_ctx -> backend );
71
70
72
71
bh_assert (!wasi_nn_ctx -> busy );
@@ -202,15 +201,6 @@ wasi_nn_destroy()
202
201
}
203
202
204
203
/* Utils */
205
- static wasi_nn_error
206
- is_model_initialized (WASINNContext * wasi_nn_ctx )
207
- {
208
- if (!wasi_nn_ctx -> is_model_loaded ) {
209
- NN_ERR_PRINTF ("Model not initialized." );
210
- return runtime_error ;
211
- }
212
- return success ;
213
- }
214
204
215
205
/*
216
206
*TODO: choose a proper backend based on
@@ -510,8 +500,6 @@ wasi_nn_load(wasm_exec_env_t exec_env, graph_builder_array_wasm *builder,
510
500
if (res != success )
511
501
goto fail ;
512
502
513
- wasi_nn_ctx -> is_model_loaded = true;
514
-
515
503
fail :
516
504
// XXX: Free intermediate structure pointers
517
505
if (builder_native .buf )
@@ -587,7 +575,6 @@ wasi_nn_load_by_name(wasm_exec_env_t exec_env, char *name, uint32_t name_len,
587
575
if (res != success )
588
576
goto fail ;
589
577
590
- wasi_nn_ctx -> is_model_loaded = true;
591
578
res = success ;
592
579
fail :
593
580
if (nul_terminated_name != NULL ) {
@@ -651,7 +638,6 @@ wasi_nn_load_by_name_with_config(wasm_exec_env_t exec_env, char *name,
651
638
if (res != success )
652
639
goto fail ;
653
640
654
- wasi_nn_ctx -> is_model_loaded = true;
655
641
res = success ;
656
642
fail :
657
643
if (nul_terminated_name != NULL ) {
@@ -684,9 +670,6 @@ wasi_nn_init_execution_context(wasm_exec_env_t exec_env, graph g,
684
670
goto fail ;
685
671
}
686
672
687
- if (success != (res = is_model_initialized (wasi_nn_ctx )))
688
- goto fail ;
689
-
690
673
if (!wasm_runtime_validate_native_addr (
691
674
instance , ctx , (uint64 )sizeof (graph_execution_context ))) {
692
675
NN_ERR_PRINTF ("ctx is invalid" );
@@ -719,9 +702,6 @@ wasi_nn_set_input(wasm_exec_env_t exec_env, graph_execution_context ctx,
719
702
goto fail ;
720
703
}
721
704
722
- if (success != (res = is_model_initialized (wasi_nn_ctx )))
723
- goto fail ;
724
-
725
705
tensor input_tensor_native = { 0 };
726
706
if (success
727
707
!= (res = tensor_app_native (instance , input_tensor ,
@@ -756,9 +736,6 @@ wasi_nn_compute(wasm_exec_env_t exec_env, graph_execution_context ctx)
756
736
goto fail ;
757
737
}
758
738
759
- if (success != (res = is_model_initialized (wasi_nn_ctx )))
760
- goto fail ;
761
-
762
739
call_wasi_nn_func (wasi_nn_ctx -> backend , compute , res ,
763
740
wasi_nn_ctx -> backend_ctx , ctx );
764
741
fail :
@@ -792,9 +769,6 @@ wasi_nn_get_output(wasm_exec_env_t exec_env, graph_execution_context ctx,
792
769
goto fail ;
793
770
}
794
771
795
- if (success != (res = is_model_initialized (wasi_nn_ctx )))
796
- goto fail ;
797
-
798
772
#if WASM_ENABLE_WASI_EPHEMERAL_NN != 0
799
773
if (!wasm_runtime_validate_native_addr (instance , output_tensor ,
800
774
output_tensor_len )) {
0 commit comments