webrev-hsail-transcendentals

Deneau, Tom tom.deneau at amd.com
Mon Jun 30 19:56:48 UTC 2014


Please review the following webrev which adds support for several missing java.lang.Math routines to the HSAIL backend.
http://cr.openjdk.java.net/~tdeneau/graal-webrevs/webrev-hsail-transcendentals/webrev/

Many of these routines were declared as native in the regular host backends, but HSAIL has no way to invoke host code from the kernels.  But if we could find java implementations of these methods we could use those thru the graal MethodSubstitution framework.  For the java implementations, we basically used a file StrictMath.java which Gustav Trede donated to OpenJDK back in 2009 as a java port of the C FDLIBM routines, thank you Gustav.
     http://mail.openjdk.java.net/pipermail/hotspot-dev/2009-August/001992.html

We made only a few minor changes to that file.     My understanding from  Joe Darcy is that in Java 9 there will be an official port of FDLIBM to java in the JDK, so when that happens we should be able to use that instead.


Notes:

*         JStrictMath.java is the java implementation of the Math routines noted above.  HSAILMathSubstitutions redirects several methods to there.  In addition test cases were added for many Math routines which were already implemented as java methods in java.lang.Math.

*         GraalTest --

o   Since the java spec specifies the tolerance for most of these Math routines in terms of ULPs, I wanted to enable a way for AssertEquals to use ULPs rather than a constant maximum delta.   This is done by overriding protected int ulpsDelta() to return something other than zero.

*         HSAILAssembler

o   fix the printing of some special Double and Float constants

o   cvt for float to integer uses zeroi_sat (saturate)

*         HSAILLIRGenerator & HSAILControlFlow

o   IntegerTestMove support was required by some of the java implementations

*         all the rest are just junit tests.

All junit tests should pass on the simulator.  These math routines have also been useful in solidifying the hsail hardware implementation.

-- Tom



More information about the graal-dev mailing list