-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[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
Changes from 5 commits
080a9d4
0c75247
1036640
47ae76a
421950d
66a7e1a
eeb377d
924839b
168103d
99a118a
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 |
|---|---|---|
|
|
@@ -396,9 +396,12 @@ any option of a multiversioned function is undefined. | |
| }]; | ||
| } | ||
|
|
||
| def SYCLKernelDocs : Documentation { | ||
| def DeviceKernelDocs : Documentation { | ||
| let Category = DocCatFunction; | ||
| let Heading = "device_kernel"; | ||
|
||
| let Content = [{ | ||
| These attributes specify that the function represents a kernel for device offloading. | ||
| The specific semantics depend on the offloading language, target, and attribute spelling. | ||
| The ``sycl_kernel`` attribute specifies that a function template will be used | ||
| to outline device code and to generate an OpenCL kernel. | ||
| Here is a code example of the SYCL program, which demonstrates the compiler's | ||
|
|
||
| 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) | ||
|
||
| 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>() && | ||
|
||
| 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 && | ||
|
||
| isa<FunctionDecl>(ND) && ND->hasAttr<DeviceKernelAttr>() && | ||
| GD.getKernelReferenceKind() == KernelReferenceKind::Stub; | ||
| if (IsDeviceStub) | ||
| mangleSourceName( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.