[vsipl++] [patch] Vector assignment, sarsim bits

Mark Mitchell mark at codesourcery.com
Fri Sep 23 20:35:59 UTC 2005


Jules Bergmann wrote:
> A bunch of misc things collected over the past few weeks to optimize and
> parallel sarsim.
> 
> Perhaps the most substantial bit, I changed the Vector assignment
> operators (+=, -=, etc) to go through the same dispatch as 'operator=',
> so that 'A += B' gets evaluated as 'A = A + B'.  This throws away the
> knowledge that it is an update expression, but it lets it get evaluated
> by IPP when possible.  In the long term, we may want to add special
> dispatch for operator assignment so we don't throw this knowledge away.
> 
> Thoughts?

We do the same thing in the compiler; "i += j" is treated exactly like
"i = i + j".  If there are special operations for update you want to
apply them in both cases, i.e., you want to optimize "i = i + j" and "i
= j + i" if the user happens to right it that way.  So, first you turn
"i += j" into "i = i + j"; then you (later) look for the update case.

In VSIPL++, you could do that at runtime-dispatch time.  In a compiler,
there's generally very little runtime dispatch; these things are decided
up front.  That does suggest that, in the long run, you may want to do
compile-time dispatch for the += case if you have a library that
specially supports that case.  But, you'll probably want to do the
runtime dispatch anyhow, and that will get you most of the bang.

So, I think your strategy makes sense.

-- 
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com
(916) 791-8304



More information about the vsipl++ mailing list