Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

bugfix: [CLWork codepath] local WS must be null if all elements are 0…

…. Using an empty buffer confuses the driver.
  • Loading branch information...
commit c967d61484154911245d213fe0820e2b2d2af549 1 parent 4c8220f
@mbien authored
View
13 src/com/jogamp/opencl/CLCommandQueue.java
@@ -1631,7 +1631,7 @@ public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, Nativ
* Calls {@native clEnqueueNDRangeKernel}.
*/
public CLCommandQueue putWork(CLWork work) {
- this.putNDRangeKernel(work.getKernel(), work.getDimension(), work.getWorkOffset(), work.getWorkSize(), work.getGroupSize(), null, null);
+ this.putWork(work, null, null);
return this;
}
@@ -1639,7 +1639,7 @@ public CLCommandQueue putWork(CLWork work) {
* Calls {@native clEnqueueNDRangeKernel}.
*/
public CLCommandQueue putWork(CLWork work, CLEventList events) {
- this.putNDRangeKernel(work.getKernel(), work.getDimension(), work.getWorkOffset(), work.getWorkSize(), work.getGroupSize(), null, events);
+ this.putWork(work, null, events);
return this;
}
@@ -1647,7 +1647,14 @@ public CLCommandQueue putWork(CLWork work, CLEventList events) {
* Calls {@native clEnqueueNDRangeKernel}.
*/
public CLCommandQueue putWork(CLWork work, CLEventList condition, CLEventList events) {
- this.putNDRangeKernel(work.getKernel(), work.getDimension(), work.getWorkOffset(), work.getWorkSize(), work.getGroupSize(), condition, events);
+ NativeSizeBuffer groupSize = null;
+ if( work.getGroupSize().get(0) != 0
+ || work.dimension >= 2 && work.getGroupSize().get(1) != 0
+ || work.dimension == 3 && work.getGroupSize().get(2) != 0) {
+ groupSize = work.getGroupSize();
+ }
+
+ this.putNDRangeKernel(work.getKernel(), work.dimension, work.getWorkOffset(), work.getWorkSize(), groupSize, condition, events);
return this;
}
View
19 test/com/jogamp/opencl/CLProgramTest.java
@@ -436,7 +436,11 @@ public void workTest() throws IOException {
CLWork1D work = CLWork.create1D(program.createCLKernel("add"));
work.getKernel().setArgs(buffer, 5, buffer.getNIOCapacity());
+
+ //optimal values
work.setWorkSize(20, 1).optimizeFor(device);
+ assertEquals(work.workSize.get(0), 20);
+ assertNotSame(work.groupSize.get(0), 0);
queue.putWriteBuffer(buffer, false)
.putWork(work)
@@ -445,6 +449,21 @@ public void workTest() throws IOException {
while(buffer.getBuffer().hasRemaining()) {
assertEquals(5, buffer.getBuffer().get());
}
+ buffer.getBuffer().rewind();
+
+ // driver choice
+ work.setWorkSize(20);
+ assertEquals(work.workSize.get(0), 20);
+ assertEquals(work.groupSize.get(0), 0);
+
+ queue.putWriteBuffer(buffer, false)
+ .putWork(work)
+ .putReadBuffer(buffer, true);
+
+ while(buffer.getBuffer().hasRemaining()) {
+ assertEquals(10, buffer.getBuffer().get());
+ }
+ buffer.getBuffer().rewind();
}finally{
context.release();
Please sign in to comment.
Something went wrong with that request. Please try again.