Patches item #1931686, was opened at 2008-04-01 14:54 Message generated for change (Comment added) made by millerpuckette You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1931686...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: puredata Group: feature Status: Open Resolution: None Priority: 5 Private: No Submitted By: Thomas Grill (xovo) Assigned to: Miller Puckette (millerpuckette) Summary: functionality for 128-bit-aligned memory (against pd-0.41-4)
Initial Comment: This patch implements public functions for allocation of 128-bit aligned memory. For allocation of all signals and buffers within PD these functions are consequently used. 128-bit alignment can speed up vector calculations, esp. if used with SIMD (also with autovectorization techniques). The infrastructure has been part of devel_0_39 and has now been ported to vanilla pd.
----------------------------------------------------------------------
Comment By: Miller Puckette (millerpuckette)
Date: 2010-07-24 20:55
Message: I need to stud this more -- probably posix_memalign() can be used. But how do "modern" compilers treat this? Maybe we can get vecorization w/o special code now?
----------------------------------------------------------------------
Comment By: Thomas Grill (xovo) Date: 2008-04-14 14:47
Message: Logged In: YES user_id=350252 Originator: YES
Here's an incremental patch which checks for null pointers in freealignedbytes and resizealignedbytes. It's obviously necessary to do that. File Added: x-0.41.4-128bit_alignment-2.diff
----------------------------------------------------------------------
Comment By: Thomas Grill (xovo) Date: 2008-04-03 07:15
Message: Logged In: YES user_id=350252 Originator: YES
Yes, you are right, but the current implementation wastes a bit of memory which might not be acceptable (although it's only 4-19 bytes per block). The implementation is portable because it relies on the existing functions, but there's also the possibility to rewrite getbytes() in a way that the system provides allocated memory right from the start. Under OS X it seems that plain malloc is ok for that (http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/mall...) under general POSIX there seems to be memalign (http://man-wiki.net/index.php/3:posix_memalign) , under Windows there's _aligned_malloc (http://msdn2.microsoft.com/en-us/library/8z34s9c6.aspx). However, i didn't want to deal with platform issues.
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave) Date: 2008-04-03 06:45
Message: Logged In: YES user_id=27104 Originator: NO
This sounds like a very useful addition. I have one minor question about the patch implementation. It seems that it would be more manageable if the new functions had the same name as the originals, then the original and the optimized versions could be swapped for each other with a single #ifdef which could be controlled by a ./configure flag.
Is there some code where you don't want to use the aligned functions? Redefining the original names would automatically give all the externals aligned memory as well.
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1931686...