heuristic used in LirGenerator.emitSwitch

Venkatachalam, Vasanth Vasanth.Venkatachalam at amd.com
Tue Nov 5 18:40:10 PST 2013


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