Skip to content

Commit

Permalink
[VSINPU EP]Add VSINPU EP to support python bindings
Browse files Browse the repository at this point in the history
Signed-off-by: Kee <[email protected]>
  • Loading branch information
xuke537 committed Nov 22, 2024
1 parent 49d3d54 commit 450f7c4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmake/onnxruntime_python.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ target_link_libraries(onnxruntime_pybind11_state PRIVATE
onnxruntime_session
${onnxruntime_libs}
${PROVIDERS_NNAPI}
${PROVIDERS_VSINPU}
${PROVIDERS_XNNPACK}
${PROVIDERS_COREML}
${PROVIDERS_RKNPU}
Expand Down Expand Up @@ -1018,4 +1019,13 @@ if (onnxruntime_USE_QNN)
endif()
endif()

if (onnxruntime_USE_VSINPU)
add_custom_command(
TARGET onnxruntime_pybind11_state POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE:onnxruntime_providers_vsinpu>
$<TARGET_FILE_DIR:${build_output_target}>/onnxruntime/capi/
)
endif()

endif()
3 changes: 3 additions & 0 deletions onnxruntime/python/onnxruntime_pybind_schema.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ void addGlobalSchemaFunctions(pybind11::module& m) {
#ifdef USE_NNAPI
onnxruntime::NnapiProviderFactoryCreator::Create(0, std::optional<std::string>()),
#endif
#ifdef USE_VSINPU
onnxruntime::VSINPUProviderFactoryCreator::Create(),
#endif
#ifdef USE_RKNPU
onnxruntime::RknpuProviderFactoryCreator::Create(),
#endif
Expand Down
4 changes: 4 additions & 0 deletions onnxruntime/python/onnxruntime_pybind_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,10 @@ std::unique_ptr<IExecutionProvider> CreateExecutionProviderInstance(
const auto partitioning_stop_ops_list = session_options.config_options.GetConfigEntry(
kOrtSessionOptionsConfigNnapiEpPartitioningStopOps);
return onnxruntime::NnapiProviderFactoryCreator::Create(0, partitioning_stop_ops_list)->CreateProvider();
#endif
} else if (type == kVSINPUExecutionProvider) {
#ifdef USE_VSINPU
return onnxruntime::VSINPUProviderFactoryCreator::Create()->CreateProvider();
#endif
} else if (type == kRknpuExecutionProvider) {
#ifdef USE_RKNPU
Expand Down
1 change: 1 addition & 0 deletions onnxruntime/python/onnxruntime_pybind_state_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_ArmNN(
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_DML(int device_id);
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_Nnapi(
uint32_t flags, const optional<std::string>& partitioning_stop_ops_list);
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_VSINPU();
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_Rknpu();
std::shared_ptr<IExecutionProviderFactory> CreateExecutionProviderFactory_CoreML(uint32_t flags);
constexpr const char* kDefaultExecutionProviderEntry = "GetProvider";
Expand Down

0 comments on commit 450f7c4

Please sign in to comment.