<< Chapter < Page | Chapter >> Page > |
A VL of 1 implies that the computation is essentially scalar, and only one complex element can fit in a vector register. An example of such a scenario is when using interleaved double-precision floating-point arithmetic on an SSE2 machine: one 128-bit XMM register is used to store two 64-bit floats that represent the real and imaginary parts of a complex number.
When , the process of generating a program for a hard-coded FFT is as follows:
[link] is a function, written in C++, that performs the first task in the process.
As mentioned earlier, elaborating a topological ordering of nodes with a depth-first recursive structure is much likeactually computing an FFT with a depth-first recursive program (cf.
Listing 3 in Appendix 2 ).
[link] lists the nodes contained in the list `
ns
' after elaborating a size-8
transform by invoking
elaborate(8, 0, 0, 0)
.
CSplitRadix::elaborate(int N, int ioffset, int offset, int stride) {
if(N > 4) {
elaborate(N/2, ioffset, offset, stride+1); if(N/4 >= 4) {
elaborate(N/4, ioffset+(1<<stride), offset+(N/2), stride+2);
elaborate(N/4, ioffset-(1<<stride), offset+(3*N/4), stride+2);
}else{ CNodeLoad *n = new CNodeLoad(this, 4, ioffset, stride, 0);
ns.push_back(assign_leaf_registers(n)); }
for(int k=0;k<N/4;k++) {
CNodeBfly *n = new CNodeBfly(this, 4, k, stride); ns.push_back(assign_body_registers(n,k,N);
} }else if(N==4) {
CNodeLoad *n = new CNodeLoad(this, 4, ioffset, stride, 1); ns.push_back(assign_leaf_registers(n));
}else if(N==2) { CNodeLoad *n = new CNodeLoad(this, 2, ioffset, stride, 1);
ns.push_back(assign_leaf_registers(n)); }
}
Elaborate function for hard-coded conjugate-pair FFT
A transform is divided into sub-transforms with recursive calls at lines 4, 6 and 7, until the base cases of size 2 or size 4 are reached at the leaves of the elaboration. As well as the size-2 and size-4 base cases, which are handled at lines 20-21 and 17-18 (respectively), there is a special case where two size-2 base cases are handled in parallel at lines 9-10. This special case of handling two size-2 base cases as a larger size-4 node ensures that larger transforms are composed of nodes that are homogeneous in size – this is of little utility when emitting code, but it is exploited in "Other vector lengths" where the topological ordering of nodes is vectorized. The second row of [link] is just such a special case, since two size-2 leaf nodes are being computed, and thus the size is listed as 2(x2).
Notification Switch
Would you like to follow the 'Computing the fast fourier transform on simd microprocessors' conversation and receive update notifications?