| 1576 | } |
| 1577 | |
| 1578 | void ExpertPool::run_split(ExpertJob* jobs, int n) { |
| 1579 | if (n <= 0) return; |
| 1580 | if (n > kMaxSplit || n_ == 1 || expert_oracle_q8_0_enabled()) { run(jobs, n); return; } |
| 1581 | const auto t0 = std::chrono::steady_clock::now(); |
| 1582 | jobs_ = jobs; |
| 1583 | const int threads = n_ + (host_works_ ? 1 : 0); |
| 1584 | // about three tasks per thread in each phase, so the tail is short |
| 1585 | parts_a_ = (std::max)(1, (3 * threads + n - 1) / n); |
| 1586 | parts_b_ = parts_a_; |
| 1587 | run_phase(1, n * parts_a_); |
| 1588 | for (int e = 0; e < n; ++e) act_quant_q8_1(split_[(size_t) e].ff, FF, split_[(size_t) e].a2); |
| 1589 | run_phase(2, n * parts_b_); |
| 1590 | mode_ = 0; |
| 1591 | ms_drain_ += std::chrono::duration<double, std::milli>(std::chrono::steady_clock::now() - t0).count(); |
| 1592 | } |
| 1593 | |
| 1594 | int ExpertPool::phase_tasks(int64_t rows) const { |
| 1595 | return tasks_ == 0 ? 3 * (n_ + (host_works_ ? 1 : 0)) : (int) (std::min)(rows, (int64_t) tasks_); |