-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL] Enable FPGA max_concurrency memory attribute #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1670,7 +1670,7 @@ as ``-mlong-calls`` and ``-mno-long-calls``. | |
|
||
def IntelFPGAMemoryAttrDocs : Documentation { | ||
let Category = DocCatVariable; | ||
let Heading = "memory (IntelFGPA)"; | ||
let Heading = "memory (IntelFPGA)"; | ||
let Content = [{ | ||
This attribute may be attached to a variable or struct member declaration and | ||
instructs the backend to implement the variable or struct member in memory | ||
|
@@ -1681,7 +1681,7 @@ it indicates what type of memory to use. | |
|
||
def IntelFPGARegisterAttrDocs : Documentation { | ||
let Category = DocCatVariable; | ||
let Heading = "register (IntelFGPA)"; | ||
let Heading = "register (IntelFPGA)"; | ||
let Content = [{ | ||
This attribute may be attached to a variable or struct member declaration and | ||
instructs the backend to promote the variable or struct member to register(s) | ||
|
@@ -1691,7 +1691,7 @@ if possible. | |
|
||
def IntelFPGABankWidthAttrDocs : Documentation { | ||
let Category = DocCatVariable; | ||
let Heading = "bankwidth (IntelFGPA)"; | ||
let Heading = "bankwidth (IntelFPGA)"; | ||
let Content = [{ | ||
This attribute may be attached to a variable or struct member declaration and | ||
instructs the backend to implement the variable or struct member in a memory | ||
|
@@ -1701,14 +1701,25 @@ with banks that are N bytes wide. | |
|
||
def IntelFPGANumBanksAttrDocs : Documentation { | ||
let Category = DocCatVariable; | ||
let Heading = "numbanks (IntelFGPA)"; | ||
let Heading = "numbanks (IntelFPGA)"; | ||
let Content = [{ | ||
This attribute may be attached to a variable or struct member declaration and | ||
instructs the backend to implement the variable or struct member in a memory | ||
with N banks. | ||
}]; | ||
} | ||
|
||
def IntelFPGAMaxConcurrencyAttrDocs : Documentation { | ||
let Category = DocCatVariable; | ||
let Heading = "max_concurrency (IntelFPGA)"; | ||
let Content = [{ | ||
This attribute may be attached to a variable or struct member declaration and | ||
instructs the backend to replicate the memory generated for the variable or | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I agree. |
||
struct member sufficiently to enable the specified number of simultaneous | ||
threads or loop iterations. | ||
}]; | ||
} | ||
|
||
def RISCVInterruptDocs : Documentation { | ||
let Category = DocCatFunction; | ||
let Heading = "interrupt (RISCV)"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,7 +53,22 @@ void foo1() | |
//CHECK: IntelFPGANumBanksAttr | ||
//CHECK-NEXT: ConstantExpr | ||
//CHECK-NEXT: IntegerLiteral{{.*}}4{{$}} | ||
__attribute__((__numbanks__(4))) unsigned int v_six2[32]; | ||
[[intelfpga::numbanks(4)]] unsigned int v_six2[32]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clearer, indeed! |
||
|
||
//CHECK: VarDecl{{.*}}v_seven | ||
//CHECK: IntelFPGAMemoryAttr{{.*}}Implicit | ||
//CHECK: IntelFPGAMaxConcurrencyAttr | ||
//CHECK-NEXT: ConstantExpr | ||
//CHECK-NEXT: IntegerLiteral{{.*}}4{{$}} | ||
__attribute__((max_concurrency(4))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am a little bit scared about naming conflicts with thousands of top-level attributes landing from many vendors... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good point. We'll think on how to solve this for C-style attributes. |
||
unsigned int v_seven[64]; | ||
|
||
//CHECK: VarDecl{{.*}}v_seven2 | ||
//CHECK: IntelFPGAMemoryAttr{{.*}}Implicit | ||
//CHECK: IntelFPGAMaxConcurrencyAttr | ||
//CHECK-NEXT: ConstantExpr | ||
//CHECK-NEXT: IntegerLiteral{{.*}}8{{$}} | ||
[[intelfpga::max_concurrency(8)]] unsigned int v_seven2[64]; | ||
|
||
int __attribute__((__register__)) A; | ||
int __attribute__((__numbanks__(4), __bankwidth__(16))) E; | ||
|
@@ -77,6 +92,12 @@ void foo1() | |
//expected-note@-2 {{conflicting attribute is here}} | ||
unsigned int reg_six[64]; | ||
|
||
//expected-error@+2{{attributes are not compatible}} | ||
__attribute__((__register__)) | ||
__attribute__((__max_concurrency__(16))) | ||
//expected-note@-2 {{conflicting attribute is here}} | ||
unsigned int reg_six_two[64]; | ||
|
||
//expected-error@+2{{attributes are not compatible}} | ||
__attribute__((__register__)) | ||
__attribute__((__numbanks__(8))) | ||
|
@@ -117,7 +138,7 @@ void foo1() | |
__attribute__((__bankwidth__(3))) | ||
unsigned int bw_three[64]; | ||
|
||
//expected-error@+1{{requires integer constant between 1 and 1048576}} | ||
//expected-error@+1{{'bankwidth' attribute requires integer constant between 1 and 1048576 inclusive}} | ||
__attribute__((__bankwidth__(-4))) | ||
unsigned int bw_four[64]; | ||
|
||
|
@@ -131,10 +152,43 @@ void foo1() | |
__attribute__((__bankwidth__(4,8))) | ||
unsigned int bw_six[64]; | ||
|
||
//expected-error@+1{{requires integer constant between 1 and 1048576}} | ||
//expected-error@+1{{'bankwidth' attribute requires integer constant between 1 and 1048576 inclusive}} | ||
__attribute__((__bankwidth__(0))) | ||
unsigned int bw_seven[64]; | ||
|
||
// max_concurrency | ||
//expected-error@+2{{attributes are not compatible}} | ||
__attribute__((__max_concurrency__(16))) | ||
__attribute__((__register__)) | ||
//expected-note@-2 {{conflicting attribute is here}} | ||
unsigned int mc_one[64]; | ||
|
||
//CHECK: VarDecl{{.*}}mc_two | ||
//CHECK: IntelFPGAMaxConcurrencyAttr | ||
//CHECK-NEXT: ConstantExpr | ||
//CHECK-NEXT: IntegerLiteral{{.*}}8{{$}} | ||
//CHECK: IntelFPGAMaxConcurrencyAttr | ||
//CHECK-NEXT: ConstantExpr | ||
//CHECK-NEXT: IntegerLiteral{{.*}}16{{$}} | ||
//expected-warning@+2{{is already applied}} | ||
__attribute__((__max_concurrency__(8))) | ||
__attribute__((__max_concurrency__(16))) | ||
unsigned int mc_two[64]; | ||
|
||
//expected-error@+1{{'max_concurrency' attribute requires integer constant between 0 and 1048576 inclusive}} | ||
__attribute__((__max_concurrency__(-4))) | ||
unsigned int mc_four[64]; | ||
|
||
int i_max_concurrency = 32; // expected-note {{declared here}} | ||
//expected-error@+1{{expression is not an integral constant expression}} | ||
__attribute__((__max_concurrency__(i_max_concurrency))) | ||
//expected-note@-1{{read of non-const variable 'i_max_concurrency' is not allowed in a constant expression}} | ||
unsigned int mc_five[64]; | ||
|
||
//expected-error@+1{{'__max_concurrency__' attribute takes one argument}} | ||
__attribute__((__max_concurrency__(4,8))) | ||
unsigned int mc_six[64]; | ||
|
||
// numbanks | ||
//expected-error@+2{{attributes are not compatible}} | ||
__attribute__((__numbanks__(16))) | ||
|
@@ -158,7 +212,7 @@ void foo1() | |
__attribute__((__numbanks__(15))) | ||
unsigned int nb_three[64]; | ||
|
||
//expected-error@+1{{requires integer constant between 1 and 1048576}} | ||
//expected-error@+1{{attribute requires integer constant between 1 and 1048576 inclusive}} | ||
__attribute__((__numbanks__(-4))) | ||
unsigned int nb_four[64]; | ||
|
||
|
@@ -172,11 +226,24 @@ void foo1() | |
__attribute__((__numbanks__(4,8))) | ||
unsigned int nb_six[64]; | ||
|
||
//expected-error@+1{{requires integer constant between 1 and 1048576}} | ||
//expected-error@+1{{'numbanks' attribute requires integer constant between 1 and 1048576 inclusive}} | ||
__attribute__((__numbanks__(0))) | ||
unsigned int nb_seven[64]; | ||
} | ||
|
||
//expected-error@+1{{attribute only applies to local non-const variables and non-static data members}} | ||
__attribute__((__max_concurrency__(8))) | ||
__constant unsigned int ext_two[64] = { 1, 2, 3 }; | ||
|
||
void other2() | ||
{ | ||
//expected-error@+1{{attribute only applies to local non-const variables and non-static data members}} | ||
__attribute__((__max_concurrency__(8))) const int ext_six[64] = { 0, 1 }; | ||
} | ||
|
||
//expected-error@+1{{attribute only applies to local non-const variables and non-static data members}} | ||
void other3(__attribute__((__max_concurrency__(8))) int pfoo) {} | ||
|
||
struct foo { | ||
//CHECK: FieldDecl{{.*}}v_two | ||
//CHECK: IntelFPGAMemoryAttr | ||
|
@@ -207,6 +274,13 @@ struct foo { | |
//CHECK-NEXT: ConstantExpr | ||
//CHECK-NEXT: IntegerLiteral{{.*}}8{{$}} | ||
__attribute__((__numbanks__(8))) unsigned int v_six[64]; | ||
|
||
//CHECK: FieldDecl{{.*}}v_seven | ||
//CHECK: IntelFPGAMemoryAttr{{.*}}Implicit | ||
//CHECK: IntelFPGAMaxConcurrencyAttr | ||
//CHECK-NEXT: ConstantExpr | ||
//CHECK-NEXT: IntegerLiteral{{.*}}4{{$}} | ||
__attribute__((__max_concurrency__(4))) unsigned int v_seven[64]; | ||
}; | ||
|
||
template <typename name, typename Func> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps
intelfpga
would be clearer if writtenintel_fpga
.Are these attributes defined to be compatible with some other tools or are just brand new attributes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can already use them, for example, in Intel® FPGA SDK for OpenCL™ 19.1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. With the "intelfpga::" namespace?
But honestly I have no problem about having Intel extension harder to use or unclear. ;-)