Skip to content

Commit

Permalink
Patch Tuesday June 2024 (microsoft#39325)
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyONeal authored Jul 4, 2024
1 parent 2444315 commit 0dab813
Show file tree
Hide file tree
Showing 36 changed files with 561 additions and 916 deletions.
16 changes: 8 additions & 8 deletions ports/libtorch/cmake-fixes.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3a48eaf4e2..7b8bc7cb6e 100644
index 3a48eaf..7b8bc7c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1049,8 +1049,7 @@ if(USE_MIMALLOC)
Expand All @@ -13,7 +13,7 @@ index 3a48eaf4e2..7b8bc7cb6e 100644

# ---[ Main build
diff --git a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
index fd6b7ff551..d185233529 100644
index fd6b7ff..d185233 100644
--- a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
+++ b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
@@ -368,7 +368,7 @@ elseif(NOT TARGET pthreadpool AND USE_SYSTEM_PTHREADPOOL)
Expand All @@ -26,7 +26,7 @@ index fd6b7ff551..d185233529 100644
IMPORTED_LOCATION "${PTHREADPOOL_LIBRARY}")
add_library(pthreadpool_interface INTERFACE)
diff --git a/c10/CMakeLists.txt b/c10/CMakeLists.txt
index feebad7cbb..ad407e18cb 100644
index feebad7..ad407e1 100644
--- a/c10/CMakeLists.txt
+++ b/c10/CMakeLists.txt
@@ -109,8 +109,7 @@ else()
Expand All @@ -40,7 +40,7 @@ index feebad7cbb..ad407e18cb 100644

if(ANDROID)
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index c3abce52e4..cd27c728ff 100644
index c3abce5..cfaf83e 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -285,7 +285,7 @@ endif()
Expand Down Expand Up @@ -129,7 +129,7 @@ index c3abce52e4..cd27c728ff 100644
endif()
endif()
- add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/foxi EXCLUDE_FROM_ALL)
+
+
+ # setup foxi
+ find_library(FOXI_LOADER_LIBPATH NAMES foxi_loader REQUIRED)
+ list(APPEND Caffe2_DEPENDENCY_LIBS "${FOXI_LOADER_LIBPATH}")
Expand Down Expand Up @@ -184,7 +184,7 @@ index c3abce52e4..cd27c728ff 100644
list(APPEND Caffe2_DEPENDENCY_LIBS fmt::fmt-header-only)
set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS} CACHE BOOL "Build shared libs" FORCE)
diff --git a/cmake/Modules/FindLMDB.cmake b/cmake/Modules/FindLMDB.cmake
index 2f0adb1b6d..8a817fd6f1 100644
index 2f0adb1..8a817fd 100644
--- a/cmake/Modules/FindLMDB.cmake
+++ b/cmake/Modules/FindLMDB.cmake
@@ -12,12 +12,8 @@
Expand All @@ -203,7 +203,7 @@ index 2f0adb1b6d..8a817fd6f1 100644
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LMDB DEFAULT_MSG LMDB_INCLUDE_DIR LMDB_LIBRARIES)
diff --git a/cmake/public/cuda.cmake b/cmake/public/cuda.cmake
index 32f3ba375b..411293794f 100644
index 32f3ba3..4112937 100644
--- a/cmake/public/cuda.cmake
+++ b/cmake/public/cuda.cmake
@@ -67,8 +67,8 @@ if(NOT CMAKE_CUDA_COMPILER_VERSION STREQUAL CUDAToolkit_VERSION OR
Expand All @@ -218,7 +218,7 @@ index 32f3ba375b..411293794f 100644

message(STATUS "Caffe2: CUDA detected: " ${CUDA_VERSION})
diff --git a/cmake/public/utils.cmake b/cmake/public/utils.cmake
index 4d48c0f0f3..ebdd39a7fd 100644
index 4d48c0f..ebdd39a 100644
--- a/cmake/public/utils.cmake
+++ b/cmake/public/utils.cmake
@@ -185,9 +185,9 @@ endfunction()
Expand Down
124 changes: 63 additions & 61 deletions ports/libtorch/cuda-adjustments.patch
Original file line number Diff line number Diff line change
@@ -1,61 +1,63 @@
diff --git a/cmake/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake b/cmake/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
index 9293df3..11bc4bf 100644
--- a/cmake/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
+++ b/cmake/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
@@ -126,11 +126,11 @@ list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
# Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority
list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 )
list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 )
-if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
+if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER AND 0)
if (CUDA_HOST_COMPILER STREQUAL "@_CUDA_MSVC_HOST_COMPILER@" AND DEFINED CCBIN)
- set(CCBIN -ccbin "${CCBIN}")
+ #set(CCBIN -ccbin "${CCBIN}")
else()
- set(CCBIN -ccbin "${CUDA_HOST_COMPILER}")
+ #set(CCBIN -ccbin "${CUDA_HOST_COMPILER}")
endif()
endif()

