From f55944250919f1e6642532dd2f6e346126f159ce Mon Sep 17 00:00:00 2001 From: Artem Date: Tue, 20 Jan 2026 12:53:28 +0300 Subject: [PATCH 1/3] fix ROCm GPU architecture detection failed on windows On windows we use hipinfo instead of rocminfo. ROCm GPU architecture detection failed despite ROCm being available. Could not detect ROCm warp size: [WinError 2] The system cannot find the file specified. Defaulting to 64. (some 4-bit functions may not work!) ROCm warp size detection failed despite ROCm being available. --- bitsandbytes/cuda_specs.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bitsandbytes/cuda_specs.py b/bitsandbytes/cuda_specs.py index 71e7568a9..3c4ca2804 100644 --- a/bitsandbytes/cuda_specs.py +++ b/bitsandbytes/cuda_specs.py @@ -3,6 +3,7 @@ import logging import re import subprocess +import platform from typing import Optional import torch @@ -83,7 +84,10 @@ def get_rocm_gpu_arch() -> str: logger = logging.getLogger(__name__) try: if torch.version.hip: - result = subprocess.run(["rocminfo"], capture_output=True, text=True) + rocminfo_process_name = "rocminfo" + if platform.system() == "Windows": + rocminfo_process_name = "hipinfo" + result = subprocess.run([rocminfo_process_name], capture_output=True, text=True) match = re.search(r"Name:\s+gfx([a-zA-Z\d]+)", result.stdout) if match: return "gfx" + match.group(1) @@ -107,7 +111,10 @@ def get_rocm_warpsize() -> int: logger = logging.getLogger(__name__) try: if torch.version.hip: - result = subprocess.run(["rocminfo"], capture_output=True, text=True) + rocminfo_process_name = "rocminfo" + if platform.system() == "Windows": + rocminfo_process_name = "hipinfo" + result = subprocess.run([rocminfo_process_name], capture_output=True, text=True) match = re.search(r"Wavefront Size:\s+([0-9]{2})\(0x[0-9]{2}\)", result.stdout) if match: return int(match.group(1)) From 519e3f3eb71e8ec52f50a8a1d5973d676361d450 Mon Sep 17 00:00:00 2001 From: Artem Date: Thu, 22 Jan 2026 10:00:24 +0300 Subject: [PATCH 2/3] fix warp size regex for windows --- bitsandbytes/cuda_specs.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bitsandbytes/cuda_specs.py b/bitsandbytes/cuda_specs.py index 3c4ca2804..92b1675e9 100644 --- a/bitsandbytes/cuda_specs.py +++ b/bitsandbytes/cuda_specs.py @@ -85,10 +85,12 @@ def get_rocm_gpu_arch() -> str: try: if torch.version.hip: rocminfo_process_name = "rocminfo" + search_pattern = r"Name:\s+gfx([a-zA-Z\d]+)" if platform.system() == "Windows": rocminfo_process_name = "hipinfo" + search_pattern = r"Name:\s*gfx([a-zA-Z\d]+)" result = subprocess.run([rocminfo_process_name], capture_output=True, text=True) - match = re.search(r"Name:\s+gfx([a-zA-Z\d]+)", result.stdout) + match = re.search(search_pattern, result.stdout) if match: return "gfx" + match.group(1) else: @@ -112,10 +114,12 @@ def get_rocm_warpsize() -> int: try: if torch.version.hip: rocminfo_process_name = "rocminfo" + search_pattern = r"Wavefront Size:\s+([0-9]{2})\(0x[0-9]{2}\)" if platform.system() == "Windows": rocminfo_process_name = "hipinfo" + search_pattern = r"warpSize:\s*(\d+)" result = subprocess.run([rocminfo_process_name], capture_output=True, text=True) - match = re.search(r"Wavefront Size:\s+([0-9]{2})\(0x[0-9]{2}\)", result.stdout) + match = re.search(search_pattern, result.stdout) if match: return int(match.group(1)) else: From 42cef1191a3794b878bf180a48d3d8ea1dda46ce Mon Sep 17 00:00:00 2001 From: Artem Date: Thu, 22 Jan 2026 10:16:13 +0300 Subject: [PATCH 3/3] Fix fatal error: 'unistd.h' file not found Fix fatal error: 'unistd.h' file not found in Windows --- csrc/ops_hip.cuh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/csrc/ops_hip.cuh b/csrc/ops_hip.cuh index 4eb446206..06db0298f 100644 --- a/csrc/ops_hip.cuh +++ b/csrc/ops_hip.cuh @@ -11,7 +11,9 @@ #include #include #include +#ifndef _WIN32 #include +#endif #include #include