Skip to content

Commit 25b9dc7

Browse files
authored
[SYCLomatic] Fix migration of cv-qualified cg::thread_block in function parameter (#553)
Signed-off-by: Cai, Justin <[email protected]>
1 parent 2b5ed9b commit 25b9dc7

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

clang/lib/DPCT/ASTTraversal.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2674,7 +2674,8 @@ void TypeInDeclRule::runRule(const MatchFinder::MatchResult &Result) {
26742674
}
26752675

26762676
std::string CanonicalTypeStr =
2677-
DpctGlobalInfo::getTypeName(TL->getType().getCanonicalType());
2677+
DpctGlobalInfo::getUnqualifiedTypeName(
2678+
TL->getType().getCanonicalType());
26782679
StringRef CanonicalTypeStrRef(CanonicalTypeStr);
26792680
if (CanonicalTypeStrRef.startswith(
26802681
"cooperative_groups::__v1::thread_block_tile<")) {
@@ -2702,8 +2703,7 @@ void TypeInDeclRule::runRule(const MatchFinder::MatchResult &Result) {
27022703
}
27032704
}
27042705

2705-
if (DpctGlobalInfo::getTypeName(TL->getType().getCanonicalType()) ==
2706-
"cooperative_groups::__v1::thread_block") {
2706+
if (CanonicalTypeStr == "cooperative_groups::__v1::thread_block") {
27072707
// Skip migrate the type in function body.
27082708
if (DpctGlobalInfo::findAncestor<clang::CompoundStmt>(TL) &&
27092709
DpctGlobalInfo::findAncestor<clang::FunctionDecl>(TL))

clang/test/dpct/sync_api.cu

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,8 @@ int foo3() {
200200
foo2<<<1,1>>>();
201201
return 0;
202202
}
203+
204+
// CHECK: void foo4(const sycl::group<3> &crtb,
205+
// CHECK-NEXT: const sycl::group<3> *cptb);
206+
__device__ void foo4(const cg::thread_block &crtb,
207+
const cg::thread_block *cptb);

0 commit comments

Comments
 (0)