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

Function range

src/backend/opencl/kernel/range.hpp:28–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26
27template<typename T>
28void range(Param out, const int dim) {
29 constexpr int RANGE_TX = 32;
30 constexpr int RANGE_TY = 8;
31 constexpr int RANGE_TILEX = 512;
32 constexpr int RANGE_TILEY = 32;
33
34 std::array<TemplateArg, 1> targs = {TemplateTypename<T>()};
35 std::array<std::string, 2> options = {
36 DefineKeyValue(T, dtype_traits<T>::getName()),
37 getTypeBuildDefinition<T>()};
38
39 auto rangeOp =
40 common::getKernel("range_kernel", {{range_cl_src}}, targs, options);
41
42 cl::NDRange local(RANGE_TX, RANGE_TY, 1);
43
44 int blocksPerMatX = divup(out.info.dims[0], RANGE_TILEX);
45 int blocksPerMatY = divup(out.info.dims[1], RANGE_TILEY);
46 cl::NDRange global(local[0] * blocksPerMatX * out.info.dims[2],
47 local[1] * blocksPerMatY * out.info.dims[3], 1);
48
49 rangeOp(cl::EnqueueArgs(getQueue(), global, local), *out.data, out.info,
50 dim, blocksPerMatX, blocksPerMatY);
51 CL_DEBUG_FINISH(getQueue());
52}
53} // namespace kernel
54} // namespace opencl
55} // namespace arrayfire

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected