Skip to content

Commit 0e13ee9

Browse files
committed
Mark auto-generated kernel with work-group metadata.
1 parent 3530e1d commit 0e13ee9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ static CXXMethodDecl *getMethodByName(const CXXRecordDecl *CRD,
980980
}
981981

982982
static KernelInvocationKind
983-
getKernelInvocationKind(FunctionDecl *KernelCallerFunc) {
983+
getKernelInvocationKind(const FunctionDecl *KernelCallerFunc) {
984984
return llvm::StringSwitch<KernelInvocationKind>(KernelCallerFunc->getName())
985985
.Case("kernel_single_task", InvokeSingleTask)
986986
.Case("kernel_parallel_for", InvokeParallelFor)
@@ -2853,6 +2853,10 @@ class SyclKernelBodyCreator : public SyclKernelFieldHandler {
28532853
CollectionInitExprs.push_back(createInitListExpr(KernelObj));
28542854
markParallelWorkItemCalls();
28552855

2856+
if (getKernelInvocationKind(KernelCallerFunc) == InvokeParallelForWorkGroup)
2857+
DC.getKernelDecl()->addAttr(SYCLScopeAttr::CreateImplicit(
2858+
S.Context, SYCLScopeAttr::Level::WorkGroup));
2859+
28562860
Stmt *DS = new (S.Context) DeclStmt(DeclGroupRef(KernelObjClone),
28572861
KernelCallerSrcLoc, KernelCallerSrcLoc);
28582862
BodyStmts.push_back(DS);

0 commit comments

Comments
 (0)