| 26 | |
| 27 | template<typename T> |
| 28 | void 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 |
nothing calls this directly
no test coverage detected