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: gfx103x creates the MTP drafter's side stream again (#2055)

Oleksandr Dovhoselets85f839d80c0a
diff --git a/docs/AMD_HIP.md b/docs/AMD_HIP.md
index 66250f25c..a8fe88349 100644
--- a/docs/AMD_HIP.md
+++ b/docs/AMD_HIP.md
@@ -216,6 +216,14 @@ of decode (one card 47.5 / 46.9 / 48.3 -> 50.5 / 48.5 / 51.3 tok/s with it on).
`bench/results/2026-10-04-community-rx-6800-windows`): on was 12-22% slower. 4x R9700: fork off was 13-45% faster.
Linux RX 6000 users can try `STRATA_SH_STREAM=1`; the output is identical either way.
+**The draft's side stream (`STRATA_MTP_SIDE_STREAM`):** HIP does not use the MTP drafter's branch stream, and since
+0.1.40.2 it does not create it (#1240: an R9700 lost prompt speed with it). gfx103x is the exception and creates it: on
+an RX 6800 under Windows (`STRATA_HIP_PROMPT_F16=1`, IQ3_XXS, two runs each) a 7.9K-token prompt reads at 798-808 tok/s
+with the stream and 584-596 without, and a 30.4K-token one at 855-863 against 553-600; `STRATA_PREFILL_TIMING=1` puts
+the whole difference in the "wait copy" phase (3,081 -> 75 ms and 12,642 -> 288 ms). Decode and the output are the same.
+`STRATA_MTP_SIDE_STREAM=0` turns it off on gfx103x, `=1` creates it on another HIP card. Measured on one card and one
+OS; a Linux gfx103x number is welcome.
+
**Long prompts on a big card: check the lend-coverage line (#1389, measured by the reporter on an RX 7900 XTX, gfx1100,
v0.1.40.2, 50 GB RAM).** With `--resident-experts` the prompt path borrows cache slots, and the experts of those slots
must also sit in RAM. After the first request of a start the engine prints
diff --git a/src/core/mtp.cpp b/src/core/mtp.cpp
index 89f8b519c..971cc3e70 100644
--- a/src/core/mtp.cpp
+++ b/src/core/mtp.cpp
@@ -432,13 +432,30 @@ bool MtpDrafter::load(const std::string& rt_dir, const ModelGeometry& g, Session
#endif
if (!prio && cudaStreamCreateWithFlags(&cs_, cudaStreamNonBlocking) != cudaSuccess) { err = "mtp: stream"; return false; }
#if !defined(STRATA_USE_HIP)
- // HIP keeps the shared expert on cs_; only CUDA needs this branch stream.
if (cudaStreamCreateWithFlags(&side_, cudaStreamNonBlocking) != cudaSuccess ||
cudaEventCreateWithFlags(&sh_fork_, cudaEventDisableTiming) != cudaSuccess ||
cudaEventCreateWithFlags(&sh_join_, cudaEventDisableTiming) != cudaSuccess) {
err = "mtp: streams";
return false;
}
+#else
+ // HIP keeps the shared expert on cs_, so nothing uses this branch stream, and #1240 stopped creating it and its two
+ // events (an R9700 lost prompt speed with them after the first request). On gfx103x the stream's existence alone
+ // makes prompts read faster: RX 6800, Windows, STRATA_HIP_PROMPT_F16=1, a 7.9K-token prompt at 798-808 tok/s
+ // with it and 584-596 without, all of it in the prompt path's "wait copy" phase (3,081 -> 75 ms); the two events
+ // change nothing. So gfx103x creates the stream and no other HIP card does. STRATA_MTP_SIDE_STREAM=1 / =0 forces
+ // either.
+ {
+ int dev = 0;
+ cudaDeviceProp prop{};
+ bool on = cudaGetDevice(&dev) == cudaSuccess && cudaGetDeviceProperties(&prop, dev) == cudaSuccess &&
+ std::strncmp(prop.gcnArchName, "gfx103", 6) == 0;
+ if (const char* v = std::getenv("STRATA_MTP_SIDE_STREAM"); v != nullptr && *v != 0) on = std::atoi(v) != 0;
+ if (on && cudaStreamCreateWithFlags(&side_, cudaStreamNonBlocking) != cudaSuccess) {
+ err = "mtp: streams";
+ return false;
+ }
+ }
#endif
const double files_s = std::chrono::duration<double>(std::chrono::steady_clock::now() - t_files).count();
if (shared != nullptr) {