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

Function reorder

src/backend/opencl/kernel/reorder.hpp:26–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24namespace kernel {
25template<typename T>
26void reorder(Param out, const Param in, const dim_t* rdims) {
27 constexpr int TX = 32;
28 constexpr int TY = 8;
29 constexpr int TILEX = 512;
30 constexpr int TILEY = 32;
31
32 std::array<TemplateArg, 1> targs = {
33 TemplateTypename<T>(),
34 };
35 std::array<std::string, 2> options = {
36 DefineKeyValue(T, dtype_traits<T>::getName()),
37 getTypeBuildDefinition<T>()};
38
39 auto reorderOp =
40 common::getKernel("reorder_kernel", {{reorder_cl_src}}, targs, options);
41
42 cl::NDRange local(TX, TY, 1);
43
44 int blocksPerMatX = divup(out.info.dims[0], TILEX);
45 int blocksPerMatY = divup(out.info.dims[1], TILEY);
46 cl::NDRange global(local[0] * blocksPerMatX * out.info.dims[2],
47 local[1] * blocksPerMatY * out.info.dims[3], 1);
48
49 reorderOp(cl::EnqueueArgs(getQueue(), global, local), *out.data, *in.data,
50 out.info, in.info, static_cast<int>(rdims[0]),
51 static_cast<int>(rdims[1]), static_cast<int>(rdims[2]),
52 static_cast<int>(rdims[3]), blocksPerMatX, blocksPerMatY);
53 CL_DEBUG_FINISH(getQueue());
54}
55} // namespace kernel
56} // namespace opencl
57} // namespace arrayfire

Callers 1

reorderOutputHelperFunction · 0.70

Calls 4

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

Tested by

no test coverage detected