Преглед изворни кода

deprecate legacy WAMR-specific "wasi_nn" module (#4382)

wasi_nn.h: deprecate legacy "wasi_nn"

cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/4326
YAMAMOTO Takashi пре 6 месеци
родитељ
комит
71c07f3e4e

+ 1 - 0
core/iwasm/libraries/wasi-nn/include/wasi_nn.h

@@ -21,6 +21,7 @@
 #else
 #define WASI_NN_IMPORT(name) \
     __attribute__((import_module("wasi_nn"), import_name(name)))
+#warning You are using "wasi_nn", which is a legacy WAMR-specific ABI. It's deperecated and will likely be removed in future versions of WAMR. Please use "wasi_ephemeral_nn" instead. (For a WASM module, use the wasi_ephemeral_nn.h header instead. For the runtime configurations, enable WASM_ENABLE_WASI_EPHEMERAL_NN/WAMR_BUILD_WASI_EPHEMERAL_NN.)
 #endif
 
 /**

+ 4 - 0
core/iwasm/libraries/wasi-nn/src/wasi_nn.c

@@ -20,6 +20,10 @@
 #include "wasi_nn_types.h"
 #include "wasm_export.h"
 
+#if WASM_ENABLE_WASI_EPHEMERAL_NN == 0
+#warning You are using "wasi_nn", which is a legacy WAMR-specific ABI. It's deperecated and will likely be removed in future versions of WAMR. Please use "wasi_ephemeral_nn" instead. (For a WASM module, use the wasi_ephemeral_nn.h header instead. For the runtime configurations, enable WASM_ENABLE_WASI_EPHEMERAL_NN/WAMR_BUILD_WASI_EPHEMERAL_NN.)
+#endif
+
 #define HASHMAP_INITIAL_SIZE 20
 #if defined(__APPLE__)
 #define LIB_EXTENTION ".dylib"

+ 2 - 1
doc/build_wamr.md

@@ -102,6 +102,7 @@ cmake -DWAMR_BUILD_PLATFORM=linux -DWAMR_BUILD_TARGET=ARM
 
 ### **Enable lib wasi-nn**
 - **WAMR_BUILD_WASI_NN**=1/0, default to disable if not set
+> Note: WAMR_BUILD_WASI_NN without WAMR_BUILD_WASI_EPHEMERAL_NN is deprecated and will likely be removed in future versions of WAMR. Please consider to enable WAMR_BUILD_WASI_EPHEMERAL_NN as well.
 > Note: See [WASI-NN](../core/iwasm/libraries/wasi-nn) for more details.
 
 ### **Enable lib wasi-nn GPU mode**
@@ -360,4 +361,4 @@ For Valgrind, begin with the following configurations and add additional ones as
   -DWAMR_DISABLE_HW_BOUND_CHECK=0 \
   -DWAMR_DISABLE_WRITE_GS_BASE=0
   #...
-```
+```