From 3241eb32779d48cb3961e38cfe4fcd091f4448fa Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Wed, 6 May 2026 12:18:11 +0000 Subject: [PATCH] Fix KFD sysfs awk fallback to read properties file The fallback added by this PR reads /sys/class/kfd/kfd/topology/nodes/*/gpu_id files but matches the literal token 'gpu_id' against their content. Those files contain only a single decimal value (e.g. '0' for CPU agents, '50432' for GPU agents), so the regex never matches and 'found' stays 0, making the fallback a no-op on every host. The properties file in the same directory contains key/value lines like 'gpu_id 50432' which is what the existing awk pattern expects. Reproduced with a synthetic sysfs layout: against gpu_id files awk exits 1; against properties files awk exits 0 when any node reports gpu_id > 0. --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 305e45917f..fa2921b5ad 100755 --- a/install.sh +++ b/install.sh @@ -1491,7 +1491,7 @@ _has_amd_rocm_gpu() { return 0 elif [ -e /dev/kfd ] && \ awk '/gpu_id/{ if ($2+0 > 0) found=1 } END{ exit !found }' \ - /sys/class/kfd/kfd/topology/nodes/*/gpu_id 2>/dev/null; then + /sys/class/kfd/kfd/topology/nodes/*/properties 2>/dev/null; then return 0 fi return 1