From 52e3fe961dda1aa769cd0b2b2551845f8a54169f Mon Sep 17 00:00:00 2001 From: Yi Zhang Date: Tue, 3 Jan 2023 11:24:06 +0800 Subject: [PATCH] add dnnl dependency in unittest.cmake (#14104) ### Description It's from the PR #14085 On multiple running msbuilds , it throws the exception of ``` 22-12-30T16:35:34.2423207Z ##[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(155,5): Error MSB3073: The command "setlocal "C:\Program Files\CMake\bin\cmake.exe" -E copy D:/a/_work/1/b/RelWithDebInfo/dnnl/install/bin/dnnl.dll D:/a/_work/1/b/RelWithDebInfo/RelWithDebInfo if %errorlevel% neq 0 goto :cmEnd :cmEnd endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone :cmErrorLevel exit /b %1 :cmDone if %errorlevel% neq 0 goto :VCEnd :VCEnd" exited with code 1. ``` https://dev.azure.com/onnxruntime/onnxruntime/_build/results?buildId=847423&view=logs&j=249e9d58-0012-5814-27cf-6a201adbd9cf&t=182b9780-832e-5dcb-3957-d6aa3ece582f It should make sure that the onnxruntime_test_all project depends on dnnl project. --- cmake/onnxruntime_unittests.cmake | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake index 0732d60484..6eb657448b 100644 --- a/cmake/onnxruntime_unittests.cmake +++ b/cmake/onnxruntime_unittests.cmake @@ -467,6 +467,10 @@ if(onnxruntime_USE_DML) list(APPEND onnxruntime_test_providers_dependencies onnxruntime_providers_dml) endif() +if(onnxruntime_USE_DNNL) + list(APPEND onnxruntime_test_providers_dependencies onnxruntime_providers_dnnl) +endif() + if(onnxruntime_USE_MIGRAPHX) list(APPEND onnxruntime_test_framework_libs onnxruntime_providers_migraphx) list(APPEND onnxruntime_test_providers_dependencies onnxruntime_providers_migraphx onnxruntime_providers_shared) @@ -596,8 +600,8 @@ file(GLOB onnxruntime_test_framework_src CONFIGURE_DEPENDS ${onnxruntime_test_framework_src_patterns} ) -#This is a small wrapper library that shouldn't use any onnxruntime internal symbols(except onnxruntime_common). -#Because it could dynamically link to onnxruntime. Otherwise you will have two copies of onnxruntime in the same +#This is a small wrapper library that shouldn't use any onnxruntime internal symbols(except onnxruntime_common). +#Because it could dynamically link to onnxruntime. Otherwise you will have two copies of onnxruntime in the same #process and you won't know which one you are testing. onnxruntime_add_static_library(onnxruntime_test_utils ${onnxruntime_test_utils_src}) if(MSVC) @@ -709,7 +713,7 @@ endif() set(test_all_args) if (onnxruntime_USE_TENSORRT) if (onnxruntime_SKIP_AND_PERFORM_FILTERED_TENSORRT_TESTS) - # TRT EP package pipelines takes much longer time to run tests with TRT 8.5. We can't use placeholder to reduce testing time due to application test deadlock. + # TRT EP package pipelines takes much longer time to run tests with TRT 8.5. We can't use placeholder to reduce testing time due to application test deadlock. # Therefore we only run filtered TRT EP tests. list(APPEND test_all_args "--gtest_filter=*tensorrt_*:*TensorrtExecutionProviderTest*" ) #list(APPEND test_all_args "--gtest_filter=-*cpu_*:*cuda_*:*ContribOpTest*:*QuantGemmTest*:*QLinearConvTest*:*MurmurHash3OpTest*:*PadOpTest*:*QLinearConvTest*" ) @@ -1009,7 +1013,7 @@ if(onnxruntime_ENABLE_EAGER_MODE) onnxruntime_optimizer onnxruntime_providers onnxruntime_util - onnxruntime_framework + onnxruntime_framework onnxruntime_graph ${ONNXRUNTIME_MLAS_LIBS} onnxruntime_common @@ -1079,7 +1083,7 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP) if (onnxruntime_BUILD_SHARED_LIB) #It will dynamically link to onnxruntime. So please don't add onxruntime_graph/onxruntime_framework/... here. - #onnxruntime_common is kind of ok because it is thin, tiny and totally stateless. + #onnxruntime_common is kind of ok because it is thin, tiny and totally stateless. set(onnxruntime_perf_test_libs onnx_test_runner_common onnxruntime_test_utils onnxruntime_common onnxruntime onnxruntime_flatbuffers onnx_test_data_proto @@ -1253,8 +1257,8 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP) endif() if (CMAKE_SYSTEM_NAME STREQUAL "Android") target_link_libraries(onnxruntime_mlas_test PRIVATE ${android_shared_libs}) - endif() - + endif() + if(WIN32) target_link_libraries(onnxruntime_mlas_test PRIVATE debug Dbghelp Advapi32) endif()