[cairo] Re: [RFC] altivec optimization

Luca Barbato lu_zero at gentoo.org
Wed Jan 24 12:34:06 PST 2007


Carl Worth wrote:
> 
> That's way too short an answer for me to take you very seriously.

I was in hurry, sorry ^^;

> 
> The liboil approach is very interesting in that it has a good
> framework for providing alternate implementations of the same
> functionality, and it has tests to ensure that all the implementations
> match the behavior of the reference version. And very significantly,
> liboil measures and selects the fastest of the several implementations
> at run-time.

Using self patching code? Interesting, but pretty worthless for my 
purpose... My arch (PowerPC/Power) has just one fast implementation 
possible ^^; (I know spe and spu exist but one is for embedded cpus that 
are quite strange, the other requires an infrastructure that is quite 
different...)

> 
> That dynamic selection is very interesting, since it can be quite a
> difficult to manually select between various functions and be assured
> that one ends up with the optimal choice, (just take a look through
> pixman's nightmare of switch statements to see where that road can end
> up).

I fail to see how it could help. (complexity+complexity means double 
complexity, not less)

> 
> Now, I would still like to see liboil improved so that the entire
> overhead of measurement isn't taken at startup time by every
> liboil-using application. It seems that there's an opportunity to
> benefit from a good cache here somewhere.

Argh so it isn't self patching code but constant startup overhead!? ok, 
another reason to say no.

> 
> But I definitely see a lot of potential that liboil has for helping
> out a library like cairo. And particularly so as David has already
> done the work to implement some of the functionality that cairo
> actually wants inside the liboil framework. So I've been waiting for
> someone to try picking this work up and seeing what it could do for
> cairo.

I'd consider liboil for cairo IFF:

- provides a way to inline functions where I want them. (it can't, the 
much despised macstl does)
- doesn't try to be too smart as you pointed already in this email
- doesn't chrash like the last time I had to try it. (hopefully now it 
is more mature)

> 
> What exactly did you mean by your very curt "no"?

I don't like overly complex libraries with strange overheads and 
unexpected behaviors and I'd rather avoid having them used widely till 
they aren't rock solid.

Liboil is great if you need some quick way to have your code running a 
bit faster and you don't have the time or the will to put more attention 
than picking a function from a list, since I'm doing altivec 
optimizations partly because I use cairo and I'd like to have it a bit 
more fast, partly because I have fun using altivec, probably I'll 
contribute some code to liboil lately, but I won't use it for cairo.

So, no on technical merits (too complex and cumbersome IMHO), no on 
personal taste.

lu

-- 

Luca Barbato

Gentoo/linux Gentoo/PPC
http://dev.gentoo.org/~lu_zero



More information about the cairo mailing list