-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[clang] Simplify device kernel attributes #137882
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
080a9d4
0c75247
1036640
47ae76a
421950d
66a7e1a
eeb377d
924839b
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 |
---|---|---|
|
@@ -3540,7 +3540,7 @@ bool FunctionDecl::isExternC() const { | |
} | ||
|
||
bool FunctionDecl::isInExternCContext() const { | ||
if (hasAttr<OpenCLKernelAttr>()) | ||
if (hasAttr<DeviceKernelAttr>() && getASTContext().getLangOpts().OpenCL) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this really the same thing? Do we prevent enabling multiple kernel-defining languages at the same time? Should this instead check spelling? |
||
return true; | ||
return getLexicalDeclContext()->isExternCContext(); | ||
} | ||
|
@@ -5511,7 +5511,7 @@ FunctionDecl *FunctionDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { | |
} | ||
|
||
bool FunctionDecl::isReferenceableKernel() const { | ||
return hasAttr<CUDAGlobalAttr>() || hasAttr<OpenCLKernelAttr>(); | ||
return hasAttr<CUDAGlobalAttr>() || hasAttr<DeviceKernelAttr>(); | ||
} | ||
|
||
BlockDecl *BlockDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1556,7 +1556,8 @@ void CXXNameMangler::mangleUnqualifiedName( | |
FD && FD->hasAttr<CUDAGlobalAttr>() && | ||
GD.getKernelReferenceKind() == KernelReferenceKind::Stub; | ||
bool IsOCLDeviceStub = | ||
FD && FD->hasAttr<OpenCLKernelAttr>() && | ||
getASTContext().getLangOpts().OpenCL && FD && | ||
FD->hasAttr<DeviceKernelAttr>() && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question here. |
||
GD.getKernelReferenceKind() == KernelReferenceKind::Stub; | ||
if (IsDeviceStub) | ||
mangleDeviceStubName(II); | ||
|
@@ -3529,10 +3530,9 @@ StringRef CXXNameMangler::getCallingConvQualifierName(CallingConv CC) { | |
case CC_AAPCS_VFP: | ||
case CC_AArch64VectorCall: | ||
case CC_AArch64SVEPCS: | ||
case CC_AMDGPUKernelCall: | ||
case CC_IntelOclBicc: | ||
case CC_SpirFunction: | ||
case CC_OpenCLKernel: | ||
case CC_DeviceKernel: | ||
case CC_PreserveMost: | ||
case CC_PreserveAll: | ||
case CC_M68kRTD: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1164,7 +1164,8 @@ void MicrosoftCXXNameMangler::mangleUnqualifiedName(GlobalDecl GD, | |
->hasAttr<CUDAGlobalAttr>())) && | ||
GD.getKernelReferenceKind() == KernelReferenceKind::Stub; | ||
bool IsOCLDeviceStub = | ||
ND && isa<FunctionDecl>(ND) && ND->hasAttr<OpenCLKernelAttr>() && | ||
getASTContext().getLangOpts().OpenCL && ND && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here :) |
||
isa<FunctionDecl>(ND) && ND->hasAttr<DeviceKernelAttr>() && | ||
GD.getKernelReferenceKind() == KernelReferenceKind::Stub; | ||
if (IsDeviceStub) | ||
mangleSourceName( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect we'll need to update the documentation because it's now going to list all of the various kernel attributes under SYCL kernel docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, will do, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made an attempt in the latest commit I just pushed here. SYCL was the only documented one previously and I didn't want to be stucking having to document all the others, so hopefully the way I did it makes sense.