FILE(GLOB native_hip_hip "native/hip/*.hip")
FILE(GLOB native_hip_cpp "native/hip/*.cpp")
FILE(GLOB native_miopen_cpp "native/miopen/*.cpp")
+FILE(GLOB native_cudnn_hip_cpp "native/cudnn/hip/*.cpp")
FILE(GLOB native_sparse_hip_hip "native/sparse/hip/*.hip")
FILE(GLOB native_sparse_hip_cpp "native/sparse/hip/*.cpp")
set(ATen_HIP_SRCS ${ATen_HIP_SRCS} ${hip_hip} ${native_hip_hip} ${native_sparse_hip_hip})
# TODO: Codegen separate files for HIP and use those (s/cuda_generated_cpp/hip_generated_cpp)
set(all_hip_cpp ${native_sparse_hip_cpp} ${hip_cpp} ${native_hip_cpp} ${cuda_generated_cpp} ${ATen_HIP_SRCS})
- set(all_hip_cpp ${native_miopen_cpp} ${miopen_cpp} ${all_hip_cpp})
+ set(all_hip_cpp ${native_miopen_cpp} ${native_cudnn_hip_cpp} ${miopen_cpp} ${all_hip_cpp})
endif()
filter_list(generated_h generated_cpp "\\.h$")
except ImportError as gpu_e:
logging.info('Failed to import cuda module: {}'.format(gpu_e))
try:
- RTLD_LAZY = 1
- with extension_loader.DlopenGuard(RTLD_LAZY):
- from caffe2.python.caffe2_pybind11_state_hip import * # noqa
+ from caffe2.python.caffe2_pybind11_state_hip import * # noqa
if num_hip_devices():
has_hip_support = True
logging.info('This caffe2 python run has AMD GPU support!')
hip_include_directories(${Caffe2_HIP_INCLUDE})
set(Caffe2_HIP_DEPENDENCY_LIBS
- ${rocrand_LIBRARIES} ${hiprand_LIBRARIES} ${PYTORCH_HIP_HCC_LIBRARIES} ${PYTORCH_MIOPEN_LIBRARIES})
- # Additional libraries required by PyTorch AMD that aren't used by Caffe2 (not in Caffe2's docker image)
- if(NOT BUILD_ATEN_MOBILE)
- set(Caffe2_HIP_DEPENDENCY_LIBS ${Caffe2_HIP_DEPENDENCY_LIBS} ${hipsparse_LIBRARIES})
- endif()
- # Note [rocblas cmake bug]
- # ~~~~~~~~~~~~~~~~~~~~~~~~
- # TODO: There is a bug in rocblas's cmake files that exports the wrong targets name in ${rocblas_LIBRARIES}
+ ${rocrand_LIBRARIES} ${hiprand_LIBRARIES} ${hipsparse_LIBRARIES} ${PYTORCH_HIP_HCC_LIBRARIES} ${PYTORCH_MIOPEN_LIBRARIES})
+
+ # Note [rocblas & rocfft cmake bug]
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ # TODO: There is a bug in rocblas's & rocfft's cmake files that exports the wrong targets name in ${rocblas_LIBRARIES}
# If you get this wrong, you'll get a complaint like 'ld: cannot find -lrocblas-targets'
list(APPEND Caffe2_HIP_DEPENDENCY_LIBS
- roc::rocblas)
-
- # TODO: Currently pytorch hipify script uses a feature called
- # "disabled_modules" that effectively ifdef out a file, but
- # without doing extra processing in the callers, which results in
- # some unresolved symbols in the shared lib
- # (libcaffe2_hip.so). Remove this when all disabled_modules are
- # eliminated.
- set(CMAKE_EXE_LINKER_FLAGS "-Wl,--unresolved-symbols=ignore-in-shared-libs ${CMAKE_EXE_LINKER_FLAGS}")
+ roc::rocblas roc::rocfft)
else()
caffe2_update_option(USE_ROCM OFF)
endif()
# Keep this synchronized with is_pytorch_file in hipify_python.py
"aten/src/ATen/cuda/*",
"aten/src/ATen/native/cuda/*",
+ "aten/src/ATen/native/cudnn/*",
"aten/src/ATen/native/sparse/cuda/*",
"aten/src/THC/*",
"aten/src/THCUNN/*",