Skip to content

Improving the ROCm build process. #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions caffe2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,25 @@ endif()

# ---[ Caffe2 HIP sources.
if(USE_ROCM)
# Call again since Caffe2_HIP_INCLUDES is extended with ATen include dirs.
IF(BUILD_ATEN)
HIP_INCLUDE_DIRECTORIES(${Caffe2_HIP_INCLUDES})
ENDIF()
if(BUILD_ATEN)
# Get Compile Definitions from the directory (FindHIP.CMake bug)
get_directory_property(MY_DEFINITIONS COMPILE_DEFINITIONS)
if(MY_DEFINITIONS)
foreach(_item ${MY_DEFINITIONS})
LIST(APPEND HIP_HCC_FLAGS "-D${_item}")
endforeach()
endif()

# Call again since Caffe2_HIP_INCLUDES is extended with ATen include dirs.
hip_include_directories(${Caffe2_HIP_INCLUDES})
endif()

IF(BUILD_CAFFE2)
set_source_files_properties(${Caffe2_HIP_SRCS} PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
ENDIF()
hip_add_library(caffe2_hip ${Caffe2_HIP_SRCS})

# Make sure the SHARED flag is set or else -fPIC is dropped when linking with HIP.
hip_add_library(caffe2_hip SHARED ${Caffe2_HIP_SRCS})

# Since PyTorch files contain HIP headers, these flags are required for the necessary definitions to be added.
set_target_properties(caffe2_hip PROPERTIES COMPILE_FLAGS ${HIP_HIPCC_FLAGS})
Expand Down
Loading