Skip to content

Commit

Permalink
Merge pull request #1221 from emankov/HIPIFY
Browse files Browse the repository at this point in the history
[HIPIFY][SWDEV-438050][6.0][fix] Use new location of some ROCm libs header files

Change-Id: I507730be59c40396a28c5d232d8320d3408b76b8
  • Loading branch information
emankov authored and searlmc1 committed Dec 21, 2023
1 parent 528b655 commit 8e860dd
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 57 deletions.
36 changes: 18 additions & 18 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand Down
36 changes: 18 additions & 18 deletions src/CUDA2HIP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,28 @@ const std::map <llvm::StringRef, hipCounter> 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}},
Expand Down
4 changes: 2 additions & 2 deletions src/HipifyAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions tests/unit_tests/headers/headers_test_09.cu
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@

// CHECK: #include <stdio.h>

// CHECK: #include "hiprand.h"
// CHECK: #include "hiprand_kernel.h"
// CHECK: #include "hiprand/hiprand.h"
// CHECK: #include "hiprand/hiprand_kernel.h"

// CHECK: #include <algorithm>

// 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"
Expand All @@ -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 <string>

// CHECK: #include "hipfft.h"
// CHECK: #include "hipfft/hipfft.h"
// CHECK: #include "hipsparse.h"

#include <cuda.h>
Expand Down
13 changes: 8 additions & 5 deletions tests/unit_tests/headers/headers_test_09_12000.cu
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@

// CHECK: #include <stdio.h>

// CHECK: #include "hiprand.h"
// CHECK: #include "hiprand_kernel.h"
// CHECK: #include "hiprand/hiprand.h"
// CHECK: #include "hiprand/hiprand_kernel.h"

// CHECK: #include <algorithm>

// 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"
Expand All @@ -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 <string>

// CHECK: #include "hipfft.h"
// CHECK: #include "hipfft/hipfft.h"
// CHECK: #include "hipsparse.h"

#include <cuda.h>
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/libraries/CUB/cub_01.cu
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: %run_test hipify "%s" "%t" %hipify_args 1 --hip-kernel-execution-syntax %clang_args
// CHECK: #include <hip/hip_runtime.h>
#include <iostream>
// CHECK: #include <hiprand.h>
// CHECK: #include <hiprand/hiprand.h>
#include <curand.h>
#define THRUST_NS_QUALIFIER ::thrust
// CHECK: #include <hipcub/hipcub.hpp>
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/libraries/CUB/cub_02.cu
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: %run_test hipify "%s" "%t" %hipify_args 1 --hip-kernel-execution-syntax %clang_args
// CHECK: #include <hip/hip_runtime.h>
#include <iostream>
// CHECK: #include <hiprand.h>
// CHECK: #include <hiprand/hiprand.h>
#include <curand.h>
#define THRUST_NS_QUALIFIER ::thrust
// CHECK: #include <hipcub/hipcub.hpp>
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/libraries/cuFFT/simple_cufft.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// CHECK: #include <hip/hip_runtime.h>
#include <cuda.h>
// CHECK: #include <hipfft.h>
// CHECK: #include <hipfft/hipfft.h>
#include <cufft.h>
#include <stdio.h>
#include <math.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "cmdparser.hpp"
// CHECK: #include <hip/hip_runtime.h>
#include <cuda_runtime.h>
// CHECK: #include <hiprand.h>
// CHECK: #include <hiprand/hiprand.h>
#include <curand.h>

// CHECK: if ((x) != hipSuccess) {
Expand Down
6 changes: 3 additions & 3 deletions tests/unit_tests/libraries/cuRAND/benchmark_curand_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
#include "cmdparser.hpp"
// CHECK: #include <hip/hip_runtime.h>
#include <cuda_runtime.h>
// CHECK: #include <hiprand.h>
// CHECK: #include <hiprand/hiprand.h>
#include <curand.h>
// CHECK: #include <hiprand_kernel.h>
// CHECK: #include <hiprand/hiprand_kernel.h>
#include <curand_kernel.h>
// CHECK: #include <hiprand_mtgp32_host.h>
// CHECK: #include <hiprand/hiprand_mtgp32_host.h>
#include <curand_mtgp32_host.h>
// CHECK: #include <rocrand_mtgp32_11213.h>
#include <curand_mtgp32dc_p_11213.h>
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/libraries/cuRAND/poisson_api_example.cu
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#include <stdlib.h>
// CHECK: #include <hip/hip_runtime.h>
#include <cuda.h>
// CHECK: #include <hiprand_kernel.h>
// CHECK: #include <hiprand/hiprand_kernel.h>
#include <curand_kernel.h>
// CHECK: #include <hiprand.h>
// CHECK: #include <hiprand/hiprand.h>
#include <curand.h>

// CHECK: #define CUDA_CALL(x) do { if((x) != hipSuccess) {
Expand Down

0 comments on commit 8e860dd

Please sign in to comment.