replacements and getHostProviders
Doug Simon
doug.simon at oracle.com
Wed Nov 20 06:35:39 PST 2013
On Nov 20, 2013, at 2:26 PM, Deneau, Tom <tom.deneau at amd.com> wrote:
> Doug --
>
> OK, to solve this particular problem, we will not delegate certain lowerings back to the host.
>
> But regarding the ReplacementUtils being only for host-only snippets, I remember the previous discussion but can't say I understood the reason.
>
> Back then you said:
> "The only way to do this is to pass all relevant configuration information into this snippets as @ConstantParameter arguments. This means every snippet that directly or indirectly uses a @Fold method (e.g., in HotSpotReplacementUtils) needs to be modified."
>
> However, in some of our allocation experiments, which we have not pushed back to trunk yet, we were able to reuse some of the utils without problem (we did have to override the threadRegister routine). Were we just lucky? How does the @Fold annotation figure into this?
The @Fold annotation means that during snippet preparation, a call to such a method is executed (via reflection) and the resulting value replaces the invoke. So, if such a method retrieves host specific configuration information, that information is “baked” into the snippet. For most of the snippets, this is configuration information. For example:
@Fold
private static int threadTlabEndOffset() {
return config().threadTlabEndOffset();
}
Configuration in this context means HotSpotVMConfig.
I’m currently pushing changes that all registers used by snippets/stubs are now passed into the snippets/stub. In conjunction, I’ve made HSAIL reuse the HotSpot host snippets, just with a different HotSpotRegistersProvider object. In theory, this means the snippets should be closer to working on HSAIL although I’m sure there’s still unresolved issues.
-Doug
> -----Original Message-----
> From: graal-dev-bounces at openjdk.java.net [mailto:graal-dev-bounces at openjdk.java.net] On Behalf Of Doug Simon
> Sent: Tuesday, November 19, 2013 6:15 PM
> To: graal-dev at openjdk.java.net
> Subject: Re: replacements and getHostProviders
>
>
>
> On 11/20/2013 12:30 AM, Deneau, Tom wrote:
>> Doug or others --
>>
>> Currently the HSAIL backend lazily delegates all replacements to the host.
>> And in HSAILHotSpotBackendFactory we also define our backend registers to be
>> HotSpotRegisters registers = new
>> HotSpotRegisters(Register.None, Register.None, Register.None);
>>
>> expecting that to hit an assert if anything tries to get the threadRegister, heapBaseRegister or stackPointerRegister.
>>
>> But if the method we are compiling in the HSAIL backend starts
>> expanding a snippet that might use the threadRegister, I see that
>> HotSpotReplacementsUtil defines threadRegister() as
>>
>> public static Register threadRegister() {
>> return runtime().getHostProviders().getRegisters().getThreadRegister();
>> }
>>
>> which always goes to the host rather than the backend's registers. So
>> we don't catch an error at compile time but instead at runtime.
>>
>> Is it a mistake that HotSpotReplacementsUtil goes thru the HostProviders?
>
> No - these utils are for host-only snippets. This is why I explained previously that for HSAIL you cannot re-use the snippets that use these utils.
>
> -Doug
>
>
More information about the graal-dev
mailing list