freepooma-devel
[Top][All Lists]
Advanced

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

Re: [Freepooma-devel] [PATCH] Optimize Vector arithmetic


From: Richard Guenther
Subject: Re: [Freepooma-devel] [PATCH] Optimize Vector arithmetic
Date: Wed, 24 Nov 2004 11:24:31 +0100 (CET)

On Tue, 23 Nov 2004, Richard Guenther wrote:

> Hi!
>
> Due to some oversight(??), Vector arithmetic is severely pessimized by
> explicit creation of temporary Vectors.  The attached patch "fixes" that
> by removing the casts to Vector<...,Full> from the VectorOperators.
> This tests ok, it even generates the same code as handwritten loops, but
> there has to be a reason the code was like it was?
>
> So, please test this on your favorite Vector-using code.  And report
> breakage and/or performance.

It seems it breaks a lot in several interesting ways:

- array_test18: You cannot use Stencil<> with

   A::Element_t
   operator()(Array<Dim, Vector<Dim, T, BinaryVectorOp<...> >,
              ExpressionTag<> >& a, int)
   {
     return a(i)-a(i-1);
   }

  obviously, because we cannot assign different Vector<BinaryVectorOp>
  to each other.  Can be fixed by enforcing a StencilFunctor::Element_t
  typedef and using Vector<.., Full> there, as we can automatically
  convert to this.

- Array.h::assign(Array<>, Vector<..., BinaryVectorOp>) does no longer
  work, because using a ConstantFunction with BinaryVectorOp is a no-no.
  Fixed by specializing assign for Vector<> and using Vector<...,Full>
  for the ConstantFunction type.  We'd want this anyway for performance
  reasons.

- Testsuite problems with templating things on Vector<Dim> or
  Vector<Dim, T> and not Vector<Dim, T, E>.  Easily fixed, done.

- BinaryVectorOp Engines need operator()(int).  Easily fixed.

- A lot of funny SIGSEGVs in testcases.  Maybe compiler problems (again).

But it may work for your day-to-day work (and give a nice speedup there).

Richard.





reply via email to

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