mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-06-07 13:49:18 +00:00
wasi_nn.h: add import_name attribute (#4328)
this would fix undefined symbol errors by making it clear these functions are imported. references:e2c698c7e8/llvm/lib/MC/WasmObjectWriter.cpp (L1798-L1799)
e2c698c7e8/llvm/lib/Object/WasmObjectFile.cpp (L749-L752)
e2c698c7e8/lld/wasm/Symbols.cpp (L203)
e2c698c7e8/lld/wasm/Relocations.cpp (L36-L40)
This commit is contained in:
parent
85efe08431
commit
b20ebc2724
|
@ -15,6 +15,9 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "wasi_nn_types.h"
|
#include "wasi_nn_types.h"
|
||||||
|
|
||||||
|
#define WASI_NN_IMPORT(name) \
|
||||||
|
__attribute__((import_module("wasi_nn"), import_name(name)))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Load an opaque sequence of bytes to use for inference.
|
* @brief Load an opaque sequence of bytes to use for inference.
|
||||||
*
|
*
|
||||||
|
@ -26,12 +29,11 @@
|
||||||
*/
|
*/
|
||||||
wasi_nn_error
|
wasi_nn_error
|
||||||
load(graph_builder_array *builder, graph_encoding encoding,
|
load(graph_builder_array *builder, graph_encoding encoding,
|
||||||
execution_target target, graph *g)
|
execution_target target, graph *g) WASI_NN_IMPORT("load");
|
||||||
__attribute__((import_module("wasi_nn")));
|
|
||||||
|
|
||||||
wasi_nn_error
|
wasi_nn_error
|
||||||
load_by_name(const char *name, uint32_t name_len, graph *g)
|
load_by_name(const char *name, uint32_t name_len, graph *g)
|
||||||
__attribute__((import_module("wasi_nn")));
|
WASI_NN_IMPORT("load_by_name");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INFERENCE
|
* INFERENCE
|
||||||
|
@ -47,7 +49,7 @@ load_by_name(const char *name, uint32_t name_len, graph *g)
|
||||||
*/
|
*/
|
||||||
wasi_nn_error
|
wasi_nn_error
|
||||||
init_execution_context(graph g, graph_execution_context *ctx)
|
init_execution_context(graph g, graph_execution_context *ctx)
|
||||||
__attribute__((import_module("wasi_nn")));
|
WASI_NN_IMPORT("init_execution_context");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Define the inputs to use for inference.
|
* @brief Define the inputs to use for inference.
|
||||||
|
@ -59,7 +61,7 @@ init_execution_context(graph g, graph_execution_context *ctx)
|
||||||
*/
|
*/
|
||||||
wasi_nn_error
|
wasi_nn_error
|
||||||
set_input(graph_execution_context ctx, uint32_t index, tensor *tensor)
|
set_input(graph_execution_context ctx, uint32_t index, tensor *tensor)
|
||||||
__attribute__((import_module("wasi_nn")));
|
WASI_NN_IMPORT("set_input");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Compute the inference on the given inputs.
|
* @brief Compute the inference on the given inputs.
|
||||||
|
@ -68,7 +70,7 @@ set_input(graph_execution_context ctx, uint32_t index, tensor *tensor)
|
||||||
* @return wasi_nn_error Execution status.
|
* @return wasi_nn_error Execution status.
|
||||||
*/
|
*/
|
||||||
wasi_nn_error
|
wasi_nn_error
|
||||||
compute(graph_execution_context ctx) __attribute__((import_module("wasi_nn")));
|
compute(graph_execution_context ctx) WASI_NN_IMPORT("compute");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Extract the outputs after inference.
|
* @brief Extract the outputs after inference.
|
||||||
|
@ -85,6 +87,6 @@ compute(graph_execution_context ctx) __attribute__((import_module("wasi_nn")));
|
||||||
wasi_nn_error
|
wasi_nn_error
|
||||||
get_output(graph_execution_context ctx, uint32_t index,
|
get_output(graph_execution_context ctx, uint32_t index,
|
||||||
tensor_data output_tensor, uint32_t *output_tensor_size)
|
tensor_data output_tensor, uint32_t *output_tensor_size)
|
||||||
__attribute__((import_module("wasi_nn")));
|
WASI_NN_IMPORT("get_output");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user