MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / findPlan

Function findPlan

src/backend/opencl/clfft.cpp:95–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95SharedPlan findPlan(clfftLayout iLayout, clfftLayout oLayout, clfftDim rank,
96 size_t *clLengths, size_t *istrides, size_t idist,
97 size_t *ostrides, size_t odist, clfftPrecision precision,
98 size_t batch) {
99 // create the key string
100 char key_str_temp[64];
101 sprintf(key_str_temp, "%d:%d:%d:", iLayout, oLayout, rank);
102
103 string key_string(key_str_temp);
104
105 /* WARNING: DO NOT CHANGE sprintf format specifier */
106 for (int r = 0; r < rank; ++r) {
107 sprintf(key_str_temp, SIZE_T_FRMT_SPECIFIER ":", clLengths[r]);
108 key_string.append(std::string(key_str_temp));
109 }
110
111 if (istrides != NULL) {
112 for (int r = 0; r < rank; ++r) {
113 sprintf(key_str_temp, SIZE_T_FRMT_SPECIFIER ":", istrides[r]);
114 key_string.append(std::string(key_str_temp));
115 }
116 sprintf(key_str_temp, SIZE_T_FRMT_SPECIFIER ":", idist);
117 key_string.append(std::string(key_str_temp));
118 }
119
120 if (ostrides != NULL) {
121 for (int r = 0; r < rank; ++r) {
122 sprintf(key_str_temp, SIZE_T_FRMT_SPECIFIER ":", ostrides[r]);
123 key_string.append(std::string(key_str_temp));
124 }
125 sprintf(key_str_temp, SIZE_T_FRMT_SPECIFIER ":", odist);
126 key_string.append(std::string(key_str_temp));
127 }
128
129 sprintf(key_str_temp, "%d:" SIZE_T_FRMT_SPECIFIER,
130 static_cast<int>(precision), batch);
131 key_string.append(std::string(key_str_temp));
132
133 PlanCache &planner = opencl::fftManager();
134 SharedPlan retVal = planner.find(key_string);
135
136 if (retVal) { return retVal; }
137
138 auto temp = make_unique<PlanType>();
139
140 // getContext() returns object of type Context
141 // Context() returns the actual cl_context handle
142 CLFFT_CHECK(clfftCreateDefaultPlan(temp.get(), opencl::getContext()(), rank,
143 clLengths));
144
145 // complex to complex
146 if (iLayout == oLayout) {
147 CLFFT_CHECK(clfftSetResultLocation(*temp, CLFFT_INPLACE));
148 } else {
149 CLFFT_CHECK(clfftSetResultLocation(*temp, CLFFT_OUTOFPLACE));
150 }
151
152 CLFFT_CHECK(clfftSetLayout(*temp, iLayout, oLayout));

Callers 3

fft_inplaceFunction · 0.70
fft_r2cFunction · 0.70
fft_c2rFunction · 0.70

Calls 6

findMethod · 0.80
resetMethod · 0.80
pushMethod · 0.80
getContextFunction · 0.50
getQueueFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected