diff --git a/hipify-clang/src/CUDA2HIP_Perl.cpp b/hipify-clang/src/CUDA2HIP_Perl.cpp index cc1a88aa9d..8f1d8b83e9 100644 --- a/hipify-clang/src/CUDA2HIP_Perl.cpp +++ b/hipify-clang/src/CUDA2HIP_Perl.cpp @@ -48,32 +48,24 @@ namespace perl { void generateSymbolFunctions(std::unique_ptr& perlStreamPtr) { *perlStreamPtr.get() << "\n" << sSub << " transformSymbolFunctions\n" << "{\n" << space << sMy; std::string sCommon = space + sForeach; - *perlStreamPtr.get() << sCommon; - unsigned int count = 0; - for (auto& dsf : DeviceSymbolFunctions0) { - const auto found = CUDA_RENAMES_MAP().find(dsf); - if (found != CUDA_RENAMES_MAP().end()) { - *perlStreamPtr.get() << (count ? ",\n" : "") << double_space << "\"" << found->second.hipName.str() << "\""; - count++; + std::set &funcSet = DeviceSymbolFunctions0; + for (int i = 0; i < 2; ++i) { + *perlStreamPtr.get() << sCommon; + if (i == 1) funcSet = DeviceSymbolFunctions1; + unsigned int count = 0; + for (auto& f : funcSet) { + const auto found = CUDA_RUNTIME_FUNCTION_MAP.find(f); + if (found != CUDA_RUNTIME_FUNCTION_MAP.end()) { + *perlStreamPtr.get() << (count ? ",\n" : "") << double_space << "\"" << found->second.hipName.str() << "\""; + count++; + } } + *perlStreamPtr.get() << "\n" << space << ")\n"; + *perlStreamPtr.get() << space << "{\n" << double_space; + if (i ==0) *perlStreamPtr.get() << "$m += s/(?second.hipName.str() << "\""; - count++; - } - } - *perlStreamPtr.get() << "\n" << space << ")\n"; - *perlStreamPtr.get() << space << "{\n"; - *perlStreamPtr.get() << double_space << "$m += s/(?