diff --git a/cmake/Modules_CUDA_fix/upstream/FindCUDA/select_compute_arch.cmake b/cmake/Modules_CUDA_fix/upstream/FindCUDA/select_compute_arch.cmake
index d917738..8f832fe 100644
--- a/cmake/Modules_CUDA_fix/upstream/FindCUDA/select_compute_arch.cmake
+++ b/cmake/Modules_CUDA_fix/upstream/FindCUDA/select_compute_arch.cmake
@@ -30,7 +30,7 @@ endif()
set(CUDA_KNOWN_GPU_ARCHITECTURES "Kepler" "Maxwell")

# This list will be used for CUDA_ARCH_NAME = Common option (enabled by default)
-set(CUDA_COMMON_GPU_ARCHITECTURES "3.5" "5.0")
+# set(CUDA_COMMON_GPU_ARCHITECTURES "3.5" "5.0")

# This list is used to filter CUDA archs when autodetecting
set(CUDA_ALL_GPU_ARCHITECTURES "3.5" "5.0")
diff --git a/cmake/Modules_CUDA_fix/upstream/FindCUDA.cmake b/cmake/Modules_CUDA_fix/upstream/FindCUDA.cmake
index 420ee63..f029b66 100644
--- a/cmake/Modules_CUDA_fix/upstream/FindCUDA.cmake
+++ b/cmake/Modules_CUDA_fix/upstream/FindCUDA.cmake
@@ -1694,9 +1694,9 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
# Match VERBATIM check below.
if(CUDA_HOST_COMPILER MATCHES "\\$\\(VCInstallDir\\)")
- list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"")
+ #list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"")
else()
- list(APPEND nvcc_flags -ccbin "${CUDA_HOST_COMPILER}")
+ #list(APPEND nvcc_flags -ccbin "${CUDA_HOST_COMPILER}")
endif()
endif()

diff --git a/cmake/public/cuda.cmake b/cmake/public/cuda.cmake
index 4112937..3e1af83 100644
--- a/cmake/public/cuda.cmake
+++ b/cmake/public/cuda.cmake
@@ -42,7 +42,7 @@ set(CUDAToolkit_ROOT "${CUDA_TOOLKIT_ROOT_DIR}")
# Must be done before CUDA language is enabled, see
# https://cmake.org/cmake/help/v3.15/variable/CMAKE_CUDA_HOST_COMPILER.html
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
- set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}")
+ #set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}")
endif()
enable_language(CUDA)
if("X${CMAKE_CUDA_STANDARD}" STREQUAL "X" )
diff --git a/cmake/Modules_CUDA_fix/upstream/FindCUDA.cmake b/cmake/Modules_CUDA_fix/upstream/FindCUDA.cmake
index 420ee63..8bc24a0 100644
--- a/cmake/Modules_CUDA_fix/upstream/FindCUDA.cmake
+++ b/cmake/Modules_CUDA_fix/upstream/FindCUDA.cmake
@@ -1691,14 +1691,6 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
# If -ccbin, --compiler-bindir has been specified, don't do anything. Otherwise add it here.
list( FIND nvcc_flags "-ccbin" ccbin_found0 )
list( FIND nvcc_flags "--compiler-bindir" ccbin_found1 )
- if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
- # Match VERBATIM check below.
- if(CUDA_HOST_COMPILER MATCHES "\\$\\(VCInstallDir\\)")
- list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"")
- else()
- list(APPEND nvcc_flags -ccbin "${CUDA_HOST_COMPILER}")
- endif()
- endif()

# Create a list of flags specified by CUDA_NVCC_FLAGS_${CONFIG} and CMAKE_${CUDA_C_OR_CXX}_FLAGS*
set(config_specific_flags)
diff --git a/cmake/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake b/cmake/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
index 9293df3..8c12015 100644
--- a/cmake/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
+++ b/cmake/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
@@ -126,13 +126,6 @@ list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
# Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority
list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 )
list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 )
-if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
- if (CUDA_HOST_COMPILER STREQUAL "@_CUDA_MSVC_HOST_COMPILER@" AND DEFINED CCBIN)
- set(CCBIN -ccbin "${CCBIN}")
- else()
- set(CCBIN -ccbin "${CUDA_HOST_COMPILER}")
- endif()
-endif()

