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++

launch: a GPU runtime start failure (hsa_exception) says the card was not ready, with a next step; the runtime text stays in the log

Niko122160d847ba3389
diff --git a/strata_cli/launch/runner.py b/strata_cli/launch/runner.py
index b408ff739..abe7e5759 100644
--- a/strata_cli/launch/runner.py
+++ b/strata_cli/launch/runner.py
@@ -1967,6 +1967,11 @@ def _read_json(path: Path) -> dict | None:
#: lines of an engine log that say why it stopped (the last one wins), and a plain next step for the causes we know. Recommend, never force.
CAUSE_LINE = re.compile(r"error|exception|failed|cannot|can't|could not|no device|not found|out of memory|unsupported|abort|invalid|missing|"
r"no kernel|illegal|denied|refus", re.I)
+# The GPU runtime (ROCm) failed while the card was being set up, often right after another engine exited: the runtime's own text
+# ("terminate called after throwing an instance of 'rocr::AMD::hsa_exception'") stays in the log, not in the sentence shown.
+HSA_START = re.compile(r"hsa_exception|HSA_STATUS_ERROR|hsaKmt", re.I)
+HSA_START_NEXT = ("The graphics card was not ready yet; wait a few seconds and run it again. If it keeps happening, restart the PC "
+ "and report the log.")
KNOWN_CAUSES = (
(re.compile(r"no device of requested type|device not found|no (gpu|sycl|level.zero) device|permission denied.*(dri|render)", re.I),
"The engine could not open the graphics card. On Linux the account must be allowed to use it: add it to the render group "
@@ -2045,10 +2050,13 @@ def explain_engine_exit(result: dict, config: Path | None, marks: dict | None =
stage = "The engine stopped while it was loading the model" + (f" (exit code {code})" if code not in (None, 0) else "")
else:
stage = f"The server did not become ready ({state}: {why or 'see the engine log'})"
+ hsa = HSA_START.search(" ".join(lines + [str(why or "")])) # the runtime's own text is kept out of the sentence (it is in the log)
+ if hsa:
+ cause = ""
text = stage + (f": {cause}" if cause else ".")
if not text.endswith((".", "!")):
text += "."
- step = next((words for pattern, words in KNOWN_CAUSES if pattern.search(" ".join([cause, str(why or "")]))), "Run it again; if it repeats, report the log.")
+ step = HSA_START_NEXT if hsa else next((words for pattern, words in KNOWN_CAUSES if pattern.search(" ".join([cause, str(why or "")]))), "Run it again; if it repeats, report the log.")
return text, step + (f" The engine's log: {log}" if log else " The engine's log has the reason (strata logs, or the log named in the run config).")
diff --git a/tests/terminal/test_round8_fixes.py b/tests/terminal/test_round8_fixes.py
index 1a8914832..47ef02764 100644
--- a/tests/terminal/test_round8_fixes.py
+++ b/tests/terminal/test_round8_fixes.py
@@ -44,6 +44,22 @@ class EngineExitIsExplained(unittest.TestCase):
self.assertIn("render group", nxt)
self.assertIn(str(log), nxt)
+ def test_a_gpu_runtime_start_failure_gets_a_plain_sentence_and_keeps_the_runtime_text_out_of_it(self):
+ cfg, log = self.config_with_log(["strata generate: loading", "terminate called after throwing an instance of 'rocr::AMD::hsa_exception'",
+ " what(): "])
+ text, nxt = R.explain_engine_exit({"state": "failed", "error": "server_exited", "engine_exit_code": 134}, cfg)
+ self.assertIn("stopped while it was loading the model (exit code 134)", text)
+ self.assertNotIn("hsa_exception", text + nxt)
+ self.assertNotIn("terminate called", text + nxt)
+ self.assertIn("graphics card was not ready yet", nxt)
+ self.assertIn("wait a few seconds", nxt)
+ self.assertIn("restart the PC", nxt)
+ self.assertIn(str(log), nxt)
+ text, nxt = R.explain_engine_exit({"error": "server_exited", "engine_exit_code": 134,
+ "log_tail": "terminate called after throwing an instance of 'rocr::AMD::hsa_exception' | what():"}, None)
+ self.assertNotIn("hsa_exception", text)
+ self.assertIn("graphics card was not ready yet", nxt)
+
def test_out_of_memory_and_old_engine_get_their_own_next_step(self):
cfg, _ = self.config_with_log(["strata generate: CUDA error: out of memory"])
self.assertIn("--context 16k", R.explain_engine_exit({"error": "server_exited"}, cfg)[1])