XPUMacros.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
  2. #pragma once
  3. #ifndef C10_USING_CUSTOM_GENERATED_MACROS
  4. #include <c10/xpu/impl/xpu_cmake_macros.h>
  5. #endif
  6. // See c10/macros/Export.h for a detailed explanation of what the function
  7. // of these macros are. We need one set of macros for every separate library
  8. // we build.
  9. #ifdef _WIN32
  10. #if defined(C10_XPU_BUILD_SHARED_LIBS)
  11. #define C10_XPU_EXPORT __declspec(dllexport)
  12. #define C10_XPU_IMPORT __declspec(dllimport)
  13. #else
  14. #define C10_XPU_EXPORT
  15. #define C10_XPU_IMPORT
  16. #endif
  17. #else // _WIN32
  18. #if defined(__GNUC__)
  19. #define C10_XPU_EXPORT __attribute__((__visibility__("default")))
  20. #else // defined(__GNUC__)
  21. #define C10_XPU_EXPORT
  22. #endif // defined(__GNUC__)
  23. #define C10_XPU_IMPORT C10_XPU_EXPORT
  24. #endif // _WIN32
  25. // This one is being used by libc10_xpu.so
  26. #ifdef C10_XPU_BUILD_MAIN_LIB
  27. #define C10_XPU_API C10_XPU_EXPORT
  28. #else
  29. #define C10_XPU_API C10_XPU_IMPORT
  30. #endif
  31. #else
  32. #error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
  33. #endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)