On Monday, March 02, 2015 03:03:00 PM Eric Anholt wrote:
> Kenneth Graunke <kenn...@whitecape.org> writes:
> 
> > Generated by the following Coccinelle semantic patch:
> >
> > @@
> > expression E;
> > @@
> > if (
> > -E
> > +unlikely(E)
> >  )
> > { ... _mesa_error(...) ... }
> >
> > Improves performance in OglBatch7 (a CPU-bound microbenchmark) on
> > an i7 4750HQ (Haswell) by 1.08546% +/- 0.519734% (n=292).
> >
> > Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
> 
> Neat!
> 
> I think you're supposed to be able to get the same result by marking
> _mesa_error as attribute cold.  Then nobody can forget to mark their
> conditions as unlikely in the future.

Oh, neat!  I wasn't aware of __attribute__((cold)).

I tried it out and ran some measurements, this time on Baytrail (since
it should more more sensitive to CPU improvements like this).  Oddly,
the results were different:

attribute cold on _mesa_error: -1.60367% +/- 0.43555%
unlikely on all _mesa_error callers: -2.92994% +/- 0.0632798%

I haven't dug into the assembly yet to try and see why.

(It's also bizarre to me that these /hurt/ performance on Baytrail, on
a CPU-limited microbenchmark that never hits _mesa_error, both with or
without the performance governor set.  More mysteries...)

I'll have to try measuring on Haswell.

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to