- Loading...
The HSA Foundation has open sourced the following repositories on github
The HSAIL-enabled Sumatra can run using the OKRA interface to the HSAIL simulator. Similarly, graal with the new HSAIL backend can run using this OKRA interface. For graal, you can either
The HSAIL simulator and associated OKRA interface are currently limited to Linux. The build process for the OKRA interface will build both the simulator and the assembler from libHSAIL which is used to create BRIG binaries for the simulator. To build the simulator with its OKRA interface, follow the directions at https://github.com/HSAFoundation/Okra-Interface-to-HSAIL-Simulator#okra-interface-to-hsail-simulator. This procedure will build the assembler, simulator and okra interface. Remember to add okra/dist/bin from this build to PATH and to LD_LIBRARY_PATH. Run the indicated OKRA sanity tests on that page to confirm a proper build.
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 clients that can be run against the Java OKRA interface to the HSAIL Simulator.
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.
mx --vm server unittest -XX:-UseGraalClassLoader -G:Log=CodeGen,~HostGraph,~Stub hsail.test.IntSquaredTest
Each graal junit test specifies a java method which takes either:
In either case, the method under test is dispatched twice:
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:
The HSAIL simulator supports debugging of the HSAIL source with gdb. For more details see the section "GDB-Based Debugging Interface" in the HSAIL Simulator README. In the particular context of debugging HSAIL generated for the graal junit tests, note that the kernel entry point is always called &run, so a kernel entry breakpoint can be set with "break run". The hsail source file will always be temp_hsa.hsail, which is a temporary file created by the OKRA interface. You will be able to step by HSAIL instructions, and inspect HSAIL registers as described in the README. Be sure to set the environment variables SIMNOOPT=1 and SIMTHREADS=1 as described there. In addition, set the environment variable OKRA_SAVEHSAILSOURCE=1. This prevents the normal action which is to delete the hsail file after it is converted to BRIG. This allows the file to be displayed as a source file by gdb.
A Sumatra JDK can be built which is then used to build a Graal Server JVM. This combination can then be used to offload certain JDK 8 Stream API parallel streams terminating in forEach() to HSA APU/GPUs or the HSAIL Simulator. Follow the instructions at Sumatra JDK build instructions.