Skip to content

Commit db13bd9

Browse files
Revert "export AOTI_TORCH_EXPORT on Windows. (pytorch#140030)"
This reverts commit b8eb4b5. Reverted pytorch#140030 on behalf of https://github.com/atalman due to Break internal tests see errors like: csrc\inductor\aoti_torch\shim_common.cpp(481): error C2491: 'aoti_torch__embedding_bag': definition of dllimport function not allowed ([comment](pytorch#140030 (comment)))
1 parent cf58de5 commit db13bd9

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

caffe2/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,6 @@ endif()
779779

780780
if(NOT BUILD_LIBTORCHLESS)
781781
add_library(torch_cpu ${Caffe2_CPU_SRCS})
782-
target_compile_definitions(torch_cpu PRIVATE -DEXPORT_AOTI_FUNCTIONS)
783782
if(HAVE_SOVERSION)
784783
set_target_properties(torch_cpu PROPERTIES
785784
VERSION ${TORCH_VERSION} SOVERSION ${TORCH_SOVERSION})
@@ -964,7 +963,6 @@ elseif(USE_CUDA)
964963
set(CUDA_LINK_LIBRARIES_KEYWORD)
965964
torch_compile_options(torch_cuda) # see cmake/public/utils.cmake
966965
target_compile_definitions(torch_cuda PRIVATE USE_CUDA)
967-
target_compile_definitions(torch_cuda PRIVATE -DEXPORT_AOTI_FUNCTIONS)
968966

969967
if(USE_CUFILE)
970968
target_link_libraries(torch_cuda PRIVATE torch::cufile)
@@ -1055,7 +1053,6 @@ if(USE_XPU)
10551053
add_library(torch_xpu ${Caffe2_XPU_SRCS})
10561054
torch_compile_options(torch_xpu) # see cmake/public/utils.cmake
10571055
target_compile_definitions(torch_xpu PRIVATE USE_XPU)
1058-
target_compile_definitions(torch_xpu PRIVATE -DEXPORT_AOTI_FUNCTIONS)
10591056
if(WIN32)
10601057
target_compile_options(torch_xpu PRIVATE /permissive-)
10611058
endif()

torch/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,6 @@ endif()
310310

311311
add_library(torch_python SHARED ${TORCH_PYTHON_SRCS})
312312
torch_compile_options(torch_python) # see cmake/public/utils.cmake
313-
target_compile_definitions(torch_python PRIVATE -DEXPORT_AOTI_FUNCTIONS)
314313
if(NOT WIN32)
315314
target_compile_options(torch_python PRIVATE
316315
$<$<COMPILE_LANGUAGE:CXX>: -fvisibility=default>)

torch/csrc/inductor/aoti_torch/c/shim.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,8 @@
4444
// to symbol clashes at link time if libtorch is included in a DLL and binary
4545
// that depends on the DLL. As a short term fix, we don't export the symbols.
4646
// In the long term, this will need to be addressed when Windows is supported.
47-
#ifdef EXPORT_AOTI_FUNCTIONS
48-
#define AOTI_TORCH_EXPORT __declspec(dllexport)
49-
#else
50-
#define AOTI_TORCH_EXPORT __declspec(dllimport)
51-
#endif
47+
// #define AOTI_TORCH_EXPORT __declspec(dllexport)
48+
#define AOTI_TORCH_EXPORT
5249
#else // !_WIN32
5350
#define AOTI_TORCH_EXPORT
5451
#endif // _WIN32

0 commit comments

Comments
 (0)