...
The sanity tests above are small tests with hand-coded HSAIL. They test both the C++ interface and the Java JNI interface. The following are a few other client clients that can be run against the Java OKRA interface to the HSAIL Simulator.
Running the Graal Junit Tests on the Simulator
Now that the HSAIL backend has been committed to the Graal trunk, you The graal trunk supports an HSAIL backend. You can run junit tests in the graal HSAIL-enabled backend by doing the following steps. Your JAVA_HOME can be either JDK7 or a recent JDK8 binary (for example jdk8-b94)
- add okra/dist/bin (from the simulator build above) to $PATH and to $LD_LIBRARY_PATH
- hg clone http://hg.openjdk.java.net/graal/graal
- cd graal (or whatever you named the clone you just made)
- Build graal using the command "mx --vm server --vmbuild product build".
- The following command runs a single junit test (the one that is described in Vasanth's HSAIL compiler blog). The command should be run on a single line, it has line breaks here for readability:
mx --vm server unittest -G:
...
Log=CodeGen hsail.test.IntSquaredTest
- The -RemoveNeverExecutedCode directive is there because the current HSAIL backend cannot handle the deoptimization that would be required when a previously never executed path is then taken.
The -Dkerneltester.logLevel=INFO Note: the -G:Log=CodeGen is optional but can be used if you want to see the generated HSAIL code on stdout
- By removing the specifier IntSquaredTest from the above command line, you can run all the junit tests in the hsail.test directory. In this case you will need to add the option -G:+InlineEverything
- -G:+InlineEverything is used because the HSAIL backend's support for function calls is still in progress.
You can experiment with different specific -Xmx heap sizes which will lead to different compressed reference encodings and see that these are handled in the HSAIL code. (You can also turn off compressed oops if desired). For example a heap of -Xmx31g will lead to compressed references that invove a shift and an add of a base.
A note about the Graal Junit Tests
...
The fields marked with @Result from the two dispatch instances are then compared for equality.
Internally, the junit tests force a few graal options to needed values using graal's "scoped options" feature:
- RemoveNeverExecutedCode is turned off because the current HSAIL backend cannot handle the deoptimization that would be required when a previously never executed path is then taken.
- InlineEverything is turned on used because the HSAIL backend's support for function calls is still in progress.
To be added: instructions for building and running Sumatra prototype thru Graal to the simulator.