[Mesa-dev] [PATCH 2/2] radeonsi: move instance divisors into a constant buffer

Nicolai Hähnle nhaehnle at gmail.com
Tue Jun 27 16:50:07 UTC 2017


On 27.06.2017 17:07, Marek Olšák wrote:
> On Tue, Jun 27, 2017 at 9:22 AM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
>> On 27.06.2017 02:14, Marek Olšák wrote:
>>>
>>> From: Marek Olšák <marek.olsak at amd.com>
>>>
>>> Shader key size: 107 -> 47
>>
>>
>> Nice improvement.
>>
>>
>>> Divisors of 0 and 1 are encoded in the shader key. Greater instance
>>> divisors
>>> are loaded from a constant buffer.
>>>
>>> The shader code doing the division is huge. Is it something we need to
>>> worry about? Does any app use instance divisors >= 2?
>>
>>
>> This reminds me of a certain LLVM improvement that I still need to clear.
>>
>> I doubt instance divisors >= 2 are used. As a data point, Vulkan doesn't
>> support it as a feature at all, IIRC.
>>
>> Can we get an optimized monotholic shader variant built for shaders that
>> have to fetch? This should help if anybody ever triggers this, because
> 
> We can't get optimized variants if we want to keep the shader key
> small. If I put all instance divisors into key.opt, it would defeat
> the effect of this patch.

What I meant is an optimized variant that still loads the instance 
divisors from the constant buffer, but compiles the prolog and main 
parts together. That way, LLVM can potentially schedule some of the 
division code before waiting for the loads of other attributes that are 
per-vertex. That should only require a single bit in the key.opt part.

Cheers,
Nicolai


> 
> Marek
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list