| 518 | |
| 519 | template<typename Ti, typename Tw, typename To> |
| 520 | void mean_first(Param<To> out, Param<Ti> in, Param<Tw> iwt) { |
| 521 | uint threads_x = nextpow2(std::max(32u, (uint)in.info.dims[0])); |
| 522 | threads_x = std::min(threads_x, THREADS_PER_BLOCK); |
| 523 | uint threads_y = THREADS_PER_BLOCK / threads_x; |
| 524 | |
| 525 | uint blocks_x = divup(in.info.dims[0], threads_x * REPEAT); |
| 526 | uint blocks_y = divup(in.info.dims[1], threads_y); |
| 527 | |
| 528 | Array<To> tmpOut = createEmptyArray<To>(dim4()); |
| 529 | Array<Tw> tmpWt = createEmptyArray<Tw>(dim4()); |
| 530 | if (blocks_x > 1) { |
| 531 | tmpOut = createEmptyArray<To>( |
| 532 | {blocks_x, in.info.dims[1], in.info.dims[2], in.info.dims[3]}); |
| 533 | tmpWt = createEmptyArray<Tw>( |
| 534 | {blocks_x, in.info.dims[1], in.info.dims[2], in.info.dims[3]}); |
| 535 | } else { |
| 536 | tmpOut = createParamArray(out, false); |
| 537 | } |
| 538 | |
| 539 | mean_first_launcher<Ti, Tw, To>(tmpOut, tmpWt, in, iwt, blocks_x, blocks_y, |
| 540 | threads_x); |
| 541 | |
| 542 | if (blocks_x > 1) { |
| 543 | Param<Tw> owt; |
| 544 | owt.data = nullptr; |
| 545 | mean_first_launcher<To, Tw, To>(out, owt, tmpOut, tmpWt, 1, blocks_y, |
| 546 | threads_x); |
| 547 | } |
| 548 | } |
| 549 | |
| 550 | template<typename Ti, typename Tw, typename To> |
| 551 | void mean_weighted(Param<To> out, Param<Ti> in, Param<Tw> iwt, int dim) { |
nothing calls this directly
no test coverage detected