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

Function calcNrThreads

src/library/blas/gens/nrm2.cpp:180–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180static void
181calcNrThreads(
182 size_t threads[2],
183 const SubproblemDim *subdims,
184 const PGranularity *pgran,
185 const void *args,
186 const void *_extra)
187{
188 DUMMY_ARG_USAGE(subdims);
189 const CLBLASKernExtra *extra = ( CLBLASKernExtra *)_extra;
190 CLBlasKargs *kargs = (CLBlasKargs *)args;
191 SolutionStep *step = container_of(kargs, args, SolutionStep);
192 TargetDevice *kDevice = &(step->device);
193
194 cl_int err;
195 unsigned int numComputeUnits = deviceComputeUnits( (kDevice->id), &err );
196 if(err != CL_SUCCESS) {
197 numComputeUnits = 1;
198 }
199
200 unsigned int vecLen = extra->vecLenA;
201 unsigned int blockSize = pgran->wgSize[0] * pgran->wgSize[1];
202
203 unsigned int wgToSpawn = ((kargs->N + (blockSize*vecLen) - 1)/ (blockSize*vecLen));
204 wgToSpawn = min( wgToSpawn, (numComputeUnits * WORKGROUPS_PER_CU) );
205
206 threads[0] = wgToSpawn * blockSize;
207 threads[1] = 1;
208}
209
210//
211// FIXME: Report correct return value - Needs change in KPRINTF

Callers

nothing calls this directly

Calls 1

deviceComputeUnitsFunction · 0.85

Tested by

no test coverage detected