[Liboil] Directed optimization
ds at schleef.org
Thu May 18 18:58:27 PDT 2006
On Thu, May 18, 2006 at 04:51:24PM -0400, Marcus Brubaker wrote:
> Maybe this exists already, maybe it doesn't, but I had an idea for
> something which would make liboil considerably more useful, particularly
> for me. Basically, it comes from the idea that different applications
> have different data profiles and optimizing using the same data profiles
> for every app may result in selecting the wrong implementation.
> For instance, I know that in my application the majority of my calls are
> going to be on shorter arrays as I have a large number of 3 element
> arrays of doubles. Selecting the implementation for this case based on
> test lengths of 100 or 1000 doesn't make much sense. E.G., a 4 or 8
> times unrolled version of multsum_f64 will perform much better with n =
> 1000 than a rolled implementation but the opposite is likely true with n
> = 3.
> Would it be (or is it already) possible to provide hints to oil_init
> about the size of data to be expected? Ranging from the individual
> class level up to a global hint, this information could be immensely
> useful if there was a simple interface to do such a thing.
> Any thoughts? I might be able to spend some time on this if someone
> thinks it's a good idea and could provide a pointer towards how best to
> implement it.
This goes into the area of user- (or rather, app-) supplied classes.
I'd like to figure out how to do this well, but it mostly appears to
be a Hard Problem. In particular, the 0.3 ABI is screwed up in ways
to make user-supplied classes nearly impossible. 0.4 should fix that.
Your suggestion is related to user-supplied classes because the way
I'd like to implement it is for the user (i.e., app) to specify a
private class (say, my_multsum_f64) that depends on oil_multsum_f64,
inherits all of its implementations, but may have a different test
function (say, one that ignores slight inaccuracies) or different
test parameters, such as n being a small number.
Big Kitten LLC (http://www.bigkitten.com/) -- data acquisition on Linux
More information about the Liboil