From b4fb8cd83ce425c396573924bb2b38f368f6f3cc Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Tue, 12 Jan 2021 11:09:32 -0800 Subject: [PATCH 1/2] Make Intel attributes consistent with clang attributes. Clang allows attributes to be specified via a special pragma named `#pragma clang attribute` and many of the Intel-specified attributes were opting out of this support for no real reason. This changes allows Intel attributes to be specified via this pragma, similar to how almost all other Clang attributes are. --- clang/include/clang/Basic/Attr.td | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index c8687725406e9..ead6e7952b80c 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -1149,7 +1149,6 @@ def SYCLDevice : InheritableAttr { let Subjects = SubjectList<[Function]>; let LangOpts = [SYCLIsDevice]; let Documentation = [SYCLDeviceDocs]; - let PragmaAttributeSupport = 0; } def SYCLKernel : InheritableAttr { @@ -1167,7 +1166,6 @@ def SYCLSimd : InheritableAttr { let Subjects = SubjectList<[Function]>; let LangOpts = [SYCLExplicitSIMD]; let Documentation = [SYCLSimdDocs]; - let PragmaAttributeSupport = 0; } // Available in SYCL explicit SIMD extension. Binds a file scope private @@ -1180,7 +1178,6 @@ def SYCLRegisterNum : InheritableAttr { // for the host device as well let LangOpts = [SYCLExplicitSIMD]; let Documentation = [SYCLRegisterNumDocs]; - let PragmaAttributeSupport = 0; } // Used to mark ESIMD kernel pointer parameters originating from accessors. @@ -1190,7 +1187,6 @@ def SYCLSimdAccessorPtr : InheritableAttr { let Subjects = SubjectList<[ParmVar]>; let LangOpts = [SYCLExplicitSIMD]; let Documentation = [SYCLSimdAccessorPtrDocs]; - let PragmaAttributeSupport = 0; } def SYCLScope : Attr { @@ -1219,7 +1215,6 @@ def SYCLDeviceIndirectlyCallable : InheritableAttr { let Subjects = SubjectList<[Function]>; let LangOpts = [SYCLIsDevice]; let Documentation = [SYCLDeviceIndirectlyCallableDocs]; - let PragmaAttributeSupport = 0; } def SYCLIntelBufferLocation : InheritableAttr { @@ -1244,7 +1239,6 @@ def SYCLIntelKernelArgsRestrict : InheritableAttr { let LangOpts = [ SYCLIsDevice, SYCLIsHost ]; let Documentation = [ SYCLIntelKernelArgsRestrictDocs ]; let SimpleHandler = 1; - let PragmaAttributeSupport = 0; } def SYCLIntelNumSimdWorkItems : InheritableAttr { @@ -1254,7 +1248,6 @@ def SYCLIntelNumSimdWorkItems : InheritableAttr { let LangOpts = [SYCLIsDevice, SYCLIsHost]; let Subjects = SubjectList<[Function], ErrorDiag>; let Documentation = [SYCLIntelNumSimdWorkItemsAttrDocs]; - let PragmaAttributeSupport = 0; } def SYCLIntelUseStallEnableClusters : InheritableAttr { @@ -1267,7 +1260,6 @@ def SYCLIntelUseStallEnableClusters : InheritableAttr { } }]; let Documentation = [SYCLIntelUseStallEnableClustersAttrDocs]; - let PragmaAttributeSupport = 0; } def SYCLIntelSchedulerTargetFmaxMhz : InheritableAttr { @@ -1277,7 +1269,6 @@ def SYCLIntelSchedulerTargetFmaxMhz : InheritableAttr { let LangOpts = [SYCLIsDevice, SYCLIsHost]; let Subjects = SubjectList<[Function], ErrorDiag>; let Documentation = [SYCLIntelSchedulerTargetFmaxMhzAttrDocs]; - let PragmaAttributeSupport = 0; let AdditionalMembers = [{ static unsigned getMinValue() { return 0; @@ -1286,7 +1277,6 @@ def SYCLIntelSchedulerTargetFmaxMhz : InheritableAttr { return 1024*1024; } }]; - } def SYCLIntelMaxWorkGroupSize : InheritableAttr { @@ -1297,7 +1287,6 @@ def SYCLIntelMaxWorkGroupSize : InheritableAttr { ExprArgument<"ZDim">]; let LangOpts = [SYCLIsDevice, SYCLIsHost]; let Subjects = SubjectList<[Function], ErrorDiag>; - let PragmaAttributeSupport = 0; let AdditionalMembers = [{ ArrayRef dimensions() const { return {getXDim(), getYDim(), getZDim()}; @@ -1322,7 +1311,6 @@ def SYCLIntelMaxGlobalWorkDim : InheritableAttr { let LangOpts = [SYCLIsDevice, SYCLIsHost]; let Subjects = SubjectList<[Function], ErrorDiag>; let Documentation = [SYCLIntelMaxGlobalWorkDimAttrDocs]; - let PragmaAttributeSupport = 0; } def SYCLIntelNoGlobalWorkOffset : InheritableAttr { @@ -1332,7 +1320,6 @@ def SYCLIntelNoGlobalWorkOffset : InheritableAttr { let LangOpts = [SYCLIsDevice, SYCLIsHost]; let Subjects = SubjectList<[Function], ErrorDiag>; let Documentation = [SYCLIntelNoGlobalWorkOffsetAttrDocs]; - let PragmaAttributeSupport = 0; } def SYCLIntelLoopFuse : InheritableAttr { @@ -1413,7 +1400,6 @@ def IntelReqdSubGroupSize: InheritableAttr { let Subjects = SubjectList<[Function, CXXMethod], ErrorDiag>; let Documentation = [IntelReqdSubGroupSizeDocs]; let LangOpts = [OpenCL, SYCLIsDevice, SYCLIsHost]; - let PragmaAttributeSupport = 0; } // This attribute is both a type attribute, and a declaration attribute (for @@ -2133,7 +2119,6 @@ def SYCLIntelPipeIO : Attr { let LangOpts = [SYCLIsDevice, SYCLIsHost]; let Subjects = SubjectList<[Var]>; let Documentation = [SYCLIntelPipeIOAttrDocs]; - let PragmaAttributeSupport = 0; } // Variadic integral arguments. From 8eaf6f5e2707e96a4bafbff577a82e7534a88c5e Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Tue, 12 Jan 2021 12:42:43 -0800 Subject: [PATCH 2/2] Update the test file. --- .../pragma-attribute-supported-attributes-list.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/clang/test/Misc/pragma-attribute-supported-attributes-list.test b/clang/test/Misc/pragma-attribute-supported-attributes-list.test index dc139c1f7f4b5..1f1ce032cb23e 100644 --- a/clang/test/Misc/pragma-attribute-supported-attributes-list.test +++ b/clang/test/Misc/pragma-attribute-supported-attributes-list.test @@ -67,6 +67,7 @@ // CHECK-NEXT: IBAction (SubjectMatchRule_objc_method_is_instance) // CHECK-NEXT: IFunc (SubjectMatchRule_function) // CHECK-NEXT: InitPriority (SubjectMatchRule_variable) +// CHECK-NEXT: IntelReqdSubGroupSize (SubjectMatchRule_function, SubjectMatchRule_function_is_member) // CHECK-NEXT: InternalLinkage (SubjectMatchRule_variable, SubjectMatchRule_function, SubjectMatchRule_record) // CHECK-NEXT: LTOVisibilityPublic (SubjectMatchRule_record) // CHECK-NEXT: Leaf (SubjectMatchRule_function) @@ -145,7 +146,19 @@ // CHECK-NEXT: ReturnTypestate (SubjectMatchRule_function, SubjectMatchRule_variable_is_parameter) // CHECK-NEXT: ReturnsNonNull (SubjectMatchRule_objc_method, SubjectMatchRule_function) // CHECK-NEXT: ReturnsTwice (SubjectMatchRule_function) +// CHECK-NEXT: SYCLDevice (SubjectMatchRule_function) +// CHECK-NEXT: SYCLDeviceIndirectlyCallable (SubjectMatchRule_function) +// CHECK-NEXT: SYCLIntelKernelArgsRestrict (SubjectMatchRule_function) // CHECK-NEXT: SYCLIntelLoopFuse (SubjectMatchRule_function) +// CHECK-NEXT: SYCLIntelMaxGlobalWorkDim (SubjectMatchRule_function) +// CHECK-NEXT: SYCLIntelMaxWorkGroupSize (SubjectMatchRule_function) +// CHECK-NEXT: SYCLIntelNoGlobalWorkOffset (SubjectMatchRule_function) +// CHECK-NEXT: SYCLIntelNumSimdWorkItems (SubjectMatchRule_function) +// CHECK-NEXT: SYCLIntelPipeIO (SubjectMatchRule_variable) +// CHECK-NEXT: SYCLIntelSchedulerTargetFmaxMhz (SubjectMatchRule_function) +// CHECK-NEXT: SYCLIntelUseStallEnableClusters (SubjectMatchRule_function) +// CHECK-NEXT: SYCLRegisterNum (SubjectMatchRule_variable_is_global) +// CHECK-NEXT: SYCLSimd (SubjectMatchRule_function) // CHECK-NEXT: ScopedLockable (SubjectMatchRule_record) // CHECK-NEXT: Section (SubjectMatchRule_function, SubjectMatchRule_variable_is_global, SubjectMatchRule_objc_method, SubjectMatchRule_objc_property) // CHECK-NEXT: SetTypestate (SubjectMatchRule_function_is_member)