File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
torch/csrc/inductor/aoti_torch/c Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -779,6 +779,7 @@ endif()
779
779
780
780
if (NOT BUILD_LIBTORCHLESS )
781
781
add_library (torch_cpu ${Caffe2_CPU_SRCS} )
782
+ target_compile_definitions (torch_cpu PRIVATE -DEXPORT_AOTI_FUNCTIONS )
782
783
if (HAVE_SOVERSION )
783
784
set_target_properties (torch_cpu PROPERTIES
784
785
VERSION ${TORCH_VERSION} SOVERSION ${TORCH_SOVERSION} )
@@ -963,6 +964,7 @@ elseif(USE_CUDA)
963
964
set (CUDA_LINK_LIBRARIES_KEYWORD )
964
965
torch_compile_options (torch_cuda ) # see cmake/public/utils.cmake
965
966
target_compile_definitions (torch_cuda PRIVATE USE_CUDA )
967
+ target_compile_definitions (torch_cuda PRIVATE -DEXPORT_AOTI_FUNCTIONS )
966
968
967
969
if (USE_CUFILE )
968
970
target_link_libraries (torch_cuda PRIVATE torch::cufile )
@@ -1053,6 +1055,7 @@ if(USE_XPU)
1053
1055
add_library (torch_xpu ${Caffe2_XPU_SRCS} )
1054
1056
torch_compile_options (torch_xpu ) # see cmake/public/utils.cmake
1055
1057
target_compile_definitions (torch_xpu PRIVATE USE_XPU )
1058
+ target_compile_definitions (torch_xpu PRIVATE -DEXPORT_AOTI_FUNCTIONS )
1056
1059
if (WIN32 )
1057
1060
target_compile_options (torch_xpu PRIVATE /permissive- )
1058
1061
endif ()
Original file line number Diff line number Diff line change 44
44
// to symbol clashes at link time if libtorch is included in a DLL and binary
45
45
// that depends on the DLL. As a short term fix, we don't export the symbols.
46
46
// In the long term, this will need to be addressed when Windows is supported.
47
- // #define AOTI_TORCH_EXPORT __declspec(dllexport)
48
- #define AOTI_TORCH_EXPORT
47
+ #ifdef EXPORT_AOTI_FUNCTIONS
48
+ #define AOTI_TORCH_EXPORT __declspec (dllexport)
49
+ #else
50
+ #define AOTI_TORCH_EXPORT __declspec (dllimport)
51
+ #endif
49
52
#else // !_WIN32
50
53
#define AOTI_TORCH_EXPORT
51
54
#endif // _WIN32
You can’t perform that action at this time.
0 commit comments