freepooma-devel
[Top][All Lists]
Advanced

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

Re: [Freepooma-devel] another stupid thought


From: Richard Guenther
Subject: Re: [Freepooma-devel] another stupid thought
Date: Mon, 11 Apr 2005 17:55:49 +0200 (CEST)

On Mon, 11 Apr 2005, Roman Krylov wrote:

> Hi again.
> Does Array<N,Vector<n,T> > have regular memory alignment for it's data
> so that if I have a pointer to the first elment(of T type), I can
> calculate pointer to 2nd and so on?

Yes.

> It's all about autovect :)
>     they say It supports strided access.
> And maybe it'll be advantageous sometimes to make some operations like
> += or *= without PETE?
> These operations can not avoid temporaries with PETE, do I understand it
> right?

PETE does not do anything with the Tiny classes.  It only decomposes
operations on Array<N, Vector<> > to individual vector operations, but
not down to the vector components.  So in the end somewhere PETE
invokes f.i. operator+(Vector<3>, Vector<3>).

> So if I have N '+=' I have N {tmp = LHS + RHS; LHS=tmp} so if RHS is
> some complex expression which can benefit from PETE,
> if it won't be bunched with LHS, there'll be no big loss, but I can
> benefit from vectorizing first statement in {...}.

You can try overloading the alternate VectorEngine constructor from
VectorEngine:

  // Copy from an argument of arbitrary type.
  // The arg must be indexable using VectorElem.
  template<class X>
    inline explicit VectorEngine(const X& x)
      {
        VectorAssign< VectorEngine<D,T,Full> , X , OpAssign, 0, D >
          ::apply(*this,x,OpAssign());
      }

This gets f.i. VectorEngine<3, double, BinaryVectorOp<Vector<3, double>,
Vector<3, double>, OpAdd> >

So in essence, you can provide custom implementations for
LHS = RHS1 op RHS2 (or of course UnaryVectorOp operations).
Of course you need to do this for different Dim and T, and in the
end the compiler may be too much confused by casts.  Who knows without
trying it ;)

With the current setup you are sure to not get other VectorOp engines
for the arguments.

> Thanks.
> Roman.
>
> P.S. Maybe it'll be good to add new mailing list for crazy ideas ? :)
> not to clutter freepooma-devel

No, it's freepooma-devel, after all ;)  Just try to keep the attachements
out of the replies.

Richard.

--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]