ling32 MTP: no calibration of the adaptive K on HIP without a tier store (tier A, all experts resident); the K starts from the cost model

On the Strix Halo (Windows, gfx1151, tier A, all experts resident) the adaptive controller never reached the speculative path: with the calibration (spec_calibrate: synthetic requests, forced K, random 40-token prompt) it ended on the plain path or on drafts that were all rejected (1.00 tokens / verify, acceptance 0.000, 29.5 tok/s at 4K, also with K_max 1).  The calibration cycles of 2..5 verify rows cost 141..146 ms (a real 2-row cycle: 43.5 ms), or did not run as that length at all (table 2:0.0(1)).

With the same adaptive controller and the calibration off (--spec-sweep block=4,adaptive=1,calibrate=0) the request picks K from the cost model and its own acceptance: 42.1 tok/s, 109 verifies, 2.28 tokens / verify, acceptance 0.633 (fixed K=1 / K=2: 41.4 / 42.1 tok/s).

spec_init now sets sp.mtp_calibrate = false for such a run and prints one line.

SCOPE: only when STRATA_USE_HIP is defined and there is no tier store (tier A, every expert resident), integrated or discrete device (the cost model is the path proven to work; the calibration is the path proven broken).  CUDA and every HIP tier-store run (tier B / C, e.g. the R9700 pool: adaptive acceptance 0.80-0.85) keep the calibration exactly as before.
This commit is contained in:
Niko1221 committed 2026-12-03 03:49:39 +01:00
1 parent 03006f62ed
commit 523e9b4c11
1 file changed
+13 -1
+13 -1
View File
@@ -1654,7 +1654,19 @@ bool Ling32Engine::spec_init(const SpecParams& p, std::string& err) {
I.m_probe = 0;
spec_on_ = true;
sstats_ = SpecStats{};
if (p.adaptive && p.mtp_calibrate) { // measure the cycle time of every verify length now, once: the controller never changes its table during requests (seeded sampling stays reproducible)
// HIP with NO tier store (tier A, every expert resident; integrated or discrete): NO calibration. Measured on the Strix Halo (Windows, gfx1151): with the calibration the adaptive controller ends on
// the plain path or drafts that are all rejected (acceptance 0.000, 29.5 tok/s); with the same adaptive controller and the calibration off (--spec-sweep ...,calibrate=0) the real request picks K from
// the cost model and its own acceptance and runs 42.1 tok/s (acceptance 0.633, ids exact); fixed K=1 / K=2 also run 41.4 / 42.1. The synthetic calibration cycles there cost 141..146 ms per verify of
// 2..5 rows (real: 43.5 ms for 2 rows) or do not run as that length at all. Every other path (CUDA, every HIP tier-store run: tier B / C, e.g. the R9700 pool) keeps its calibration.
bool hip_no_store = false;
#if defined(STRATA_USE_HIP)
hip_no_store = provider_ == nullptr;
#endif
if (hip_no_store && p.adaptive && p.mtp_calibrate) {
I.sp.mtp_calibrate = false;
std::fprintf(stderr, "ling32: MTP: HIP, all experts resident (no tier store): the adaptive K starts from the cost model (no calibration)\n");
}
if (p.adaptive && p.mtp_calibrate && !hip_no_store) { // measure the cycle time of every verify length now, once: the controller never changes its table during requests (seeded sampling stays reproducible)
std::string e2;
if (!spec_calibrate(e2)) std::fprintf(stderr, "ling32: MTP calibration failed (%s); the adaptive K uses the cost model\n", e2.c_str());
}