MCPcopy Create free account
hub / github.com/clMathLibraries/clFFT / genTwiddleMath

Function genTwiddleMath

src/library/generator.transpose.cpp:84–117  ·  view source on GitHub ↗

Small snippet of code that multiplies the twiddle factors into the butterfiles. It is only emitted if the plan tells the generator that it wants the twiddle factors generated inside of the transpose

Source from the content-addressed store, hash-verified

82// Small snippet of code that multiplies the twiddle factors into the butterfiles. It is only emitted if the plan tells
83// the generator that it wants the twiddle factors generated inside of the transpose
84clfftStatus genTwiddleMath(const FFTKernelGenKeyParams& params, std::stringstream& transKernel, const std::string& dtComplex, bool fwd)
85{
86
87 clKernWrite(transKernel, 9) << std::endl;
88
89 clKernWrite(transKernel, 9) << dtComplex << " Wm = TW3step( (t_gx_p*32 + lidx) * (t_gy_p*32 + lidy + loop*8) );" << std::endl;
90 clKernWrite(transKernel, 9) << dtComplex << " Wt = TW3step( (t_gy_p*32 + lidx) * (t_gx_p*32 + lidy + loop*8) );" << std::endl;
91
92 clKernWrite(transKernel, 9) << dtComplex << " Tm, Tt;" << std::endl;
93
94 if (fwd)
95 {
96 clKernWrite(transKernel, 9) << "Tm.x = ( Wm.x * tmpm.x ) - ( Wm.y * tmpm.y );" << std::endl;
97 clKernWrite(transKernel, 9) << "Tm.y = ( Wm.y * tmpm.x ) + ( Wm.x * tmpm.y );" << std::endl;
98 clKernWrite(transKernel, 9) << "Tt.x = ( Wt.x * tmpt.x ) - ( Wt.y * tmpt.y );" << std::endl;
99 clKernWrite(transKernel, 9) << "Tt.y = ( Wt.y * tmpt.x ) + ( Wt.x * tmpt.y );" << std::endl;
100 }
101 else
102 {
103 clKernWrite(transKernel, 9) << "Tm.x = ( Wm.x * tmpm.x ) + ( Wm.y * tmpm.y );" << std::endl;
104 clKernWrite(transKernel, 9) << "Tm.y = -( Wm.y * tmpm.x ) + ( Wm.x * tmpm.y );" << std::endl;
105 clKernWrite(transKernel, 9) << "Tt.x = ( Wt.x * tmpt.x ) + ( Wt.y * tmpt.y );" << std::endl;
106 clKernWrite(transKernel, 9) << "Tt.y = -( Wt.y * tmpt.x ) + ( Wt.x * tmpt.y );" << std::endl;
107 }
108
109 clKernWrite(transKernel, 9) << "tmpm.x = Tm.x;" << std::endl;
110 clKernWrite(transKernel, 9) << "tmpm.y = Tm.y;" << std::endl;
111 clKernWrite(transKernel, 9) << "tmpt.x = Tt.x;" << std::endl;
112 clKernWrite(transKernel, 9) << "tmpt.y = Tt.y;" << std::endl;
113
114 clKernWrite(transKernel, 9) << std::endl;
115
116 return CLFFT_SUCCESS;
117}
118
119// Small snippet of code that multiplies the twiddle factors into the butterfiles. It is only emitted if the plan tells
120// the generator that it wants the twiddle factors generated inside of the transpose

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected