Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

Static variable error

Altera_Forum
Honored Contributor II
1,227 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
523 Views

My question is why the static variable is required?

0 Kudos
Altera_Forum
Honored Contributor II
523 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
523 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