From cb4ba13bd0e8d79cb64327f77bd91ad4e7434228 Mon Sep 17 00:00:00 2001 From: Jehandad Khan Date: Wed, 18 Jan 2023 13:01:47 -0600 Subject: [PATCH] fix recursion, add more mappings --- hipify/cuda_to_hip_mappings.py | 3 +++ hipify/hipify_python.py | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hipify/cuda_to_hip_mappings.py b/hipify/cuda_to_hip_mappings.py index 965b775..3c7e7c9 100644 --- a/hipify/cuda_to_hip_mappings.py +++ b/hipify/cuda_to_hip_mappings.py @@ -7605,6 +7605,9 @@ ), ), ("cuComplex", ("rocblas_float_complex", CONV_TYPE, API_BLAS)), + ("cuFloatComplex", ("rocblas_float_complex", CONV_TYPE, API_BLAS)), + ("cuCrealf", ("std::real", CONV_TYPE, API_BLAS)), # From rocblas complex header + ("cuCimagf", ("std::imag", CONV_TYPE, API_BLAS)), # From rocblas complex header ("cuDoubleComplex", ("rocblas_double_complex", CONV_TYPE, API_BLAS)), ("cufftResult_t", ("hipfftResult_t", CONV_TYPE, API_FFT)), ("cufftResult", ("hipfftResult", CONV_TYPE, API_FFT)), diff --git a/hipify/hipify_python.py b/hipify/hipify_python.py index 897a436..e07fbe2 100755 --- a/hipify/hipify_python.py +++ b/hipify/hipify_python.py @@ -173,10 +173,13 @@ def preprocess_file_and_save_result( is_pytorch_extension: bool, clean_ctx: GeneratedFileCleaner, show_progress: bool) -> None: + fin_path = os.path.abspath(os.path.join(output_directory, filepath)) + if fin_path not in HIPIFY_FINAL_RESULT: + HIPIFY_FINAL_RESULT[fin_path] = {} + HIPIFY_FINAL_RESULT[fin_path]["hipified_path"] = fin_path result = preprocessor(output_directory, filepath, all_files, header_include_dirs, stats, hip_clang_launch, is_pytorch_extension, clean_ctx, show_progress) - fin_path = os.path.abspath(os.path.join(output_directory, filepath)) # Show what happened if show_progress and "ignored" not in result["status"]: print( @@ -766,7 +769,6 @@ def pt_sparse_repl(m): # checks SPARSE map first, and if a miss occurs, falls back to pytorch mappings return PYTORCH_SPARSE_MAP.get(m.group(0), pt_repl(m)) - if is_pytorch_extension: output_source = RE_PYTORCH_PREPROCESSOR.sub(pt_repl, output_source) else: @@ -820,6 +822,7 @@ def repl(m): return m.group(0) # Hipify header file first if needed if header_filepath not in HIPIFY_FINAL_RESULT: + print(f'recursing on {header_filepath}') preprocess_file_and_save_result(output_directory, header_filepath, all_files, header_include_dirs, stats, hip_clang_launch,