Skip to content

Commit 56f87b7

Browse files
authored
wasi-nn: do not pretend to support legacy abi in openvino and llamacpp (#4468)
as tested by core/iwasm/libraries/wasi-nn/test/test_tensorflow.c, the legacy "wasi_nn" abi uses the number of fp32 for get_output. because these backends don't implement the abi, bail out explicitly in build time. cf. #4376
1 parent 933e49d commit 56f87b7

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ extern char const *LLAMA_COMMIT;
1717
extern char const *LLAMA_COMPILER;
1818
extern char const *LLAMA_BUILD_TARGET;
1919

20+
#if WASM_ENABLE_WASI_EPHEMERAL_NN == 0
21+
#error This backend doesn't support legacy "wasi_nn" abi. Please enable WASM_ENABLE_WASI_EPHEMERAL_NN.
22+
#endif
23+
2024
// compatible with WasmEdge
2125
// https://github.com/second-state/WasmEdge-WASINN-examples/blob/master/wasmedge-ggml/README.md#parameters
2226
// https://github.com/WasmEdge/WasmEdge/blob/master/plugins/wasi_nn/ggml.cpp

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99

1010
#include "openvino/c/openvino.h"
1111

12+
#if WASM_ENABLE_WASI_EPHEMERAL_NN == 0
13+
#error This backend doesn't support legacy "wasi_nn" abi. Please enable WASM_ENABLE_WASI_EPHEMERAL_NN.
14+
#endif
15+
1216
/*
1317
* refer to
1418
* https://docs.openvino.ai/2024/openvino-workflow/running-inference/integrate-openvino-with-your-application.html

0 commit comments

Comments
 (0)