NullPointerException from native method
Posted by
bananafish on
Apr 11, 2023; 9:34pm
URL: https://forum.jogamp.org/NullPointerException-from-native-method-tp4042433.html
To debug my JOCL-based app I switched to OCLGrind as my device to find possible issues. It typically works fine but I suddenly started getting this exception on invocations of putNDRangeKernel():
java.lang.NullPointerException
at com.jogamp.opencl.llb.impl.CLAbstractImpl.dispatch_clEnqueueNDRangeKernel0(Native Method)
at com.jogamp.opencl.llb.impl.CLAbstractImpl.clEnqueueNDRangeKernel(CLAbstractImpl.java:1346)
at com.jogamp.opencl.CLCommandQueue.putNDRangeKernel(CLCommandQueue.java:1656)
at com.jogamp.opencl.CLCommandQueue.put1DRangeKernel(CLCommandQueue.java:1523)
at com.jogamp.opencl.CLCommandQueue.put1DRangeKernel(CLCommandQueue.java:1493)
I suspect this has something to do with OCLGrind but the origin of the NullPointerException - apparently a deliberately-thrown java exception on the native side - something of which OCLGrind has no concept- is puzzling Here's one example of the offending code, with asserts to try to catch something amiss:
assert numWorkItems > 0;
assert queue.getID() > 0;
assert kernel.getID() > 0;
assert queue.getContext().getID() > 0;
assert queue.getContext().getCL() != null;
queue.put1DRangeKernel(kernel, 0, numWorkItems, 0);
My POM deps have:
<dependency>
<groupId>org.jocl</groupId>
<artifactId>jocl</artifactId>
<version>2.0.4</version>
</dependency>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt-main</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.jogamp.jocl</groupId>
<artifactId>jocl-main</artifactId>
<version>2.3.2</version>
</dependency>
This exception is happening throughout the app at persistent but bafflingly-random selections of kernels. Switching back to Intel GPU as the device removes the issue and results in normal function.
...any idea as to what is throwing this NPE?