diff --git a/c10/macros/Export.h b/c10/macros/Export.h index cb68060ed81..21808de77a3 100644 --- a/c10/macros/Export.h +++ b/c10/macros/Export.h @@ -139,8 +139,10 @@ #endif #if defined(TORCH_HIP_BUILD_MAIN_LIB) +#define TORCH_HIP_CPP_API C10_EXPORT #define TORCH_HIP_API C10_EXPORT #else +#define TORCH_HIP_CPP_API C10_IMPORT #define TORCH_HIP_API C10_IMPORT #endif diff --git a/torch/utils/hipify/cuda_to_hip_mappings.py b/torch/utils/hipify/cuda_to_hip_mappings.py index bb9257079a7..f1c19b3cddc 100644 --- a/torch/utils/hipify/cuda_to_hip_mappings.py +++ b/torch/utils/hipify/cuda_to_hip_mappings.py @@ -8422,6 +8422,8 @@ CUDA_SPECIAL_MAP = collections.OrderedDict( PYTORCH_SPECIFIC_MAPPINGS = collections.OrderedDict( [ ("USE_CUDA", ("USE_ROCM", API_PYTORCH)), + ("TORCH_CUDA_CPP_API", ("TORCH_HIP_CPP_API", API_PYTORCH)), + ("TORCH_CUDA_CU_API", ("TORCH_HIP_API", API_PYTORCH)), ("CUDA_VERSION", ("TORCH_HIP_VERSION", API_PYTORCH)), ("cudaHostAllocator", ("hipHostAllocator", API_PYTORCH)), ("cudaDeviceAllocator", ("hipDeviceAllocator", API_PYTORCH)),