Logging options & UI Cleanup, useless option removal, minimizing on options never used

This commit is contained in:
resonantsky
2026-10-05 10:23:41 +02:00
parent 1256611e35
commit daa2467ae0
3 changed files with 233 additions and 171 deletions
+41 -6
View File
@@ -9,7 +9,7 @@ from modules.logger import log
from modules.json_helpers import readfile, writefile
from modules.shared import opts
from scripts.rocm.rocm_vars import ROCM_ENV_VARS # pylint: disable=no-name-in-module
from scripts.rocm.rocm_vars import ROCM_ENV_VARS, MIOPEN_LOGGING_VARS # pylint: disable=no-name-in-module
from scripts.rocm import rocm_profiles # pylint: disable=no-name-in-module
if sys.platform == "win32":
from scripts.rocm import rocm_log_win32 as rocm_log # pylint: disable=no-name-in-module
@@ -207,6 +207,25 @@ def _dropdown_choices(options):
return options
def _set_miopen_logging(config: Dict[str, str], enabled: bool) -> None:
config["MIOPEN_LOG_LEVEL"] = "5" if enabled else "0"
config["MIOPEN_DEBUG_ENABLE"] = "1" if enabled else "0"
def _normalize_miopen_logging(config: Dict[str, str]) -> bool:
"""Keep both MIOpen logging variables in sync; DEBUG_ENABLE is authoritative."""
enabled = str(config.get("MIOPEN_DEBUG_ENABLE", ROCM_ENV_VARS["MIOPEN_DEBUG_ENABLE"]["default"])) == "1"
previous = (config.get("MIOPEN_LOG_LEVEL"), config.get("MIOPEN_DEBUG_ENABLE"))
_set_miopen_logging(config, enabled)
return previous != (config["MIOPEN_LOG_LEVEL"], config["MIOPEN_DEBUG_ENABLE"])
def _apply_miopen_logging_env(config: Dict[str, str]) -> None:
_normalize_miopen_logging(config)
for name in MIOPEN_LOGGING_VARS:
os.environ[name] = config[name]
# --- config I/O ---
def load_config() -> Dict[str, str]:
@@ -222,10 +241,13 @@ def load_config() -> Dict[str, str]:
dirty = {k for k in _cache if k in _UNSET_VARS or (k != _ARCH_KEY and k not in ROCM_ENV_VARS)}
if dirty:
_cache = {k: v for k, v in _cache.items() if k not in dirty}
logging_changed = _normalize_miopen_logging(_cache)
if dirty or logging_changed:
writefile(_cache, str(CONFIG))
log.debug(f'ROCm: config={str(CONFIG)} purged={len(dirty)} stale/unsafe')
log.debug(f'ROCm: config={str(CONFIG)} purged={len(dirty)} stale/unsafe miopen_logging_normalized={logging_changed}')
else:
_cache = {k: v["default"] for k, v in ROCM_ENV_VARS.items()}
_normalize_miopen_logging(_cache)
log.debug(f'ROCm: load config={str(CONFIG)} items={len(_cache)}')
return _cache
@@ -233,6 +255,7 @@ def load_config() -> Dict[str, str]:
def save_config(config: Dict[str, str]) -> None:
global _cache # pylint: disable=global-statement
sanitized = {k: v for k, v in config.items() if k not in _UNSET_VARS}
_normalize_miopen_logging(sanitized)
# Enforce arch-incompatible solvers to "0" before writing.
# Prevents malformed edits (UI or JSON hand-edit) from persisting incompatible "1" values.
arch = sanitized.get(_ARCH_KEY, "")
@@ -246,8 +269,8 @@ def save_config(config: Dict[str, str]) -> None:
def apply_env(config: Optional[Dict[str, str]] = None) -> None:
if config is None:
config = load_config()
config = dict(config if config is not None else load_config())
_normalize_miopen_logging(config)
for var in _UNSET_VARS | _EXTRA_CLEAR_VARS:
if var in os.environ:
del os.environ[var]
@@ -285,7 +308,7 @@ def stop_miopen_logging() -> None:
rocm_log.stop_miopen_logging()
def apply_all(names: list, values: list) -> None:
def apply_all(names: list, values: list, miopen_logging: Optional[bool] = None) -> None:
config = load_config().copy()
arch = config.get(_ARCH_KEY, "")
unavailable = rocm_profiles.UNAVAILABLE.get(arch, set())
@@ -314,6 +337,16 @@ def apply_all(names: list, values: list) -> None:
if meta.get("options"):
value = _dropdown_stored(str(value), meta["options"])
config[name] = _collapse_venv(str(value))
if miopen_logging is not None:
_set_miopen_logging(config, miopen_logging)
save_config(config)
apply_env(config)
def set_miopen_logging(enabled: bool) -> None:
"""Persist and apply both MIOpen logging environment variables together."""
config = load_config().copy()
_set_miopen_logging(config, enabled)
save_config(config)
apply_env(config)
@@ -465,7 +498,7 @@ def info() -> dict:
# --- ROCm / HIP package versions ---
rocm_pkgs = {}
for pkg in ("rocm", "rocm-sdk-core", "rocm-sdk-devel"):
for pkg in ("rocm",):
v = _pkg_version(pkg)
if v != "n/a":
rocm_pkgs[pkg] = v
@@ -556,6 +589,8 @@ if _is_rocm_runtime():
try:
if CONFIG.exists():
apply_env()
else:
_apply_miopen_logging_env(load_config())
rocm_log.start_miopen_logging()
except Exception as _e:
log.debug(f"[rocm_mgr] Warning: failed to apply env at import: {_e}")
+164 -157
View File
@@ -18,6 +18,20 @@ def _sitepackages_subpath(*parts: str) -> str: # auto-path helper (currently not
GENERAL_VARS: Dict[str, Dict[str, Any]] = {
"MIOPEN_FIND_MODE": {
"default": "2",
"desc": "MIOpen Find Mode",
"widget": "dropdown",
"options": [("1 - NORMAL", "1"), ("2 - FAST", "2"), ("3 - HYBRID", "3"), ("5 - DYNAMIC_HYBRID", "5"), ("6 - TRUST_VERIFY", "6"), ("7 - TRUST_VERIFY_FULL", "7")],
"restart_required": True,
},
"MIOPEN_FIND_ENFORCE": {
"default": "1",
"desc": "MIOpen Find Enforce",
"widget": "dropdown",
"options": [("1 - NONE", "1"), ("2 - DB_UPDATE", "2"), ("3 - SEARCH", "3"), ("4 - SEARCH_DB_UPDATE", "4"), ("5 - DB_CLEAN", "5")],
"restart_required": True,
},
"MIOPEN_SYSTEM_DB_PATH": {
# "default": _sitepackages_subpath("{LIBS_PKG}", _BIN_DIR) + os.sep, # auto-path disabled; kept for troubleshooting.
"default": "",
@@ -34,6 +48,20 @@ GENERAL_VARS: Dict[str, Dict[str, Any]] = {
"options": None,
"restart_required": True,
},
"MIOPEN_LOG_LEVEL": {
"default": "0",
"desc": "MIOpen log verbosity level",
"widget": "dropdown",
"options": [("0 - Default", "0"), ("1 - Quiet", "1"), ("3 - Error", "3"), ("4 - Warning", "4"), ("5 - Info", "5"), ("6 - Detail", "6"), ("7 - Trace", "7")],
"restart_required": False,
},
"MIOPEN_DEBUG_ENABLE": {
"default": "0",
"desc": "Enable MIOpen logging",
"widget": "dropdown",
"options": [("0 - Off", "0"), ("1 - On", "1")],
"restart_required": False,
},
"MIOPEN_GEMM_ENFORCE_BACKEND": {
"default": "1",
"desc": "GEMM backend",
@@ -62,20 +90,7 @@ GENERAL_VARS: Dict[str, Dict[str, Any]] = {
"options": [("0 - Tensile (rocBLAS)", "0"), ("1 - hipBLASLt", "1")],
"restart_required": True,
},
"MIOPEN_FIND_MODE": {
"default": "2",
"desc": "MIOpen Find Mode",
"widget": "dropdown",
"options": [("1 - NORMAL", "1"), ("2 - FAST", "2"), ("3 - HYBRID", "3"), ("5 - DYNAMIC_HYBRID", "5"), ("6 - TRUST_VERIFY", "6"), ("7 - TRUST_VERIFY_FULL", "7")],
"restart_required": True,
},
"MIOPEN_FIND_ENFORCE": {
"default": "1",
"desc": "MIOpen Find Enforce",
"widget": "dropdown",
"options": [("1 - NONE", "1"), ("2 - DB_UPDATE", "2"), ("3 - SEARCH", "3"), ("4 - SEARCH_DB_UPDATE", "4"), ("5 - DB_CLEAN", "5")],
"restart_required": True,
},
"MIOPEN_SEARCH_CUTOFF": {
"default": "0",
"desc": "Enable early termination of suboptimal searches",
@@ -97,152 +112,142 @@ GENERAL_VARS: Dict[str, Dict[str, Any]] = {
"options": None,
"restart_required": False,
},
"ROCBLAS_DEVICE_MEMORY_SIZE": {
"default": "",
"desc": "rocBLAS workspace size in bytes (empty = dynamic)",
"widget": "textbox",
"options": None,
"restart_required": False,
},
"PYTORCH_TUNABLEOP_CACHE_DIR": {
"default": os.path.join("{ROOT}", "models", "tunable"),
"desc": "TunableOp cache directory",
"widget": "textbox",
"options": None,
"restart_required": False,
},
# --> OUTCOMMENTED SECTION REMOVED FROM ACTIVE ROCm CONFIGURATION REGISTRY; KEPT FOR REFERENCE <--
"ROCBLAS_STREAM_ORDER_ALLOC": {
"default": "1",
"desc": "rocBLAS stream-ordered memory allocation",
"widget": "dropdown",
"options": [("0 - Standard", "0"), ("1 - Stream-ordered", "1")],
"restart_required": False,
},
"ROCBLAS_DEFAULT_ATOMICS_MODE": {
"default": "1",
"desc": "rocBLAS allow atomics",
"widget": "dropdown",
"options": [("0 - Off (deterministic)", "0"), ("1 - On (performance)", "1")],
"restart_required": False,
},
"PYTORCH_TUNABLEOP_ROCBLAS_ENABLED": {
"default": "0",
"desc": "TunableOp: Enable tuning",
"widget": "dropdown",
"options": [("0 - Off", "0"), ("1 - On", "1")],
"restart_required": False,
},
"PYTORCH_TUNABLEOP_TUNING": {
"default": "0",
"desc": "TunableOp: Tuning mode",
"widget": "dropdown",
"options": [("0 - Use Cache", "0"), ("1 - Benchmark new shapes", "1")],
"restart_required": False,
},
"PYTORCH_TUNABLEOP_HIPBLASLT_ENABLED": {
"default": "0",
"desc": "TunableOp: benchmark hipBLASLt kernels",
"widget": "dropdown",
"options": [("0 - Off", "0"), ("1 - On", "1")],
"restart_required": False,
},
"MIOPEN_LOG_LEVEL": {
"default": "0",
"desc": "MIOpen log verbosity level",
"widget": "dropdown",
"options": [("0 - Default", "0"), ("1 - Quiet", "1"), ("3 - Error", "3"), ("4 - Warning", "4"), ("5 - Info", "5"), ("6 - Detail", "6"), ("7 - Trace", "7")],
"restart_required": False,
},
"MIOPEN_DEBUG_ENABLE": {
"default": "0",
"desc": "Enable MIOpen logging",
"widget": "dropdown",
"options": [("0 - Off", "0"), ("1 - On", "1")],
"restart_required": False,
},
"ROCBLAS_LAYER": {
"default": "0",
"desc": "rocBLAS logging",
"widget": "dropdown",
"options": [("0 - Off", "0"), ("1 - Trace", "1"), ("2 - Bench", "2"), ("3 - Trace+Bench", "3"), ("4 - Profile", "4"), ("5 - Trace+Profile", "5"), ("6 - Bench+Profile", "6"), ("7 - All", "7")],
"restart_required": False,
},
"HIPBLASLT_LOG_LEVEL": {
"default": "0",
"desc": "hipBLASLt logging",
"widget": "dropdown",
"options": [("0 - Off", "0"), ("1 - Error", "1"), ("2 - Trace", "2"), ("3 - Hints", "3"), ("4 - Info", "4"), ("5 - API Trace", "5")],
"restart_required": False,
},
#"ROCBLAS_DEVICE_MEMORY_SIZE": {
# "default": "",
# "desc": "rocBLAS workspace size in bytes (empty = dynamic)",
# "widget": "textbox",
# "options": None,
# "restart_required": False,
#},
#"PYTORCH_TUNABLEOP_CACHE_DIR": {
# "default": os.path.join("{ROOT}", "models", "tunable"),
# "desc": "TunableOp cache directory",
# "widget": "textbox",
# "options": None,
# "restart_required": False,
#},
#
#"ROCBLAS_STREAM_ORDER_ALLOC": {
# "default": "1",
# "desc": "rocBLAS stream-ordered memory allocation",
# "widget": "dropdown",
# "options": [("0 - Standard", "0"), ("1 - Stream-ordered", "1")],
# "restart_required": False,
#},
#"ROCBLAS_DEFAULT_ATOMICS_MODE": {
# "default": "1",
# "desc": "rocBLAS allow atomics",
# "widget": "dropdown",
# "options": [("0 - Off (deterministic)", "0"), ("1 - On (performance)", "1")],
# "restart_required": False,
#},
#"PYTORCH_TUNABLEOP_ROCBLAS_ENABLED": {
# "default": "0",
# "desc": "TunableOp: Enable tuning",
# "widget": "dropdown",
# "options": [("0 - Off", "0"), ("1 - On", "1")],
# "restart_required": False,
#},
#"PYTORCH_TUNABLEOP_TUNING": {
# "default": "0",
# "desc": "TunableOp: Tuning mode",
# "widget": "dropdown",
# "options": [("0 - Use Cache", "0"), ("1 - Benchmark new shapes", "1")],
# "restart_required": False,
#},
#"PYTORCH_TUNABLEOP_HIPBLASLT_ENABLED": {
# "default": "0",
# "desc": "TunableOp: benchmark hipBLASLt kernels",
# "widget": "dropdown",
# "options": [("0 - Off", "0"), ("1 - On", "1")],
# "restart_required": False,
#},
#
#"ROCBLAS_LAYER": {
# "default": "0",
# "desc": "rocBLAS logging",
# "widget": "dropdown",
# "options": [("0 - Off", "0"), ("1 - Trace", "1"), ("2 - Bench", "2"), ("3 - Trace+Bench", "3"), ("4 - Profile", "4"), ("5 - Trace+Profile", "5"), ("6 - Bench+Profile", "6"), ("7 - All", "7")],
# "restart_required": False,
#},
#"HIPBLASLT_LOG_LEVEL": {
# "default": "0",
# "desc": "hipBLASLt logging",
# "widget": "dropdown",
# "options": [("0 - Off", "0"), ("1 - Error", "1"), ("2 - Trace", "2"), ("3 - Hints", "3"), ("4 - Info", "4"), ("5 - API Trace", "5")],
# "restart_required": False,
#},
}
_SOLVER_DESCS: Dict[str, str] = {}
_SOLVER_DESCS.update({
"MIOPEN_DEBUG_CONV_FFT": "Enable FFT solver",
"MIOPEN_DEBUG_CONV_DIRECT": "Enable Direct solver",
"MIOPEN_DEBUG_CONV_GEMM": "Enable GEMM solver",
"MIOPEN_DEBUG_CONV_WINOGRAD": "Enable Winograd solver",
"MIOPEN_DEBUG_CONV_IMPLICIT_GEMM": "Enable Implicit GEMM solver",
})
_SOLVER_DESCS.update({
"MIOPEN_DEBUG_CONV_IMMED_FALLBACK": "Enable Immediate Fallback",
"MIOPEN_DEBUG_ENABLE_AI_IMMED_MODE_FALLBACK": "Enable AI Immediate Mode Fallback",
"MIOPEN_DEBUG_FORCE_IMMED_MODE_FALLBACK": "Force Immediate Mode Fallback",
})
_SOLVER_DESCS.update({
"MIOPEN_DEBUG_GCN_ASM_KERNELS": "Enable GCN ASM kernels",
"MIOPEN_DEBUG_HIP_KERNELS": "Enable HIP kernels",
"MIOPEN_DEBUG_OPENCL_CONVOLUTIONS": "Enable OpenCL convolutions",
"MIOPEN_DEBUG_OPENCL_WAVE64_NOWGP": "Enable OpenCL Wave64 NOWGP",
"MIOPEN_DEBUG_ATTN_SOFTMAX": "Enable Attention Softmax",
})
_SOLVER_DESCS.update({
# Direct ASM — FWD inference only (WRW, fixed-geometry, FP32-reference removed)
"MIOPEN_DEBUG_CONV_DIRECT_ASM_3X3U": "Enable Direct ASM 3x3U",
"MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U": "Enable Direct ASM 1x1U",
"MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1UV2": "Enable Direct ASM 1x1UV2",
"MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_SEARCH_OPTIMIZED": "Enable Direct ASM 1x1U Search Optimized",
"MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_AI_HEUR": "Enable Direct ASM 1x1U AI Heuristic",
})
_SOLVER_DESCS.update({
# Direct OCL — FWD inference only (WRW, FWD11X11 fixed-geom, FWDGEN FP32-ref removed)
"MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD": "Enable Direct OCL FWD",
"MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD1X1": "Enable Direct OCL FWD1X1",
})
_SOLVER_DESCS.update({
# Winograd FWD — WRW removed; Fury/Rage kept as RDNA3/4 inference (off by default)
"MIOPEN_DEBUG_AMD_WINOGRAD_3X3": "Enable AMD Winograd 3x3",
"MIOPEN_DEBUG_AMD_WINOGRAD_RXS": "Enable AMD Winograd RxS",
"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_FWD_BWD": "Enable AMD Winograd RxS FWD",
"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2": "Enable AMD Winograd RxS F3x2",
"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3": "Enable AMD Winograd RxS F2x3",
"MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3_G1": "Enable AMD Winograd RxS F2x3 G1",
"MIOPEN_DEBUG_AMD_FUSED_WINOGRAD": "Enable AMD Fused Winograd",
"MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F2X3": "Enable AMD Winograd Fury RxS F2x3",
"MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F3X2": "Enable AMD Winograd Fury RxS F3x2",
"MIOPEN_DEBUG_AMD_WINOGRAD_RAGE_RXS_F2X3": "Enable AMD Winograd Rage RxS F2x3",
})
_SOLVER_DESCS.update({
# Multi-pass Winograd — only F3x2/F3x3 match typical 3x3 SD shapes; wider kernels removed
"MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X2": "Enable AMD Winograd MPASS F3x2",
"MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X3": "Enable AMD Winograd MPASS F3x3",
})
_SOLVER_DESCS.update({
# Implicit GEMM FWD — BWD/WRW (training), CDNA-exclusive XDLOPS variants removed
"MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1": "Enable ASM Implicit GEMM FWD V4R1",
"MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1_1X1": "Enable ASM Implicit GEMM FWD V4R1 1x1",
"MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1": "Enable HIP Implicit GEMM FWD V4R1",
"MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4": "Enable HIP Implicit GEMM FWD V4R4",
})
_SOLVER_DESCS.update({
# Group Conv XDLOPS FWD — RDNA3/4 (gfx1100+) only; disabled by default
"MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS": "Enable Group Conv Implicit GEMM XDLOPS FWD",
"MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS_AI_HEUR": "Enable Group Conv Implicit GEMM XDLOPS FWD AI Heuristic",
# CK (Composable Kernel) default kernels — RDNA3/4 (gfx1100+); disabled by default
"MIOPEN_DEBUG_CK_DEFAULT_KERNELS": "Enable CK (Composable Kernel) default kernels",
})
# _SOLVER_DESCS: Dict[str, str] = {}
#
# _SOLVER_DESCS.update({
# "MIOPEN_DEBUG_CONV_FFT": "Enable FFT solver",
# "MIOPEN_DEBUG_CONV_DIRECT": "Enable Direct solver",
# "MIOPEN_DEBUG_CONV_GEMM": "Enable GEMM solver",
# "MIOPEN_DEBUG_CONV_WINOGRAD": "Enable Winograd solver",
# "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM": "Enable Implicit GEMM solver",
# })
# _SOLVER_DESCS.update({
# "MIOPEN_DEBUG_CONV_IMMED_FALLBACK": "Enable Immediate Fallback",
# "MIOPEN_DEBUG_ENABLE_AI_IMMED_MODE_FALLBACK": "Enable AI Immediate Mode Fallback",
# "MIOPEN_DEBUG_FORCE_IMMED_MODE_FALLBACK": "Force Immediate Mode Fallback",
# })
# _SOLVER_DESCS.update({
# "MIOPEN_DEBUG_GCN_ASM_KERNELS": "Enable GCN ASM kernels",
# "MIOPEN_DEBUG_HIP_KERNELS": "Enable HIP kernels",
# "MIOPEN_DEBUG_OPENCL_CONVOLUTIONS": "Enable OpenCL convolutions",
# "MIOPEN_DEBUG_OPENCL_WAVE64_NOWGP": "Enable OpenCL Wave64 NOWGP",
# "MIOPEN_DEBUG_ATTN_SOFTMAX": "Enable Attention Softmax",
# })
# _SOLVER_DESCS.update({
# # Direct ASM — FWD inference only (WRW, fixed-geometry, FP32-reference removed)
# "MIOPEN_DEBUG_CONV_DIRECT_ASM_3X3U": "Enable Direct ASM 3x3U",
# "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U": "Enable Direct ASM 1x1U",
# "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1UV2": "Enable Direct ASM 1x1UV2",
# "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_SEARCH_OPTIMIZED": "Enable Direct ASM 1x1U Search Optimized",
# "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_AI_HEUR": "Enable Direct ASM 1x1U AI Heuristic",
# })
# _SOLVER_DESCS.update({
# # Direct OCL — FWD inference only (WRW, FWD11X11 fixed-geom, FWDGEN FP32-ref removed)
# "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD": "Enable Direct OCL FWD",
# "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD1X1": "Enable Direct OCL FWD1X1",
# })
# _SOLVER_DESCS.update({
# # Winograd FWD — WRW removed; Fury/Rage kept as RDNA3/4 inference (off by default)
# "MIOPEN_DEBUG_AMD_WINOGRAD_3X3": "Enable AMD Winograd 3x3",
# "MIOPEN_DEBUG_AMD_WINOGRAD_RXS": "Enable AMD Winograd RxS",
# "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_FWD_BWD": "Enable AMD Winograd RxS FWD",
# "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2": "Enable AMD Winograd RxS F3x2",
# "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3": "Enable AMD Winograd RxS F2x3",
# "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3_G1": "Enable AMD Winograd RxS F2x3 G1",
# "MIOPEN_DEBUG_AMD_FUSED_WINOGRAD": "Enable AMD Fused Winograd",
# "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F2X3": "Enable AMD Winograd Fury RxS F2x3",
# "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F3X2": "Enable AMD Winograd Fury RxS F3x2",
# "MIOPEN_DEBUG_AMD_WINOGRAD_RAGE_RXS_F2X3": "Enable AMD Winograd Rage RxS F2x3",
# })
# _SOLVER_DESCS.update({
# # Multi-pass Winograd — only F3x2/F3x3 match typical 3x3 SD shapes; wider kernels removed
# "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X2": "Enable AMD Winograd MPASS F3x2",
# "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X3": "Enable AMD Winograd MPASS F3x3",
# })
# _SOLVER_DESCS.update({
# # Implicit GEMM FWD — BWD/WRW (training), CDNA-exclusive XDLOPS variants removed
# "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1": "Enable ASM Implicit GEMM FWD V4R1",
# "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1_1X1": "Enable ASM Implicit GEMM FWD V4R1 1x1",
# "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1": "Enable HIP Implicit GEMM FWD V4R1",
# "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4": "Enable HIP Implicit GEMM FWD V4R4",
# })
# _SOLVER_DESCS.update({
# # Group Conv XDLOPS FWD — RDNA3/4 (gfx1100+) only; disabled by default
# "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS": "Enable Group Conv Implicit GEMM XDLOPS FWD",
# "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS_AI_HEUR": "Enable Group Conv Implicit GEMM XDLOPS FWD AI Heuristic",
# # CK (Composable Kernel) default kernels — RDNA3/4 (gfx1100+); disabled by default
# "MIOPEN_DEBUG_CK_DEFAULT_KERNELS": "Enable CK (Composable Kernel) default kernels",
# })
# Solvers still in the registry but disabled by default.
@@ -293,6 +298,8 @@ SOLVER_DTYPE_TAGS: Dict[str, str] = {
ROCM_ENV_VARS: Dict[str, Dict[str, Any]] = {}
ROCM_ENV_VARS.update(GENERAL_VARS)
MIOPEN_LOGGING_VARS = {"MIOPEN_LOG_LEVEL", "MIOPEN_DEBUG_ENABLE"}
SOLVER_GROUPS: List[Tuple[str, List[str]]] = []
# Variables that are relevant only when hipBLASLt is the active GEMM backend.
+28 -8
View File
@@ -64,8 +64,6 @@ class ROCmScript(scripts_manager.Script):
return f"<style>{' '.join(rules)}</style>" if rules else ""
with gr.Accordion('ROCm: Advanced Config', open=False, elem_id='rocm_config'):
with gr.Row():
gr.HTML("<p><u>Advanced configuration for ROCm users.</u></p><br><p>This script aims to take the guesswork out of configuring MIOpen and rocBLAS on Windows ROCm, but also to expose the functioning switches of MIOpen for advanced configurations.</p><br><p>For best performance ensure that cuDNN and PyTorch tunable ops are set to <b><i>default</i></b> in Backend Settings.</p><br><p>This script was written with the intent to support ROCm Windows users, it should however, function identically for Linux users.</p><br>")
with gr.Row():
btn_info = gr.Button("Refresh Info", variant="primary", elem_id="rocm_btn_info", size="sm")
btn_apply = gr.Button("Apply", variant="primary", elem_id="rocm_btn_apply", size="sm")
@@ -81,7 +79,16 @@ class ROCmScript(scripts_manager.Script):
# General vars (dropdowns, textboxes, checkboxes)
with gr.Group():
gr.HTML("<br><h3>MIOpen Settings</h3><hr>")
miopen_logging = "Enabled" if config.get("MIOPEN_DEBUG_ENABLE", "0") == "1" else "Disabled"
miopen_logging_comp = gr.Dropdown(
label="MIOpen logging",
choices=["Disabled", "Enabled"],
value=miopen_logging,
elem_id="rocm_miopen_logging",
)
for name, meta in rocm_vars.GENERAL_VARS.items():
if name in rocm_vars.MIOPEN_LOGGING_VARS:
continue
comp = _make_component(name, meta, config)
var_names.append(name)
components.append(comp)
@@ -110,6 +117,13 @@ class ROCmScript(scripts_manager.Script):
if meta["widget"] == "dropdown" and name != "MIOPEN_GEMM_ENFORCE_BACKEND":
comp.change(fn=lambda v, n=name: _autosave_field(n, v), inputs=[comp], outputs=[], show_progress='hidden')
miopen_logging_comp.change(
fn=lambda value: rocm_mgr.set_miopen_logging(value == "Enabled"),
inputs=[miopen_logging_comp],
outputs=[],
show_progress='hidden',
)
_GEMM_COMPANIONS = {
"PYTORCH_ROCM_USE_ROCBLAS": {"1": "1", "5": "0"},
"PYTORCH_HIPBLASLT_DISABLE": {"1": "1", "5": "0"},
@@ -141,11 +155,12 @@ class ROCmScript(scripts_manager.Script):
gemm_comp.change(fn=gemm_changed, inputs=[gemm_comp], outputs=[style_out] + components, show_progress='hidden')
def apply_fn(*values):
rocm_mgr.apply_all(var_names, list(values))
rocm_mgr.apply_all(var_names, list(values[:-1]), miopen_logging=values[-1] == "Enabled")
saved = rocm_mgr.load_config()
arch = saved.get(rocm_mgr._ARCH_KEY, "")
unavailable = rocm_profiles.UNAVAILABLE.get(arch, set())
gemm_val = saved.get("MIOPEN_GEMM_ENFORCE_BACKEND", "1")
logging_value = "Enabled" if saved.get("MIOPEN_DEBUG_ENABLE", "0") == "1" else "Disabled"
result = [gr.update(value=_build_style(unavailable, gemm_val == "1"))]
for name in var_names:
meta = rocm_vars.ROCM_ENV_VARS[name]
@@ -156,6 +171,7 @@ class ROCmScript(scripts_manager.Script):
result.append(gr.update(value=rocm_mgr._dropdown_display(val, meta["options"])))
else:
result.append(gr.update(value=rocm_mgr._expand_venv(val)))
result.append(gr.update(value=logging_value))
return result
def reset_fn():
@@ -164,6 +180,7 @@ class ROCmScript(scripts_manager.Script):
arch = updated.get(rocm_mgr._ARCH_KEY, "")
unavailable = rocm_profiles.UNAVAILABLE.get(arch, set())
gemm_val = updated.get("MIOPEN_GEMM_ENFORCE_BACKEND", "1")
logging_value = "Enabled" if updated.get("MIOPEN_DEBUG_ENABLE", "0") == "1" else "Disabled"
result = [gr.update(value=_build_style(unavailable, gemm_val == "1"))]
for name in var_names:
meta = rocm_vars.ROCM_ENV_VARS[name]
@@ -174,6 +191,7 @@ class ROCmScript(scripts_manager.Script):
result.append(gr.update(value=rocm_mgr._dropdown_display(val, meta["options"])))
else:
result.append(gr.update(value=rocm_mgr._expand_venv(val)))
result.append(gr.update(value=logging_value))
return result
def clear_fn():
@@ -189,6 +207,7 @@ class ROCmScript(scripts_manager.Script):
result.append(gr.update(value=rocm_mgr._dropdown_display(meta["default"], meta["options"])))
else:
result.append(gr.update(value=""))
result.append(gr.update(value="Disabled"))
return result
def delete_fn():
@@ -203,12 +222,13 @@ class ROCmScript(scripts_manager.Script):
result.append(gr.update(value=rocm_mgr._dropdown_display(meta["default"], meta["options"])))
else:
result.append(gr.update(value=""))
result.append(gr.update(value="Disabled"))
return result
btn_info.click(fn=_info_html, inputs=[], outputs=[info_out], show_progress='hidden')
btn_apply.click(fn=apply_fn, inputs=components, outputs=[style_out] + components, show_progress='hidden')
btn_reset.click(fn=reset_fn, inputs=[], outputs=[style_out] + components, show_progress='hidden')
btn_clear.click(fn=clear_fn, inputs=[], outputs=[style_out] + components, show_progress='hidden')
btn_delete.click(fn=delete_fn, inputs=[], outputs=[style_out] + components, show_progress='hidden')
btn_apply.click(fn=apply_fn, inputs=components + [miopen_logging_comp], outputs=[style_out] + components + [miopen_logging_comp], show_progress='hidden')
btn_reset.click(fn=reset_fn, inputs=[], outputs=[style_out] + components + [miopen_logging_comp], show_progress='hidden')
btn_clear.click(fn=clear_fn, inputs=[], outputs=[style_out] + components + [miopen_logging_comp], show_progress='hidden')
btn_delete.click(fn=delete_fn, inputs=[], outputs=[style_out] + components + [miopen_logging_comp], show_progress='hidden')
return components
return components + [miopen_logging_comp]