[Mesa-dev] [PATCH 3/4] radeonsi: add more unlikely() uses into si_draw_vbo

Rob Clark robdclark at gmail.com
Wed Sep 7 01:19:57 UTC 2016


On Tue, Sep 6, 2016 at 8:23 PM, Michel Dänzer <michel at daenzer.net> wrote:
> On 06/09/16 08:33 PM, Marek Olšák wrote:
>> On Sep 6, 2016 12:03 PM, "Michel Dänzer" <michel at daenzer.net
>> <mailto:michel at daenzer.net>> wrote:
>>> On 06/09/16 06:04 PM, Marek Olšák wrote:
>>> > On Tue, Sep 6, 2016 at 3:54 AM, Michel Dänzer <michel at daenzer.net
>> <mailto:michel at daenzer.net>> wrote:
>>> >> On 06/09/16 07:46 AM, Marek Olšák wrote:
>>> >>> From: Marek Olšák <marek.olsak at amd.com <mailto:marek.olsak at amd.com>>
>>> >>
>>> >> Did you measure any significant performance boost with this change?
>>> >
>>> > I didn't measure anything.
>>> >
>>> >> Otherwise, using (un)likely can be bad because it can defeat the CPU's
>>> >> branch prediction, which tends to be pretty good these days.
>>> >
>>> > I'm not an expert on that, but it doesn't seem to be the case
>>> > according to other people's comments here.
>>>
>>> My main point (which Gustaw seems to agree with) is that (un)likely
>>> should only be used when measurements show that they have a positive
>> effect.
>>
>> I agree with you, but do you always measure the effect of unlikely? I
>> almost never do and I just use it instinctively like most people do. Due
>> to our manpower constraints, we can't even afford to measure performance
>> for much bigger changes than this.
>
> So let's spend our manpower on more important things than (un)likely
> annotations. :)
>

I guess it is still a reasonable thing to use annotations in places
that should really be gl edge cases where we don't want to penalize
if(false) case by jumping over multiple cache lines of instructions
(ie. I still plan to use it for the if(unlikely(samplerExternalOES))
stuff to deal with YUV external images).. but in cases where there is
more doubt probably not worth using them.

BR,
-R


More information about the mesa-dev mailing list