heuristic used in LirGenerator.emitSwitch
Lukas Stadler
lukas.stadler at jku.at
Wed Nov 6 07:25:32 PST 2013
Hi Vasanth,
you’re right - the heuristic in LIRGenerator.emitSwitch is actually somewhat architecture/x86 - dependent.
I’ve made the LIRGenerator.emitSequentialSwitch - method protected, so that it should be easy for you to create your own emitSwitch that always just generates a sequential switch - just like you proposed.
- Lukas
On 06 Nov 2013, at 3:40, Venkatachalam, Vasanth <Vasanth.Venkatachalam at amd.com> wrote:
> Doug or others-
>
> To clarify the question below.
>
> For optimally performant HSAIL code generation of a switch statement, its currently preferable to use a series of compare and branch instructions, following the pattern of what would be implemented in the emitSequentialSwitch( ) routine instead of emitTableSwitch( ).
>
> Currently LIRGenerator is using a heuristic to decide whether to invoke emitSequentialSwitch( ) or emitTableSwitch( ). Is there a way I can force it to always call emitSequentialSwitch when I'm running an HSAIL test case?
>
> More generally, if it doesn't make sense for us to implement HSAILLIRGenerator.emitTableSwitch( ), do you have a preference for how we should handle this in Graal?
> As a start, I was thinking of implementing just emitSequentialSwitch and having only that routine called from LIRGenerator.emitSwitch() whenever I'm running an HSAIL test case.
>
> Vasanth
>
>
> From: Venkatachalam, Vasanth
> Sent: Tuesday, November 05, 2013 3:51 PM
> To: graal-dev at openjdk.java.net<mailto:graal-dev at openjdk.java.net>
> Cc: dl.Runtimes
> Subject: heuristic used in LirGenerator.emitSwitch
>
> Can someone explain the reasons behind the heuristic that Graal uses (in LIRGenerator.emitSwitch() ) to decide which of the switch statement implementations (sequential switch, table switch) should be used for a given target platform?
> Is there a way to adapt this heuristic in cases where the target platform may favor one implementation over the other?
>
> Vasanth
More information about the graal-dev
mailing list