| 27 | |
| 28 | template<typename T> |
| 29 | void iota(Param out, const af::dim4& sdims) { |
| 30 | constexpr int IOTA_TX = 32; |
| 31 | constexpr int IOTA_TY = 8; |
| 32 | constexpr int TILEX = 512; |
| 33 | constexpr int TILEY = 32; |
| 34 | |
| 35 | std::array<std::string, 2> options = { |
| 36 | DefineKeyValue(T, dtype_traits<T>::getName()), |
| 37 | getTypeBuildDefinition<T>()}; |
| 38 | |
| 39 | auto iota = common::getKernel("iota_kernel", {{iota_cl_src}}, |
| 40 | TemplateArgs(TemplateTypename<T>()), options); |
| 41 | cl::NDRange local(IOTA_TX, IOTA_TY, 1); |
| 42 | |
| 43 | int blocksPerMatX = divup(out.info.dims[0], TILEX); |
| 44 | int blocksPerMatY = divup(out.info.dims[1], TILEY); |
| 45 | cl::NDRange global(local[0] * blocksPerMatX * out.info.dims[2], |
| 46 | local[1] * blocksPerMatY * out.info.dims[3], 1); |
| 47 | |
| 48 | iota(cl::EnqueueArgs(getQueue(), global, local), *out.data, out.info, |
| 49 | static_cast<int>(sdims[0]), static_cast<int>(sdims[1]), |
| 50 | static_cast<int>(sdims[2]), static_cast<int>(sdims[3]), blocksPerMatX, |
| 51 | blocksPerMatY); |
| 52 | CL_DEBUG_FINISH(getQueue()); |
| 53 | } |
| 54 | } // namespace kernel |
| 55 | } // namespace opencl |
| 56 | } // namespace arrayfire |
no test coverage detected