[Mesa-dev] [PATCH 7/8] glsl: Optimize "if (cond) discard; " to a conditional discard.

Matt Turner mattst88 at gmail.com
Tue Feb 24 10:39:53 PST 2015


On Tue, Feb 24, 2015 at 10:31 AM, Connor Abbott <cwabbott0 at gmail.com> wrote:
> On Tue, Feb 24, 2015 at 11:39 AM, Matt Turner <mattst88 at gmail.com> wrote:
>> On Tue, Feb 24, 2015 at 7:53 AM, Jason Ekstrand <jason at jlekstrand.net> wrote:
>>> On Tue, Feb 24, 2015 at 2:19 AM, Kenneth Graunke <kenneth at whitecape.org>
>>> wrote:
>>>>
>>>> st_glsl_to_tgsi and ir_to_mesa have handled conditional discards for a
>>>> long time; the previous patch added that capability to i965.
>>>>
>>>> i965 (Haswell) shader-db stats:
>>>>
>>>> Without NIR:
>>>> total instructions in shared programs: 5792133 -> 5776360 (-0.27%)
>>>> instructions in affected programs:     737585 -> 721812 (-2.14%)
>>>> helped:                                6300
>>>> HURT:                                  68
>>>> GAINED:                                2
>>>>
>>>> With NIR:
>>>> total instructions in shared programs: 5787538 -> 5769569 (-0.31%)
>>>> instructions in affected programs:     767843 -> 749874 (-2.34%)
>>>> helped:                                6522
>>>> HURT:                                  35
>>>> GAINED:                                6
>>>
>>>
>>> What all do you have in that branch?  Last I checked (10 minutes ago), NIR
>>> wasn't beating GLSL IR yet.
>>> --Jason
>>
>> I think you misread. Those stats are just for this patch, and they
>> show NIR generating more instructions than non-NIR.
>
>> Without NIR:
>> total instructions in shared programs: 5792133 -> 5776360 (-0.27%)
>
>> With NIR:
>> total instructions in shared programs: 5787538 -> 5769569 (-0.31%)
>
> So either I fail at reading comprehension, or the stats show us
> generating more instructions with non-NIR than with NIR. Maybe Ken ran
> the comparison on top of his Mesa IR -> NIR series? We get some
> *serious* improvements in the ARB shaders when we run them through
> NIR, so I wouldn't be too surprised if NIR starts beating non-NIR
> after we start using the NIR path for those.

Oh you're right. I was just looking at the affected program numbers it seems.


More information about the mesa-dev mailing list