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

Method OffsetCalc

src/library/generator.stockham.cpp:2900–2939  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2898 }
2899
2900 inline std::string OffsetCalc(const std::string &off, bool input = true, bool rc_second_index = false)
2901 {
2902 std::string str;
2903
2904 const size_t *pStride = input ? params.fft_inStride : params.fft_outStride;
2905
2906 std::string batch;
2907 if(r2c2r && !rcSimple)
2908 {
2909 batch += "(batch*"; batch += SztToStr(2*numTrans);
2910 if(rc_second_index) batch += " + 1";
2911 else batch += " + 0";
2912
2913 if(numTrans != 1) { batch += " + 2*(me/"; batch += SztToStr(workGroupSizePerTrans); batch += "))"; }
2914 else { batch += ")"; }
2915 }
2916 else
2917 {
2918 if(numTrans == 1) { batch += "batch"; }
2919 else { batch += "(batch*"; batch += SztToStr(numTrans);
2920 batch += " + (me/"; batch += SztToStr(workGroupSizePerTrans); batch += "))"; }
2921 }
2922
2923 str += "\t"; str += off; str += " = ";
2924 std::string nextBatch = batch;
2925 for(size_t i=(params.fft_DataDim - 1); i>1; i--)
2926 {
2927 size_t currentLength = 1;
2928 for(int j=1; j<i; j++) currentLength *= params.fft_N[j];
2929
2930 str += "("; str += nextBatch; str += "/"; str += SztToStr(currentLength);
2931 str += ")*"; str += SztToStr(pStride[i]); str += " + ";
2932
2933 nextBatch = "(" + nextBatch + "%" + SztToStr(currentLength) + ")";
2934 }
2935
2936 str += nextBatch; str += "*"; str += SztToStr(pStride[1]); str += ";\n";
2937
2938 return str;
2939 }
2940
2941 public:
2942 Kernel( const FFTKernelGenKeyParams &paramsVal) :

Callers

nothing calls this directly

Calls 1

SztToStrFunction · 0.85

Tested by

no test coverage detected