question about testing arrays
Thomas Wuerthinger
thomas.wuerthinger at oracle.com
Mon Mar 4 05:19:42 PST 2013
The issue below is that the instruction is expecting a register "REG" but got a constant as one of its operand. In that case, you need to load the constant into a register using a move first. Do most HSAIL instructions can take an inlined constant as operand?
- thomas
On Mar 1, 2013, at 10:21 PM, "Venkatachalam, Vasanth" <Vasanth.Venkatachalam at amd.com> wrote:
> Thomas,
>
> I'm not proposing that we remove the array bounds check. I'm just trying to understand what I need to do to get the below test case working so that I can see the code being generated, just as in your simple addition test case. From the stack trace I see that Graal is trying to generate a guard node and this in turn emits a CompareBranch node, which seems to be getting some unexpected values. Does this mean I have not implemented the emitCompareBranch method properly? I just modeled it after the implementation that you and Christian checked in. Or is there some other issue here?
>
> Vasanth
>
> -----Original Message-----
> From: Thomas Wuerthinger [mailto:thomas.wuerthinger at oracle.com]
> Sent: Friday, March 01, 2013 2:21 PM
> To: Venkatachalam, Vasanth
> Cc: graal-dev at openjdk.java.net
> Subject: Re: question about testing arrays
>
> Vasanth,
>
> Do you want to completely avoid the array bounds check for the example below (i.e., you assume all array accesses are safe), or what would be the desired behavior in case of an out-of-bounds access?
>
> - thomas
>
>
> On Mar 1, 2013, at 8:07 PM, "Venkatachalam, Vasanth" <Vasanth.Venkatachalam at amd.com> wrote:
>
>> Hi,
>>
>> My question has to do with arrays. I am implementing a new test harness for my ISA backend, modeling it after the test harness that Christian and Thomas recently checked in.
>>
>> Thomas's test example was doing a simple addition. I would like to try something involving arrays, like:
>>
>> public static int test1Snippet(int array1[], int array2[]) {
>>
>> return array1[0]* array2[0] + array1[1] *array2[1]; }
>>
>> For this type of code, it looks like Graal emits a Guard check which results in the emission of a compare-branch in the LIR, which in turn is getting some unexpected values. Does anyone have more insight into this error and the best way to work around it? Also are there are other array test examples I can look at to see how array operations may have to be implemented?
>>
>> instruction ICMP (x: int[0|0x0], y: v1|i) condition: AE
>> mode: USE flags: [REG]
>> Unexpected value: Constant int[0|0x0]
>> scope: GraalCompiler.BackEnd.LIRGen.InterceptException
>> Exception occurred in scope:
>> GraalCompiler.BackEnd.LIRGen.InterceptException
>> Context obj com.oracle.graal.graph.GraalInternalError: should not reach here
>> at node: 12|Guard
>> Context obj
>> com.oracle.graal.compiler.hsail.HSAILLIRGenerator at 6035b93b<mailto:com.
>> oracle.graal.compiler.hsail.HSAILLIRGenerator at 6035b93b>
>> 1) test1(com.oracle.graal.compiler.hsail.test.BasicHSAILTest)
>> com.oracle.graal.graph.GraalInternalError: should not reach here
>> at node: 12|Guard
>> at com.oracle.graal.graph.GraalInternalError.shouldNotReachHere(GraalInternalError.java:46)
>> at com.oracle.graal.lir.LIRVerifier.allowed(LIRVerifier.java:241)
>> at com.oracle.graal.lir.LIRVerifier.access$000(LIRVerifier.java:37)
>> at com.oracle.graal.lir.LIRVerifier$1.doValue(LIRVerifier.java:68)
>> at com.oracle.graal.lir.LIRInstructionClass.forEach(LIRInstructionClass.java:346)
>> at
>> com.oracle.graal.lir.LIRInstructionClass.forEachUse(LIRInstructionCla
>> at com.oracle.graal.compiler.gen.LIRGenerator.append(LIRGenerator.java:258)
>> at com.oracle.graal.compiler.hsail.HSAILLIRGenerator.emitCompareBranch(HSAILLIRGenerator.java:196)
>> at com.oracle.graal.compiler.gen.LIRGenerator.emitCompareBranch(LIRGenerator.java:634)
>> at com.oracle.graal.compiler.gen.LIRGenerator.emitBranch(LIRGenerator.java:611)
>> at com.oracle.graal.compiler.gen.LIRGenerator.emitGuardCheck(LIRGenerator.java:600)
>> at com.oracle.graal.nodes.GuardNode.generate(GuardNode.java:95)
>> at com.oracle.graal.compiler.gen.LIRGenerator.emitNode(LIRGenerator.java:460)
>> at
>> com.oracle.graal.compiler.hsail.HSAILLIRGenerator.emitNode(HSAILLIRGen
>> erator.java:78)
>>
>>
>
>
>
More information about the graal-dev
mailing list