MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / get_out_idx

Function get_out_idx

src/backend/opencl/kernel/where.hpp:30–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28namespace kernel {
29template<typename T>
30static void get_out_idx(cl::Buffer *out_data, Param &otmp, Param &rtmp,
31 Param &in, uint threads_x, uint groups_x,
32 uint groups_y) {
33 using cl::EnqueueArgs;
34 using cl::NDRange;
35 using std::string;
36 using std::vector;
37
38 ToNumStr<T> toNumStr;
39 vector<TemplateArg> tmpltArgs = {
40 TemplateTypename<T>(),
41 };
42 vector<string> compileOpts = {
43 DefineKeyValue(T, dtype_traits<T>::getName()),
44 DefineKeyValue(ZERO, toNumStr(scalar<T>(0))),
45 DefineKeyValue(CPLX, iscplx<T>()),
46 };
47 compileOpts.emplace_back(getTypeBuildDefinition<T>());
48
49 auto getIdx = common::getKernel("get_out_idx", {{where_cl_src}}, tmpltArgs,
50 compileOpts);
51
52 NDRange local(threads_x, THREADS_PER_GROUP / threads_x);
53 NDRange global(local[0] * groups_x * in.info.dims[2],
54 local[1] * groups_y * in.info.dims[3]);
55
56 uint lim = divup(otmp.info.dims[0], (threads_x * groups_x));
57
58 getIdx(EnqueueArgs(getQueue(), global, local), *out_data, *otmp.data,
59 otmp.info, *rtmp.data, rtmp.info, *in.data, in.info, groups_x,
60 groups_y, lim);
61 CL_DEBUG_FINISH(getQueue());
62}
63
64template<typename T>
65static void where(Param &out, Param &in) {

Callers

nothing calls this directly

Calls 5

getNameFunction · 0.85
getIdxFunction · 0.85
EnqueueArgsClass · 0.85
getKernelFunction · 0.50
getQueueFunction · 0.50

Tested by

no test coverage detected