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

Function unwrap

src/backend/cuda/kernel/unwrap.hpp:24–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23template<typename T>
24void unwrap(Param<T> out, CParam<T> in, const int wx, const int wy,
25 const int sx, const int sy, const int px, const int py,
26 const int dx, const int dy, const int nx, const bool is_column) {
27 auto unwrap = common::getKernel(
28 "arrayfire::cuda::unwrap", {{unwrap_cuh_src}},
29 TemplateArgs(TemplateTypename<T>(), TemplateArg(is_column)));
30
31 dim3 threads, blocks;
32 int reps;
33
34 if (is_column) {
35 int TX = std::min(THREADS_PER_BLOCK, nextpow2(out.dims[0]));
36
37 threads = dim3(TX, THREADS_PER_BLOCK / TX);
38 blocks = dim3(divup(out.dims[1], threads.y), out.dims[2] * out.dims[3]);
39 reps = divup((wx * wy),
40 threads.x); // is > 1 only when TX == 256 && wx * wy > 256
41 } else {
42 threads = dim3(THREADS_X, THREADS_Y);
43 blocks = dim3(divup(out.dims[0], threads.x), out.dims[2] * out.dims[3]);
44
45 reps = divup((wx * wy), threads.y);
46 }
47
48 const int maxBlocksY = getDeviceProp(getActiveDeviceId()).maxGridSize[1];
49 blocks.z = divup(blocks.y, maxBlocksY);
50 blocks.y = divup(blocks.y, blocks.z);
51
52 EnqueueArgs qArgs(blocks, threads, getActiveStream());
53
54 unwrap(qArgs, out, in, wx, wy, sx, sy, px, py, dx, dy, nx, reps);
55 POST_LAUNCH_CHECK();
56}
57
58} // namespace kernel
59} // namespace cuda

Callers

nothing calls this directly

Calls 7

TemplateArgsFunction · 0.85
TemplateArgClass · 0.85
nextpow2Function · 0.85
getActiveStreamFunction · 0.85
getKernelFunction · 0.50
minFunction · 0.50
getActiveDeviceIdFunction · 0.50

Tested by

no test coverage detected