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

Function calcNrThreads

src/library/blas/gens/dot.cpp:175–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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