PTX example

Thomas Wuerthinger thomas.wuerthinger at oracle.com
Fri Feb 22 10:45:02 PST 2013


There is no global flag as there could be any number of Graal instances running each targeting a different ISA. In the unit test example, I create a new instance of the type PTXBackend in the method BasicPTXTest.test. This defines the configuration object that specifies the way code is generated by Graal. In general, you can take a look at the classes with "PTX" or the packages with "ptx" in the name to see what has been added for the new ISA. We will do some further refactorings and simplifications as we learn more about the requirements of GPU architectures.

- thomas

On Feb 22, 2013, at 9:06 AM, "Venkatachalam, Vasanth" <Vasanth.Venkatachalam at amd.com> wrote:

> Hi Thomas,
> 
> Thanks for this update. I will test your example as soon as I can.
> 
> Can you explain how to switch the ISA that Graal generates code for? For example, if I wanted to switch from using x86 as the backend(the default) to using SPARC, PTX or my own ISA, what would I have to modify? Is there a command line parameter (to be applied at build or run time) for specifying the target ISA?
> 
> Vasanth
> 
> -----Original Message-----
> From: Thomas Wuerthinger [mailto:thomas.wuerthinger at oracle.com] 
> Sent: Thursday, February 21, 2013 5:30 PM
> To: Venkatachalam, Vasanth
> Cc: graal-dev at openjdk.java.net; sumatra-dev at openjdk.java.net
> Subject: PTX example
> 
> Vasanth,
> 
> I've committed and pushed the basic PTX example. After running "./mx.sh --vm server build" and "./mx.sh --vm server unittest BasicPTXTest" you should get the output I pasted in below. The "--vm server" flag means that you are using Graal in hosted mode running on top of HotSpot's server compiler. You can also start the unit test from within Eclipse after generating Eclipse project files with "./mx.sh ideinit".
> 
> Note that the example is still very basic and we'll need more restructuring of the compiler backend to nicely work with GPU architectures. But we have to start with *something* ;).
> 
> - thomas
> 
> running tests in com.oracle.graal.compiler.ptx.test
> JUnit version 4.8
> .0: int
> .entry test1Snippet (	
> 	.param .u32 param0
> ) {	
> 	  .reg .pred %p;
> 	  .reg .u32 %r<16>;
> L87:
> 	mov.s32 %r0, %r6;
> 	add.s32 %r0, %r0, 1;
> 	exit; 
> }	
> 
> result=com.oracle.graal.api.code.CompilationResult at 665df3c6
> 
> Time: 0.03
> 
> OK (1 test) 
> 



More information about the sumatra-dev mailing list