[macstl-dev] Questions on valarray use : non-aligned buffers

Glen Low glen.low at pixelglow.com
Wed Sep 21 19:16:56 WST 2005

  • Previous message: [macstl-dev] Questions on valarray use : non-aligned buffers
  • Next message: [macstl-dev] Questions on valarray use : non-aligned buffers
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]


Stéphane:

On 20/09/2005, at 11:50 PM, Stéphane Letz wrote:

> It seems that valarray functions do not support non-aligned  
> buffers. It a feature that could make sense to add in a future  
> version?
>
> (Apple vecLib code use scalor code in case of on-aligned buffers..)
>
> http://developer.apple.com/documentation/Performance/Conceptual/ 
> vDSP/ref_chap/chapter_4.1_section_244.html

macstl gets its insane speed partly from not needing to check the  
buffers for alignment. valarray and statarray were defined first and  
since they encapsulate the details of element storage, I could then  
guarantee their alignment. Now that I've defined the refarray class,  
I cannot guarantee the alignment of data beforehand -- in the next  
version I'll likely insert an assert to that effect.

Rather than slow down all macstl code with a runtime check for  
alignment, I'd suggest that you check for alignment yourself and act  
accordingly. E.g. in pseudo-code:

if (a is aligned and b is aligned) then use macstl;
if (a and b are relatively aligned) then peel off the initial  
sequence, and use macstl on the rest;
else use regular arithmetic;

In your case you may find one or two of the above situations never  
arise, so you lose less speed checking for them.

If you need to minimize duplication of arithmetic, you might be able  
to put the refarray code in it's own module, and compile with and  
without Altivec (or SSE),




Cheers, Glen Low


---
pixelglow software | simply brilliant stuff
www.pixelglow.com
aim: pixglen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pixelglow.com/lists/archive/macstl-dev/attachments/20050921/41087ffe/attachment.html

  • Previous message: [macstl-dev] Questions on valarray use : non-aligned buffers
  • Next message: [macstl-dev] Questions on valarray use : non-aligned buffers
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

More information about the macstl-dev mailing list