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

Function calcNrThreads

src/library/blas/gens/axpy_reg.cpp:172–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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