if then else constructs and ptx backend

Morris Meyer morris.meyer at oracle.com
Sat Apr 27 09:59:59 PDT 2013


Tom,

I've been working to expand the PTX implementation.  As part of 
GRAAL-234 I've added PTX compilation through a lightweight linkage to 
libcuda and have first successful compilation on my Mac Pro with a GTX 
660 card.  I'll be sending that out to review next week.

Take a look at PTXControlFlow.BranchOp - I think that might need a tweak.

         --mm

On 4/27/13 9:26 AM, Deneau, Tom wrote:
> Hi --
>
> I am working with Vasanth on the HSAIL backend.  As you may know we patterned this
> after some of the PTX backend work.  We have noticed a problem with if then else constructs
> and I see a similar problem in the PTX backend.  Below is some java code and the ptx code.
> Note the dangling if block at L233.
>
> Can you tell us where we should start to look to solve this problem?
>
> -- Tom Deneau
>
>
> Java code:
>    public static int testIfThen(int a) {
> 	return (a > 5 ? a + 7 : a - 3);
>      }
>
>
> testIfThen:
> .entry testIfThen (	
> 	.param .u32 param0
> ) {	
> 	  .reg .pred %p,%q;
> 	  .reg .u32 %r<16>;
> 	.version 1.4
> 	.target sm_10
> L117:
> 	setp.ge.s32 %p, 5, %r6;
> 	@%p
> 	bra L2147483647;         # I assume this should really be bra L233
> L172:
> 	sub.s32 %r6, %r6, 3;
> L200:
> 	mov.s32 %r0, %r6;
> 	exit;
> L233:
> 	add.s32 %r6, %r6, 7;     # doesn't rejoin the main flow to exit
> }	
>
>



More information about the graal-dev mailing list