Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions bitsandbytes/cuda_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
import re
import subprocess
import platform
from typing import Optional

import torch
Expand Down Expand Up @@ -83,8 +84,13 @@ def get_rocm_gpu_arch() -> str:
logger = logging.getLogger(__name__)
try:
if torch.version.hip:
result = subprocess.run(["rocminfo"], capture_output=True, text=True)
match = re.search(r"Name:\s+gfx([a-zA-Z\d]+)", result.stdout)
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(search_pattern, result.stdout)
if match:
return "gfx" + match.group(1)
else:
Expand All @@ -107,8 +113,13 @@ def get_rocm_warpsize() -> int:
logger = logging.getLogger(__name__)
try:
if torch.version.hip:
result = subprocess.run(["rocminfo"], capture_output=True, text=True)
match = re.search(r"Wavefront Size:\s+([0-9]{2})\(0x[0-9]{2}\)", result.stdout)
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(search_pattern, result.stdout)
if match:
return int(match.group(1))
else:
Expand Down
2 changes: 2 additions & 0 deletions csrc/ops_hip.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
#include <cstdint>
#include <iostream>
#include <stdio.h>
#ifndef _WIN32
#include <unistd.h>
#endif

#include <common.h>
#include <functional>
Expand Down