Syncleus / aparapi

The New Official Aparapi: a framework for executing native Java and Scala code on the GPU.

Home Page:http://aparapi.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bounty $20] Codegen not correct for assignment to static array element

freemo opened this issue · comments

Tested for here:
https://github.com/Syncleus/aparapi/blob/master/src/test/java/com/aparapi/runtime/StaticArrayAssignmentTest.java
and here:
https://github.com/Syncleus/aparapi/blob/master/src/test/java/com/aparapi/runtime/StaticVariableAssignmentTest.java

Note: I have seen both the above tests fail locally when running on the GPU but have never failed on travis and many others have reported that it hasnt failed for them. It fails for me on my macbook pro warning that the arrays dont match (the copy operation never occurs). However what seems strange is they fail most of the time but not always. Usually at least one of the tests fail and more often than not both.

The following text from google code originally:

What steps will reproduce the problem? 1. In the kernel use a static field like:

static int[] target = new int[size];

@Override public void run() { int id = getGlobalId(); target[id] = source[id]; }

the codegen does not emit "this->" for the target ref, so the results are incorrect compared to regular java.

int id = get_global_id(0); target[id] = source[id]; return;

What is the expected output? What do you see instead? The assigned values in the kernel code are not there when you return to java

We have a unit test reproducing this here: https://github.com/Syncleus/aparapi/blob/65ece52225d1dfb6564b354162765de374e14eba/src/test/java/com/aparapi/runtime/Issue103Test.java