diff --git a/build_tools/print_driver_gpu_info.py b/build_tools/print_driver_gpu_info.py index 6339e041e4a..95fe1573603 100644 --- a/build_tools/print_driver_gpu_info.py +++ b/build_tools/print_driver_gpu_info.py @@ -20,7 +20,6 @@ but does not fail. """ -import fcntl import os from pathlib import Path import platform @@ -41,6 +40,11 @@ def _get_kfd_version() -> Tuple[int, int]: + # fcntl is a Unix-only stdlib module and is only needed for this Linux + # KFD ioctl query. Import it lazily so the Windows sanity check does not + # crash at import time with ModuleNotFoundError: No module named 'fcntl'. + import fcntl + fd = os.open(_KFD_DEVICE, os.O_RDWR) try: buf = bytearray(8)