From af7455bd64a15fcdb3969766139af93d9a8a0077 Mon Sep 17 00:00:00 2001 From: Evgeny Mankov Date: Tue, 14 Feb 2017 16:28:05 +0300 Subject: [PATCH] [HIPIFY] Narrow cudaKernelCallExpr matcher. [Explanation] Narrow cudaKernelCallExpr matcher to isExpansionInMainFile() - to the file being actually converted (without system includes). But as for Thrust, there are *.inl files, which are nevertheless being expanded in main file. These files contain cuda kernel launches, which are not converted successfully by hipify, for instance: thrust/system/cuda/detail/detail/launch_closure.inl:98:23. [ToDo] File a bug on cudaKernelCallExpr matcher for conversion error (thrust\examples\cuda\). [ROCm/hip commit: d1cfcf55f19e919176b108b3c98d53bd29d7205f] --- projects/hip/hipify-clang/src/Cuda2Hip.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/hip/hipify-clang/src/Cuda2Hip.cpp b/projects/hip/hipify-clang/src/Cuda2Hip.cpp index cf9eae51b7..ec6a2dacff 100644 --- a/projects/hip/hipify-clang/src/Cuda2Hip.cpp +++ b/projects/hip/hipify-clang/src/Cuda2Hip.cpp @@ -2494,7 +2494,7 @@ void addAllMatchers(ast_matchers::MatchFinder &Finder, Cuda2HipCallback *Callbac callee(functionDecl(matchesName("cu.*")))) .bind("cudaCall"), Callback); - Finder.addMatcher(cudaKernelCallExpr().bind("cudaLaunchKernel"), Callback); + Finder.addMatcher(cudaKernelCallExpr(isExpansionInMainFile()).bind("cudaLaunchKernel"), Callback); Finder.addMatcher(memberExpr(isExpansionInMainFile(), hasObjectExpression(hasType(cxxRecordDecl( matchesName("__cuda_builtin_")))))