Skip to content

Commit 97a199f

Browse files
mohammadfawazbader
authored andcommitted
[SYCL][FPGA] Changing the max_private_copies to private_copies (#1024)
The SPIRV coming out of the translator does not change. The SPIRV decoration is still MaxPrivateCopies. This should probably be fixed in the future (starting with the SPIRV spec) for consistency. Signed-off-by: Mohammad Fawaz <[email protected]>
1 parent ac99b50 commit 97a199f

File tree

7 files changed

+45
-45
lines changed

7 files changed

+45
-45
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,12 +1721,12 @@ def IntelFPGANumBanks : Attr {
17211721
}];
17221722
}
17231723

1724-
def IntelFPGAMaxPrivateCopies : InheritableAttr {
1725-
let Spellings = [CXX11<"intelfpga","max_private_copies">];
1724+
def IntelFPGAPrivateCopies : InheritableAttr {
1725+
let Spellings = [CXX11<"intelfpga","private_copies">];
17261726
let Args = [ExprArgument<"Value">];
17271727
let LangOpts = [SYCLIsDevice, SYCLIsHost];
17281728
let Subjects = SubjectList<[IntelFPGALocalNonConstVar, Field], ErrorDiag>;
1729-
let Documentation = [IntelFPGAMaxPrivateCopiesAttrDocs];
1729+
let Documentation = [IntelFPGAPrivateCopiesAttrDocs];
17301730
let AdditionalMembers = [{
17311731
static unsigned getMinValue() {
17321732
return 0;

clang/include/clang/Basic/AttrDocs.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,9 +1876,9 @@ with N banks.
18761876
}];
18771877
}
18781878

1879-
def IntelFPGAMaxPrivateCopiesAttrDocs : Documentation {
1879+
def IntelFPGAPrivateCopiesAttrDocs : Documentation {
18801880
let Category = DocCatVariable;
1881-
let Heading = "max_private_copies (IntelFPGA)";
1881+
let Heading = "private_copies (IntelFPGA)";
18821882
let Content = [{
18831883
This attribute may be attached to a variable or struct member declaration and
18841884
instructs the backend to replicate the memory generated for the variable or

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3975,9 +3975,9 @@ void CodeGenModule::generateIntelFPGAAnnotation(
39753975
llvm::APSInt BWAInt = BWA->getValue()->EvaluateKnownConstInt(getContext());
39763976
Out << '{' << BWA->getSpelling() << ':' << BWAInt << '}';
39773977
}
3978-
if (const auto *MCA = D->getAttr<IntelFPGAMaxPrivateCopiesAttr>()) {
3979-
llvm::APSInt MCAInt = MCA->getValue()->EvaluateKnownConstInt(getContext());
3980-
Out << '{' << MCA->getSpelling() << ':' << MCAInt << '}';
3978+
if (const auto *PCA = D->getAttr<IntelFPGAPrivateCopiesAttr>()) {
3979+
llvm::APSInt PCAInt = PCA->getValue()->EvaluateKnownConstInt(getContext());
3980+
Out << '{' << PCA->getSpelling() << ':' << PCAInt << '}';
39813981
}
39823982
if (const auto *NBA = D->getAttr<IntelFPGANumBanksAttr>()) {
39833983
llvm::APSInt NBAInt = NBA->getValue()->EvaluateKnownConstInt(getContext());

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3877,7 +3877,7 @@ void Sema::AddOneConstantValueAttr(Decl *D, const AttributeCommonInfo &CI,
38773877
E = ICE.get();
38783878
}
38793879

3880-
if (IntelFPGAMaxPrivateCopiesAttr::classof(&TmpAttr)) {
3880+
if (IntelFPGAPrivateCopiesAttr::classof(&TmpAttr)) {
38813881
if (!D->hasAttr<IntelFPGAMemoryAttr>())
38823882
D->addAttr(IntelFPGAMemoryAttr::CreateImplicit(
38833883
Context, IntelFPGAMemoryAttr::Default));
@@ -5241,7 +5241,7 @@ static bool checkIntelFPGARegisterAttrCompatibility(Sema &S, Decl *D,
52415241
InCompat = true;
52425242
if (checkAttrMutualExclusion<IntelFPGABankWidthAttr>(S, D, Attr))
52435243
InCompat = true;
5244-
if (checkAttrMutualExclusion<IntelFPGAMaxPrivateCopiesAttr>(S, D, Attr))
5244+
if (checkAttrMutualExclusion<IntelFPGAPrivateCopiesAttr>(S, D, Attr))
52455245
InCompat = true;
52465246
if (auto *NBA = D->getAttr<IntelFPGANumBanksAttr>())
52475247
if (!NBA->isImplicit() &&
@@ -5445,17 +5445,17 @@ void Sema::AddIntelFPGABankBitsAttr(Decl *D, const AttributeCommonInfo &CI,
54455445
IntelFPGABankBitsAttr(Context, CI, Args.data(), Args.size()));
54465446
}
54475447

5448-
static void handleIntelFPGAMaxPrivateCopiesAttr(Sema &S, Decl *D,
5449-
const ParsedAttr &Attr) {
5448+
static void handleIntelFPGAPrivateCopiesAttr(Sema &S, Decl *D,
5449+
const ParsedAttr &Attr) {
54505450

54515451
if (S.LangOpts.SYCLIsHost)
54525452
return;
54535453

5454-
checkForDuplicateAttribute<IntelFPGAMaxPrivateCopiesAttr>(S, D, Attr);
5454+
checkForDuplicateAttribute<IntelFPGAPrivateCopiesAttr>(S, D, Attr);
54555455
if (checkAttrMutualExclusion<IntelFPGARegisterAttr>(S, D, Attr))
54565456
return;
54575457

5458-
S.AddOneConstantValueAttr<IntelFPGAMaxPrivateCopiesAttr>(
5458+
S.AddOneConstantValueAttr<IntelFPGAPrivateCopiesAttr>(
54595459
D, Attr, Attr.getArgAsExpr(0));
54605460
}
54615461

@@ -7965,8 +7965,8 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
79657965
case ParsedAttr::AT_IntelFPGANumBanks:
79667966
handleOneConstantPowerTwoValueAttr<IntelFPGANumBanksAttr>(S, D, AL);
79677967
break;
7968-
case ParsedAttr::AT_IntelFPGAMaxPrivateCopies:
7969-
handleIntelFPGAMaxPrivateCopiesAttr(S, D, AL);
7968+
case ParsedAttr::AT_IntelFPGAPrivateCopies:
7969+
handleIntelFPGAPrivateCopiesAttr(S, D, AL);
79707970
break;
79717971
case ParsedAttr::AT_IntelFPGAMaxReplicates:
79727972
handleIntelFPGAMaxReplicatesAttr(S, D, AL);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// CHECK-DEVICE: [[ANN2:@.str.[0-9]*]] = {{.*}}{register:1}
66
// CHECK-DEVICE: [[ANN3:@.str.[0-9]*]] = {{.*}}{memory:DEFAULT}{sizeinfo:4}
77
// CHECK-DEVICE: [[ANN4:@.str.[0-9]*]] = {{.*}}{memory:DEFAULT}{sizeinfo:4}{bankwidth:4}
8-
// CHECK-DEVICE: [[ANN5:@.str.[0-9]*]] = {{.*}}{memory:DEFAULT}{sizeinfo:4}{max_private_copies:8}
8+
// CHECK-DEVICE: [[ANN5:@.str.[0-9]*]] = {{.*}}{memory:DEFAULT}{sizeinfo:4}{private_copies:8}
99
// CHECK-DEVICE: [[ANN10:@.str.[0-9]*]] = {{.*}}{memory:DEFAULT}{sizeinfo:4}{pump:1}
1010
// CHECK-DEVICE: [[ANN11:@.str.[0-9]*]] = {{.*}}{memory:DEFAULT}{sizeinfo:4}{pump:2}
1111
// CHECK-DEVICE: [[ANN12:@.str.[0-9]*]] = {{.*}}{memory:DEFAULT}{sizeinfo:4}{merge:foo:depth}
@@ -15,7 +15,7 @@
1515
// CHECK-DEVICE: [[ANN6:@.str.[0-9]*]] = {{.*}}{memory:BLOCK_RAM}{sizeinfo:4}
1616
// CHECK-DEVICE: [[ANN7:@.str.[0-9]*]] = {{.*}}{memory:MLAB}{sizeinfo:4}
1717
// CHECK-DEVICE: [[ANN8:@.str.[0-9]*]] = {{.*}}{memory:DEFAULT}{sizeinfo:4}{bankwidth:8}
18-
// CHECK-DEVICE: [[ANN9:@.str.[0-9]*]] = {{.*}}{memory:DEFAULT}{sizeinfo:4}{max_private_copies:4}
18+
// CHECK-DEVICE: [[ANN9:@.str.[0-9]*]] = {{.*}}{memory:DEFAULT}{sizeinfo:4}{private_copies:4}
1919
// CHECK-BOTH: [[ANN16:@.str[.0-9]*]] = {{.*}}foobar
2020
// CHECK-DEVICE: [[ANN17:@.str.[0-9]*]] = {{.*}}{memory:MLAB}{sizeinfo:4,500}
2121
// CHECK-DEVICE: [[ANN18:@.str.[0-9]*]] = {{.*}}{memory:BLOCK_RAM}{sizeinfo:4,10,2}
@@ -56,7 +56,7 @@ struct foo_two {
5656
int f2 [[intelfpga::register]];
5757
int f3 [[intelfpga::memory]];
5858
int f4 [[intelfpga::bankwidth(4)]];
59-
int f5 [[intelfpga::max_private_copies(8)]];
59+
int f5 [[intelfpga::private_copies(8)]];
6060
int f6 [[intelfpga::singlepump]];
6161
int f7 [[intelfpga::doublepump]];
6262
int f8 [[intelfpga::merge("foo", "depth")]];
@@ -130,7 +130,7 @@ void baz() {
130130
// CHECK-DEVICE: %[[V_SEVEN:[0-9]+]] = bitcast{{.*}}v_seven
131131
// CHECK-DEVICE: %[[V_SEVEN1:v_seven[0-9]+]] = bitcast{{.*}}v_seven
132132
// CHECK-DEVICE: llvm.var.annotation{{.*}}%[[V_SEVEN1]],{{.*}}[[ANN9]]
133-
int v_seven [[intelfpga::max_private_copies(4)]];
133+
int v_seven [[intelfpga::private_copies(4)]];
134134
// CHECK-DEVICE: %[[V_EIGHT:[0-9]+]] = bitcast{{.*}}v_eight
135135
// CHECK-DEVICE: %[[V_EIGHT1:v_eight[0-9]+]] = bitcast{{.*}}v_eight
136136
// CHECK-DEVICE: 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
@@ -45,10 +45,10 @@ void foo1()
4545

4646
//CHECK: VarDecl{{.*}}v_seven
4747
//CHECK: IntelFPGAMemoryAttr{{.*}}Implicit
48-
//CHECK: IntelFPGAMaxPrivateCopiesAttr
48+
//CHECK: IntelFPGAPrivateCopiesAttr
4949
//CHECK-NEXT: ConstantExpr
5050
//CHECK-NEXT: IntegerLiteral{{.*}}8{{$}}
51-
[[intelfpga::max_private_copies(8)]] unsigned int v_seven[64];
51+
[[intelfpga::private_copies(8)]] unsigned int v_seven[64];
5252

5353
//CHECK: VarDecl{{.*}}v_ten
5454
//CHECK: IntelFPGAMemoryAttr{{.*}}Implicit
@@ -202,7 +202,7 @@ void foo1()
202202

203203
//expected-error@+2{{attributes are not compatible}}
204204
[[intelfpga::register]]
205-
[[intelfpga::max_private_copies(16)]]
205+
[[intelfpga::private_copies(16)]]
206206
//expected-note@-2 {{conflicting attribute is here}}
207207
unsigned int reg_six_two[64];
208208

@@ -304,37 +304,37 @@ void foo1()
304304
unsigned int bw_seven[64];
305305

306306

307-
// max_private_copies_
307+
// private_copies_
308308
//expected-error@+2{{attributes are not compatible}}
309-
[[intelfpga::max_private_copies(16)]]
309+
[[intelfpga::private_copies(16)]]
310310
[[intelfpga::register]]
311311
//expected-note@-2 {{conflicting attribute is here}}
312312
unsigned int mc_one[64];
313313

314314
//CHECK: VarDecl{{.*}}mc_two
315-
//CHECK: IntelFPGAMaxPrivateCopiesAttr
315+
//CHECK: IntelFPGAPrivateCopiesAttr
316316
//CHECK-NEXT: ConstantExpr
317317
//CHECK-NEXT: IntegerLiteral{{.*}}8{{$}}
318-
//CHECK: IntelFPGAMaxPrivateCopiesAttr
318+
//CHECK: IntelFPGAPrivateCopiesAttr
319319
//CHECK-NEXT: ConstantExpr
320320
//CHECK-NEXT: IntegerLiteral{{.*}}16{{$}}
321321
//expected-warning@+2{{is already applied}}
322-
[[intelfpga::max_private_copies(8)]]
323-
[[intelfpga::max_private_copies(16)]]
322+
[[intelfpga::private_copies(8)]]
323+
[[intelfpga::private_copies(16)]]
324324
unsigned int mc_two[64];
325325

326-
//expected-error@+1{{'max_private_copies' attribute requires integer constant between 0 and 1048576 inclusive}}
327-
[[intelfpga::max_private_copies(-4)]]
326+
//expected-error@+1{{'private_copies' attribute requires integer constant between 0 and 1048576 inclusive}}
327+
[[intelfpga::private_copies(-4)]]
328328
unsigned int mc_four[64];
329329

330-
int i_max_private_copies = 32; // expected-note {{declared here}}
330+
int i_private_copies = 32; // expected-note {{declared here}}
331331
//expected-error@+1{{expression is not an integral constant expression}}
332-
[[intelfpga::max_private_copies(i_max_private_copies)]]
333-
//expected-note@-1{{read of non-const variable 'i_max_private_copies' is not allowed in a constant expression}}
332+
[[intelfpga::private_copies(i_private_copies)]]
333+
//expected-note@-1{{read of non-const variable 'i_private_copies' is not allowed in a constant expression}}
334334
unsigned int mc_five[64];
335335

336-
//expected-error@+1{{'max_private_copies' attribute takes one argument}}
337-
[[intelfpga::max_private_copies(4,8)]]
336+
//expected-error@+1{{'private_copies' attribute takes one argument}}
337+
[[intelfpga::private_copies(4,8)]]
338338
unsigned int mc_six[64];
339339

340340
// numbanks
@@ -476,8 +476,8 @@ void foo1()
476476
//expected-warning@+1{{unknown attribute '__doublepump__' ignored}}
477477
unsigned int __attribute__((__doublepump__)) a_six;
478478

479-
//expected-warning@+1{{unknown attribute '__max_private_copies__' ignored}}
480-
int __attribute__((__max_private_copies__(4))) a_seven;
479+
//expected-warning@+1{{unknown attribute '__private_copies__' ignored}}
480+
int __attribute__((__private_copies__(4))) a_seven;
481481

482482
//expected-warning@+1{{unknown attribute '__merge__' ignored}}
483483
int __attribute__((__merge__("mrg1","depth"))) a_eight;
@@ -493,17 +493,17 @@ void foo1()
493493
}
494494

495495
//expected-error@+1{{attribute only applies to local non-const variables and non-static data members}}
496-
[[intelfpga::max_private_copies(8)]]
496+
[[intelfpga::private_copies(8)]]
497497
__attribute__((opencl_constant)) unsigned int ext_two[64] = { 1, 2, 3 };
498498

499499
void other2()
500500
{
501501
//expected-error@+1{{attribute only applies to local non-const variables and non-static data members}}
502-
[[intelfpga::max_private_copies(8)]] const int ext_six[64] = { 0, 1 };
502+
[[intelfpga::private_copies(8)]] const int ext_six[64] = { 0, 1 };
503503
}
504504

505505
//expected-error@+1{{attribute only applies to local non-const variables and non-static data members}}
506-
void other3([[intelfpga::max_private_copies(8)]] int pfoo) {}
506+
void other3([[intelfpga::private_copies(8)]] int pfoo) {}
507507

508508
struct foo {
509509
//CHECK: FieldDecl{{.*}}v_one
@@ -554,10 +554,10 @@ struct foo {
554554

555555
//CHECK: FieldDecl{{.*}}v_seven
556556
//CHECK: IntelFPGAMemoryAttr{{.*}}Implicit
557-
//CHECK: IntelFPGAMaxPrivateCopiesAttr
557+
//CHECK: IntelFPGAPrivateCopiesAttr
558558
//CHECK-NEXT: ConstantExpr
559559
//CHECK-NEXT: IntegerLiteral{{.*}}4{{$}}
560-
[[intelfpga::max_private_copies(4)]] unsigned int v_seven[64];
560+
[[intelfpga::private_copies(4)]] unsigned int v_seven[64];
561561

562562
//CHECK: FieldDecl{{.*}}v_ten
563563
//CHECK: IntelFPGAMemoryAttr{{.*}}Implicit

clang/test/SemaSYCL/spurious-host-warning.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ void foo()
3838
[[intelfpga::numbanks(8)]] unsigned int v_six[32];
3939

4040
#ifndef SYCLHOST
41-
// expected-warning@+2 {{'max_private_copies' attribute ignored}}
41+
// expected-warning@+2 {{'private_copies' attribute ignored}}
4242
#endif
43-
[[intelfpga::max_private_copies(8)]] unsigned int v_seven[64];
43+
[[intelfpga::private_copies(8)]] unsigned int v_seven[64];
4444

4545
#ifndef SYCLHOST
4646
// expected-warning@+2 {{'merge' attribute ignored}}

0 commit comments

Comments
 (0)