[Mesa-dev] swizzling in llvmpipe [was: other stuff]

Keith Whitwell keithw at vmware.com
Wed Sep 1 09:47:39 PDT 2010

On Wed, 2010-09-01 at 09:24 -0700, Luca Barbieri wrote:
> > It's an impressive amount of work you did here. I'll comment only on the
> > llvmpipe of the changes for now.
> Thanks for your feedback!
> > Admittedly, always using a floating point is not ideal. A better
> > solution would be to choose a swizzled data type (unorm8, fixed point,
> > float, etc) that matched the color buffer format.
> Exactly, also because we'll want unnormalized formats and 64-bit formats too.
> > But we've been seeing some results which point that the whole color
> > buffer swizzling idea might be overrated: it increases memory bandwidth
> > usage substantially,
> Why?
> It should decrease it due to a lower number of cache misses, thanks to
> having a 2D instead of a 1D neighborhood of a pixel in the cache.

Well, don't forget that you have to populate the tile from somewhere -
so you'll hit all of the same cachelines that the non-swizzled version
would have.  

We still get locality from binning, meaning that all accesses to a group
of cachelines come in a single burst, after which they are done with and
can migrate out of L1 cache according to the processors own mechanisms.
With swizzling, we need to write them out ourselves, and try and do so
without blowing the caches (which is possible with non-temporal writes,
but it's still an extra operation).

A tile covers the same number of cachelines either way, and in normal
rendering the entire tile gets written, even if it's just with the clear

In any case, this isn't really an argument that will be resolved by
discourse - one day someone will do the work to build a non-swizzling
version of llvmpipe & it will either be faster than what's there
currently or not.

It's also worth noting that things like improving texture sampling are
far higher on the list.  We do quite well in non-textured mesa demos
relative to i965 (50% from a single core seems typical), but drop behind
drastically in things like tunnel, etc.  Swizzling or not won't bridge
that gap.


More information about the mesa-dev mailing list