Fix the benchmark code (#8926)

This commit is contained in:
Changming Sun 2021-09-02 10:36:24 -07:00 committed by GitHub
parent 6490191f58
commit 1a34775fe9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View file

@ -853,7 +853,7 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
file(GLOB_RECURSE MLAS_BENCH_SOURCE_FILES "${MLAS_BENCH_DIR}/*.cpp" "${MLAS_BENCH_DIR}/*.h")
onnxruntime_add_executable(onnxruntime_mlas_benchmark ${MLAS_BENCH_SOURCE_FILES})
target_include_directories(onnxruntime_mlas_benchmark PRIVATE ${ONNXRUNTIME_ROOT}/core/mlas/inc)
target_link_libraries(onnxruntime_mlas_benchmark PRIVATE benchmark::benchmark onnxruntime_mlas onnxruntime_common onnxruntime_framework onnxruntime_util)
target_link_libraries(onnxruntime_mlas_benchmark PRIVATE benchmark::benchmark onnxruntime_util onnxruntime_framework onnxruntime_mlas onnxruntime_common ${CMAKE_DL_LIBS})
if(NOT WIN32)
target_link_libraries(onnxruntime_mlas_benchmark PRIVATE nsync_cpp)
endif()

View file

@ -86,9 +86,17 @@ class MyIExecutionFrame : public IExecutionFrame {
const OrtValueNameIdxMap& ort_value_idx_map, const NodeIndexInfo& node_index_info)
: IExecutionFrame(ort_value_idx_map, node_index_info, fetch_mlvalue_idxs),
a_(a) {
Init(feed_mlvalue_idxs, feeds, initializers, fetches);
Init(
feed_mlvalue_idxs, feeds, initializers, [](const std::string& name) -> bool { return false; }, fetches);
}
const DataTransferManager& GetDataTransferManager() const override {
abort();
}
Status CreateNodeOutputMLValueImpl(OrtValue& ort_value, int ort_value_idx, const TensorShape* shape) override {
abort();
}
AllocatorPtr GetAllocatorImpl(const OrtMemoryInfo& info) const {
return a_.GetAllocator(info.id, info.mem_type);
}

View file

@ -43,7 +43,7 @@ jobs:
--build_wheel \
--enable_onnx_tests \
--enable_transformers_tool_test \
--build_java --build_nodejs --update --build
--build_java --build_nodejs --update --build --cmake_extra_defines onnxruntime_BUILD_BENCHMARKS=ON
workingDirectory: $(Build.SourcesDirectory)
- task: CmdLine@2