From 5853d40483a78a9e25430b436fd999e203071470 Mon Sep 17 00:00:00 2001 From: Owen Hilyard Date: Sat, 3 Jan 2026 19:37:50 -0500 Subject: [PATCH] Fix bug caused by disabled gpu Many AMD iGPUs are paired with a dGPU, and the BIOS has the option to disable the iGPU. Doing so can fix a variety of software problems related to multi-GPU-incompatible software. When this happens, rocm-smi prints an error message to stderr since the amdgpu driver is not initalized, but returns 0. Checking that there was actually data returned fixes the crash (since amd-smi correctly returns 255) for those with this hardware configuration. Signed-off-by: Owen Hilyard --- mojo/mojo_host_platform.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mojo/mojo_host_platform.bzl b/mojo/mojo_host_platform.bzl index e37a435..8ecda5b 100644 --- a/mojo/mojo_host_platform.bzl +++ b/mojo/mojo_host_platform.bzl @@ -67,7 +67,7 @@ def _get_amd_constraints_with_rocm_smi(rctx, rocm_smi, gpu_mapping): _log_result(rctx, rocm_smi, result) constraints = [] - if result.return_code == 0: + if result.return_code == 0 and len(result.stdout) > 0: #len(result.stdout) == 0 when the driver is not initialized blob = json.decode(result.stdout) if len(blob.keys()) == 0: fail("rocm-smi succeeded but didn't actually have any GPUs, please report this issue")