Skip to content

Commit dab9deb

Browse files
authored
[SYCL] Rename FPGA kernel attribute stall_enable (#2787)
The FPGA kernel attribute [[intel::stall_enable]] should be renamed to [[intel::use_stall_enable_clusters]] for SYCL to be consistent with the name used in OpenCL and HLS. There is no need to formally deprecate the old name, because users have not had a chance to use the old name yet. Signed-off-by: Soumi Manna <[email protected]>
1 parent a4f0924 commit dab9deb

File tree

8 files changed

+32
-31
lines changed

8 files changed

+32
-31
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,16 +1236,16 @@ def SYCLIntelNumSimdWorkItems : InheritableAttr {
12361236
let PragmaAttributeSupport = 0;
12371237
}
12381238

1239-
def SYCLIntelStallEnable : InheritableAttr {
1240-
let Spellings = [CXX11<"intel","stall_enable">];
1239+
def SYCLIntelUseStallEnableClusters : InheritableAttr {
1240+
let Spellings = [CXX11<"intel","use_stall_enable_clusters">];
12411241
let LangOpts = [SYCLIsHost, SYCLIsDevice];
12421242
let Subjects = SubjectList<[Function], ErrorDiag>;
12431243
let AdditionalMembers = [{
12441244
static const char *getName() {
12451245
return "stall_enable";
12461246
}
12471247
}];
1248-
let Documentation = [SYCLIntelStallEnableAttrDocs];
1248+
let Documentation = [SYCLIntelUseStallEnableClustersAttrDocs];
12491249
let PragmaAttributeSupport = 0;
12501250
}
12511251

clang/include/clang/Basic/AttrDocs.td

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,33 +2241,33 @@ device kernel, the attribute is ignored and it is not propagated to a kernel.
22412241
}];
22422242
}
22432243

