-
Notifications
You must be signed in to change notification settings - Fork 1
[SYCL-Upstreaming] Add support for host kernel launch stmt generation #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
9240a18
e0bb6e9
ad0065b
145e850
9c91fce
07967ea
520a4e6
319caa5
2c89c01
aa02c24
c3d3035
cb314fe
76d904b
6f2541b
db002bb
345e7b7
2c155ef
6d7e4c1
7e3a0bf
b48996e
1193734
c83509b
cb21a34
07402a9
1b2d1dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15754,7 +15754,6 @@ Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D, | |
if (!Bases.empty()) | ||
OpenMP().ActOnFinishedFunctionDefinitionInOpenMPDeclareVariantScope(Dcl, | ||
Bases); | ||
|
||
return Dcl; | ||
} | ||
|
||
|
@@ -16167,6 +16166,20 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D, | |
|
||
maybeAddDeclWithEffects(FD); | ||
|
||
if (FD && !FD->isInvalidDecl() && | ||
FD->hasAttr<SYCLKernelEntryPointAttr>() && FnBodyScope) { | ||
// Building KernelLaunchStmt requires performing an unqualified lookup which | ||
// can only be done correctly while the stack of parsing scopes is alive, so | ||
// we do it here when we start parsing function body even if it is a | ||
// templated function. | ||
const auto *SKEPAttr = FD->getAttr<SYCLKernelEntryPointAttr>(); | ||
if (!SKEPAttr->isInvalidAttr()) { | ||
CompoundStmt *LaunchStmt = | ||
SYCL().BuildSYCLKernelLaunchStmt(FD, SKEPAttr->getKernelName()); | ||
getCurFunction()->SYCLKernelLaunchStmt = LaunchStmt; | ||
} | ||
} | ||
|
||
return D; | ||
} | ||
|
||
|
@@ -16368,9 +16381,14 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body, bool IsInstantiation, | |
SKEPAttr->setInvalidAttr(); | ||
} | ||
|
||
if (Body && !FD->isTemplated() && !SKEPAttr->isInvalidAttr()) { | ||
StmtResult SR = | ||
SYCL().BuildSYCLKernelCallStmt(FD, cast<CompoundStmt>(Body)); | ||
auto *BodyCompound = dyn_cast_or_null<CompoundStmt>(Body); | ||
// If Body is not a compound, that was a templated function and we don't | ||
// need to build SYCLKernelCallStmt for it since it was already created by | ||
// template instantiator. | ||
|
||
if (BodyCompound && !SKEPAttr->isInvalidAttr()) { | ||
StmtResult SR = SYCL().BuildSYCLKernelCallStmt( | ||
FD->isTemplated() ? nullptr : FD, BodyCompound, | ||
getCurFunction()->SYCLKernelLaunchStmt); | ||
if (SR.isInvalid()) | ||
return nullptr; | ||
Body = SR.get(); | ||
|
Uh oh!
There was an error while loading. Please reload this page.