Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

HIP: run the MTP prompt pass per group by default

Abhinand Bb827a47dbd5d
diff --git a/src/core/mtp.cpp b/src/core/mtp.cpp
index e2b89b6ff..f35165e03 100644
--- a/src/core/mtp.cpp
+++ b/src/core/mtp.cpp
@@ -30,6 +30,7 @@
#include <atomic>
#include <chrono>
#include <cstdio>
+#include <cstdlib>
#include <cstring>
#include <exception>
#include <fstream>
@@ -728,8 +729,21 @@ bool MtpDrafter::prefill(const float* R_rows, const int32_t* next_tokens, int64_
// E-4: every group's token / step / position records uploaded at once; each group is then device copies and a
// graph on the one stream, with a single sync at the end (a group of <= max_t rows used to be staged in mapped
// memory and synced before the next: ~5,500 host round trips on a 32K prompt). The same work in the same
- // order. STRATA_MTP_PREFILL_SYNC=1 keeps the old loop.
- static const bool per_group_sync = std::getenv("STRATA_MTP_PREFILL_SYNC") != nullptr;
+ // order. STRATA_MTP_PREFILL_SYNC=1 keeps the old loop, =0 forces E-4.
+ // HIP defaults to the old loop. This pass runs whenever E-9 (Prefill::draft_kv) declines, which it does for the
+ // drafter's ring (KV streaming, --kv-resident), and on gfx1201 / ROCm 7.2.4 the E-4 queue (a graph launch and four
+ // device copies per group, ~2,000 groups per 8192-token chunk, no sync) sometimes never completes: the prompt hangs
+ // in hipGraphLaunch or the final sync until the watchdog ends the engine. R9700, full IQ3_XXS, --kv-resident
+ // 32768, mixed load (chats, 32K and 7K prompts, deep follow-ups): E-4 hung in the first round on 2 of 2 tries,
+ // the old loop ran 30 of 30 rounds clean, prompt speed unchanged.
+ static const bool per_group_sync = [] {
+ if (const char* v = std::getenv("STRATA_MTP_PREFILL_SYNC")) return std::atoi(v) != 0;
+#if defined(STRATA_USE_HIP)
+ return true;
+#else
+ return false;
+#endif
+ }();
const int64_t NHp = g_->n_head, per_row = 1 + 4 + NHp;
if (!per_group_sync && n > 0) {
if (pf_cap_ < n * per_row) {