Fix ability to use patch on Windows CI machines (#18356)

### Description
<!-- Describe your changes. -->
Add 32-bit patch binary and infra to fallback to it. The Azure devops
Windows CIs are missing patch.exe from their git install for some reason
so the default `find_package(Patch)` fails as that is where it expects
to find it.

Remove Eigen patch. Underlying issue was fixed in source 3 years ago by
c6c84ed961
and the patch command is invalid (args are for git apply not patch).

### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
Make usage of patch consistent across all CIs
Fix https://github.com/microsoft/onnxruntime/issues/15248
This commit is contained in:
Scott McKay 2023-11-11 07:32:14 +10:00 committed by GitHub
parent 28c23aed04
commit 64c91d790b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 42 deletions

View file

@ -526,7 +526,21 @@ if(NOT WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
find_package(Iconv REQUIRED)
set(ICONV_LIB Iconv::Iconv)
endif()
find_package(Patch)
if (WIN32 AND NOT Patch_FOUND)
# work around CI machines missing patch from the git install by falling back to the binary in this repo.
# replicate what happens in https://github.com/Kitware/CMake/blob/master/Modules/FindPatch.cmake but without
# the hardcoded suffixes in the path to the patch binary.
find_program(Patch_EXECUTABLE NAMES patch PATHS ${PROJECT_SOURCE_DIR}/external/git.Win32.2.41.03.patch)
if(Patch_EXECUTABLE)
set(Patch_FOUND 1)
if (NOT TARGET Patch::patch)
add_executable(Patch::patch IMPORTED)
set_property(TARGET Patch::patch PROPERTY IMPORTED_LOCATION ${Patch_EXECUTABLE})
endif()
endif()
endif()
if(Patch_FOUND)
message("Patch found: ${Patch_EXECUTABLE}")
endif()

View file

@ -1,23 +1,14 @@
if (onnxruntime_USE_PREINSTALLED_EIGEN)
add_library(eigen INTERFACE)
file(TO_CMAKE_PATH ${eigen_SOURCE_PATH} eigen_INCLUDE_DIRS)
target_include_directories(eigen INTERFACE ${eigen_INCLUDE_DIRS})
else ()
if (onnxruntime_USE_ACL)
FetchContent_Declare(
eigen
URL ${DEP_URL_eigen}
URL_HASH SHA1=${DEP_SHA1_eigen}
PATCH_COMMAND ${Patch_EXECUTABLE} --ignore-space-change --ignore-whitespace < ${PROJECT_SOURCE_DIR}/patches/eigen/Fix_Eigen_Build_Break.patch
)
else()
FetchContent_Declare(
eigen
URL ${DEP_URL_eigen}
URL_HASH SHA1=${DEP_SHA1_eigen}
)
endif()
FetchContent_Declare(
eigen
URL ${DEP_URL_eigen}
URL_HASH SHA1=${DEP_SHA1_eigen}
)
FetchContent_Populate(eigen)
set(eigen_INCLUDE_DIRS "${eigen_SOURCE_DIR}")
endif()

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,27 +0,0 @@
diff -Naur git_org/cmake/external/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h git/cmake/external/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h
--- git_org/cmake/external/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h 2019-07-17 15:27:59.540667336 -0500
+++ git/cmake/external/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h 2019-07-17 15:30:16.000000000 -0500
@@ -1076,8 +1076,9 @@
dest = *b;
}
- EIGEN_STRONG_INLINE void updateRhs(const RhsScalar* b, RhsPacketx4& dest) const
- {}
+ EIGEN_STRONG_INLINE void updateRhs(const RhsScalar*, RhsPacketx4&) const
+ {
+ }
EIGEN_STRONG_INLINE void loadRhsQuad(const RhsScalar* b, RhsPacket& dest) const
{
@@ -1145,8 +1146,9 @@
loadRhs(b,dest);
}
- EIGEN_STRONG_INLINE void updateRhs(const RhsScalar* b, RhsPacketx4& dest) const
- {}
+ EIGEN_STRONG_INLINE void updateRhs(const RhsScalar*, RhsPacketx4&) const
+ {
+ }
EIGEN_STRONG_INLINE void loadRhsQuad(const RhsScalar* b, RhsPacket& dest) const
{