2244-
def SYCLIntelStallEnableAttrDocs : Documentation {
2244+
def SYCLIntelUseStallEnableClustersAttrDocs : Documentation {
22452245
let Category = DocCatFunction;
2246-
let Heading = "intel::stall_enable";
2246+
let Heading = "intel::use_stall_enable_clusters";
22472247
let Content = [{
22482248
When applied to a lambda or function call operator (of a function object)
22492249
on device, this requests, to the extent possible, that statically-scheduled
22502250
clusters handle stalls using a stall-enable signal to freeze computation
22512251
within the cluster. This attribute is ignored on the host.
22522252

2253-
If ``intel::stall_enable`` is applied to a function called from a device
2253+
If ``intel::use_stall_enable_clusters`` is applied to a function called from a device
22542254
kernel, the attribute is ignored and it is not propagated to a kernel.
22552255

2256-
The ``intel::stall_enable`` attribute takes no argument and has an effect
2256+
The ``intel::use_stall_enable_clusters`` attribute takes no argument and has an effect
22572257
when applied to a function, and no effect otherwise.
22582258

22592259
.. code-block:: c++
22602260

22612261
class Functor
22622262
{
2263-
[[intel::stall_enable]] void operator()(item<1> item)
2263+
[[intel::use_stall_enable_clusters]] void operator()(item<1> item)
22642264
{
22652265
/* kernel code */
22662266
}
22672267
}
22682268

22692269
kernel<class kernel_name>(
2270-
[]() [[intel::stall_enable]] {
2270+
[]() [[intel::use_stall_enable_clusters]] {
22712271
/* kernel code */
22722272
});
22732273

clang/include/clang/Basic/AttributeCommonInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class AttributeCommonInfo {
166166
ParsedAttr == AT_SYCLIntelMaxWorkGroupSize ||
167167
ParsedAttr == AT_SYCLIntelMaxGlobalWorkDim ||
168168
ParsedAttr == AT_SYCLIntelNoGlobalWorkOffset ||
169-
ParsedAttr == AT_SYCLIntelStallEnable)
169+
ParsedAttr == AT_SYCLIntelUseStallEnableClusters)
170170
return true;
171171

172172
return false;

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ void CodeGenFunction::EmitOpenCLKernelMetadata(const FunctionDecl *FD,
677677
Fn->setMetadata("no_global_work_offset", llvm::MDNode::get(Context, {}));
678678
}
679679

680-
if (FD->hasAttr<SYCLIntelStallEnableAttr>()) {
680+
if (FD->hasAttr<SYCLIntelUseStallEnableClustersAttr>()) {
681681
llvm::Metadata *AttrMDArgs[] = {
682682
llvm::ConstantAsMetadata::get(Builder.getInt32(1))};
683683
Fn->setMetadata("stall_enable", llvm::MDNode::get(Context, AttrMDArgs));

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3029,8 +3029,9 @@ static void handleNumSimdWorkItemsAttr(Sema &S, Decl *D,
30293029
E);
30303030
}
30313031

3032-
// Handles stall_enable
3033-
static void handleStallEnableAttr(Sema &S, Decl *D, const ParsedAttr &Attr) {
3032+
// Handles use_stall_enable_clusters
3033+
static void handleUseStallEnableClustersAttr(Sema &S, Decl *D,
3034+
const ParsedAttr &Attr) {
30343035
if (D->isInvalidDecl())
30353036
return;
30363037

@@ -3040,7 +3041,7 @@ static void handleStallEnableAttr(Sema &S, Decl *D, const ParsedAttr &Attr) {
30403041
return;
30413042
}
30423043

3043-
handleSimpleAttribute<SYCLIntelStallEnableAttr>(S, D, Attr);
3044+
handleSimpleAttribute<SYCLIntelUseStallEnableClustersAttr>(S, D, Attr);
30443045
}
30453046

30463047
// Add scheduler_target_fmax_mhz
@@ -8415,8 +8416,8 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
84158416
case ParsedAttr::AT_SYCLIntelNoGlobalWorkOffset:
84168417
handleNoGlobalWorkOffsetAttr(S, D, AL);
84178418
break;
8418-
case ParsedAttr::AT_SYCLIntelStallEnable:
8419-
handleStallEnableAttr(S, D, AL);
8419+
case ParsedAttr::AT_SYCLIntelUseStallEnableClusters:
8420+
handleUseStallEnableClustersAttr(S, D, AL);
84208421
break;
84218422
case ParsedAttr::AT_VecTypeHint:
84228423
handleVecTypeHint(S, D, AL);

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -547,16 +547,16 @@ class MarkDeviceFunction : public RecursiveASTVisitor<MarkDeviceFunction> {
547547
if (auto *A = FD->getAttr<SYCLSimdAttr>())
548548
Attrs.insert(A);
549549

550-
// Allow the kernel attribute "stall_enable" only on lambda functions
551-
// and function objects that are called directly from a kernel
550+
// Allow the kernel attribute "use_stall_enable_clusters" only on lambda
551+
// functions and function objects that are called directly from a kernel
552552
// (i.e. the one passed to the single_task or parallel_for functions).
553553
// For all other cases, emit a warning and ignore.
554-
if (auto *A = FD->getAttr<SYCLIntelStallEnableAttr>()) {
554+
if (auto *A = FD->getAttr<SYCLIntelUseStallEnableClustersAttr>()) {
555555
if (ParentFD == SYCLKernel) {
556556
Attrs.insert(A);
557557
} else {
558558
SemaRef.Diag(A->getLocation(), diag::warn_attribute_ignored) << A;
559-
FD->dropAttr<SYCLIntelStallEnableAttr>();
559+
FD->dropAttr<SYCLIntelUseStallEnableClustersAttr>();
560560
}
561561
}
562562

@@ -3277,7 +3277,7 @@ void Sema::MarkDevice(void) {
32773277
case attr::Kind::SYCLIntelSchedulerTargetFmaxMhz:
32783278
case attr::Kind::SYCLIntelMaxGlobalWorkDim:
32793279
case attr::Kind::SYCLIntelNoGlobalWorkOffset:
3280-
case attr::Kind::SYCLIntelStallEnable:
3280+
case attr::Kind::SYCLIntelUseStallEnableClusters:
32813281
case attr::Kind::SYCLSimd: {
32823282
if ((A->getKind() == attr::Kind::SYCLSimd) && KernelBody &&
32833283
!KernelBody->getAttr<SYCLSimdAttr>()) {

clang/test/CodeGenSYCL/stall_enable.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ queue q;
77

88
class Foo {
99
public:
10-
[[intel::stall_enable]] void operator()() const {}
10+
[[intel::use_stall_enable_clusters]] void operator()() const {}
1111
};
1212

1313
int main() {
@@ -16,7 +16,7 @@ int main() {
1616
h.single_task<class test_kernel1>(f);
1717

1818
h.single_task<class test_kernel2>(
19-
[]() [[intel::stall_enable]]{});
19+
[]() [[intel::use_stall_enable_clusters]]{});
2020
});
2121
return 0;
2222
}

clang/test/SemaSYCL/stall_enable.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@
66
using namespace cl::sycl;
77
queue q;
88

9-
[[intel::stall_enable]] void test() {} //expected-warning{{'stall_enable' attribute ignored}}
9+
[[intel::use_stall_enable_clusters]] void test() {} //expected-warning{{'use_stall_enable_clusters' attribute ignored}}
1010

1111
#ifdef TRIGGER_ERROR
12-
[[intel::stall_enable(1)]] void bar1() {} // expected-error{{'stall_enable' attribute takes no arguments}}
13-
[[intel::stall_enable]] int N; // expected-error{{'stall_enable' attribute only applies to functions}}
12+
[[intel::use_stall_enable_clusters(1)]] void bar1() {} // expected-error{{'use_stall_enable_clusters' attribute takes no arguments}}
13+
[[intel::use_stall_enable_clusters]] int N; // expected-error{{'use_stall_enable_clusters' attribute only applies to functions}}
1414
#endif
1515

1616
struct FuncObj {
17-
[[intel::stall_enable]] void operator()() const {}
17+
[[intel::use_stall_enable_clusters]] void operator()() const {}
1818
};
1919

2020
int main() {
2121
q.submit([&](handler &h) {
2222
// CHECK-LABEL: FunctionDecl {{.*}}test_kernel1
23-
// CHECK: SYCLIntelStallEnableAttr {{.*}}
23+
// CHECK: SYCLIntelUseStallEnableClustersAttr {{.*}}
2424
h.single_task<class test_kernel1>(
2525
FuncObj());
2626

2727
// CHECK-LABEL: FunctionDecl {{.*}}test_kernel2
28-
// CHECK: SYCLIntelStallEnableAttr {{.*}}
28+
// CHECK: SYCLIntelUseStallEnableClustersAttr {{.*}}
2929
h.single_task<class test_kernel2>(
30-
[]() [[intel::stall_enable]]{});
30+
[]() [[intel::use_stall_enable_clusters]]{});
3131

3232
// CHECK-LABEL: FunctionDecl {{.*}}test_kernel3
33-
// CHECK-NOT: SYCLIntelStallEnableAttr {{.*}}
33+
// CHECK-NOT: SYCLIntelUseStallEnableClustersAttr {{.*}}
3434
h.single_task<class test_kernel3>(
3535
[]() { test(); });
3636
});

0 commit comments

Comments
 (0)