# cuda_execute_process - Executes a command with optional command echo and status message.
#
diff --git a/cmake/Modules_CUDA_fix/upstream/FindCUDA/select_compute_arch.cmake b/cmake/Modules_CUDA_fix/upstream/FindCUDA/select_compute_arch.cmake
index d917738..6d0d4fa 100644
--- a/cmake/Modules_CUDA_fix/upstream/FindCUDA/select_compute_arch.cmake
+++ b/cmake/Modules_CUDA_fix/upstream/FindCUDA/select_compute_arch.cmake
@@ -30,7 +30,6 @@ endif()
set(CUDA_KNOWN_GPU_ARCHITECTURES "Kepler" "Maxwell")

# This list will be used for CUDA_ARCH_NAME = Common option (enabled by default)
-set(CUDA_COMMON_GPU_ARCHITECTURES "3.5" "5.0")

# This list is used to filter CUDA archs when autodetecting
set(CUDA_ALL_GPU_ARCHITECTURES "3.5" "5.0")
diff --git a/cmake/public/cuda.cmake b/cmake/public/cuda.cmake
index 4112937..5964429 100644
--- a/cmake/public/cuda.cmake
+++ b/cmake/public/cuda.cmake
@@ -41,9 +41,6 @@ set(CUDAToolkit_ROOT "${CUDA_TOOLKIT_ROOT_DIR}")
# Pass clang as host compiler, which according to the docs
# Must be done before CUDA language is enabled, see
# https://cmake.org/cmake/help/v3.15/variable/CMAKE_CUDA_HOST_COMPILER.html
-if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
- set(CMAKE_CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}")
-endif()
enable_language(CUDA)
if("X${CMAKE_CUDA_STANDARD}" STREQUAL "X" )
set(CMAKE_CUDA_STANDARD ${CMAKE_CXX_STANDARD})
22 changes: 11 additions & 11 deletions ports/libtorch/fix-build.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/c10/cuda/CMakeLists.txt b/c10/cuda/CMakeLists.txt
index c0628d0c96..5dfb7f2abb 100644
index c0628d0..5dfb7f2 100644
--- a/c10/cuda/CMakeLists.txt
+++ b/c10/cuda/CMakeLists.txt
@@ -74,7 +74,11 @@ add_subdirectory(test)
Expand All @@ -16,7 +16,7 @@ index c0628d0c96..5dfb7f2abb 100644
get_filename_component( dir ${file} DIRECTORY )
install( FILES ${file} DESTINATION include/c10/cuda/${dir} )
diff --git a/c10/util/Exception.h b/c10/util/Exception.h
index ecbc7c1345..2dd1001c9e 100644
index ecbc7c1..2dd1001 100644
--- a/c10/util/Exception.h
+++ b/c10/util/Exception.h
@@ -14,6 +14,9 @@
Expand All @@ -30,7 +30,7 @@ index ecbc7c1345..2dd1001c9e 100644

