MCPcopy Create free account
hub / github.com/Niko1221/Strata / run_split_multi

Method run_split_multi

engine/src/kernels/cpu/pool.cpp:1598–1635  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1596}
1597
1598void ExpertPool::run_split_multi(ExpertJobMulti* jobs, int n) {
1599 if (n <= 0) return;
1600 if (n > kMaxSplitMulti || expert_oracle_q8_0_enabled()) {
1601 // one token at a time through the single-token path (the oracle contract has no multi kernel)
1602 std::vector<ExpertJob> single;
1603 for (int e = 0; e < n; ++e)
1604 for (int t = 0; t < jobs[e].nt; ++t) {
1605 ExpertJob j;
1606 j.blob = jobs[e].blob;
1607 j.act = jobs[e].act[t];
1608 j.out = jobs[e].out[t];
1609 single.push_back(j);
1610 }
1611 for (size_t i = 0; i < single.size(); i += kMaxSplit)
1612 run_split(single.data() + i, (int) (std::min)((size_t) kMaxSplit, single.size() - i));
1613 return;
1614 }
1615 const auto t0 = std::chrono::steady_clock::now();
1616 mjobs_ = jobs;
1617 mrows_ = (int64_t) n * FF;
1618 mtasks_ = phase_tasks(mrows_);
1619 run_phase(3, mtasks_);
1620 const auto t1 = std::chrono::steady_clock::now();
1621 for (int e = 0; e < n; ++e)
1622 for (int t = 0; t < jobs[e].nt; ++t)
1623 act_quant_q8_1(split_multi_[(size_t) e].ff[t], FF, split_multi_[(size_t) e].a2[t]);
1624 const auto t2 = std::chrono::steady_clock::now();
1625 mrows_ = (int64_t) n * H;
1626 mtasks_ = phase_tasks(mrows_);
1627 run_phase(4, mtasks_);
1628 const auto t3 = std::chrono::steady_clock::now();
1629 ms_multi_gu += std::chrono::duration<double, std::milli>(t1 - t0).count();
1630 ms_multi_q += std::chrono::duration<double, std::milli>(t2 - t1).count();
1631 ms_multi_down += std::chrono::duration<double, std::milli>(t3 - t2).count();
1632 multi_bytes += (int64_t) n * (int64_t) BLOB;
1633 mode_ = 0;
1634 ms_drain_ += std::chrono::duration<double, std::milli>(std::chrono::steady_clock::now() - t0).count();
1635}
1636
1637void ExpertPool::run_split_multi_native(const NativeFmt& f, ExpertJobMulti* jobs, int n, NativeArithmetic arithmetic) {
1638 if (n <= 0) return;

Callers 3

mainFunction · 0.45

Calls 7

push_backMethod · 0.80
nowFunction · 0.70
act_quant_q8_1Function · 0.70
sizeMethod · 0.45
dataMethod · 0.45
countMethod · 0.45

Tested by 1

mainFunction · 0.36