MCPcopy Create free account
hub / github.com/clMathLibraries/clBLAS / calcNrThreads

Function calcNrThreads

src/library/blas/gens/gbmv.cpp:189–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187}
188
189static void
190calcNrThreads(
191 size_t threads[2],
192 const SubproblemDim *subdims,
193 const PGranularity *pgran,
194 const void *args,
195 const void *_extra)
196{
197 int BLOCKSIZE = pgran->wgSize[0] * pgran->wgSize[1]; // 1D Block
198 size_t fM, fN;
199
200 const CLBlasKargs *kargs = (const CLBlasKargs *)args;
201 const CLBLASKernExtra *extra = ( CLBLASKernExtra *)_extra;
202
203 clblasOrder order = ( extra->flags & KEXTRA_COLUMN_MAJOR) ? clblasColumnMajor: clblasRowMajor;
204 clblasTranspose trans = ( extra->flags & KEXTRA_TRANS_A) ? clblasTrans :
205 (( extra->flags & KEXTRA_CONJUGATE_A) ? clblasConjTrans: clblasNoTrans);
206
207 fM = kargs->M;
208 fN = kargs->N;
209 if ( order == clblasColumnMajor )
210 {
211 order = clblasRowMajor;
212 fM = kargs->N;
213 fN = kargs->M;
214 if ( trans == clblasNoTrans)
215 {
216 trans = clblasTrans;
217 }
218 else if ( trans == clblasTrans )
219 {
220 trans = clblasNoTrans;
221 }
222 else // clblasConjTrans
223 {
224 trans = clblasNoTrans;
225 }
226 }
227 if( (kargs->pigFuncID == CLBLAS_SBMV) || (kargs->pigFuncID == CLBLAS_HBMV) ) // Only NT kernel is used
228 {
229 trans = clblasNoTrans;
230 }
231
232 size_t blocks;
233 size_t H = subdims->x;
234 size_t TARGET_ROWS = BLOCKSIZE / H;
235
236 if( trans == clblasNoTrans )
237 {
238 blocks = ((fM - 1)/ TARGET_ROWS) + 1;
239 }
240 else {
241 blocks = ((fN - 1)/ H) + 1;
242 }
243
244 threads[0] = blocks * BLOCKSIZE;
245 threads[1] = 1;
246

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected