| 623 | } |
| 624 | |
| 625 | TYPED_TEST(ReduceByKey, MultiBlockReduceSingleval) { |
| 626 | SUPPORTED_TYPE_CHECK(TypeParam); |
| 627 | array keys = constant(0, 1024 * 1024, s32); |
| 628 | array vals = constant(1, 1024 * 1024, |
| 629 | (af_dtype)af::dtype_traits<TypeParam>::af_type); |
| 630 | |
| 631 | array keyResGold = constant(0, 1); |
| 632 | using promoted_t = typename promote_type<TypeParam, af_sum>::type; |
| 633 | array valsReducedGold = constant( |
| 634 | 1024 * 1024, 1, (af_dtype)af::dtype_traits<promoted_t>::af_type); |
| 635 | |
| 636 | array keyRes, valsReduced; |
| 637 | sumByKey(keyRes, valsReduced, keys, vals); |
| 638 | |
| 639 | ASSERT_TRUE(allTrue<bool>(keyResGold == keyRes)); |
| 640 | ASSERT_ARRAYS_NEAR(valsReducedGold, valsReduced, 1e-5); |
| 641 | } |
| 642 | |
| 643 | void reduce_by_key_test(std::string test_fn) { |
| 644 | vector<dim4> numDims; |
nothing calls this directly
no test coverage detected