From 8e860dd1f39ea15bcbdb2f70eb5af9107b3f8aec Mon Sep 17 00:00:00 2001 From: Evgeny Mankov Date: Wed, 20 Dec 2023 17:27:21 +0000 Subject: [PATCH] Merge pull request #1221 from emankov/HIPIFY [HIPIFY][SWDEV-438050][6.0][fix] Use new location of some ROCm libs header files Change-Id: I507730be59c40396a28c5d232d8320d3408b76b8 --- bin/hipify-perl | 36 +++++++++---------- src/CUDA2HIP.cpp | 36 +++++++++---------- src/HipifyAction.cpp | 4 +-- tests/unit_tests/headers/headers_test_09.cu | 13 ++++--- .../headers/headers_test_09_12000.cu | 13 ++++--- tests/unit_tests/libraries/CUB/cub_01.cu | 2 +- tests/unit_tests/libraries/CUB/cub_02.cu | 2 +- .../libraries/cuFFT/simple_cufft.cu | 2 +- .../cuRAND/benchmark_curand_generate.cpp | 2 +- .../cuRAND/benchmark_curand_kernel.cpp | 6 ++-- .../libraries/cuRAND/poisson_api_example.cu | 4 +-- 11 files changed, 63 insertions(+), 57 deletions(-) diff --git a/bin/hipify-perl b/bin/hipify-perl index 21217aae..54260313 100755 --- a/bin/hipify-perl +++ b/bin/hipify-perl @@ -4099,23 +4099,23 @@ sub simpleSubstitutions { subst("cuda_profiler_api.h", "hip\/hip_runtime_api.h", "include"); subst("cuda_runtime_api.h", "hip\/hip_runtime_api.h", "include"); subst("cuda_texture_types.h", "hip\/hip_texture_types.h", "include"); - subst("cufftXt.h", "hipfftXt.h", "include"); - subst("curand_discrete.h", "hiprand_kernel.h", "include"); - subst("curand_discrete2.h", "hiprand_kernel.h", "include"); - subst("curand_globals.h", "hiprand_kernel.h", "include"); - subst("curand_kernel.h", "hiprand_kernel.h", "include"); - subst("curand_lognormal.h", "hiprand_kernel.h", "include"); - subst("curand_mrg32k3a.h", "hiprand_kernel.h", "include"); - subst("curand_mtgp32.h", "hiprand_kernel.h", "include"); - subst("curand_mtgp32_host.h", "hiprand_mtgp32_host.h", "include"); - subst("curand_mtgp32_kernel.h", "hiprand_kernel.h", "include"); + subst("cufftXt.h", "hipfft\/hipfftXt.h", "include"); + subst("curand_discrete.h", "hiprand\/hiprand_kernel.h", "include"); + subst("curand_discrete2.h", "hiprand\/hiprand_kernel.h", "include"); + subst("curand_globals.h", "hiprand\/hiprand_kernel.h", "include"); + subst("curand_kernel.h", "hiprand\/hiprand_kernel.h", "include"); + subst("curand_lognormal.h", "hiprand\/hiprand_kernel.h", "include"); + subst("curand_mrg32k3a.h", "hiprand\/hiprand_kernel.h", "include"); + subst("curand_mtgp32.h", "hiprand\/hiprand_kernel.h", "include"); + subst("curand_mtgp32_host.h", "hiprand\/hiprand_mtgp32_host.h", "include"); + subst("curand_mtgp32_kernel.h", "hiprand\/hiprand_kernel.h", "include"); subst("curand_mtgp32dc_p_11213.h", "rocrand_mtgp32_11213.h", "include"); - subst("curand_normal.h", "hiprand_kernel.h", "include"); - subst("curand_normal_static.h", "hiprand_kernel.h", "include"); - subst("curand_philox4x32_x.h", "hiprand_kernel.h", "include"); - subst("curand_poisson.h", "hiprand_kernel.h", "include"); - subst("curand_precalc.h", "hiprand_kernel.h", "include"); - subst("curand_uniform.h", "hiprand_kernel.h", "include"); + subst("curand_normal.h", "hiprand\/hiprand_kernel.h", "include"); + subst("curand_normal_static.h", "hiprand\/hiprand_kernel.h", "include"); + subst("curand_philox4x32_x.h", "hiprand\/hiprand_kernel.h", "include"); + subst("curand_poisson.h", "hiprand\/hiprand_kernel.h", "include"); + subst("curand_precalc.h", "hiprand\/hiprand_kernel.h", "include"); + subst("curand_uniform.h", "hiprand\/hiprand_kernel.h", "include"); subst("device_functions.h", "hip\/device_functions.h", "include"); subst("driver_types.h", "hip\/driver_types.h", "include"); subst("library_types.h", "hip\/library_types.h", "include"); @@ -4127,8 +4127,8 @@ sub simpleSubstitutions { subst("cuda.h", "hip\/hip_runtime.h", "include_cuda_main_header"); subst("cuda_runtime.h", "hip\/hip_runtime.h", "include_cuda_main_header"); subst("cudnn.h", "hipDNN.h", "include_cuda_main_header"); - subst("cufft.h", "hipfft.h", "include_cuda_main_header"); - subst("curand.h", "hiprand.h", "include_cuda_main_header"); + subst("cufft.h", "hipfft\/hipfft.h", "include_cuda_main_header"); + subst("curand.h", "hiprand\/hiprand.h", "include_cuda_main_header"); subst("cusparse.h", "hipsparse.h", "include_cuda_main_header"); subst("nvrtc.h", "hiprtc.h", "include_cuda_main_header"); subst("cublas_v2.h", "hipblas.h", "include_cuda_main_header_v2"); diff --git a/src/CUDA2HIP.cpp b/src/CUDA2HIP.cpp index bbfb3085..d8dc1e21 100644 --- a/src/CUDA2HIP.cpp +++ b/src/CUDA2HIP.cpp @@ -45,28 +45,28 @@ const std::map CUDA_INCLUDE_MAP { {"cublas_v2.h", {"hipblas.h", "rocblas.h", CONV_INCLUDE_CUDA_MAIN_V2_H, API_BLAS, 0}}, {"cublas_api.h", {"hipblas.h", "rocblas.h", CONV_INCLUDE, API_BLAS, 0}}, // cuRAND includes - {"curand.h", {"hiprand.h", "", CONV_INCLUDE_CUDA_MAIN_H, API_RAND, 0}}, - {"curand_kernel.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, - {"curand_discrete.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, - {"curand_discrete2.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, - {"curand_globals.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, - {"curand_lognormal.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, - {"curand_mrg32k3a.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, - {"curand_mtgp32.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, - {"curand_mtgp32_host.h", {"hiprand_mtgp32_host.h", "", CONV_INCLUDE, API_RAND, 0}}, - {"curand_mtgp32_kernel.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, + {"curand.h", {"hiprand/hiprand.h", "", CONV_INCLUDE_CUDA_MAIN_H, API_RAND, 0}}, + {"curand_kernel.h", {"hiprand/hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, + {"curand_discrete.h", {"hiprand/hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, + {"curand_discrete2.h", {"hiprand/hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, + {"curand_globals.h", {"hiprand/hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, + {"curand_lognormal.h", {"hiprand/hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, + {"curand_mrg32k3a.h", {"hiprand/hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, + {"curand_mtgp32.h", {"hiprand/hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, + {"curand_mtgp32_host.h", {"hiprand/hiprand_mtgp32_host.h", "", CONV_INCLUDE, API_RAND, 0}}, + {"curand_mtgp32_kernel.h", {"hiprand/hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, {"curand_mtgp32dc_p_11213.h", {"rocrand_mtgp32_11213.h", "", CONV_INCLUDE, API_RAND, 0}}, - {"curand_normal.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, - {"curand_normal_static.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, - {"curand_philox4x32_x.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, - {"curand_poisson.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, - {"curand_precalc.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, - {"curand_uniform.h", {"hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, + {"curand_normal.h", {"hiprand/hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, + {"curand_normal_static.h", {"hiprand/hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, + {"curand_philox4x32_x.h", {"hiprand/hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, + {"curand_poisson.h", {"hiprand/hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, + {"curand_precalc.h", {"hiprand/hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, + {"curand_uniform.h", {"hiprand/hiprand_kernel.h", "", CONV_INCLUDE, API_RAND, 0}}, // cuDNN includes {"cudnn.h", {"hipDNN.h", "miopen/miopen.h", CONV_INCLUDE_CUDA_MAIN_H, API_DNN, 0}}, // cuFFT includes - {"cufft.h", {"hipfft.h", "", CONV_INCLUDE_CUDA_MAIN_H, API_FFT, 0}}, - {"cufftXt.h", {"hipfftXt.h", "", CONV_INCLUDE, API_FFT, 0}}, + {"cufft.h", {"hipfft/hipfft.h", "", CONV_INCLUDE_CUDA_MAIN_H, API_FFT, 0}}, + {"cufftXt.h", {"hipfft/hipfftXt.h", "", CONV_INCLUDE, API_FFT, 0}}, // cuSPARSE includes {"cusparse.h", {"hipsparse.h", "rocsparse.h", CONV_INCLUDE_CUDA_MAIN_H, API_SPARSE, 0}}, {"cusparse_v2.h", {"hipsparse.h", "rocsparse.h", CONV_INCLUDE_CUDA_MAIN_V2_H, API_SPARSE, 0}}, diff --git a/src/HipifyAction.cpp b/src/HipifyAction.cpp index 2681c60a..75aecb6e 100644 --- a/src/HipifyAction.cpp +++ b/src/HipifyAction.cpp @@ -48,8 +48,8 @@ std::string s_int32_t = "int32_t"; std::string s_int64_t = "int64_t"; const std::string sHipLaunchKernelGGL = "hipLaunchKernelGGL"; const std::string sDim3 = "dim3("; -const std::string s_hiprand_kernel_h = "hiprand_kernel.h"; -const std::string s_hiprand_h = "hiprand.h"; +const std::string s_hiprand_kernel_h = "hiprand/hiprand_kernel.h"; +const std::string s_hiprand_h = "hiprand/hiprand.h"; const std::string sOnce = "once"; const std::string s_string_literal = "[string literal]"; // CUDA identifiers, used in matchers diff --git a/tests/unit_tests/headers/headers_test_09.cu b/tests/unit_tests/headers/headers_test_09.cu index 067fe179..078645e2 100644 --- a/tests/unit_tests/headers/headers_test_09.cu +++ b/tests/unit_tests/headers/headers_test_09.cu @@ -23,13 +23,13 @@ // CHECK: #include -// CHECK: #include "hiprand.h" -// CHECK: #include "hiprand_kernel.h" +// CHECK: #include "hiprand/hiprand.h" +// CHECK: #include "hiprand/hiprand_kernel.h" // CHECK: #include -// CHECK-NOT: #include "hiprand.h" -// CHECK-NOT: #include "hiprand_kernel.h" +// CHECK-NOT: #include "hiprand/hiprand.h" +// CHECK-NOT: #include "hiprand/hiprand_kernel.h" // CHECK-NOT: #include "curand_discrete.h" // CHECK-NOT: #include "curand_discrete2.h" // CHECK-NOT: #include "curand_globals.h" @@ -46,9 +46,12 @@ // CHECK-NOT: #include "curand_precalc.h" // CHECK-NOT: #include "curand_uniform.h" +// CHECK: #include "hiprand/hiprand_mtgp32_host.h" +// CHECK: #include "rocrand_mtgp32_11213.h" + // CHECK: #include -// CHECK: #include "hipfft.h" +// CHECK: #include "hipfft/hipfft.h" // CHECK: #include "hipsparse.h" #include diff --git a/tests/unit_tests/headers/headers_test_09_12000.cu b/tests/unit_tests/headers/headers_test_09_12000.cu index fbef60c9..823b8346 100644 --- a/tests/unit_tests/headers/headers_test_09_12000.cu +++ b/tests/unit_tests/headers/headers_test_09_12000.cu @@ -22,13 +22,13 @@ // CHECK: #include -// CHECK: #include "hiprand.h" -// CHECK: #include "hiprand_kernel.h" +// CHECK: #include "hiprand/hiprand.h" +// CHECK: #include "hiprand/hiprand_kernel.h" // CHECK: #include -// CHECK-NOT: #include "hiprand.h" -// CHECK-NOT: #include "hiprand_kernel.h" +// CHECK-NOT: #include "hiprand/hiprand.h" +// CHECK-NOT: #include "hiprand/hiprand_kernel.h" // CHECK-NOT: #include "curand_discrete.h" // CHECK-NOT: #include "curand_discrete2.h" // CHECK-NOT: #include "curand_globals.h" @@ -45,9 +45,12 @@ // CHECK-NOT: #include "curand_precalc.h" // CHECK-NOT: #include "curand_uniform.h" +// CHECK: #include "hiprand/hiprand_mtgp32_host.h" +// CHECK: #include "rocrand_mtgp32_11213.h" + // CHECK: #include -// CHECK: #include "hipfft.h" +// CHECK: #include "hipfft/hipfft.h" // CHECK: #include "hipsparse.h" #include diff --git a/tests/unit_tests/libraries/CUB/cub_01.cu b/tests/unit_tests/libraries/CUB/cub_01.cu index 7c211bbb..432b1b85 100644 --- a/tests/unit_tests/libraries/CUB/cub_01.cu +++ b/tests/unit_tests/libraries/CUB/cub_01.cu @@ -1,7 +1,7 @@ // RUN: %run_test hipify "%s" "%t" %hipify_args 1 --hip-kernel-execution-syntax %clang_args // CHECK: #include #include -// CHECK: #include +// CHECK: #include #include #define THRUST_NS_QUALIFIER ::thrust // CHECK: #include diff --git a/tests/unit_tests/libraries/CUB/cub_02.cu b/tests/unit_tests/libraries/CUB/cub_02.cu index f78e35dd..782e3e73 100644 --- a/tests/unit_tests/libraries/CUB/cub_02.cu +++ b/tests/unit_tests/libraries/CUB/cub_02.cu @@ -1,7 +1,7 @@ // RUN: %run_test hipify "%s" "%t" %hipify_args 1 --hip-kernel-execution-syntax %clang_args // CHECK: #include #include -// CHECK: #include +// CHECK: #include #include #define THRUST_NS_QUALIFIER ::thrust // CHECK: #include diff --git a/tests/unit_tests/libraries/cuFFT/simple_cufft.cu b/tests/unit_tests/libraries/cuFFT/simple_cufft.cu index 9c05a53f..2dbbef4b 100644 --- a/tests/unit_tests/libraries/cuFFT/simple_cufft.cu +++ b/tests/unit_tests/libraries/cuFFT/simple_cufft.cu @@ -2,7 +2,7 @@ // CHECK: #include #include -// CHECK: #include +// CHECK: #include #include #include #include diff --git a/tests/unit_tests/libraries/cuRAND/benchmark_curand_generate.cpp b/tests/unit_tests/libraries/cuRAND/benchmark_curand_generate.cpp index efdecf96..4bf77d11 100644 --- a/tests/unit_tests/libraries/cuRAND/benchmark_curand_generate.cpp +++ b/tests/unit_tests/libraries/cuRAND/benchmark_curand_generate.cpp @@ -32,7 +32,7 @@ #include "cmdparser.hpp" // CHECK: #include #include -// CHECK: #include +// CHECK: #include #include // CHECK: if ((x) != hipSuccess) { diff --git a/tests/unit_tests/libraries/cuRAND/benchmark_curand_kernel.cpp b/tests/unit_tests/libraries/cuRAND/benchmark_curand_kernel.cpp index 9c5b5517..6eb492d0 100644 --- a/tests/unit_tests/libraries/cuRAND/benchmark_curand_kernel.cpp +++ b/tests/unit_tests/libraries/cuRAND/benchmark_curand_kernel.cpp @@ -33,11 +33,11 @@ #include "cmdparser.hpp" // CHECK: #include #include -// CHECK: #include +// CHECK: #include #include -// CHECK: #include +// CHECK: #include #include -// CHECK: #include +// CHECK: #include #include // CHECK: #include #include diff --git a/tests/unit_tests/libraries/cuRAND/poisson_api_example.cu b/tests/unit_tests/libraries/cuRAND/poisson_api_example.cu index 9ad8e820..08bb2921 100644 --- a/tests/unit_tests/libraries/cuRAND/poisson_api_example.cu +++ b/tests/unit_tests/libraries/cuRAND/poisson_api_example.cu @@ -19,9 +19,9 @@ #include // CHECK: #include #include -// CHECK: #include +// CHECK: #include #include -// CHECK: #include +// CHECK: #include #include // CHECK: #define CUDA_CALL(x) do { if((x) != hipSuccess) {