mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
export AOTI_TORCH_EXPORT on Windows. (#140030)
Fixes #139954 reproduce UT: ```cmd pytest test/inductor/test_torchinductor_codegen_dynamic_shapes.py -k test_device_assert_dynamic_shapes_cpu ``` Issue: <img width="856" alt="image" src="https://github.com/user-attachments/assets/5fc501a9-54e5-45ac-9fb3-509ec11a7abe"> After fixing:  Reland: 1. Declare export on Windows explicitly. 2. Support cpu, cuda and xpu devices. Pull Request resolved: https://github.com/pytorch/pytorch/pull/140030 Approved by: https://github.com/jgong5, https://github.com/desertfire, https://github.com/malfet Co-authored-by: Nikita Shulga <2453524+malfet@users.noreply.github.com>
This commit is contained in:
parent
fb4b5a9299
commit
2645fc45b1
2 changed files with 12 additions and 1 deletions
|
|
@ -1101,6 +1101,9 @@ if(NOT MSVC)
|
|||
append_cxx_flag_if_supported("-Wno-error=redundant-move" CMAKE_CXX_FLAGS)
|
||||
endif()
|
||||
else()
|
||||
# Define export functions for AOTI.
|
||||
add_compile_definitions(EXPORT_AOTI_FUNCTIONS)
|
||||
|
||||
# skip unwanted includes from windows.h
|
||||
add_compile_definitions(WIN32_LEAN_AND_MEAN)
|
||||
# Windows SDK broke compatibility since version 25131, but introduced this
|
||||
|
|
|
|||
|
|
@ -44,8 +44,16 @@
|
|||
// 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.
|
||||
// In the long term, this will need to be addressed when Windows is supported.
|
||||
// #define AOTI_TORCH_EXPORT __declspec(dllexport)
|
||||
#ifdef OVRSOURCE
|
||||
// Do not export AOTI on Windows for internal builds
|
||||
#define AOTI_TORCH_EXPORT
|
||||
#else /* OVRSOURCE */
|
||||
#ifdef EXPORT_AOTI_FUNCTIONS
|
||||
#define AOTI_TORCH_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define AOTI_TORCH_EXPORT __declspec(dllimport)
|
||||
#endif
|
||||
#endif /* OVRSOURCE */
|
||||
#else // !_WIN32
|
||||
#define AOTI_TORCH_EXPORT
|
||||
#endif // _WIN32
|
||||
|
|
|
|||
Loading…
Reference in a new issue