| 384 | |
| 385 | template<typename Ti, typename Tw, typename To> |
| 386 | void mean_first(Param<To> out, CParam<Ti> in, CParam<Tw> iwt) { |
| 387 | uint threads_x = nextpow2(std::max(32u, (uint)in.dims[0])); |
| 388 | threads_x = std::min(threads_x, THREADS_PER_BLOCK); |
| 389 | uint threads_y = THREADS_PER_BLOCK / threads_x; |
| 390 | |
| 391 | uint blocks_x = divup(in.dims[0], threads_x * REPEAT); |
| 392 | uint blocks_y = divup(in.dims[1], threads_y); |
| 393 | |
| 394 | Array<To> tmpOut = createEmptyArray<To>(dim4()); |
| 395 | Array<Tw> tmpWt = createEmptyArray<Tw>(dim4()); |
| 396 | if (blocks_x > 1) { |
| 397 | tmpOut = createEmptyArray<To>( |
| 398 | {blocks_x, in.dims[1], in.dims[2], in.dims[3]}); |
| 399 | tmpWt = createEmptyArray<Tw>( |
| 400 | {blocks_x, in.dims[1], in.dims[2], in.dims[3]}); |
| 401 | } else { |
| 402 | tmpOut = createParamArray(out, false); |
| 403 | } |
| 404 | |
| 405 | mean_first_launcher<Ti, Tw, To>(tmpOut, tmpWt, in, iwt, blocks_x, blocks_y, |
| 406 | threads_x); |
| 407 | |
| 408 | if (blocks_x > 1) { |
| 409 | Param<Tw> owt; |
| 410 | owt.ptr = NULL; |
| 411 | mean_first_launcher<To, Tw, To>(out, owt, tmpOut, tmpWt, 1, blocks_y, |
| 412 | threads_x); |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | template<typename Ti, typename Tw, typename To> |
| 417 | void mean_weighted(Param<To> out, CParam<Ti> in, CParam<Tw> iwt, int dim) { |
nothing calls this directly
no test coverage detected