[vsipl++] [patch] Some enhancements to the FFT code.

Jules Bergmann jules at codesourcery.com
Mon Feb 27 13:50:25 UTC 2006


Stefan Seefeld wrote:
> Please find attached two patches (folded into one):
> 
> The SAL FFT backend uses a number of different
> functions that take temporary workspace, to avoid
> the input array to be clobbered. This is a first
> step to allow the frontend not to copy data in
> some (the most frequent ?) cases.
> 
> The second part of the patch is the addition of
> tests to tests/fft.cpp that specifically targets
> the Complex_split_fmt. It passes with builtin fft
> (i.e. FFTW), and I'm planning to add support for
> split format to the SAR backend in the coming
> days.
> 
> Regards,
>         Stefan

Stefan,

I'm not sure if the mercury FFTs have any stated alignment requirements 
for their temporary buffer, but to be safe we should allocate with 
either a 16-byte (altivec) or 32-byte (cache line) alignment using the 
alloc_aligned function.

Otherwise, this looks good, please check it in.

				-- Jules



> 
> 
> ------------------------------------------------------------------------

>    VSIP_THROW((std::bad_alloc))
>  {
>    self.is_forward_ = (expn == -1);
> +  self.buffer_ = new Complex_of<inT>::type[dom.size()];

      int const sal_alignment = 16;
      self.buffer_ = vsip::impl::alloc_align(sal_alignment,
                                             dom.size() * sizeof(...));

>    unsigned long max = sal::log2n<D>::translate(dom, sd, self.size_);
>    sal::fft_planner<D, inT, outT>::create(self.plan_, max);
>  }
> @@ -202,6 +203,7 @@
>  destroy(Fft_core<D, inT, outT, doFftm>& self) VSIP_THROW((std::bad_alloc))
>  {
>    sal::fft_planner<D, inT, outT>::destroy(self.plan_);
> +  delete [] self.buffer_;

      vsip::impl::free_align(self.buffer_);
>  }
>  


-- 
Jules Bergmann
CodeSourcery
jules at codesourcery.com
(650) 331-3385 x705



More information about the vsipl++ mailing list