We can not just simply merging two same split For example, shape = [6], we are trying to merge [2, 2]: (S0, S0) -> [4]: S0 For each rank, [4]: S0 has number of data: 2, 2, 1, 1 For each rank, [2]: S0 has number of data: 3, 3 For each rank, [2, 2]: (S0, S0) has number of data: 2, 1, 2, 1 Thus {[2, 2]: (S0, S0)} != {[4]: S0} for shape [6] However {[2, 2]: (S0, S0)} == {[4]: S0} for shape [4], [5], [
| 395 | // More specifically, {[a, b]: (Si, Si)} == {[a*b]: Si} if and only if |
| 396 | // shape value % (a * b) == 0, 1, a*b - 1 |
| 397 | bool CanMergeSplit(int32_t shape_value, int32_t merged_split_hierarchy_value) { |
| 398 | int32_t remainder = shape_value % merged_split_hierarchy_value; |
| 399 | if (remainder <= 1 || remainder == merged_split_hierarchy_value - 1) { |
| 400 | return true; |
| 401 | } else { |
| 402 | return false; |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | } // namespace |
| 407 |
no outgoing calls
no test coverage detected