Skip to content

Commit 4ad0398

Browse files
MrSidimsromanovvlad
authored andcommitted
[SYCL] Rename max_concurrency attribute to max_private_copies
Signed-off-by: Dmitry Sidorov <[email protected]>
1 parent edc6e41 commit 4ad0398

File tree

6 files changed

+40
-40
lines changed

6 files changed

+40
-40
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,12 +1498,12 @@ def IntelFPGANumBanks : Attr {
14981498
}];
14991499
}
15001500

1501-
def IntelFPGAMaxConcurrency : InheritableAttr {
1502-
let Spellings = [GNU<"max_concurrency">, CXX11<"intelfpga","max_concurrency">];
1501+
def IntelFPGAMaxPrivateCopies : InheritableAttr {
1502+
let Spellings = [GNU<"max_private_copies">, CXX11<"intelfpga","max_private_copies">];
15031503
let Args = [ExprArgument<"Value">];
15041504
let LangOpts = [SYCL];
15051505
let Subjects = SubjectList<[IntelFPGALocalNonConstVar, Field], ErrorDiag>;
1506-
let Documentation = [IntelFPGAMaxConcurrencyAttrDocs];
1506+
let Documentation = [IntelFPGAMaxPrivateCopiesAttrDocs];
15071507
let AdditionalMembers = [{
15081508
static unsigned getMinValue() {
15091509
return 0;

clang/include/clang/Basic/AttrDocs.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,9 +1729,9 @@ with N banks.
17291729
}];
17301730
}
17311731

1732-
def IntelFPGAMaxConcurrencyAttrDocs : Documentation {
1732+
def IntelFPGAMaxPrivateCopiesAttrDocs : Documentation {
17331733
let Category = DocCatVariable;
1734-
let Heading = "max_concurrency (IntelFPGA)";
1734+
let Heading = "max_private_copies (IntelFPGA)";
17351735
let Content = [{
17361736
This attribute may be attached to a variable or struct member declaration and
17371737
instructs the backend to replicate the memory generated for the variable or

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3539,7 +3539,7 @@ void CodeGenModule::generateIntelFPGAAnnotation(
35393539
llvm::APSInt BWAInt = BWA->getValue()->EvaluateKnownConstInt(getContext());
35403540
Out << '{' << BWA->getSpelling() << ':' << BWAInt << '}';
35413541
}
3542-
if (const auto *MCA = D->getAttr<IntelFPGAMaxConcurrencyAttr>()) {
3542+
if (const auto *MCA = D->getAttr<IntelFPGAMaxPrivateCopiesAttr>()) {
35433543
llvm::APSInt MCAInt = MCA->getValue()->EvaluateKnownConstInt(getContext());
35443544
Out << '{' << MCA->getSpelling() << ':' << MCAInt << '}';
35453545
}

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3793,7 +3793,7 @@ void Sema::AddOneConstantValueAttr(SourceRange AttrRange, Decl *D, Expr *E,
37933793
E = ICE.get();
37943794
}
37953795

3796-
if (IntelFPGAMaxConcurrencyAttr::classof(&TmpAttr)) {
3796+
if (IntelFPGAMaxPrivateCopiesAttr::classof(&TmpAttr)) {
37973797
if (!D->hasAttr<IntelFPGAMemoryAttr>())
37983798
D->addAttr(IntelFPGAMemoryAttr::CreateImplicit(
37993799
Context, IntelFPGAMemoryAttr::Default));
@@ -5083,7 +5083,7 @@ static bool checkIntelFPGARegisterAttrCompatibility(Sema &S, Decl *D,
50835083
InCompat = true;
50845084
if (checkAttrMutualExclusion<IntelFPGABankWidthAttr>(S, D, Attr))
50855085
InCompat = true;
5086-
if (checkAttrMutualExclusion<IntelFPGAMaxConcurrencyAttr>(S, D, Attr))
5086+
if (checkAttrMutualExclusion<IntelFPGAMaxPrivateCopiesAttr>(S, D, Attr))
50875087
InCompat = true;
50885088
if (auto *NBA = D->getAttr<IntelFPGANumBanksAttr>())
50895089
if (!NBA->isImplicit() &&
@@ -5122,13 +5122,13 @@ static void handleOneConstantPowerTwoValueAttr(Sema &S, Decl *D,
51225122
Attr.getAttributeSpellingListIndex());
51235123
}
51245124

5125-
static void handleIntelFPGAMaxConcurrencyAttr(Sema &S, Decl *D,
5125+
static void handleIntelFPGAMaxPrivateCopiesAttr(Sema &S, Decl *D,
51265126
const ParsedAttr &Attr) {
5127-
checkForDuplicateAttribute<IntelFPGAMaxConcurrencyAttr>(S, D, Attr);
5127+
checkForDuplicateAttribute<IntelFPGAMaxPrivateCopiesAttr>(S, D, Attr);
51285128
if (checkAttrMutualExclusion<IntelFPGARegisterAttr>(S, D, Attr))
51295129
return;
51305130

5131-
S.AddOneConstantValueAttr<IntelFPGAMaxConcurrencyAttr>(
5131+
S.AddOneConstantValueAttr<IntelFPGAMaxPrivateCopiesAttr>(
51325132
Attr.getRange(), D, Attr.getArgAsExpr(0),
51335133
Attr.getAttributeSpellingListIndex());
51345134
}
@@ -7503,8 +7503,8 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
75037503
case ParsedAttr::AT_IntelFPGANumBanks:
75047504
handleOneConstantPowerTwoValueAttr<IntelFPGANumBanksAttr>(S, D, AL);
75057505
break;
7506-
case ParsedAttr::AT_IntelFPGAMaxConcurrency:
7507-
handleIntelFPGAMaxConcurrencyAttr(S, D, AL);
7506+
case ParsedAttr::AT_IntelFPGAMaxPrivateCopies:
7507+
handleIntelFPGAMaxPrivateCopiesAttr(S, D, AL);
75087508
break;
75097509

75107510
case ParsedAttr::AT_AnyX86NoCallerSavedRegisters:

clang/test/CodeGenSYCL/intel-fpga-local.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
//CHECK: [[ANN2:@.str[\.]*[0-9]*]] = {{.*}}{register:1}
55
//CHECK: [[ANN3:@.str[\.]*[0-9]*]] = {{.*}}{memory:DEFAULT}
66
//CHECK: [[ANN4:@.str[\.]*[0-9]*]] = {{.*}}{memory:DEFAULT}{bankwidth:4}
7-
//CHECK: [[ANN5:@.str[\.]*[0-9]*]] = {{.*}}{memory:DEFAULT}{max_concurrency:8}
7+
//CHECK: [[ANN5:@.str[\.]*[0-9]*]] = {{.*}}{memory:DEFAULT}{max_private_copies:8}
88
//CHECK: [[ANN10:@.str[\.]*[0-9]*]] = {{.*}}{memory:DEFAULT}{pump:1}
99
//CHECK: [[ANN11:@.str[\.]*[0-9]*]] = {{.*}}{memory:DEFAULT}{pump:2}
1010
//CHECK: [[ANN6:@.str[\.]*[0-9]*]] = {{.*}}{memory:BLOCK_RAM}
1111
//CHECK: [[ANN7:@.str[\.]*[0-9]*]] = {{.*}}{memory:MLAB}
1212
//CHECK: [[ANN8:@.str[\.]*[0-9]*]] = {{.*}}{memory:DEFAULT}{bankwidth:8}
13-
//CHECK: [[ANN9:@.str[\.]*[0-9]*]] = {{.*}}{memory:DEFAULT}{max_concurrency:4}
13+
//CHECK: [[ANN9:@.str[\.]*[0-9]*]] = {{.*}}{memory:DEFAULT}{max_private_copies:4}
1414

1515
void foo() {
1616
//CHECK: %[[VAR_ONE:[0-9]+]] = bitcast{{.*}}var_one
@@ -36,7 +36,7 @@ struct foo_two {
3636
int __attribute__((register)) f2;
3737
int __attribute__((__memory__)) f3;
3838
int __attribute__((__bankwidth__(4))) f4;
39-
int __attribute__((max_concurrency(8))) f5;
39+
int __attribute__((max_private_copies(8))) f5;
4040
int __attribute__((singlepump)) f6;
4141
int __attribute__((doublepump)) f7;
4242
};
@@ -101,7 +101,7 @@ void baz() {
101101
//CHECK: %[[V_SEVEN:[0-9]+]] = bitcast{{.*}}v_seven
102102
//CHECK: %[[V_SEVEN1:v_seven[0-9]+]] = bitcast{{.*}}v_seven
103103
//CHECK: llvm.var.annotation{{.*}}%[[V_SEVEN1]],{{.*}}[[ANN9]]
104-
int v_seven [[intelfpga::max_concurrency(4)]];
104+
int v_seven [[intelfpga::max_private_copies(4)]];
105105
//CHECK: %[[V_EIGHT:[0-9]+]] = bitcast{{.*}}v_eight
106106
//CHECK: %[[V_EIGHT1:v_eight[0-9]+]] = bitcast{{.*}}v_eight
107107
//CHECK: llvm.var.annotation{{.*}}%[[V_EIGHT1]],{{.*}}[[ANN10]]

clang/test/SemaSYCL/intel-fpga-local.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,18 @@ void foo1()
7979

8080
//CHECK: VarDecl{{.*}}v_seven
8181
//CHECK: IntelFPGAMemoryAttr{{.*}}Implicit
82-
//CHECK: IntelFPGAMaxConcurrencyAttr
82+
//CHECK: IntelFPGAMaxPrivateCopiesAttr
8383
//CHECK-NEXT: ConstantExpr
8484
//CHECK-NEXT: IntegerLiteral{{.*}}4{{$}}
85-
__attribute__((max_concurrency(4)))
85+
__attribute__((max_private_copies(4)))
8686
unsigned int v_seven[64];
8787

8888
//CHECK: VarDecl{{.*}}v_seven2
8989
//CHECK: IntelFPGAMemoryAttr{{.*}}Implicit
90-
//CHECK: IntelFPGAMaxConcurrencyAttr
90+
//CHECK: IntelFPGAMaxPrivateCopiesAttr
9191
//CHECK-NEXT: ConstantExpr
9292
//CHECK-NEXT: IntegerLiteral{{.*}}8{{$}}
93-
[[intelfpga::max_concurrency(8)]] unsigned int v_seven2[64];
93+
[[intelfpga::max_private_copies(8)]] unsigned int v_seven2[64];
9494

9595
//CHECK: VarDecl{{.*}}v_fourteen
9696
//CHECK: IntelFPGADoublePumpAttr
@@ -179,7 +179,7 @@ void foo1()
179179

180180
//expected-error@+2{{attributes are not compatible}}
181181
__attribute__((__register__))
182-
__attribute__((__max_concurrency__(16)))
182+
__attribute__((__max_private_copies__(16)))
183183
//expected-note@-2 {{conflicting attribute is here}}
184184
unsigned int reg_six_two[64];
185185

@@ -241,37 +241,37 @@ void foo1()
241241
__attribute__((__bankwidth__(0)))
242242
unsigned int bw_seven[64];
243243

244-
// max_concurrency
244+
// max_private_copies_
245245
//expected-error@+2{{attributes are not compatible}}
246-
__attribute__((__max_concurrency__(16)))
246+
__attribute__((__max_private_copies__(16)))
247247
__attribute__((__register__))
248248
//expected-note@-2 {{conflicting attribute is here}}
249249
unsigned int mc_one[64];
250250

251251
//CHECK: VarDecl{{.*}}mc_two
252-
//CHECK: IntelFPGAMaxConcurrencyAttr
252+
//CHECK: IntelFPGAMaxPrivateCopiesAttr
253253
//CHECK-NEXT: ConstantExpr
254254
//CHECK-NEXT: IntegerLiteral{{.*}}8{{$}}
255-
//CHECK: IntelFPGAMaxConcurrencyAttr
255+
//CHECK: IntelFPGAMaxPrivateCopiesAttr
256256
//CHECK-NEXT: ConstantExpr
257257
//CHECK-NEXT: IntegerLiteral{{.*}}16{{$}}
258258
//expected-warning@+2{{is already applied}}
259-
__attribute__((__max_concurrency__(8)))
260-
__attribute__((__max_concurrency__(16)))
259+
__attribute__((__max_private_copies__(8)))
260+
__attribute__((__max_private_copies__(16)))
261261
unsigned int mc_two[64];
262262

263-
//expected-error@+1{{'max_concurrency' attribute requires integer constant between 0 and 1048576 inclusive}}
264-
__attribute__((__max_concurrency__(-4)))
263+
//expected-error@+1{{'max_private_copies' attribute requires integer constant between 0 and 1048576 inclusive}}
264+
__attribute__((__max_private_copies__(-4)))
265265
unsigned int mc_four[64];
266266

267-
int i_max_concurrency = 32; // expected-note {{declared here}}
267+
int i_max_private_copies = 32; // expected-note {{declared here}}
268268
//expected-error@+1{{expression is not an integral constant expression}}
269-
__attribute__((__max_concurrency__(i_max_concurrency)))
270-
//expected-note@-1{{read of non-const variable 'i_max_concurrency' is not allowed in a constant expression}}
269+
__attribute__((__max_private_copies__(i_max_private_copies)))
270+
//expected-note@-1{{read of non-const variable 'i_max_private_copies' is not allowed in a constant expression}}
271271
unsigned int mc_five[64];
272272

273-
//expected-error@+1{{'__max_concurrency__' attribute takes one argument}}
274-
__attribute__((__max_concurrency__(4,8)))
273+
//expected-error@+1{{'__max_private_copies__' attribute takes one argument}}
274+
__attribute__((__max_private_copies__(4,8)))
275275
unsigned int mc_six[64];
276276

277277
// numbanks
@@ -317,17 +317,17 @@ void foo1()
317317
}
318318

319319
//expected-error@+1{{attribute only applies to local non-const variables and non-static data members}}
320-
__attribute__((__max_concurrency__(8)))
320+
__attribute__((__max_private_copies__(8)))
321321
__constant unsigned int ext_two[64] = { 1, 2, 3 };
322322

323323
void other2()
324324
{
325325
//expected-error@+1{{attribute only applies to local non-const variables and non-static data members}}
326-
__attribute__((__max_concurrency__(8))) const int ext_six[64] = { 0, 1 };
326+
__attribute__((__max_private_copies__(8))) const int ext_six[64] = { 0, 1 };
327327
}
328328

329329
//expected-error@+1{{attribute only applies to local non-const variables and non-static data members}}
330-
void other3(__attribute__((__max_concurrency__(8))) int pfoo) {}
330+
void other3(__attribute__((__max_private_copies__(8))) int pfoo) {}
331331

332332
struct foo {
333333
//CHECK: FieldDecl{{.*}}v_one
@@ -378,10 +378,10 @@ struct foo {
378378

379379
//CHECK: FieldDecl{{.*}}v_seven
380380
//CHECK: IntelFPGAMemoryAttr{{.*}}Implicit
381-
//CHECK: IntelFPGAMaxConcurrencyAttr
381+
//CHECK: IntelFPGAMaxPrivateCopiesAttr
382382
//CHECK-NEXT: ConstantExpr
383383
//CHECK-NEXT: IntegerLiteral{{.*}}4{{$}}
384-
__attribute__((__max_concurrency__(4))) unsigned int v_seven[64];
384+
__attribute__((__max_private_copies__(4))) unsigned int v_seven[64];
385385
};
386386

387387
template <typename name, typename Func>

0 commit comments

Comments
 (0)