Skip to content

Commit

Permalink
make xnnpack build for ort-web (#11745)
Browse files Browse the repository at this point in the history
* make xnnpack build for ort-web

* make ci happy
  • Loading branch information
guschmue authored Jun 10, 2022
1 parent f745eb1 commit d4ea596
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,8 @@ if (onnxruntime_USE_XNNPACK)

set(wasmsimd_src_patterns "${XNNPACK_DIR}/src/wasmsimd-*.c"
"${XNNPACK_DIR}/src/*-wasmsimd-*.c"
"${XNNPACK_DIR}/src/*-wasmsimd.c")
"${XNNPACK_DIR}/src/*-wasmsimd.c"
"${XNNPACK_DIR}/src/*/wasmsimd.c")

file(GLOB_RECURSE XNNPACK_WASMSIMD_MICROKERNEL_SRCS CONFIGURE_DEPENDS ${wasmsimd_src_patterns})
message(DEBUG "XNNPACK_WASMSIMD_MICROKERNEL_SRCS:${XNNPACK_WASMSIMD_MICROKERNEL_SRCS}")
Expand Down
3 changes: 3 additions & 0 deletions cmake/onnxruntime_webassembly.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ else()
onnxruntime_util
re2::re2
)
if (onnxruntime_USE_XNNPACK)
target_link_libraries(onnxruntime_webassembly PRIVATE XNNPACK)
endif()

if (onnxruntime_ENABLE_TRAINING OR onnxruntime_ENABLE_TRAINING_OPS)
target_link_libraries(onnxruntime_webassembly PRIVATE tensorboard)
Expand Down
9 changes: 7 additions & 2 deletions onnxruntime/wasm/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include "api.h"

#include "core/session/onnxruntime_cxx_api.h"
#ifdef USE_XNNPACK
#include "core/providers/xnnpack/xnnpack_provider_factory.h"
#endif

#include <iostream>
#include <vector>
Expand Down Expand Up @@ -112,7 +115,9 @@ OrtSessionOptions* OrtCreateSessionOptions(size_t graph_optimization_level,
// Enable ORT CustomOps in onnxruntime-extensions
RETURN_NULLPTR_IF_ERROR(EnableOrtCustomOps, session_options);
#endif

#if defined(USE_XNNPACK)
(void)OrtSessionOptionsAppendExecutionProvider_Xnnpack(session_options);
#endif
return session_options;
}

Expand Down Expand Up @@ -359,4 +364,4 @@ char* OrtEndProfiling(ort_session_handle_t session) {
return (CHECK_STATUS(SessionEndProfiling, session, allocator, &file_name) == ORT_OK)
? file_name
: nullptr;
}
}

0 comments on commit d4ea596

Please sign in to comment.