Skip to content

Commit 08f125b

Browse files
pruthvistonypytorchmergebot
authored andcommitted
[ROCm] Remove usage of deprecated ROCm component header includes (#97620)
- clang parameter 'amdgpu-target' changed to 'offload-arch' - HIP and MIOpen includes path updated for extensions Pull Request resolved: #97620 Approved by: https://github.com/ezyang, https://github.com/jithunnair-amd
1 parent 4afef85 commit 08f125b

File tree

4 files changed

+3
-10
lines changed

4 files changed

+3
-10
lines changed

cmake/Dependencies.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ if(USE_ROCM)
12881288
# host linker to link.
12891289
list(APPEND HIP_CLANG_FLAGS -fno-gpu-rdc)
12901290
foreach(pytorch_rocm_arch ${PYTORCH_ROCM_ARCH})
1291-
list(APPEND HIP_CLANG_FLAGS --amdgpu-target=${pytorch_rocm_arch})
1291+
list(APPEND HIP_CLANG_FLAGS --offload-arch=${pytorch_rocm_arch})
12921292
endforeach()
12931293

12941294
set(Caffe2_HIP_INCLUDE

cmake/public/LoadHIP.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,5 +313,4 @@ if(HIP_FOUND)
313313
find_library(ROCM_HIPRTC_LIB ${hip_library_name} HINTS ${HIP_PATH}/lib)
314314
# roctx is part of roctracer
315315
find_library(ROCM_ROCTX_LIB roctx64 HINTS ${ROCTRACER_PATH}/lib)
316-
set(roctracer_INCLUDE_DIRS ${ROCTRACER_PATH}/include)
317316
endif()

torch/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ if(USE_ROCM)
139139
__HIP_PLATFORM_HCC__
140140
)
141141
list(APPEND TORCH_PYTHON_LINK_LIBRARIES ${ROCM_ROCTX_LIB})
142-
list(APPEND TORCH_PYTHON_INCLUDE_DIRECTORIES ${roctracer_INCLUDE_DIRS})
143142
endif()
144143

145144
if(USE_EXPERIMENTAL_CUDNN_V8_API)

torch/utils/cpp_extension.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ def _join_rocm_home(*paths) -> str:
200200
environment variable or add NVCC to your system PATH. The extension compilation will fail.
201201
'''
202202
ROCM_HOME = _find_rocm_home()
203-
MIOPEN_HOME = _join_rocm_home('miopen') if ROCM_HOME else None
204203
HIP_HOME = _join_rocm_home('hip') if ROCM_HOME else None
205204
IS_HIP_EXTENSION = True if ((ROCM_HOME is not None) and (torch.version.hip is not None)) else False
206205
ROCM_VERSION = None
@@ -1142,10 +1141,6 @@ def include_paths(cuda: bool = False) -> List[str]:
11421141
if cuda and IS_HIP_EXTENSION:
11431142
paths.append(os.path.join(lib_include, 'THH'))
11441143
paths.append(_join_rocm_home('include'))
1145-
if MIOPEN_HOME is not None:
1146-
paths.append(os.path.join(MIOPEN_HOME, 'include'))
1147-
if HIP_HOME is not None:
1148-
paths.append(os.path.join(HIP_HOME, 'include'))
11491144
elif cuda:
11501145
cuda_home_include = _join_cuda_home('include')
11511146
# if we have the Debian/Ubuntu packages for cuda, we get /usr as cuda home.
@@ -1804,7 +1799,7 @@ def _get_rocm_arch_flags(cflags: Optional[List[str]] = None) -> List[str]:
18041799
# (from `extra_compile_args`)
18051800
if cflags is not None:
18061801
for flag in cflags:
1807-
if 'amdgpu-target' in flag:
1802+
if 'amdgpu-target' in flag or 'offload-arch' in flag:
18081803
return ['-fno-gpu-rdc']
18091804
# Use same defaults as used for building PyTorch
18101805
# Allow env var to override, just like during initial cmake build.
@@ -1817,7 +1812,7 @@ def _get_rocm_arch_flags(cflags: Optional[List[str]] = None) -> List[str]:
18171812
archs = []
18181813
else:
18191814
archs = _archs.replace(' ', ';').split(';')
1820-
flags = ['--amdgpu-target=%s' % arch for arch in archs]
1815+
flags = ['--offload-arch=%s' % arch for arch in archs]
18211816
flags += ['-fno-gpu-rdc']
18221817
return flags
18231818

0 commit comments

Comments
 (0)