octave-maintainers
[Top][All Lists]
Advanced

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

FFT slowup in 2.1.55


From: David Bateman
Subject: FFT slowup in 2.1.55
Date: Fri, 27 Feb 2004 15:16:43 +0100
User-agent: Mutt/1.4.1i

Ok, due to the alignment issues in FFTW 3.x I've found I can get
into the case where I'm calling exactly the same FFT, but the 
alignment changes each time I call the function. The planner in
oct-fftw.cc then recreates the plan each time, which is slow.
For small FFT's [I've tested fft(randn(64,45))], this results in 
a significant slowup.

I've tried two lines of attack to fix this problem. The first is to
try and force the 16-byte alignment in "class Array<T>" using

#ifdef HAVE_ATTRIB_ALIGN
    typedef T alignedT __attribute__ ((aligned(16)));
#else
    typedef T alignedT;
#endif

where HAVE_ATTRIB_ALIGN is a configure time option. I then replace the
"new T" in ArrayRep with "new alignedT". This appears to only give me
8-byte alignment, but I've read in the gcc manual that ld might not be
able to do better than 8-byte alignment, so it is not clear to me if

1) The code I've done is correct, but the linker won't give me 16-byte
alignment, or
2) I've missing somewhere which also needs 16-byte alignment.

Does anyone have any ideas on this?

Secondly, I force the use of FFTW_UNALIGNED when the data is not
aligned on a 16 byte boundary. I can then reuse this plan with any
unaligned data. Also, to prevent the continual switching between an
aligned and unaligned plan, if I have a good unaligned good, I don't
recreate a plan even if the data is now aligned. 

With this change I've managed to fix the symptoms of the problem, and
have regained the speed of FFTW3. However, I'd really like to get the
16-byte alignment working, so any clues here would be appreciated.

I attach a patch, that can probably be applied as is...

Regards
David


-- 
David Bateman                                address@hidden
Motorola CRM                                 +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 1 69 35 77 01 (Fax) 
91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

Attachment: patch
Description: Text document


reply via email to

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