From f8de92ed3fcc558d92336c7572e7966d3063de50 Mon Sep 17 00:00:00 2001 From: Seunghoon Lee Date: Sat, 15 Feb 2025 11:35:58 +0900 Subject: [PATCH] fix zluda installer bug --- installer.py | 2 +- modules/zluda_installer.py | 23 +++++++---------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/installer.py b/installer.py index 1144dfd0d..ff5574b80 100644 --- a/installer.py +++ b/installer.py @@ -629,11 +629,11 @@ def install_rocm_zluda(): error = None from modules import zluda_installer - zluda_installer.set_default_agent(device) try: if args.reinstall or zluda_installer.is_old_zluda(): zluda_installer.uninstall() zluda_installer.install() + zluda_installer.set_default_agent(device) except Exception as e: error = e log.warning(f'Failed to install ZLUDA: {e}') diff --git a/modules/zluda_installer.py b/modules/zluda_installer.py index b5b13e626..85876f482 100644 --- a/modules/zluda_installer.py +++ b/modules/zluda_installer.py @@ -34,7 +34,12 @@ def set_default_agent(agent: rocm.Agent): global default_agent # pylint: disable=global-statement default_agent = agent - is_nightly = is_nightly_zluda() or (not os.path.exists(path) and nightly) + global nvcuda # pylint: disable=global-statement + if nvcuda is None: + nvcuda = ctypes.windll.LoadLibrary(os.path.join(path, 'nvcuda.dll')) + nvcuda.zluda_get_nightly_flag.restype = ctypes.c_int + nvcuda.zluda_get_nightly_flag.argtypes = [] + is_nightly = nvcuda.zluda_get_nightly_flag() == 1 global hipBLASLt_available, hipBLASLt_enabled # pylint: disable=global-statement hipBLASLt_available = is_nightly and os.path.exists(rocm.blaslt_tensile_libpath) @@ -44,14 +49,7 @@ def set_default_agent(agent: rocm.Agent): MIOpen_available = is_nightly and agent.gfx_version in (0x908, 0x90a, 0x940, 0x941, 0x942, 0x1030, 0x1100, 0x1101, 0x1102,) -def load_nvcuda(): - global nvcuda # pylint: disable=global-statement - if nvcuda is None: - nvcuda = ctypes.windll.LoadLibrary(os.path.join(path, 'nvcuda.dll')) - - -def is_old_zluda() -> bool: # ZLUDA<3.8.7 - load_nvcuda() +def is_old_zluda() -> bool: # ZLUDA<3.8.8 try: nvcuda.zluda_get_nightly_flag() return False @@ -59,13 +57,6 @@ def is_old_zluda() -> bool: # ZLUDA<3.8.7 return True -def is_nightly_zluda() -> bool: - load_nvcuda() - nvcuda.zluda_get_nightly_flag.restype = ctypes.c_int - nvcuda.zluda_get_nightly_flag.argtypes = [] - return nvcuda.zluda_get_nightly_flag() == 1 - - def install() -> None: if os.path.exists(path): return