Skip to content

Commit aeb4de7

Browse files
authored
[SYCL] Make Intel attributes consistent with clang attributes. (#3022)
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.
1 parent 4dc3b35 commit aeb4de7

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,6 @@ def SYCLDevice : InheritableAttr {
11491149
let Subjects = SubjectList<[Function]>;
11501150
let LangOpts = [SYCLIsDevice];
11511151
let Documentation = [SYCLDeviceDocs];
1152-
let PragmaAttributeSupport = 0;
11531152
}
11541153

11551154
def SYCLKernel : InheritableAttr {
@@ -1167,7 +1166,6 @@ def SYCLSimd : InheritableAttr {
11671166
let Subjects = SubjectList<[Function]>;
11681167
let LangOpts = [SYCLExplicitSIMD];
11691168
let Documentation = [SYCLSimdDocs];
1170-
let PragmaAttributeSupport = 0;
11711169
}
11721170

11731171
// Available in SYCL explicit SIMD extension. Binds a file scope private
@@ -1180,7 +1178,6 @@ def SYCLRegisterNum : InheritableAttr {
11801178
// for the host device as well
11811179
let LangOpts = [SYCLExplicitSIMD];
11821180
let Documentation = [SYCLRegisterNumDocs];
1183-
let PragmaAttributeSupport = 0;
11841181
}
11851182

11861183
// Used to mark ESIMD kernel pointer parameters originating from accessors.
@@ -1190,7 +1187,6 @@ def SYCLSimdAccessorPtr : InheritableAttr {
11901187
let Subjects = SubjectList<[ParmVar]>;
11911188
let LangOpts = [SYCLExplicitSIMD];
11921189
let Documentation = [SYCLSimdAccessorPtrDocs];
1193-
let PragmaAttributeSupport = 0;
11941190
}
11951191

11961192
def SYCLScope : Attr {
@@ -1219,7 +1215,6 @@ def SYCLDeviceIndirectlyCallable : InheritableAttr {
12191215
let Subjects = SubjectList<[Function]>;
12201216
let LangOpts = [SYCLIsDevice];
12211217
let Documentation = [SYCLDeviceIndirectlyCallableDocs];
1222-
let PragmaAttributeSupport = 0;
12231218
}
12241219

12251220
def SYCLIntelBufferLocation : InheritableAttr {
@@ -1244,7 +1239,6 @@ def SYCLIntelKernelArgsRestrict : InheritableAttr {
12441239
let LangOpts = [ SYCLIsDevice, SYCLIsHost ];
12451240
let Documentation = [ SYCLIntelKernelArgsRestrictDocs ];
12461241
let SimpleHandler = 1;
1247-
let PragmaAttributeSupport = 0;
12481242
}
12491243

12501244
def SYCLIntelNumSimdWorkItems : InheritableAttr {
@@ -1254,7 +1248,6 @@ def SYCLIntelNumSimdWorkItems : InheritableAttr {
12541248
let LangOpts = [SYCLIsDevice, SYCLIsHost];
12551249
let Subjects = SubjectList<[Function], ErrorDiag>;
12561250
let Documentation = [SYCLIntelNumSimdWorkItemsAttrDocs];
1257-
let PragmaAttributeSupport = 0;
12581251
}
12591252

12601253
def SYCLIntelUseStallEnableClusters : InheritableAttr {
@@ -1267,7 +1260,6 @@ def SYCLIntelUseStallEnableClusters : InheritableAttr {
12671260
}
12681261
}];
12691262
let Documentation = [SYCLIntelUseStallEnableClustersAttrDocs];
1270-
let PragmaAttributeSupport = 0;
12711263
}
12721264

12731265
def SYCLIntelSchedulerTargetFmaxMhz : InheritableAttr {
@@ -1277,7 +1269,6 @@ def SYCLIntelSchedulerTargetFmaxMhz : InheritableAttr {
12771269
let LangOpts = [SYCLIsDevice, SYCLIsHost];
12781270
let Subjects = SubjectList<[Function], ErrorDiag>;
12791271
let Documentation = [SYCLIntelSchedulerTargetFmaxMhzAttrDocs];
1280-
let PragmaAttributeSupport = 0;
12811272
let AdditionalMembers = [{
12821273
static unsigned getMinValue() {
12831274
return 0;
@@ -1286,7 +1277,6 @@ def SYCLIntelSchedulerTargetFmaxMhz : InheritableAttr {
12861277
return 1024*1024;
12871278
}
12881279
}];
1289-
12901280
}
12911281

12921282
def SYCLIntelMaxWorkGroupSize : InheritableAttr {
@@ -1297,7 +1287,6 @@ def SYCLIntelMaxWorkGroupSize : InheritableAttr {
12971287
ExprArgument<"ZDim">];
12981288
let LangOpts = [SYCLIsDevice, SYCLIsHost];
12991289
let Subjects = SubjectList<[Function], ErrorDiag>;
1300-
let PragmaAttributeSupport = 0;
13011290
let AdditionalMembers = [{
13021291
ArrayRef<const Expr *> dimensions() const {
13031292
return {getXDim(), getYDim(), getZDim()};
@@ -1322,7 +1311,6 @@ def SYCLIntelMaxGlobalWorkDim : InheritableAttr {
13221311
let LangOpts = [SYCLIsDevice, SYCLIsHost];
13231312
let Subjects = SubjectList<[Function], ErrorDiag>;
13241313
let Documentation = [SYCLIntelMaxGlobalWorkDimAttrDocs];
1325-
let PragmaAttributeSupport = 0;
13261314
}
13271315

13281316
def SYCLIntelNoGlobalWorkOffset : InheritableAttr {
@@ -1332,7 +1320,6 @@ def SYCLIntelNoGlobalWorkOffset : InheritableAttr {
13321320
let LangOpts = [SYCLIsDevice, SYCLIsHost];
13331321
let Subjects = SubjectList<[Function], ErrorDiag>;
13341322
let Documentation = [SYCLIntelNoGlobalWorkOffsetAttrDocs];
1335-
let PragmaAttributeSupport = 0;
13361323
}
13371324

13381325
def SYCLIntelLoopFuse : InheritableAttr {
@@ -1413,7 +1400,6 @@ def IntelReqdSubGroupSize: InheritableAttr {
14131400
let Subjects = SubjectList<[Function, CXXMethod], ErrorDiag>;
14141401
let Documentation = [IntelReqdSubGroupSizeDocs];
14151402
let LangOpts = [OpenCL, SYCLIsDevice, SYCLIsHost];
1416-
let PragmaAttributeSupport = 0;
14171403
}
14181404

14191405
// This attribute is both a type attribute, and a declaration attribute (for
@@ -2133,7 +2119,6 @@ def SYCLIntelPipeIO : Attr {
21332119
let LangOpts = [SYCLIsDevice, SYCLIsHost];
21342120
let Subjects = SubjectList<[Var]>;
21352121
let Documentation = [SYCLIntelPipeIOAttrDocs];
2136-
let PragmaAttributeSupport = 0;
21372122
}
21382123

21392124
// Variadic integral arguments.

clang/test/Misc/pragma-attribute-supported-attributes-list.test

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
// CHECK-NEXT: IBAction (SubjectMatchRule_objc_method_is_instance)
6868
// CHECK-NEXT: IFunc (SubjectMatchRule_function)
6969
// CHECK-NEXT: InitPriority (SubjectMatchRule_variable)
70+
// CHECK-NEXT: IntelReqdSubGroupSize (SubjectMatchRule_function, SubjectMatchRule_function_is_member)
7071
// CHECK-NEXT: InternalLinkage (SubjectMatchRule_variable, SubjectMatchRule_function, SubjectMatchRule_record)
7172
// CHECK-NEXT: LTOVisibilityPublic (SubjectMatchRule_record)
7273
// CHECK-NEXT: Leaf (SubjectMatchRule_function)
@@ -145,7 +146,19 @@
145146
// CHECK-NEXT: ReturnTypestate (SubjectMatchRule_function, SubjectMatchRule_variable_is_parameter)
146147
// CHECK-NEXT: ReturnsNonNull (SubjectMatchRule_objc_method, SubjectMatchRule_function)
147148
// CHECK-NEXT: ReturnsTwice (SubjectMatchRule_function)
149+
// CHECK-NEXT: SYCLDevice (SubjectMatchRule_function)
150+
// CHECK-NEXT: SYCLDeviceIndirectlyCallable (SubjectMatchRule_function)
151+
// CHECK-NEXT: SYCLIntelKernelArgsRestrict (SubjectMatchRule_function)
148152
// CHECK-NEXT: SYCLIntelLoopFuse (SubjectMatchRule_function)
153+
// CHECK-NEXT: SYCLIntelMaxGlobalWorkDim (SubjectMatchRule_function)
154+
// CHECK-NEXT: SYCLIntelMaxWorkGroupSize (SubjectMatchRule_function)
155+
// CHECK-NEXT: SYCLIntelNoGlobalWorkOffset (SubjectMatchRule_function)
156+
// CHECK-NEXT: SYCLIntelNumSimdWorkItems (SubjectMatchRule_function)
157+
// CHECK-NEXT: SYCLIntelPipeIO (SubjectMatchRule_variable)
158+
// CHECK-NEXT: SYCLIntelSchedulerTargetFmaxMhz (SubjectMatchRule_function)
159+
// CHECK-NEXT: SYCLIntelUseStallEnableClusters (SubjectMatchRule_function)
160+
// CHECK-NEXT: SYCLRegisterNum (SubjectMatchRule_variable_is_global)
161+
// CHECK-NEXT: SYCLSimd (SubjectMatchRule_function)
149162
// CHECK-NEXT: ScopedLockable (SubjectMatchRule_record)
150163
// CHECK-NEXT: Section (SubjectMatchRule_function, SubjectMatchRule_variable_is_global, SubjectMatchRule_objc_method, SubjectMatchRule_objc_property)
151164
// CHECK-NEXT: SetTypestate (SubjectMatchRule_function_is_member)

0 commit comments

Comments
 (0)