From 07cca5b6bb83070d93d6fa870818899ccfc60d6f Mon Sep 17 00:00:00 2001 From: Evgeny Mankov Date: Fri, 1 Nov 2019 14:34:18 +0300 Subject: [PATCH] [HIPIFY][CUB][#1460][perl] Add "cub::" namespace prefix support in hipify-perl as well [ROCm/hip commit: c48fdefee8938793f230da3580e4570b0dcd10dd] --- projects/hip/bin/hipify-perl | 1 + projects/hip/hipify-clang/src/CUDA2HIP_Perl.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/hip/bin/hipify-perl b/projects/hip/bin/hipify-perl index 64a9e1dd5b..7b286d638d 100755 --- a/projects/hip/bin/hipify-perl +++ b/projects/hip/bin/hipify-perl @@ -1680,6 +1680,7 @@ sub transformKernelLaunch { sub transformCubNamespace { my $k = 0; $k += s/using\s*namespace\s*cub/using namespace hipcub/g; + $k += s/\bcub::\b/hipcub::/g; return $k; } diff --git a/projects/hip/hipify-clang/src/CUDA2HIP_Perl.cpp b/projects/hip/hipify-clang/src/CUDA2HIP_Perl.cpp index 8d59089d4f..cd5c952145 100644 --- a/projects/hip/hipify-clang/src/CUDA2HIP_Perl.cpp +++ b/projects/hip/hipify-clang/src/CUDA2HIP_Perl.cpp @@ -253,7 +253,8 @@ namespace perl { void generateCubNamespace(unique_ptr& streamPtr) { *streamPtr.get() << endl << sub << "transformCubNamespace" << " {" << endl_tab << my_k << endl; - *streamPtr.get() << tab << "$k += s/using\\s*namespace\\s*cub/using namespace hipcub/g;" << endl << tab << return_k << "}" << endl; + *streamPtr.get() << tab << "$k += s/using\\s*namespace\\s*cub/using namespace hipcub/g;" << endl; + *streamPtr.get() << tab << "$k += s/\\bcub::\\b/hipcub::/g;" << endl << tab << return_k << "}" << endl; } void generateHostFunctions(unique_ptr& streamPtr) {