[Mesa-dev] [PATCH] radeonsi: don't overwrite the scratch offset in shader prologs

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Wed Apr 13 17:28:36 UTC 2016


On Wed, Apr 13, 2016 at 7:13 PM, Marek Olšák <maraeo at gmail.com> wrote:
> On Wed, Apr 13, 2016 at 6:18 PM, Bas Nieuwenhuizen
> <bas at basnieuwenhuizen.nl> wrote:
>> If I understand correctly, you want to pass the scratch register from
>> the prolog to the main shader?
>>
>> If so, I don't think this will work correctly, as this will shift all
>> prolog outputs after  the copied input sgprs one sgpr up and puts the
>> scratch offset in the middle. In the main shader we don't compensate
>> and at least with D18941 the scratch is expected after all SGPR
>> arguments, including the arguments generated by the prolog.
>
> What you are saying can't happen because:
> - Prologs don't add SGPR inputs to the main part as far as I can see.

Missed that they only add VGPR inputs, not SGPR inputs.  This patch is

Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

> - The main part is compiled without any assumption about prologs.
> - Prologs can be empty.
> - Prologs must behave in a way that doesn't cause undesirable side
> effects to the main part.
> - Prologs write SGPR outputs, but that's really only a hint for LLVM
> not to overwrite the inputs. For example, if a prolog copies 20 SGPR
> inputs to outputs, the register allocator won't use s0..19. That's the
> only effect.
> - We don't care about the scratch offset in prologs, because prologs
> don't use scratch.
>
> Marek


More information about the mesa-dev mailing list