Revert "export AOTI_TORCH_EXPORT on Windows. (#140030)"

This reverts commit 6733045a4aaef7a8d9fb1f9f8b80f4f5f4ef1f4f.

Reverted https://github.com/pytorch/pytorch/pull/140030 on behalf of https://github.com/huydhn due to Sorry for reverting your change, but my first attempt to fix internal build does not fix all the cases, so let us try again ([comment](https://github.com/pytorch/pytorch/pull/140030#issuecomment-2558043056))
This commit is contained in:
PyTorch MergeBot
2024-12-21 08:06:19 +00:00
parent 51eacea8c4
commit e15442a9b2
4 changed files with 2 additions and 12 deletions

View File

@ -1102,9 +1102,6 @@ if(NOT MSVC)
append_cxx_flag_if_supported("-Wno-error=redundant-move" CMAKE_CXX_FLAGS) append_cxx_flag_if_supported("-Wno-error=redundant-move" CMAKE_CXX_FLAGS)
endif() endif()
else() else()
# Define export functions for AOTI.
add_compile_definitions(EXPORT_AOTI_FUNCTIONS)
# skip unwanted includes from windows.h # skip unwanted includes from windows.h
add_compile_definitions(WIN32_LEAN_AND_MEAN) add_compile_definitions(WIN32_LEAN_AND_MEAN)
# Windows SDK broke compatibility since version 25131, but introduced this # Windows SDK broke compatibility since version 25131, but introduced this

View File

@ -779,7 +779,6 @@ endif()
if(NOT BUILD_LIBTORCHLESS) if(NOT BUILD_LIBTORCHLESS)
add_library(torch_cpu ${Caffe2_CPU_SRCS}) add_library(torch_cpu ${Caffe2_CPU_SRCS})
# target_compile_definitions(torch_cpu PRIVATE -DEXPORT_AOTI_FUNCTIONS)
if(HAVE_SOVERSION) if(HAVE_SOVERSION)
set_target_properties(torch_cpu PROPERTIES set_target_properties(torch_cpu PROPERTIES
VERSION ${TORCH_VERSION} SOVERSION ${TORCH_SOVERSION}) VERSION ${TORCH_VERSION} SOVERSION ${TORCH_SOVERSION})
@ -959,7 +958,6 @@ elseif(USE_CUDA)
set(CUDA_LINK_LIBRARIES_KEYWORD) set(CUDA_LINK_LIBRARIES_KEYWORD)
torch_compile_options(torch_cuda) # see cmake/public/utils.cmake torch_compile_options(torch_cuda) # see cmake/public/utils.cmake
target_compile_definitions(torch_cuda PRIVATE USE_CUDA) target_compile_definitions(torch_cuda PRIVATE USE_CUDA)
# target_compile_definitions(torch_cuda PRIVATE -DEXPORT_AOTI_FUNCTIONS)
if(USE_CUFILE) if(USE_CUFILE)
target_link_libraries(torch_cuda PRIVATE torch::cufile) target_link_libraries(torch_cuda PRIVATE torch::cufile)
@ -1051,7 +1049,6 @@ if(USE_XPU)
add_library(torch_xpu ${Caffe2_XPU_SRCS}) add_library(torch_xpu ${Caffe2_XPU_SRCS})
torch_compile_options(torch_xpu) # see cmake/public/utils.cmake torch_compile_options(torch_xpu) # see cmake/public/utils.cmake
target_compile_definitions(torch_xpu PRIVATE USE_XPU) target_compile_definitions(torch_xpu PRIVATE USE_XPU)
# target_compile_definitions(torch_xpu PRIVATE -DEXPORT_AOTI_FUNCTIONS)
if(WIN32) if(WIN32)
target_compile_options(torch_xpu PRIVATE /permissive-) target_compile_options(torch_xpu PRIVATE /permissive-)
endif() endif()

View File

@ -310,7 +310,6 @@ endif()
add_library(torch_python SHARED ${TORCH_PYTHON_SRCS}) add_library(torch_python SHARED ${TORCH_PYTHON_SRCS})
torch_compile_options(torch_python) # see cmake/public/utils.cmake torch_compile_options(torch_python) # see cmake/public/utils.cmake
# target_compile_definitions(torch_python PRIVATE -DEXPORT_AOTI_FUNCTIONS)
if(APPLE) if(APPLE)
target_compile_options(torch_python PRIVATE target_compile_options(torch_python PRIVATE
$<$<COMPILE_LANGUAGE:CXX>: -fvisibility=default>) $<$<COMPILE_LANGUAGE:CXX>: -fvisibility=default>)

View File

@ -44,11 +44,8 @@
// to symbol clashes at link time if libtorch is included in a DLL and binary // to symbol clashes at link time if libtorch is included in a DLL and binary
// that depends on the DLL. As a short term fix, we don't export the symbols. // that depends on the DLL. As a short term fix, we don't export the symbols.
// In the long term, this will need to be addressed when Windows is supported. // In the long term, this will need to be addressed when Windows is supported.
#ifdef EXPORT_AOTI_FUNCTIONS // #define AOTI_TORCH_EXPORT __declspec(dllexport)
#define AOTI_TORCH_EXPORT __declspec(dllexport) #define AOTI_TORCH_EXPORT
#else
#define AOTI_TORCH_EXPORT __declspec(dllimport)
#endif
#else // !_WIN32 #else // !_WIN32
#define AOTI_TORCH_EXPORT #define AOTI_TORCH_EXPORT
#endif // _WIN32 #endif // _WIN32