From 669825b5eac292379956b58e9557be54ca86570f Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 10 Sep 2025 00:41:11 +0000 Subject: [PATCH] Try harder to handle amd-smi invalid json We see more cases of this issue, I think the case is more fatal than before so now we just error but at least print the invalid json when we hit it. Warnings are still ignored https://github.com/ROCm/amdsmi/pull/114 --- mojo/mojo_host_platform.bzl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mojo/mojo_host_platform.bzl b/mojo/mojo_host_platform.bzl index 9aac95a..4790640 100644 --- a/mojo/mojo_host_platform.bzl +++ b/mojo/mojo_host_platform.bzl @@ -162,7 +162,10 @@ def _impl(rctx): if line.startswith("WARNING:"): continue json_lines.append(line) - blob = json.decode("\n".join(json_lines)) + failure_sentinel = {"DECODE": "FAILED"} + blob = json.decode("\n".join(json_lines), default = failure_sentinel) + if blob == failure_sentinel: + fail("amd-smi output was not valid json, please report this issue: {}".format(result.stdout)) if len(blob) == 0: fail("amd-smi succeeded but didn't actually have any GPUs, please report this issue")