JDK webrev to use Graal HSAIL compiler to offload parallel stream lambdas

Caspole, Eric Eric.Caspole at amd.com
Mon Jun 17 14:07:01 PDT 2013


Hello Sumatra readers,

We have now pushed out a JDK webrev at

 http://cr.openjdk.java.net/~ecaspole/sumatrajdk.01/

that is designed to work with the HSAIL Graal webrev we pushed last week at:

  http://cr.openjdk.java.net/~ecaspole/graal_hsail/

When built together this code produces a JDK that allows offloading
certain JDK 8 Stream API parallel streams terminating in forEach() to
HSA APU/GPUs. This version does not reuse any code from Aparapi and does
not use OpenCL.

As an initial vector add example

Streams.intRange(0, in.length).parallel().forEach( id ->
{c[id]=a[id]+b[id];});

In the code above, as an example, we can create a kernel from the lambda
in the forEach() block. In the HSAIL source, we use the Java iteration
variable ("id" above) as the HSA work item id. That means each HSA work
item is working on one value of id.

The HSA foundation should be shortly releasing an open source simulator
that allows running the junit test cases we added into the Graal
project, or running examples via the Graal mx script or standalone. We
have integrated use of the simulator into the Graal build in the OKRA
subproject which allows running the HSAIL code in the simulator until
the HSA Runtime spec is available.

To build the whole system, apply this webrev patch to a JDK 8 clone

  http://hg.openjdk.java.net/jdk8/jdk8/

then build it, then use that built JDK image as the JAVA_HOME for
building Graal with our HSAIL patch applied.

When the simulator is available we will follow up with instructions to
build it and run the samples in the simulator.

Regards,
Eric



More information about the sumatra-dev mailing list