From 01a4ee4d66f7aa78983b2da8a9074f7aae92d300 Mon Sep 17 00:00:00 2001 From: nimlgen <138685161+nimlgen@users.noreply.github.com> Date: Sun, 8 Feb 2026 19:14:13 +0300 Subject: [PATCH] do not hive_reset when amdgpu (#14624) --- extra/amdpci/hive_reset.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extra/amdpci/hive_reset.py b/extra/amdpci/hive_reset.py index e604a143d1..f9b681f8b7 100755 --- a/extra/amdpci/hive_reset.py +++ b/extra/amdpci/hive_reset.py @@ -1,11 +1,17 @@ #!/usr/bin/env python3 +import os from tinygrad.helpers import Context from tinygrad.runtime.support.system import System, PCIDevice, PCIDevImplBase +from tinygrad.runtime.support.hcq import FileIOInterface from tinygrad.runtime.support.am.amdev import AMDev if __name__ == "__main__": gpus = System.pci_scan_bus(0x1002, [(0xffff, [0x74a1, 0x75a0])]) + for gpu in gpus: + drv_path = f"/sys/bus/pci/devices/{gpu}/driver" + if FileIOInterface.exists(drv_path) and os.path.basename(os.readlink(drv_path)) == "amdgpu": + raise RuntimeError(f"amdgpu is bound to {gpu}. Stopping...") pcidevs = [PCIDevice("AM", gpu, bars=[0, 2, 5]) for gpu in gpus] amdevs = [] with Context(DEBUG=2):