| 21 | |
| 22 | template<typename T> |
| 23 | void triangle(Param<T> r, CParam<T> in, bool is_upper, bool is_unit_diag) { |
| 24 | constexpr unsigned TX = 32; |
| 25 | constexpr unsigned TY = 8; |
| 26 | constexpr unsigned TILEX = 128; |
| 27 | constexpr unsigned TILEY = 32; |
| 28 | |
| 29 | auto triangle = common::getKernel( |
| 30 | "arrayfire::cuda::triangle", {{triangle_cuh_src}}, |
| 31 | TemplateArgs(TemplateTypename<T>(), TemplateArg(is_upper), |
| 32 | TemplateArg(is_unit_diag))); |
| 33 | |
| 34 | dim3 threads(TX, TY, 1); |
| 35 | |
| 36 | int blocksPerMatX = divup(r.dims[0], TILEX); |
| 37 | int blocksPerMatY = divup(r.dims[1], TILEY); |
| 38 | dim3 blocks(blocksPerMatX * r.dims[2], blocksPerMatY * r.dims[3], 1); |
| 39 | |
| 40 | const int maxBlocksY = getDeviceProp(getActiveDeviceId()).maxGridSize[1]; |
| 41 | blocks.z = divup(blocks.y, maxBlocksY); |
| 42 | blocks.y = divup(blocks.y, blocks.z); |
| 43 | |
| 44 | EnqueueArgs qArgs(blocks, threads, getActiveStream()); |
| 45 | |
| 46 | triangle(qArgs, r, in, blocksPerMatX, blocksPerMatY); |
| 47 | POST_LAUNCH_CHECK(); |
| 48 | } |
| 49 | |
| 50 | } // namespace kernel |
| 51 | } // namespace cuda |
nothing calls this directly
no test coverage detected