mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
zluda&rocm bf16 test
This commit is contained in:
@@ -549,6 +549,7 @@ def install_rocm_zluda():
|
||||
log.warning("ZLUDA support: experimental")
|
||||
error = None
|
||||
from modules import zluda_installer
|
||||
zluda_installer.set_default_agent(device)
|
||||
try:
|
||||
if args.reinstall_zluda:
|
||||
zluda_installer.uninstall()
|
||||
|
||||
+9
-10
@@ -4,6 +4,7 @@ import time
|
||||
import contextlib
|
||||
from functools import wraps
|
||||
import torch
|
||||
from modules import rocm
|
||||
from modules.errors import log, display, install as install_traceback
|
||||
from installer import install
|
||||
|
||||
@@ -283,16 +284,14 @@ def test_bf16():
|
||||
if sys.platform == "darwin" or backend == 'openvino' or backend == 'directml': # override
|
||||
bf16_ok = False
|
||||
return bf16_ok
|
||||
elif backend == 'zluda':
|
||||
device_name = torch.cuda.get_device_name(device)
|
||||
if device_name.startswith("AMD Radeon RX "): # only force AMD
|
||||
device_name = device_name.replace("AMD Radeon RX ", "").split(" ", maxsplit=1)[0]
|
||||
if len(device_name) == 4 and device_name[0] in {"5", "6"}: # RDNA 1 and 2
|
||||
bf16_ok = False
|
||||
return bf16_ok
|
||||
elif backend == 'rocm':
|
||||
gcn_arch = getattr(torch.cuda.get_device_properties(device), "gcnArchName", "gfx0000")[3:7]
|
||||
if len(gcn_arch) == 4 and gcn_arch[0:2] == "10": # RDNA 1 and 2
|
||||
elif backend == 'rocm' or backend == 'zluda':
|
||||
gcn_arch = None
|
||||
if backend == 'rocm':
|
||||
gcn_arch = rocm.Agent.parse_gfx_version(getattr(torch.cuda.get_device_properties(device), "gcnArchName", "gfx0000"))
|
||||
else:
|
||||
from modules.zluda_installer import default_agent
|
||||
gcn_arch = 0x0 if default_agent is None else default_agent.gfx_version
|
||||
if gcn_arch < 0x1100: # all cards before RDNA 3
|
||||
bf16_ok = False
|
||||
return bf16_ok
|
||||
try:
|
||||
|
||||
@@ -4,7 +4,7 @@ import ctypes
|
||||
import shutil
|
||||
import zipfile
|
||||
import urllib.request
|
||||
from typing import Optional
|
||||
from typing import Optional, Union
|
||||
from modules import rocm
|
||||
|
||||
|
||||
@@ -15,12 +15,18 @@ DLL_MAPPING = {
|
||||
}
|
||||
HIPSDK_TARGETS = ['rocblas.dll', 'rocsolver.dll', f'hiprtc{"".join([v.zfill(2) for v in rocm.version.split(".")])}.dll']
|
||||
ZLUDA_TARGETS = ('nvcuda.dll', 'nvml.dll',)
|
||||
default_agent: Union[rocm.Agent, None] = None
|
||||
|
||||
|
||||
def get_path() -> str:
|
||||
return os.path.abspath(os.environ.get('ZLUDA', '.zluda'))
|
||||
|
||||
|
||||
def set_default_agent(agent: rocm.Agent):
|
||||
global default_agent # pylint: disable=global-statement
|
||||
default_agent = agent
|
||||
|
||||
|
||||
def install(zluda_path: os.PathLike) -> None:
|
||||
if os.path.exists(zluda_path):
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user