From 70d2dc8209852541cd8ec0d61e88911c9683f31c Mon Sep 17 00:00:00 2001 From: Sumit Agarwal Date: Wed, 24 May 2023 19:20:40 -0500 Subject: [PATCH] [DML EP] Fix issue with --dml_path build option (#15972) ### Description DML_PACKAGE_DIR cmake variable is not getting set properly when dml_path build options is used. ### Motivation and Context - Why is this change required? What problem does it solve? It is required for DML Perf dashboard. --- cmake/external/dml.cmake | 7 ++++--- cmake/onnxruntime_python.cmake | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmake/external/dml.cmake b/cmake/external/dml.cmake index 1ee3a06b41..f446c2be98 100644 --- a/cmake/external/dml.cmake +++ b/cmake/external/dml.cmake @@ -72,12 +72,12 @@ else() if (dml_EXTERNAL_PROJECT) set(dml_preset_config $,debug,release>) set(dml_preset_name ${onnxruntime_target_platform}-win-redist-${dml_preset_config}) - + target_compile_definitions(DirectML INTERFACE DML_TARGET_VERSION_USE_LATEST=1) include(ExternalProject) ExternalProject_Add( directml_repo GIT_REPOSITORY https://dev.azure.com/microsoft/WindowsAI/_git/DirectML - GIT_TAG 2290bd6495fdf8c35822816213516d13f3742cc9 + GIT_TAG d460f0f46967bea878786f1bed69487692c779bf GIT_SHALLOW OFF # not allowed when GIT_TAG is a commit SHA, which is preferred (it's stable, unlike branches) GIT_PROGRESS ON BUILD_IN_SOURCE ON @@ -95,6 +95,7 @@ else() add_dependencies(DirectML directml_repo-install) include_directories(BEFORE ${directml_install_path}/include) else() - include_directories(${dml_INCLUDE_DIR}) + include_directories(BEFORE ${dml_INCLUDE_DIR}) + set(DML_PACKAGE_DIR ${dml_INCLUDE_DIR}/..) endif() endif() diff --git a/cmake/onnxruntime_python.cmake b/cmake/onnxruntime_python.cmake index 5dfe9ca43b..893b0b0df6 100644 --- a/cmake/onnxruntime_python.cmake +++ b/cmake/onnxruntime_python.cmake @@ -906,7 +906,7 @@ if (onnxruntime_USE_TVM) endif() if (onnxruntime_USE_DML) - if (NOT dml_EXTERNAL_PROJECT) + if (NOT onnxruntime_USE_CUSTOM_DIRECTML) set(dml_shared_lib_path ${DML_PACKAGE_DIR}/bin/${onnxruntime_target_platform}-win/${DML_SHARED_LIB}) else() set(dml_shared_lib_path ${DML_PACKAGE_DIR}/bin/${DML_SHARED_LIB})