Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Static variable error

Altera_Forum
Honored Contributor II
1,256 Views

hey 

 

I have a error when I write the static variable in kernel function. 

Here is a simple example. 

void funA() 

static int b = 0; 

 

void kernel fun(__global int *a) 

funA(); 

 

Don't I use the "static" in opencl kernel ? 

 

regards.,
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
552 Views

My question is why the static variable is required?

0 Kudos
Altera_Forum
Honored Contributor II
552 Views

The OpenCL language specification does not allow static variables. See Section 6.8.f "The extern, static, auto and register storage-class specifiers are notsupported." 

 

 

--- Quote Start ---  

hey 

 

I have a error when I write the static variable in kernel function. 

Here is a simple example. 

void funA() 

static int b = 0; 

 

void kernel fun(__global int *a) 

funA(); 

 

Don't I use the "static" in opencl kernel ? 

 

regards., 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
552 Views

You can however define constant data at file scope: 

 

__constant int b = 0; void funA() { // Access b here } void kernel fun(__global int *a) { funA(); }
0 Kudos
Reply