launch: the hsa_exception sentence ignores hsaKmt lines, and a real cause in the same log (out of memory, no permission on the card) still wins; tests for both
This commit is contained in:
1 parent
60d847ba33
commit
41e804d93c
2 files changed
+20
-2
No files matched your search
@@ -1969,7 +1969,7 @@ CAUSE_LINE = re.compile(r"error|exception|failed|cannot|can't|could not|no devic
|
||||
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 = re.compile(r"hsa_exception|HSA_STATUS_ERROR", 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 = (
|
||||
@@ -2052,7 +2052,13 @@ def explain_engine_exit(result: dict, config: Path | None, marks: dict | None =
|
||||
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 = ""
|
||||
# a real cause in the same log (out of memory, no permission on the card ...) wins: its line is the cause shown
|
||||
real = next((x for x in reversed(lines) if any(p.search(x) for p, _ in KNOWN_CAUSES)), None)
|
||||
if real:
|
||||
hsa = None
|
||||
cause = re.sub(r"^(\[strata\]\s*)?(\d{4}-\d\d-\d\d[ T][\d:.]+\s*)?", "", real.strip())[:240]
|
||||
else:
|
||||
cause = ""
|
||||
text = stage + (f": {cause}" if cause else ".")
|
||||
if not text.endswith((".", "!")):
|
||||
text += "."
|
||||
|
||||
@@ -60,6 +60,18 @@ class EngineExitIsExplained(unittest.TestCase):
|
||||
self.assertNotIn("hsa_exception", text)
|
||||
self.assertIn("graphics card was not ready yet", nxt)
|
||||
|
||||
def test_a_real_cause_in_the_same_log_wins_over_the_gpu_runtime_start_failure(self):
|
||||
cfg, log = self.config_with_log(["strata generate: CUDA error: out of memory",
|
||||
"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("out of memory", text)
|
||||
self.assertIn("--context 16k", nxt)
|
||||
self.assertNotIn("graphics card was not ready", nxt)
|
||||
cfg, _ = self.config_with_log(["Permission denied: /dev/dri/renderD128", "terminate called after throwing an instance of 'rocr::AMD::hsa_exception'"])
|
||||
self.assertIn("render group", R.explain_engine_exit({"error": "server_exited", "engine_exit_code": 134}, cfg)[1])
|
||||
cfg, _ = self.config_with_log(["hsaKmtOpenKFD ok", "strata generate: CUDA error: out of memory"])
|
||||
self.assertNotIn("graphics card was not ready", R.explain_engine_exit({"error": "server_exited"}, cfg)[1])
|
||||
|
||||
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])
|
||||
|
||||
Reference in new issue
Block a user