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

Function padBorders

src/backend/opencl/kernel/pad_array_borders.hpp:29–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28template<typename T>
29void padBorders(Param out, const Param in, dim4 const& lBPadding,
30 const af_border_type borderType) {
31 using cl::EnqueueArgs;
32 using cl::NDRange;
33 using std::string;
34 using std::vector;
35
36 vector<TemplateArg> tmpltArgs = {
37 TemplateTypename<T>(),
38 TemplateArg(borderType),
39 };
40 vector<string> compileOpts = {
41 DefineKeyValue(T, dtype_traits<T>::getName()),
42 DefineKeyValue(AF_BORDER_TYPE, (int)borderType),
43 DefineKeyValue(AF_PAD_SYM, (int)AF_PAD_SYM),
44 DefineKeyValue(AF_PAD_PERIODIC, (int)AF_PAD_PERIODIC),
45 DefineKeyValue(AF_PAD_CLAMP_TO_EDGE, (int)AF_PAD_CLAMP_TO_EDGE),
46 };
47 compileOpts.emplace_back(getTypeBuildDefinition<T>());
48
49 auto pad = common::getKernel("padBorders", {{pad_array_borders_cl_src}},
50 tmpltArgs, compileOpts);
51
52 NDRange local(PADB_THREADS_X, PADB_THREADS_Y);
53
54 unsigned blk_x = divup(out.info.dims[0], local[0]);
55 unsigned blk_y = divup(out.info.dims[1], local[1]);
56
57 NDRange global(blk_x * out.info.dims[2] * local[0],
58 blk_y * out.info.dims[3] * local[1]);
59
60 pad(EnqueueArgs(getQueue(), global, local), *out.data, out.info, *in.data,
61 in.info, static_cast<int>(lBPadding[0]), static_cast<int>(lBPadding[1]),
62 static_cast<int>(lBPadding[2]), static_cast<int>(lBPadding[3]), blk_x,
63 blk_y);
64 CL_DEBUG_FINISH(getQueue());
65}
66} // namespace kernel
67} // namespace opencl
68} // namespace arrayfire

Callers

nothing calls this directly

Calls 6

TemplateArgClass · 0.85
getNameFunction · 0.85
EnqueueArgsClass · 0.85
getKernelFunction · 0.50
padFunction · 0.50
getQueueFunction · 0.50

Tested by

no test coverage detected