xref: /aosp_15_r20/external/pytorch/c10/cuda/CUDAMacros.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 #ifndef C10_USING_CUSTOM_GENERATED_MACROS
4 
5 // We have not yet modified the AMD HIP build to generate this file so
6 // we add an extra option to specifically ignore it.
7 #ifndef C10_CUDA_NO_CMAKE_CONFIGURE_FILE
8 #include <c10/cuda/impl/cuda_cmake_macros.h>
9 #endif // C10_CUDA_NO_CMAKE_CONFIGURE_FILE
10 
11 #endif
12 
13 // See c10/macros/Export.h for a detailed explanation of what the function
14 // of these macros are.  We need one set of macros for every separate library
15 // we build.
16 
17 #ifdef _WIN32
18 #if defined(C10_CUDA_BUILD_SHARED_LIBS)
19 #define C10_CUDA_EXPORT __declspec(dllexport)
20 #define C10_CUDA_IMPORT __declspec(dllimport)
21 #else
22 #define C10_CUDA_EXPORT
23 #define C10_CUDA_IMPORT
24 #endif
25 #else // _WIN32
26 #if defined(__GNUC__)
27 #define C10_CUDA_EXPORT __attribute__((__visibility__("default")))
28 #else // defined(__GNUC__)
29 #define C10_CUDA_EXPORT
30 #endif // defined(__GNUC__)
31 #define C10_CUDA_IMPORT C10_CUDA_EXPORT
32 #endif // _WIN32
33 
34 // This one is being used by libc10_cuda.so
35 #ifdef C10_CUDA_BUILD_MAIN_LIB
36 #define C10_CUDA_API C10_CUDA_EXPORT
37 #else
38 #define C10_CUDA_API C10_CUDA_IMPORT
39 #endif
40 
41 /**
42  * The maximum number of GPUs that we recognizes. Increasing this beyond the
43  * initial limit of 16 broke Caffe2 testing, hence the ifdef guards.
44  * This value cannot be more than 128 because our DeviceIndex is a uint8_t.
45 o */
46 #ifdef FBCODE_CAFFE2
47 // fbcode depends on this value being 16
48 #define C10_COMPILE_TIME_MAX_GPUS 16
49 #else
50 #define C10_COMPILE_TIME_MAX_GPUS 120
51 #endif
52