Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • To: Jules Bergmann <jules@xxxxxxxxxxxxxxxx>
  • Subject: Re: [vsipl++] [patch] Vector assignment, sarsim bits
  • From: Mark Mitchell <mark@xxxxxxxxxxxxxxxx>
  • Date: Fri, 23 Sep 2005 13:35:59 -0700

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@xxxxxxxxxxxxxxxx
(916) 791-8304