Webrev for throwing some exceptions from HSAIL
Caspole, Eric
Eric.Caspole at amd.com
Mon Dec 9 16:31:29 PST 2013
Hi everybody,
Tom and I came up with our first baby steps of throwing exceptions from HSAIL kernels back into "regular" java. This is for the context of running as a parallel stream such as a parallel().forEach(). This works such that the first kernel workitem to set an atomic after detecting a problem "wins" to report the exception back to java. The kernel workitems that detect a problem return early even if they lose to set the flag, and the others run on normally. This is about the same as you get with CPU parallel streams.
http://cr.openjdk.java.net/~ecaspole/hsail_exceptions/<http://cr.openjdk.java.net/%7Eecaspole/hsail_exceptions/>
We can now detect ArrayIndexOutOfBounds and ClassCastExceptions via explicit checks in the HSAIL code, and return a deoptimization reason to the CPU side. In the JVM kernel launch code, we check for these exceptions, then save the method, reason and bci in the thread, then throw using the THROW/CHECK mechanism from C++ back to java. When the thread later gets to fillInStackTrace, it uses the saved info in the thread to add the kernel lambda method as the top frame in the stack trace.
Let us know what you think.
Thanks,
Eric
More information about the graal-dev
mailing list