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

Function calcNrThreads

src/library/blas/gens/asum.cpp:178–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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