/// The primary ATen error class.
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index 2c5c5b95d8..8c1742591f 100644
index b46a444..255d7f4 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -1581,19 +1581,10 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX)
Expand All @@ -50,15 +50,15 @@ index 2c5c5b95d8..8c1742591f 100644
- endif()
- set_property(TARGET onnx_proto PROPERTY IMPORTED_LOCATION ${ONNX_PROTO_LIBRARY})
- message("-- Found onnx: ${ONNX_LIBRARY} ${ONNX_PROTO_LIBRARY}")
+ find_package(onnx REQUIRED)
+ find_package(ONNX REQUIRED)
+ set(ONNX_LIBRARY onnx)
+ set(ONNX_PROTO_LIBRARY onnx_proto)
+ message("-- Found onnx")
list(APPEND Caffe2_DEPENDENCY_LIBS onnx_proto onnx)
endif()
include_directories(${FOXI_INCLUDE_DIRS})
diff --git a/pyproject.toml b/pyproject.toml
index eb764cb895..c70f317c2f 100644
index eb764cb..c70f317 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,11 +4,9 @@ requires = [
Expand All @@ -75,7 +75,7 @@ index eb764cb895..c70f317c2f 100644
# Use legacy backend to import local packages in setup.py
build-backend = "setuptools.build_meta:__legacy__"
diff --git a/setup.py b/setup.py
index 17bf16b89a..b90ebbc9eb 100644
index 7016441..a6416c7 100644
--- a/setup.py
+++ b/setup.py
@@ -263,7 +263,7 @@ from tools.setup_helpers.env import build_type, IS_DARWIN, IS_LINUX, IS_WINDOWS
Expand Down Expand Up @@ -109,7 +109,7 @@ index 17bf16b89a..b90ebbc9eb 100644
all_commands = [entry for f in ninja_files + cmake_files for entry in load(f)]

diff --git a/third_party/nvfuser/csrc/instrumentation.h b/third_party/nvfuser/csrc/instrumentation.h
index cd57825a24..75e81e9fac 100644
index cd57825..75e81e9 100644
--- a/third_party/nvfuser/csrc/instrumentation.h
+++ b/third_party/nvfuser/csrc/instrumentation.h
@@ -2,7 +2,7 @@
Expand All @@ -122,7 +122,7 @@ index cd57825a24..75e81e9fac 100644
// NOLINTNEXTLINE(modernize-deprecated-headers)
#include <stdio.h>
diff --git a/tools/setup_helpers/env.py b/tools/setup_helpers/env.py
index d87e97a2bb..e1bc42e87c 100644
index d87e97a..6c52f39 100644
--- a/tools/setup_helpers/env.py
+++ b/tools/setup_helpers/env.py
@@ -19,7 +19,7 @@ CONDA_DIR = os.path.join(os.path.dirname(sys.executable), "..")
Expand All @@ -135,7 +135,7 @@ index d87e97a2bb..e1bc42e87c 100644

def check_env_flag(name: str, default: str = "") -> bool:
diff --git a/torch/lib/libshm/CMakeLists.txt b/torch/lib/libshm/CMakeLists.txt
index 20158a9a25..7d3c475a9b 100644
index 20158a9..7d3c475 100644
--- a/torch/lib/libshm/CMakeLists.txt
+++ b/torch/lib/libshm/CMakeLists.txt
@@ -71,6 +71,10 @@ target_link_libraries(torch_shm_manager PRIVATE shm)
Expand All @@ -151,7 +151,7 @@ index 20158a9a25..7d3c475a9b 100644
install(FILES libshm.h DESTINATION "include")
install(TARGETS torch_shm_manager DESTINATION "bin")
diff --git a/torch/lib/libshm_windows/CMakeLists.txt b/torch/lib/libshm_windows/CMakeLists.txt
index df2a106493..b86e0b6872 100644
index df2a106..b86e0b6 100644
--- a/torch/lib/libshm_windows/CMakeLists.txt
+++ b/torch/lib/libshm_windows/CMakeLists.txt
@@ -19,9 +19,12 @@ target_include_directories(shm PRIVATE
Expand All @@ -170,7 +170,7 @@ index df2a106493..b86e0b6872 100644
+ install(FILES $<TARGET_PDB_FILE:shm> DESTINATION "${LIBSHM_INSTALL_BIN_SUBDIR}" OPTIONAL)
endif()
diff --git a/torch/utils/cpp_extension.py b/torch/utils/cpp_extension.py
index 6600eb3cb5..1d5e451c14 100644
index 6600eb3..15ddc8c 100644
--- a/torch/utils/cpp_extension.py
+++ b/torch/utils/cpp_extension.py
@@ -38,7 +38,7 @@ SHARED_FLAG = '/DLL' if IS_WINDOWS else '-shared'
Expand Down
13 changes: 0 additions & 13 deletions ports/libtorch/fix-onnx-case.patch

This file was deleted.

4 changes: 2 additions & 2 deletions ports/libtorch/force-cuda-include.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/cmake/public/cuda.cmake b/cmake/public/cuda.cmake
index e8e450d36c..8ba1778b4f 100644
index 5964429..d528597 100644
--- a/cmake/public/cuda.cmake
+++ b/cmake/public/cuda.cmake
@@ -60,6 +60,7 @@ find_package(CUDAToolkit REQUIRED)
@@ -57,6 +57,7 @@ find_package(CUDAToolkit REQUIRED)

cmake_policy(POP)

Expand Down
7 changes: 4 additions & 3 deletions ports/libtorch/fxdiv.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
index d18523352..1f53945cf 100644
index d185233..11f285b 100644
--- a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
+++ b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
@@ -389,12 +389,12 @@ if(NOT TARGET fxdiv AND NOT USE_SYSTEM_FXDIV)
Expand All @@ -19,10 +19,10 @@ index d18523352..1f53945cf 100644
target_link_libraries(pytorch_qnnpack PRIVATE fxdiv)

diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
index f7a595e1b..fb315c435 100644
index f7a595e..47faec5 100644
--- a/caffe2/CMakeLists.txt
+++ b/caffe2/CMakeLists.txt
@@ -108,11 +108,18 @@ endif()
@@ -108,12 +108,19 @@ endif()
# addressed yet.

if(NOT MSVC AND USE_XNNPACK)
Expand All @@ -42,3 +42,4 @@ index f7a595e1b..fb315c435 100644
+ target_include_directories(fxdiv INTERFACE "${FXDIV_HDR}")
endif()
endif()

Loading

0 comments on commit 0dab813

Please sign in to comment.