Saalma / aparapi

Automatically exported from code.google.com/p/aparapi
Other
0 stars 0 forks source link

Allow use of static arrays in kernels #92

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Currently static fields are not really supported. While it is not allowed to 
assign to basic type fields, it should be allowed to use static arrays for 
reading and assigning the array elements in a kernel, for example:

public class UseStaticArray extends Kernel {

   static final int size = 256;

   static final int[] values = new int[size];
   static final int[] results = new int[size];

   public void run() {
      int gid = getGlobalId();
      results[gid] = values[gid];
   }   
...

Original issue reported on code.google.com by ecasp...@gmail.com on 22 Jan 2013 at 8:34

GoogleCodeExporter commented 8 years ago
The other thing to consider is if this is enough to put enable.GETSTATIC true 
by default. I think there are enough tests to catch other uses of getstatic and 
not emit a weird kernel.

Original comment by ecasp...@gmail.com on 22 Jan 2013 at 8:37

GoogleCodeExporter commented 8 years ago
Here is a patch for adding this functionality.

Original comment by ecasp...@gmail.com on 22 Jan 2013 at 8:38

Attachments:

GoogleCodeExporter commented 8 years ago
This new diff sets enableGETSTATIC=true

Original comment by ecasp...@gmail.com on 22 Jan 2013 at 9:13

Attachments:

GoogleCodeExporter commented 8 years ago
Fixed in r990.

Original comment by ecasp...@gmail.com on 23 Jan 2013 at 4:10