[AMD] Fix some legacy hipify script (#70594)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/70594

Pull Request resolved: https://github.com/facebookincubator/gloo/pull/315

Fix some out-dated hipify script:
* python -> python3 (fb internal)
* rocblas return code
* gloo makefile for hip clang

Test Plan: Sandcastle + OSS build

Reviewed By: malfet, shintaro-iwasaki

Differential Revision: D33402839

fbshipit-source-id: 5893039451bcf77bbbb1b88d2e46ae3e39caa154
This commit is contained in:
Xiaodong Wang 2022-01-05 11:32:41 -08:00 committed by Facebook GitHub Bot
parent 34c49d3d3b
commit 025cd69a86
2 changed files with 26 additions and 21 deletions

View File

@ -206,6 +206,8 @@ const char* cublasGetErrorString(cublasStatus_t error) {
return "rocblas_status_size_increased"; return "rocblas_status_size_increased";
case rocblas_status_size_unchanged: case rocblas_status_size_unchanged:
return "rocblas_status_size_unchanged"; return "rocblas_status_size_unchanged";
default:
return "unrecognized_rocblas_error";
#endif #endif
} }
// To suppress compiler warning. // To suppress compiler warning.

View File

@ -116,7 +116,8 @@ ignores = [
def is_hip_clang() -> bool: def is_hip_clang() -> bool:
try: try:
hip_path = os.getenv('HIP_PATH', '/opt/rocm/hip') hip_path = os.getenv('HIP_PATH', '/opt/rocm/hip')
return 'HIP_COMPILER=clang' in open(hip_path + '/lib/.hipInfo').read() with open(hip_path + '/lib/.hipInfo') as f:
return 'HIP_COMPILER=clang' in f.read()
except IOError: except IOError:
return False return False
@ -124,6 +125,7 @@ def is_hip_clang() -> bool:
if is_hip_clang(): if is_hip_clang():
gloo_cmake_file = "third_party/gloo/cmake/Hip.cmake" gloo_cmake_file = "third_party/gloo/cmake/Hip.cmake"
do_write = False do_write = False
if os.path.exists(gloo_cmake_file):
with open(gloo_cmake_file, "r") as sources: with open(gloo_cmake_file, "r") as sources:
lines = sources.readlines() lines = sources.readlines()
newlines = [line.replace(' hip_hcc ', ' amdhip64 ') for line in lines] newlines = [line.replace(' hip_hcc ', ' amdhip64 ') for line in lines]
@ -153,6 +155,7 @@ if os.path.exists(gloo_cmake_file):
if is_hip_clang(): if is_hip_clang():
gloo_cmake_file = "third_party/gloo/cmake/Dependencies.cmake" gloo_cmake_file = "third_party/gloo/cmake/Dependencies.cmake"
do_write = False do_write = False
if os.path.exists(gloo_cmake_file):
with open(gloo_cmake_file, "r") as sources: with open(gloo_cmake_file, "r") as sources:
lines = sources.readlines() lines = sources.readlines()
newlines = [line.replace('HIP_HCC_FLAGS', 'HIP_CLANG_FLAGS') for line in lines] newlines = [line.replace('HIP_HCC_FLAGS', 'HIP_CLANG_FLAGS') for line in lines]