[PD-dev] gcc 4.1 and auto-vectorization

Thomas Grill gr at grrrr.org
Mon Nov 20 00:16:51 CET 2006

Am 19.11.2006 um 22:57 schrieb Mathieu Bouchard:

> On Sun, 19 Nov 2006, Thomas Grill wrote:
>> Am 18.11.2006 um 22:16 schrieb Mathieu Bouchard:
>>> perhaps it would be a good start to reimplement newbytes(n) using  
>>> memalign(16,n) instead of malloc(n).
>> A few years ago i introduced aligned memory allocation in the pd- 
>> devel branch.
> I see how you did it. Is it because posix_memalign() isn't as  
> portable as we'd like it to be? (I wrote "memalign" by mistake,  
> which is the name of a deprecated function that does a similar job)
> It seems like a lot of memory is allocated unaligned. Is that  
> normal? If the memory allocations you've align cover the most speed- 
> critical memory, then why did Tim say that about memory alignment?

The point is that i only introduced and used the aligned memory  
functions for the SIMD codelets, which are used for DSP and array  
processing. I'm sure that there are aligned memory allocation  
functions for either platform (maybe not necessarily  
posix_memalign...), but i wanted to stay as close as possible to the  
original PD memory functions.
I don't think it makes much sense to use aligned memory for anything  
else than DSP and tables. If one wanted to use it with auto- 
vectorization the header code would be much the same as the one in  
the DSP perform functions, with some casting to aligned pointers, so  
that the compiler knows about it. Aliasing is another thing, though.


More information about the Pd-dev mailing list