From 5e4819c3e94ec20316bc887ac8a25840bd5b9a86 Mon Sep 17 00:00:00 2001 From: CalamitousFelicitousness Date: Fri, 20 Mar 2026 21:43:44 +0000 Subject: [PATCH 01/33] run enso extension installer after clone and update After deletion and re-clone, enso.install() runs after install_extensions() has already passed, so install.py was never triggered and the frontend was not built. --- modules/enso.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/enso.py b/modules/enso.py index 1f6063659..cc9677ff5 100644 --- a/modules/enso.py +++ b/modules/enso.py @@ -1,5 +1,5 @@ import os -from installer import log, git +from installer import log, git, run_extension_installer from modules.paths import extensions_dir @@ -14,6 +14,7 @@ def install(): return log.info(f'Enso: folder="{ENSO_DIR}" installing') git(f'clone "{ENSO_REPO}" "{ENSO_DIR}"') + run_extension_installer(ENSO_DIR) def update(): @@ -22,3 +23,4 @@ def update(): return log.info(f'Enso: folder="{ENSO_DIR}" updating') git('pull', folder=ENSO_DIR) + run_extension_installer(ENSO_DIR) From a54e9b3311fa4617b9811a50e1a54a467e39ae9f Mon Sep 17 00:00:00 2001 From: vladmandic Date: Sat, 21 Mar 2026 09:06:55 +0100 Subject: [PATCH 02/33] update readme and some debug functions Signed-off-by: vladmandic --- README.md | 113 ++++++++++++++++++++++++++------------------ TODO.md | 4 +- launch.py | 7 ++- modules/cmd_args.py | 4 +- modules/memstats.py | 37 +++++++++++++-- 5 files changed, 108 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index 7cbd3e8a6..e7d7f15f7 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,14 @@
-SD.Next +SD.Next: AI art generator logo -# SD.Next: All-in-one WebUI for AI generative image and video creation and captioning +# SD.Next: All-in-one WebUI +SD.Next is a powerful, open-source WebUI app for AI image and video generation, built on Stable Diffusion and supporting dozens of advanced models. Create, caption, and process images and videos with a modern, cross-platform interface—perfect for artists, researchers, and AI enthusiasts. + + +![Stars](https://img.shields.io/github/stars/vladmandic/sdnext?style=social) +![Forks](https://img.shields.io/github/forks/vladmandic/sdnext?style=social) +![Contributors](https://img.shields.io/github/contributors/vladmandic/sdnext) ![Last update](https://img.shields.io/github/last-commit/vladmandic/sdnext?svg=true) ![License](https://img.shields.io/github/license/vladmandic/sdnext?svg=true) [![Discord](https://img.shields.io/discord/1101998836328697867?logo=Discord&svg=true)](https://discord.gg/VjvR2tabEX) @@ -17,61 +23,63 @@ ## Table of contents - [Documentation](https://vladmandic.github.io/sdnext-docs/) -- [SD.Next Features](#sdnext-features) -- [Model support](#model-support) -- [Platform support](#platform-support) +- [SD.Features](#features--capabilities) +- [Supported AI Models](#supported-ai-models) +- [Supported Platforms & Hardware](#supported-platforms--hardware) - [Getting started](#getting-started) -## SD.Next Features +### Screenshot: Desktop interface -All individual features are not listed here, instead check [ChangeLog](CHANGELOG.md) for full list of changes -- Fully localized: - ▹ **English | Chinese | Russian | Spanish | German | French | Italian | Portuguese | Japanese | Korean** -- Desktop and Mobile support! -- Multiple [diffusion models](https://vladmandic.github.io/sdnext-docs/Model-Support/)! -- Multi-platform! - ▹ **Windows | Linux | MacOS | nVidia CUDA | AMD ROCm | Intel Arc / IPEX XPU | DirectML | OpenVINO | ONNX+Olive | ZLUDA** +
+SD.Next: AI art generator desktop interface screenshot +
+ +### Screenshot: Mobile interface + +
+SD.Next: AI art generator mobile interface screenshot +
+
+ +
+ +## Features & Capabilities + +SD.Next is feature-rich with a focus on performance, flexibility, and user experience. Key features include: +- [Multi-platform](#platform-support! +- Many [diffusion models](https://vladmandic.github.io/sdnext-docs/Model-Support/)! +- Fully localized to ~15 languages and with support for many [UI themes](https://vladmandic.github.io/sdnext-docs/Themes/)! +- [Desktop](#screenshot-desktop-interface) and [Mobile](#screenshot-mobile-interface) support! - Platform specific auto-detection and tuning performed on install -- Optimized processing with latest `torch` developments with built-in support for model compile and quantize - Compile backends: *Triton | StableFast | DeepCache | OneDiff | TeaCache | etc.* - Quantization methods: *SDNQ | BitsAndBytes | Optimum-Quanto | TorchAO / LayerWise* -- **Captioning** with 150+ **OpenCLiP** models, **Tagger** with **WaifuDiffusion** and **DeepDanbooru** models, and 20+ built-in **VLMs** - Built in installer with automatic updates and dependency management -
+### Unique features -**Desktop** interface -
-screenshot-modernui-desktop -
- -**Mobile** interface -
-screenshot-modernui-mobile -
- -For screenshots and information on other available themes, see [Themes](https://vladmandic.github.io/sdnext-docs/Themes/) +SD.Next includes many features not found in other WebUIs, such as: +- **SDNQ**: State-of-the-Art quantization engine + Use pre-quantized or run with quantizaion on-the-fly for up to 4x VRAM reduction with no or minimal quality and performance impact +- **Balanced Offload**: Dynamically balance CPU and GPU memory to run larger models on limited hardware +- **Captioning** with 150+ **OpenCLiP** models, **Tagger** with **WaifuDiffusion** and **DeepDanbooru** models, and 25+ built-in **VLMs** +- **Image Processing** with full image correction color-grading suite of tools
-## Model support +## Supported AI Models SD.Next supports broad range of models: [supported models](https://vladmandic.github.io/sdnext-docs/Model-Support/) and [model specs](https://vladmandic.github.io/sdnext-docs/Models/) -## Platform support +## Supported Platforms & Hardware - *nVidia* GPUs using **CUDA** libraries on both *Windows and Linux* -- *AMD* GPUs using **ROCm** libraries on *Linux* - Support will be extended to *Windows* once AMD releases ROCm for Windows +- *AMD* GPUs using **ROCm** libraries on both *Linux and Windows* +- *AMD* GPUs on Windows using **ZLUDA** libraries - *Intel Arc* GPUs using **OneAPI** with *IPEX XPU* libraries on both *Windows and Linux* +- Any *CPU/GPU* or device compatible with **OpenVINO** libraries on both *Windows and Linux* - Any GPU compatible with *DirectX* on *Windows* using **DirectML** libraries - This includes support for AMD GPUs that are not supported by native ROCm libraries -- Any GPU or device compatible with **OpenVINO** libraries on both *Windows and Linux* - *Apple M1/M2* on *OSX* using built-in support in Torch with **MPS** optimizations - *ONNX/Olive* -- *AMD* GPUs on Windows using **ZLUDA** libraries -Plus Docker container recipes for: [CUDA, ROCm, Intel IPEX and OpenVINO](https://vladmandic.github.io/sdnext-docs/Docker/) +Plus **Docker** container recipes for: [CUDA, ROCm, Intel IPEX and OpenVINO](https://vladmandic.github.io/sdnext-docs/Docker/) ## Getting started @@ -84,21 +92,37 @@ Plus Docker container recipes for: [CUDA, ROCm, Intel IPEX and OpenVINO](https:/ > And for platform specific information, check out > [WSL](https://vladmandic.github.io/sdnext-docs/WSL/) | [Intel Arc](https://vladmandic.github.io/sdnext-docs/Intel-ARC/) | [DirectML](https://vladmandic.github.io/sdnext-docs/DirectML/) | [OpenVINO](https://vladmandic.github.io/sdnext-docs/OpenVINO/) | [ONNX & Olive](https://vladmandic.github.io/sdnext-docs/ONNX-Runtime/) | [ZLUDA](https://vladmandic.github.io/sdnext-docs/ZLUDA/) | [AMD ROCm](https://vladmandic.github.io/sdnext-docs/AMD-ROCm/) | [MacOS](https://vladmandic.github.io/sdnext-docs/MacOS-Python/) | [nVidia](https://vladmandic.github.io/sdnext-docs/nVidia/) | [Docker](https://vladmandic.github.io/sdnext-docs/Docker/) +### Quick Start + +```shell +git clone https://github.com/vladmandic/sdnext +cd sdnext +./webui.sh # Linux/Mac +webui.bat # Windows +webui.ps1 # PowerShell +``` + > [!WARNING] > If you run into issues, check out [troubleshooting](https://vladmandic.github.io/sdnext-docs/Troubleshooting/) and [debugging](https://vladmandic.github.io/sdnext-docs/Debug/) guides + +## Community & Support + +If you're unsure how to use a feature, best place to start is [Docs](https://vladmandic.github.io/sdnext-docs/) and if its not there, +check [ChangeLog](https://vladmandic.github.io/sdnext-docs/CHANGELOG/) for when feature was first introduced as it will always have a short note on how to use it + +And for any question, reach out on [Discord](https://discord.gg/VjvR2tabEX) or open an [issue](https://github.com/vladmandic/sdnext/issues) or [discussion](https://github.com/vladmandic/sdnext/discussions) + ### Contributing Please see [Contributing](CONTRIBUTING) for details on how to contribute to this project -And for any question, reach out on [Discord](https://discord.gg/VjvR2tabEX) or open an [issue](https://github.com/vladmandic/sdnext/issues) or [discussion](https://github.com/vladmandic/sdnext/discussions) -### Credits +## License & Credits +- SD.Next is licensed under the [Apache License 2.0](LICENSE.txt) - Main credit goes to [Automatic1111 WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) for the original codebase -- Additional credits are listed in [Credits](https://github.com/AUTOMATIC1111/stable-diffusion-webui/#credits) -- Licenses for modules are listed in [Licenses](html/licenses.html) -### Evolution +## Evolution @@ -109,9 +133,4 @@ And for any question, reach out on [Discord](https://discord.gg/VjvR2tabEX) or o - [OSS Stats](https://ossinsight.io/analyze/vladmandic/sdnext#overview) -### Docs - -If you're unsure how to use a feature, best place to start is [Docs](https://vladmandic.github.io/sdnext-docs/) and if its not there, -check [ChangeLog](https://vladmandic.github.io/sdnext-docs/CHANGELOG/) for when feature was first introduced as it will always have a short note on how to use it -
diff --git a/TODO.md b/TODO.md index 4003d74ef..1bad643d7 100644 --- a/TODO.md +++ b/TODO.md @@ -2,20 +2,22 @@ ## Release -- Update **README** - Bumb packages - Implement `unload_auxiliary_models` - Release **Launcher** - Release **Enso** - Update **ROCm** - Tips **Color Grading** +- Tips **Latent Corrections** ## Internal +- Integrate: [Depth3D](https://github.com/vladmandic/sd-extension-depth3d) - Feature: Color grading in processing - Feature: RIFE update - Feature: RIFE in processing - Feature: SeedVR2 in processing +- Feature: Add video models to `Reference` - Deploy: Lite vs Expert mode - Engine: [mmgp](https://github.com/deepbeepmeep/mmgp) - Engine: `TensorRT` acceleration diff --git a/launch.py b/launch.py index 3099bba33..14e11274e 100755 --- a/launch.py +++ b/launch.py @@ -308,6 +308,7 @@ def main(): log.warning('Restart is recommended due to packages updates...') t_server = time.time() t_monitor = time.time() + while True: try: alive = uv.thread.is_alive() @@ -326,8 +327,10 @@ def main(): if float(monitor_rate) > 0 and t_current - t_monitor > float(monitor_rate): log.trace(f'Monitor: {get_memory_stats(detailed=True)}') t_monitor = t_current - from modules.api.validate import get_api_stats - get_api_stats() + # from modules.api.validate import get_api_stats + # get_api_stats() + # from modules import memstats + # memstats.get_objects() if not alive: if uv is not None and uv.wants_restart: clean_server() diff --git a/modules/cmd_args.py b/modules/cmd_args.py index 6c0390201..da5fe2a6c 100644 --- a/modules/cmd_args.py +++ b/modules/cmd_args.py @@ -74,8 +74,8 @@ def add_diag_args(p): p.add_argument('--safe', default=env_flag("SD_SAFE", False), action='store_true', help="Run in safe mode with no user extensions") p.add_argument('--test', default=env_flag("SD_TEST", False), action='store_true', help="Run test only and exit") p.add_argument('--version', default=False, action='store_true', help="Print version information") - p.add_argument("--monitor", default=os.environ.get("SD_MONITOR", -1), help="Run memory monitor, default: %(default)s") - p.add_argument("--status", default=os.environ.get("SD_STATUS", -1), help="Run server is-alive status, default: %(default)s") + p.add_argument("--monitor", type=float, default=float(os.environ.get("SD_MONITOR", -1)), help="Run memory monitor, default: %(default)s") + p.add_argument("--status", type=float, default=float(os.environ.get("SD_STATUS", -1)), help="Run server is-alive status, default: %(default)s") def add_log_args(p): diff --git a/modules/memstats.py b/modules/memstats.py index b6397ad43..fbfdfb29a 100644 --- a/modules/memstats.py +++ b/modules/memstats.py @@ -1,9 +1,11 @@ import re import sys import os +import types +from collections import deque import psutil import torch -from modules import shared, errors +from modules import shared, errors, devices from modules.logger import log @@ -130,28 +132,53 @@ def reset_stats(): class Object: pattern = r"'(.*?)'" + def get_size(self, obj, seen=None): + size = sys.getsizeof(obj) + if seen is None: + seen = set() + obj_id = id(obj) + if obj_id in seen: + return 0 # Avoid double counting + seen.add(obj_id) + if isinstance(obj, dict): + size += sum(self.get_size(k, seen) + self.get_size(v, seen) for k, v in obj.items()) + elif isinstance(obj, (list, tuple, set, frozenset, deque)): + size += sum(self.get_size(i, seen) for i in obj) + return size + def __init__(self, name, obj): self.id = id(obj) self.name = name self.fn = sys._getframe(2).f_code.co_name - self.size = sys.getsizeof(obj) self.refcount = sys.getrefcount(obj) if torch.is_tensor(obj): self.type = obj.dtype self.size = obj.element_size() * obj.nelement() else: self.type = re.findall(self.pattern, str(type(obj)))[0] - self.size = sys.getsizeof(obj) + self.size = self.get_size(obj) def __str__(self): return f'{self.fn}.{self.name} type={self.type} size={self.size} ref={self.refcount}' -def get_objects(gcl=None, threshold:int=0): +def get_objects(gcl=None, threshold:int=1024*1024): + devices.torch_gc(force=True) if gcl is None: + # gcl = globals() gcl = {} + log.trace(f'Memory: modules={len(sys.modules)}') + for _module_name, module in sys.modules.items(): + try: + if not isinstance(module, types.ModuleType): + continue + namespace = vars(module) + gcl.update(namespace) + except Exception: + pass # Some modules may not allow introspection objects = [] seen = [] + log.trace(f'Memory: items={len(gcl)} threshold={threshold}') for name, obj in gcl.items(): if id(obj) in seen: continue @@ -169,6 +196,6 @@ def get_objects(gcl=None, threshold:int=0): objects = sorted(objects, key=lambda x: x.size, reverse=True) for obj in objects: - log.trace(obj) + log.trace(f'Memory: {obj}') return objects From 9a5e908ddfcbd1450d786af895def8a71ea24871 Mon Sep 17 00:00:00 2001 From: CalamitousFelicitousness Date: Sat, 21 Mar 2026 23:27:46 +0000 Subject: [PATCH 03/33] fix(ui): initialize max_length before tokenizer block --- modules/ui_common.py | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/ui_common.py b/modules/ui_common.py index 133136d8d..4de125eb4 100644 --- a/modules/ui_common.py +++ b/modules/ui_common.py @@ -439,6 +439,7 @@ def update_token_counter(text: str): from modules.extra_networks import parse_prompt count_formatted = '0' + max_length = 0 visible = False prompt, _ = parse_prompt(text) From afe3786f5f2d0e279a612ef1f1e7d029edc5889d Mon Sep 17 00:00:00 2001 From: vladmandic Date: Sun, 22 Mar 2026 11:07:09 +0100 Subject: [PATCH 04/33] add unet/dir to networks Signed-off-by: vladmandic --- CHANGELOG.md | 11 +++++--- javascript/ui.js | 8 ++++++ modules/api/api.py | 2 ++ modules/api/endpoints.py | 11 +++++++- modules/api/models.py | 4 +++ modules/civitai/metadata_civitai.py | 4 +-- modules/lora/lora_apply.py | 2 +- modules/options_handler.py | 5 +++- modules/sd_checkpoint.py | 26 +++++++++-------- modules/sd_unet.py | 1 + modules/shared.py | 1 + modules/ui_extra_networks.py | 6 ++-- modules/ui_extra_networks_unet.py | 43 +++++++++++++++++++++++++++++ modules/ui_models.py | 12 +++++++- modules/ui_settings.py | 7 +++++ 15 files changed, 119 insertions(+), 24 deletions(-) create mode 100644 modules/ui_extra_networks_unet.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 503b46a0e..7951844f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,20 +1,22 @@ # Change Log for SD.Next -## Update for 2026-03-20 +## Update for 2026-03-22 -### Highlights for 2026-03-20 +### Highlights for 2026-03-22 This release brings massive code refactoring to modernize codebase and removal of some obsolete features. Leaner & Faster! And since its a bit quieter period when it comes to new models, notable additions would be : *FireRed-Image-Edit* *SkyWorks-UniPic-3* and *Anima-Preview-2* +If you're on Windows platform, we have a brand new [All-in-one Installer & Launcher](https://github.com/vladmandic/sdnext-launcher): simply download `exe` or `zip` and done! + *What else*? Really a lot! -New color grading module, updated localization with new languages and improved translations, new civitai integration module, several new upscalers, improvements to LLM/VLM in captioning and prompt enhance, a lot of new control preprocessors, new realtime server info panel, some new UI themes +New color grading module, updated localization with new languages and improved translations, new civitai integration module, new finetunes loader, several new upscalers, improvements to LLM/VLM in captioning and prompt enhance, a lot of new control preprocessors, new realtime server info panel, some new UI themes And major work on API hardening: security, rate limits, secrets handling, new endpoints, etc. But also many smaller quality-of-life improvements - for full details, see [ChangeLog](https://github.com/vladmandic/automatic/blob/master/CHANGELOG.md) [ReadMe](https://github.com/vladmandic/automatic/blob/master/README.md) | [ChangeLog](https://github.com/vladmandic/automatic/blob/master/CHANGELOG.md) | [Docs](https://vladmandic.github.io/sdnext-docs/) | [WiKi](https://github.com/vladmandic/automatic/wiki) | [Discord](https://discord.com/invite/sd-next-federal-batch-inspectors-1101998836328697867) | [Sponsor](https://github.com/sponsors/vladmandic) -### Details for 2026-03-20 +### Details for 2026-03-22 - **Models** - [Google Flash 3.1 Image](https://ai.google.dev/gemini-api/docs/models/gemini-3-flash-preview) a.k.a. *Nano Banana 2* @@ -58,6 +60,7 @@ But also many smaller quality-of-life improvements - for full details, see [Chan > `set TORCH_COMMAND='torch==2.9.1 torchvision==0.24.1 torchaudio==2.9.1 --index-url https://download.pytorch.org/whl/cu126'` - **UI** - new panel: **server info** with detailed runtime informaton + - **networks** add **UNet/DiT** - **localization** improved translation quality and new translations locales: *en, en1, en2, en3, en4, hr, es, it, fr, de, pt, ru, zh, ja, ko, hi, ar, bn, ur, id, vi, tr, sr, po, he, xx, yy, qq, tlh* yes, this now includes stuff like *latin, esperanto, arabic, hebrew, klingon* and a lot more! diff --git a/javascript/ui.js b/javascript/ui.js index e76d55611..913cb0fc6 100644 --- a/javascript/ui.js +++ b/javascript/ui.js @@ -524,6 +524,14 @@ function selectVAE(name) { markSelectedCards([desiredVAEName], 'vae'); } +let desiredUNetName = null; +function selectUNet(name) { + desiredUNetName = name; + gradioApp().getElementById('change_unet').click(); + log(`selectUNet: ${desiredUNetName}`); + markSelectedCards([desiredUNetName], 'unet'); +} + function selectReference(name) { log(`selectReference: ${name}`); desiredCheckpointName = name; diff --git a/modules/api/api.py b/modules/api/api.py index 15cf83884..f460fea51 100644 --- a/modules/api/api.py +++ b/modules/api/api.py @@ -88,6 +88,7 @@ class Api: self.add_api_route("/sdapi/v1/sd-vae", endpoints.get_sd_vaes, methods=["GET"], response_model=list[models.ItemVae]) self.add_api_route("/sdapi/v1/extensions", endpoints.get_extensions_list, methods=["GET"], response_model=list[models.ItemExtension]) self.add_api_route("/sdapi/v1/extra-networks", endpoints.get_extra_networks, methods=["GET"], response_model=list[models.ItemExtraNetwork]) + self.add_api_route("/sdapi/v1/unets", endpoints.get_unets, methods=["GET"], response_model=list[models.ItemUNet]) # functional api self.add_api_route("/sdapi/v1/png-info", endpoints.post_pnginfo, methods=["POST"], response_model=models.ResImageInfo, tags=["Functional"]) @@ -98,6 +99,7 @@ class Api: self.add_api_route("/sdapi/v1/reload-checkpoint", endpoints.post_reload_checkpoint, methods=["POST"], tags=["Functional"]) self.add_api_route("/sdapi/v1/lock-checkpoint", endpoints.post_lock_checkpoint, methods=["POST"], tags=["Functional"]) self.add_api_route("/sdapi/v1/refresh-vae", endpoints.post_refresh_vae, methods=["POST"], tags=["Functional"]) + self.add_api_route("/sdapi/v1/refresh-unets", endpoints.post_refresh_unets, methods=["POST"], tags=["Functional"]) self.add_api_route("/sdapi/v1/latents", endpoints.get_latent_history, methods=["GET"], response_model=list[str], tags=["Functional"]) self.add_api_route("/sdapi/v1/latents", endpoints.post_latent_history, methods=["POST"], response_model=int, tags=["Functional"]) self.add_api_route("/sdapi/v1/modules", endpoints.get_modules, methods=["GET"], tags=["Functional"]) diff --git a/modules/api/endpoints.py b/modules/api/endpoints.py index 775fa1bc9..6f02b2986 100644 --- a/modules/api/endpoints.py +++ b/modules/api/endpoints.py @@ -65,7 +65,6 @@ get_restorers = get_detailers # legacy alias for /sdapi/v1/face-restorers def get_ip_adapters(): """ List available IP-Adapter models. - Returns adapter names that can be used for image-prompt conditioning during generation. """ from modules import ipadapter @@ -75,6 +74,11 @@ def get_prompt_styles(): """List all saved prompt styles with their prompt, negative prompt, and preview.""" return [{ 'name': v.name, 'prompt': v.prompt, 'negative_prompt': v.negative_prompt, 'extra': v.extra, 'filename': v.filename, 'preview': v.preview} for v in shared.prompt_styles.styles.values()] +def get_unets(): + """List available UNet models with their names and filenames.""" + from modules.sd_unet import unet_dict + return [{"name": k, "filename": v} for k, v in unet_dict.items()] + def get_embeddings(): """List loaded and skipped textual-inversion embeddings for the current model.""" db = getattr(shared.sd_model, 'embedding_db', None) if shared.sd_loaded else None @@ -221,6 +225,11 @@ def post_lock_checkpoint(lock:bool=False): modeldata.model_data.locked = lock return {} +def post_refresh_unets(): + """Rescan UNet directories and update the available UNet list.""" + import modules.sd_unet + return modules.sd_unet.refresh_unet_list() + def get_checkpoint(): """Return information about the currently loaded checkpoint including type, class, title, and hash.""" if not shared.sd_loaded or shared.sd_model is None: diff --git a/modules/api/models.py b/modules/api/models.py index f51bd3ad9..f4bf64899 100644 --- a/modules/api/models.py +++ b/modules/api/models.py @@ -146,6 +146,10 @@ class ItemStyle(BaseModel): filename: str | None = Field(title="Filename", description="Path to the styles file") preview: str | None = Field(title="Preview", description="URL to the style preview image") +class ItemUNet(BaseModel): + name: str = Field(title="Name", description="UNet/DiT name") + filename: str | None = Field(title="Filename", description="Path to the UNet/DiT file") + class ItemExtraNetwork(BaseModel): name: str = Field(title="Name", description="Network short name") type: str = Field(title="Type", description="Network type (lora, checkpoint, embedding, etc.)") diff --git a/modules/civitai/metadata_civitai.py b/modules/civitai/metadata_civitai.py index 57c4e082e..e337749dd 100644 --- a/modules/civitai/metadata_civitai.py +++ b/modules/civitai/metadata_civitai.py @@ -219,8 +219,8 @@ def civit_search_metadata(title: str = None, raw: bool = False): import concurrent with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor: future_items = {} - for fn in candidates: - future_items[executor.submit(atomic_civit_search_metadata, fn, results)] = fn + for candidate in candidates: + future_items[executor.submit(atomic_civit_search_metadata, candidate, results)] = candidate for future in concurrent.futures.as_completed(future_items): future.result() yield results if raw else create_search_metadata_table(results) diff --git a/modules/lora/lora_apply.py b/modules/lora/lora_apply.py index 62bc4d15d..0cd33e851 100644 --- a/modules/lora/lora_apply.py +++ b/modules/lora/lora_apply.py @@ -4,13 +4,13 @@ import re import time from typing import TYPE_CHECKING import torch -import diffusers.models.lora from modules.lora import lora_common as l from modules import shared, devices, errors, model_quant from modules.logger import log if TYPE_CHECKING: from collections.abc import Callable + import diffusers.models.lora bnb = None diff --git a/modules/options_handler.py b/modules/options_handler.py index 5041eb86c..9fb5c8faf 100644 --- a/modules/options_handler.py +++ b/modules/options_handler.py @@ -93,7 +93,10 @@ class Options: def set(self, key, value): """sets an option and calls its onchange callback, returning True if the option changed and False otherwise""" - oldval = self.data.get(key, None) + if key in self.secrets: + oldval = self.secrets.get(key, None) + else: + oldval = self.data.get(key, None) if oldval is None: if key in self.data_labels: oldval = self.data_labels[key].default diff --git a/modules/sd_checkpoint.py b/modules/sd_checkpoint.py index f6cd40fa3..c861fcf12 100644 --- a/modules/sd_checkpoint.py +++ b/modules/sd_checkpoint.py @@ -24,8 +24,8 @@ warn_once = False class CheckpointInfo: - def __init__(self, filename, sha=None, subfolder=None): - self.name = None + def __init__(self, filename, name=None, sha=None, subfolder=None, model_type: str = 'checkpoint'): + self.name = name self.hash = sha self.filename = filename self.type = '' @@ -62,9 +62,9 @@ class CheckpointInfo: self.sha256 = None self.type = 'unknown' elif os.path.isfile(filename): # ckpt or safetensor - self.name = relname + self.name = self.name or relname self.filename = filename - self.sha256 = hashes.sha256_from_cache(self.filename, f"checkpoint/{relname}") + self.sha256 = hashes.sha256_from_cache(self.filename, f"{model_type}/{relname}") or hashes.sha256_from_cache(self.filename, f"{model_type}/{name}") self.type = ext if 'nf4' in filename: self.type = 'transformer' @@ -74,12 +74,12 @@ class CheckpointInfo: else: repo = [r for r in modelloader.diffuser_repos if self.hash == r['hash']] if len(repo) == 0: - self.name = filename + self.name = self.name or filename self.filename = filename self.sha256 = None self.type = 'unknown' else: - self.name = os.path.join(os.path.basename(shared.opts.diffusers_dir), repo[0]['name']) + self.name = self.name or os.path.join(os.path.basename(shared.opts.diffusers_dir), repo[0]["name"]) self.filename = repo[0]['path'] self.sha256 = repo[0]['hash'] self.type = 'diffusers' @@ -109,7 +109,7 @@ class CheckpointInfo: return self.shorthash def __str__(self): - return f'CheckpointInfo(name="{self.name}" filename="{self.filename}" hash={self.shorthash} type={self.type} title="{self.title}" path="{self.path}" subfolder="{self.subfolder}")' + return f'CheckpointInfo(name="{self.name}" filename="{self.filename}" sha256={self.sha256} sha={self.shorthash} type={self.type} title="{self.title}" path="{self.path}" subfolder="{self.subfolder}")' def setup_model(): @@ -160,7 +160,7 @@ def list_models(): checkpoints_list = dict(sorted(checkpoints_list.items(), key=lambda cp: cp[1].filename)) -def update_model_hashes(): +def update_model_hashes(model_list: dict = None, model_type: str = 'checkpoint'): def update_model_hashes_table(rows): html = """ @@ -186,14 +186,16 @@ def update_model_hashes(): log.error(f'Model list: row={row} {e}') return html.format(tbody=tbody) - lst = [ckpt for ckpt in checkpoints_list.values() if ckpt.hash is None] + if model_list is None: + model_list = checkpoints_list + lst = [ckpt for ckpt in model_list.values() if ckpt.hash is None] for ckpt in lst: ckpt.hash = model_hash(ckpt.filename) - lst = [ckpt for ckpt in checkpoints_list.values() if ckpt.sha256 is None or ckpt.shorthash is None] - log.info(f'Models list: hash missing={len(lst)} total={len(checkpoints_list)}') + lst = [ckpt for ckpt in model_list.values() if ckpt.sha256 is None or ckpt.shorthash is None] + log.info(f'Models list: hash missing={len(lst)} total={len(model_list)}') updated = [] for ckpt in lst: - ckpt.sha256 = hashes.sha256(ckpt.filename, f"checkpoint/{ckpt.name}") + ckpt.sha256 = hashes.sha256(ckpt.filename, f"{model_type}/{ckpt.name}") ckpt.shorthash = ckpt.sha256[0:10] if ckpt.sha256 is not None else None updated.append(ckpt) yield update_model_hashes_table(updated) diff --git a/modules/sd_unet.py b/modules/sd_unet.py index a3ac1c633..4d6ab58b2 100644 --- a/modules/sd_unet.py +++ b/modules/sd_unet.py @@ -102,3 +102,4 @@ def refresh_unet_list(): name = os.path.splitext(basename)[0] if ".safetensors" in basename else basename unet_dict[name] = file log.info(f'Available UNets: path="{shared.opts.unet_dir}" items={len(unet_dict)}') + return unet_dict diff --git a/modules/shared.py b/modules/shared.py index 2bd4cdc53..0a9a20a9a 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -151,6 +151,7 @@ def list_samplers(): modules.sd_samplers.set_samplers() return modules.sd_samplers.all_samplers + log.debug('Initializing: default modes') startup_offload_mode, startup_offload_min_gpu, startup_offload_max_gpu, startup_cross_attention, startup_sdp_options, startup_sdp_choices, startup_sdp_override_options, startup_sdp_override_choices, startup_offload_always, startup_offload_never = get_default_modes(cmd_opts=cmd_opts, mem_stat=mem_stat) diff --git a/modules/ui_extra_networks.py b/modules/ui_extra_networks.py index d80ff9573..17a1c5b7e 100644 --- a/modules/ui_extra_networks.py +++ b/modules/ui_extra_networks.py @@ -584,6 +584,8 @@ def register_pages(): register_page(ExtraNetworksPageLora()) from modules.ui_extra_networks_wildcards import ExtraNetworksPageWildcards register_page(ExtraNetworksPageWildcards()) + from modules.ui_extra_networks_unet import ExtraNetworksPageUNets + register_page(ExtraNetworksPageUNets()) if shared.opts.latent_history > 0: from modules.ui_extra_networks_history import ExtraNetworksPageHistory register_page(ExtraNetworksPageHistory()) @@ -596,7 +598,7 @@ def get_pages(title=None): visible = shared.opts.extra_networks pages: list[ExtraNetworksPage] = [] if 'All' in visible or visible == []: # default en sort order - visible = ['Model', 'Lora', 'Style', 'Wildcards', 'Embedding', 'VAE', 'History', 'Hypernetwork'] + visible = ['Model', 'Lora', 'UNet/DiT', 'Style', 'Wildcards', 'Embedding', 'VAE', 'History', 'Hypernetwork'] titles = [page.title for page in shared.extra_networks] if title is None: @@ -743,7 +745,7 @@ def create_ui(container, button_parent, tabname, skip_indexing = False): with ui.tabs: def ui_tab_change(page): - scan_visible = page in ['Model', 'Lora', 'VAE', 'Hypernetwork', 'Embedding'] + scan_visible = page in ['Model', 'Lora', 'VAE', 'UNet/DiT', 'Hypernetwork', 'Embedding'] save_visible = page in ['Style'] model_visible = page in ['Model'] return [gr.update(visible=scan_visible), gr.update(visible=save_visible), gr.update(visible=model_visible)] diff --git a/modules/ui_extra_networks_unet.py b/modules/ui_extra_networks_unet.py new file mode 100644 index 000000000..7d6e016d6 --- /dev/null +++ b/modules/ui_extra_networks_unet.py @@ -0,0 +1,43 @@ +import html +import json +import os +from modules import shared, ui_extra_networks, sd_unet, hashes, modelstats +from modules.logger import log + + +class ExtraNetworksPageUNets(ui_extra_networks.ExtraNetworksPage): + def __init__(self): + super().__init__('UNet/DiT') + + def refresh(self): + return sd_unet.refresh_unet_list() + + def list_items(self): + for name, filename in sd_unet.unet_dict.items(): + try: + size, mtime = modelstats.stat(filename) + info = self.find_info(filename) + version = self.find_version(None, info) + record = { + "type": 'UNet/DiT', + "name": name, + "alias": os.path.splitext(os.path.basename(filename))[0], + "title": name, + "filename": filename, + "hash": hashes.sha256_from_cache(filename, f"unet/{name}"), + "preview": self.find_preview(filename), + "local_preview": f"{os.path.splitext(filename)[0]}.{shared.opts.samples_format}", + "metadata": {}, + "onclick": '"' + html.escape(f"""return selectUNet({json.dumps(name)})""") + '"', + "mtime": mtime, + "size": size, + "info": info, + "description": self.find_description(filename, info), + "version": version.get("baseModel", "N/A") if info else "N/A", + } + yield record + except Exception as e: + log.debug(f'Networks error: type=vae file="{filename}" {e}') + + def allowed_directories_for_previews(self): + return [v for v in [shared.opts.unet_dir] if v is not None] diff --git a/modules/ui_models.py b/modules/ui_models.py index 2856448e6..2edfd0ade 100644 --- a/modules/ui_models.py +++ b/modules/ui_models.py @@ -12,6 +12,16 @@ from modules.shared import opts, log extra_ui = [] +def update_model_hashes(): + from modules import sd_unet, sd_checkpoint + unets = {} + for k, v in sd_unet.unet_dict.items(): + unets[k] = sd_checkpoint.CheckpointInfo(name=k, filename=v, model_type='unet') + print('HERE3', unets[k]) + yield from sd_models.update_model_hashes(unets, model_type='unet') + yield from sd_models.update_model_hashes(model_type='checkpoint') + + def create_ui(): log.debug('UI initialize: tab=models') dummy_component = gr.Label(visible=False) @@ -143,7 +153,7 @@ def create_ui(): with gr.Row(): model_table = gr.HTML(value='', elem_id="model_list_table") - model_checkhash_btn.click(fn=sd_models.update_model_hashes, inputs=[], outputs=[model_table]) + model_checkhash_btn.click(fn=update_model_hashes, inputs=[], outputs=[model_table]) model_list_btn.click(fn=lambda: create_models_table(list(sd_models.checkpoints_list.values())), inputs=[], outputs=[model_table]) with gr.Tab(label="Metadata", elem_id="models_metadata_tab"): diff --git a/modules/ui_settings.py b/modules/ui_settings.py index 317186343..80c310e5b 100644 --- a/modules/ui_settings.py +++ b/modules/ui_settings.py @@ -396,6 +396,13 @@ def create_quicksettings(interfaces): inputs=[shared.settings_components['sd_vae'], dummy_component], outputs=[shared.settings_components['sd_vae'], text_settings], ) + button_set_unet = gr.Button("Change UNet", elem_id="change_unet", visible=False) + button_set_unet.click( + fn=lambda value, _: run_settings_single(value, key="sd_unet"), + _js="function(v){ var res = desiredUNetName; desiredUNetName = ''; return [res || v, null]; }", + inputs=[shared.settings_components["sd_unet"], dummy_component], + outputs=[shared.settings_components["sd_unet"], text_settings], + ) def reference_submit(model): if '@' not in model: # diffusers From e5723647668bc43b6e866e150f1e8e9bdb9ed352 Mon Sep 17 00:00:00 2001 From: vladmandic Date: Sun, 22 Mar 2026 11:07:50 +0100 Subject: [PATCH 05/33] update modernui Signed-off-by: vladmandic --- extensions-builtin/sdnext-modernui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions-builtin/sdnext-modernui b/extensions-builtin/sdnext-modernui index 9153b52f3..d3f63ee8c 160000 --- a/extensions-builtin/sdnext-modernui +++ b/extensions-builtin/sdnext-modernui @@ -1 +1 @@ -Subproject commit 9153b52f3980fe857c4ab9c3dd4f131b6175d20e +Subproject commit d3f63ee8c3b6220f290e5fa54dc172a772b8c108 From b2b4e13bab6326f838f8be5391e4434860519b39 Mon Sep 17 00:00:00 2001 From: vladmandic Date: Sun, 22 Mar 2026 11:17:41 +0100 Subject: [PATCH 06/33] lint Signed-off-by: vladmandic --- modules/errorlimiter.py | 2 +- modules/ui_common.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/errorlimiter.py b/modules/errorlimiter.py index 93c96377a..b869a8553 100644 --- a/modules/errorlimiter.py +++ b/modules/errorlimiter.py @@ -12,7 +12,7 @@ _lock = Lock() def _make_unique(name: str): - global _instance_id + global _instance_id # pylint: disable=global-statement with _lock: # Guard against race conditions new_name = f"{name}__{_instance_id}" _instance_id += 1 diff --git a/modules/ui_common.py b/modules/ui_common.py index 4de125eb4..e4957e1df 100644 --- a/modules/ui_common.py +++ b/modules/ui_common.py @@ -476,7 +476,7 @@ def update_token_counter(text: str): token_counts = [len(group) - int(has_bos_token) - int(has_eos_token) for group in ids] if len(token_counts) > 1: visible = True - count_formatted = f"{token_counts} {sum(token_counts)}" if shared.opts.prompt_detailed_tokens else str(sum(token_counts)) + count_formatted = f"{token_counts}/{sum(token_counts)}" elif len(token_counts) == 1 and token_counts[0] > 0: visible = True count_formatted = str(token_counts[0]) From e87fcd1bc54096ae920de1226065996c30378021 Mon Sep 17 00:00:00 2001 From: vladmandic Date: Sun, 22 Mar 2026 11:27:36 +0100 Subject: [PATCH 07/33] latent correction hints Signed-off-by: vladmandic --- TODO.md | 2 +- html/locale_en.json | 19 +++++++++---------- modules/ui_sections.py | 14 +++++++------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/TODO.md b/TODO.md index 1bad643d7..c4b820105 100644 --- a/TODO.md +++ b/TODO.md @@ -8,7 +8,7 @@ - Release **Enso** - Update **ROCm** - Tips **Color Grading** -- Tips **Latent Corrections** +- Regen **Localization** ## Internal diff --git a/html/locale_en.json b/html/locale_en.json index e4ee61e99..ef16327f0 100644 --- a/html/locale_en.json +++ b/html/locale_en.json @@ -163,7 +163,6 @@ {"id":"","label":"Batch size","localized":"","hint":"How many image to create in a single batch (increases generation performance at cost of higher VRAM usage)","ui":"txt2img"}, {"id":"","label":"Beta schedule","localized":"","hint":"Defines how beta (noise strength per step) grows. Options:
- default: the model default
- linear: evenly decays noise per step
- scaled: squared version of linear, used only by Stable Diffusion
- cosine: smoother decay, often better results with fewer steps
- sigmoid: sharp transition, experimental","ui":"txt2img"}, {"id":"","label":"Base shift","localized":"","hint":"Minimum shift value for low resolutions when using dynamic shifting.","ui":"txt2img"}, - {"id":"","label":"Brightness","localized":"","hint":"","ui":"txt2img"}, {"id":"","label":"Block","localized":"","hint":"","ui":"script_kohya_hires_fix"}, {"id":"","label":"Block size","localized":"","hint":"","ui":"script_nudenet"}, {"id":"","label":"Banned words","localized":"","hint":"","ui":"script_nudenet"}, @@ -235,8 +234,6 @@ {"id":"","label":"CLIP Analysis","localized":"","hint":"","ui":"caption"}, {"id":"","label":"Context","localized":"","hint":"","ui":"txt2img"}, {"id":"","label":"Correction mode","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"Color","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"Center","localized":"","hint":"","ui":"txt2img"}, {"id":"","label":"Color grading","localized":"","hint":"","ui":"txt2img"}, {"id":"","label":"Crop to portrait","localized":"","hint":"Crop input image to portrait-only before using it as IP adapter input","ui":"txt2img"}, {"id":"","label":"Concept Tokens","localized":"","hint":"","ui":"script_consistory"}, @@ -649,9 +646,6 @@ {"id":"","label":"HiDiffusion","localized":"","hint":"HiDiffusion allows creation of high-resolution images using your standard models without duplicates/distortions and improved performance","ui":"settings_advanced"}, {"id":"","label":"Height","localized":"","hint":"Image height","ui":"txt2img"}, {"id":"","label":"HiRes steps","localized":"","hint":"Number of sampling steps for upscaled picture. If 0, uses same as for original","ui":"txt2img"}, - {"id":"","label":"HDR clamp","localized":"","hint":"Adjusts the level of nonsensical details by pruning values that deviate significantly from the distribution mean. It is particularly useful for enhancing generation at higher guidance scales, identifying outliers early in the process and applying mathematical adjustments based on the Range (Boundary) and Threshold settings. Think of it as setting the range within which you want your image values to be, and adjusting the threshold determines which values should be brought back into that range","ui":"txt2img"}, - {"id":"","label":"HDR maximize","localized":"","hint":"Calculates a 'normalization factor' by dividing the maximum tensor value by the specified range multiplied by 4. This factor is then used to shift the channels within the given boundary, ensuring maximum dynamic range for subsequent processing. The objective is to optimize dynamic range for external applications like Photoshop, particularly for adjusting levels, contrast, and brightness","ui":"txt2img"}, - {"id":"","label":"HDR range","localized":"","hint":"","ui":"script_hdr"}, {"id":"","label":"Hue","localized":"","hint":"","ui":"script_lut_color_grading"}, {"id":"","label":"HQ init latents","localized":"","hint":"","ui":"script_instantir"}, {"id":"","label":"Height after","localized":"","hint":"","ui":"control"}, @@ -758,6 +752,15 @@ ], "l": [ + {"id":"","label":"Latent brightness","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Latent center","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Latent clamp","localized":"","hint":"Adjusts the level of nonsensical details by pruning values that deviate significantly from the distribution mean. It is particularly useful for enhancing generation at higher guidance scales, identifying outliers early in the process and applying mathematical adjustments based on the Range (Boundary) and Threshold settings. Think of it as setting the range within which you want your image values to be, and adjusting the threshold determines which values should be brought back into that range","ui":"txt2img"}, + {"id":"","label":"Latent color","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Latent max range","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Latent maximize","localized":"","hint":"Calculates a 'normalization factor' by dividing the maximum tensor value by the specified range multiplied by 4. This factor is then used to shift the channels within the given boundary, ensuring maximum dynamic range for subsequent processing. The objective is to optimize dynamic range for external applications like Photoshop, particularly for adjusting levels, contrast, and brightness","ui":"txt2img"}, + {"id":"","label":"Latent range","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Latent sharpen","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Latent threshold","localized":"","hint":"","ui":"txt2img"}, {"id":"prompt_enhance_load","label":"Load model","localized":"","hint":"","ui":"script_prompt_enhance"}, {"id":"prompt_enhance_custom_load","label":"Load custom model","localized":"","hint":"Load a custom model with the specified configuration","ui":"script_prompt_enhance"}, {"id":"control_mask_remove","label":"LaMa Remove","localized":"","hint":"","ui":"control"}, @@ -871,7 +874,6 @@ {"id":"","label":"Max overlap","localized":"","hint":"Maximum overlap between two detected items before one is discarded","ui":"txt2img"}, {"id":"","label":"Min size","localized":"","hint":"Minimum size of detected object as percentage of overal image","ui":"txt2img"}, {"id":"","label":"Max size","localized":"","hint":"Maximum size of detected object as percentage of overal image","ui":"txt2img"}, - {"id":"","label":"Max Range","localized":"","hint":"","ui":"txt2img"}, {"id":"","label":"Momentum","localized":"","hint":"","ui":"script_apg"}, {"id":"","label":"Mode x-axis","localized":"","hint":"","ui":"script_asymmetric_tiling"}, {"id":"","label":"Mode y-axis","localized":"","hint":"","ui":"script_asymmetric_tiling"}, @@ -1196,7 +1198,6 @@ {"id":"","label":"Refine negative prompt","localized":"","hint":"Negative prompt used for both second encoder in base model (if it exists) and for refiner pass (if enabled)","ui":"txt2img"}, {"id":"","label":"Renoise","localized":"","hint":"Apply additional noise during detailing","ui":"txt2img"}, {"id":"","label":"Renoise end","localized":"","hint":"Final step when renoise is applied","ui":"txt2img"}, - {"id":"","label":"Range","localized":"","hint":"","ui":"txt2img"}, {"id":"","label":"Repeat x-axis","localized":"","hint":"","ui":"script_asymmetric_tiling"}, {"id":"","label":"Repeat y-axis","localized":"","hint":"","ui":"script_asymmetric_tiling"}, {"id":"","label":"ReSwapper Model","localized":"","hint":"","ui":"script_face"}, @@ -1307,7 +1308,6 @@ {"id":"","label":"SEG config","localized":"","hint":"","ui":"txt2img"}, {"id":"","label":"Strength","localized":"","hint":"Denoising strength of during image operation controls how much of original image is allowed to change during generate","ui":"txt2img"}, {"id":"","label":"Sort detections","localized":"","hint":"Sort detected areas by from left to right instead of detection score","ui":"txt2img"}, - {"id":"","label":"Sharpen","localized":"","hint":"","ui":"txt2img"}, {"id":"","label":"Subject","localized":"","hint":"","ui":"script_consistory"}, {"id":"","label":"Same latent","localized":"","hint":"","ui":"script_consistory"}, {"id":"","label":"Share queries","localized":"","hint":"","ui":"script_consistory"}, @@ -1441,7 +1441,6 @@ {"id":"","label":"Timesteps override","localized":"","hint":"","ui":"txt2img"}, {"id":"","label":"thresholding","localized":"","hint":"","ui":"txt2img"}, {"id":"","label":"Texture tiling","localized":"","hint":"Apply seamless tiling to generated image so it can be used as a texture","ui":"txt2img"}, - {"id":"","label":"Threshold","localized":"","hint":"","ui":"txt2img"}, {"id":"","label":"Trigger word","localized":"","hint":"","ui":"script_face"}, {"id":"","label":"Temperature","localized":"","hint":"","ui":"script_flux_prompt_enhance_(legacy)"}, {"id":"","label":"Timestep","localized":"","hint":"","ui":"script_kohya_hires_fix"}, diff --git a/modules/ui_sections.py b/modules/ui_sections.py index 886e392a2..4a6b2d05a 100644 --- a/modules/ui_sections.py +++ b/modules/ui_sections.py @@ -172,15 +172,15 @@ def create_latent_inputs(tab): hdr_sharpen = gr.Slider(minimum=-4.0, maximum=4.0, step=0.05, value=0, label="Latent sharpen", elem_id=f"{tab}_hdr_sharpen") hdr_color = gr.Slider(minimum=0.0, maximum=16.0, step=0.1, value=0.0, label="Latent color", elem_id=f"{tab}_hdr_color") with gr.Row(elem_id=f"{tab}_hdr_clamp_row"): - hdr_clamp = gr.Checkbox(label="Clamp", value=False, elem_id=f"{tab}_hdr_clamp") - hdr_boundary = gr.Slider(minimum=0.0, maximum=10.0, step=0.1, value=4.0, label="Range", elem_id=f"{tab}_hdr_boundary") - hdr_threshold = gr.Slider(minimum=0.0, maximum=1.0, step=0.01, value=0.95, label="Threshold", elem_id=f"{tab}_hdr_threshold") + hdr_clamp = gr.Checkbox(label="Latent clamp", value=False, elem_id=f"{tab}_hdr_clamp") + hdr_boundary = gr.Slider(minimum=0.0, maximum=10.0, step=0.1, value=4.0, label="Latent range", elem_id=f"{tab}_hdr_boundary") + hdr_threshold = gr.Slider(minimum=0.0, maximum=1.0, step=0.01, value=0.95, label="Latent threshold", elem_id=f"{tab}_hdr_threshold") with gr.Row(elem_id=f"{tab}_hdr_max_row"): - hdr_maximize = gr.Checkbox(label="Maximize", value=False, elem_id=f"{tab}_hdr_maximize") - hdr_max_center = gr.Slider(minimum=0.0, maximum=2.0, step=0.1, value=0.6, label="Center", elem_id=f"{tab}_hdr_max_center") - hdr_max_boundary = gr.Slider(minimum=0.5, maximum=2.0, step=0.1, value=1.0, label="Max range", elem_id=f"{tab}_hdr_max_boundary") + hdr_maximize = gr.Checkbox(label="Latent maximize", value=False, elem_id=f"{tab}_hdr_maximize") + hdr_max_center = gr.Slider(minimum=0.0, maximum=2.0, step=0.1, value=0.6, label="Latent center", elem_id=f"{tab}_hdr_max_center") + hdr_max_boundary = gr.Slider(minimum=0.5, maximum=2.0, step=0.1, value=1.0, label="Latent max range", elem_id=f"{tab}_hdr_max_boundary") with gr.Row(elem_id=f"{tab}_hdr_color_row"): - hdr_color_picker = gr.ColorPicker(label="Tint color", show_label=True, container=False, value=None, elem_id=f"{tab}_hdr_color_picker") + hdr_color_picker = gr.ColorPicker(label="Latent tint", show_label=True, container=False, value=None, elem_id=f"{tab}_hdr_color_picker") hdr_tint_ratio = gr.Slider(label="Tint strength", minimum=-4.0, maximum=4.0, step=0.05, value=0.0, elem_id=f"{tab}_hdr_tint_ratio") return hdr_mode, hdr_brightness, hdr_color, hdr_sharpen, hdr_clamp, hdr_boundary, hdr_threshold, hdr_maximize, hdr_max_center, hdr_max_boundary, hdr_color_picker, hdr_tint_ratio, hdr_apply_hires From deb45c49b33b1f958d669560d04666da5ace187a Mon Sep 17 00:00:00 2001 From: vladmandic Date: Sun, 22 Mar 2026 17:32:47 +0100 Subject: [PATCH 08/33] add rocm config prototype Signed-off-by: vladmandic --- .gitignore | 1 + scripts/rocm/rocm_mgr.py | 32 ++++++++++++++++++++++++++++++ scripts/rocm_ext.py | 42 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 scripts/rocm/rocm_mgr.py create mode 100644 scripts/rocm_ext.py diff --git a/.gitignore b/.gitignore index 42a7cf49c..8a581342d 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ __pycache__ /data/cache.json /data/themes.json /data/installer.json +/data/rocm.json node_modules pnpm-lock.yaml package-lock.json diff --git a/scripts/rocm/rocm_mgr.py b/scripts/rocm/rocm_mgr.py new file mode 100644 index 000000000..507a73018 --- /dev/null +++ b/scripts/rocm/rocm_mgr.py @@ -0,0 +1,32 @@ +import os +import installer +from modules.logger import log +from modules.json_helpers import readfile, writefile + + +CONFIG = os.path.join('data', 'rocm.json') +DATA = {} + + +def load(): + global DATA # pylint: disable=global-statement + DATA = readfile(CONFIG, silent=True) or {} + log.debug(f'ROCm load: config={CONFIG} items={len(DATA)}') + + +def reset(): + log.info(f"ROCm reset: config={CONFIG}") + DATA.clear() + writefile(DATA, CONFIG) + + +def apply(db_path): + DATA["MIOPEN_SYSTEM_DB_PATH"] = db_path + log.info(f'ROCm apply: config={CONFIG} items={len(DATA)}') + writefile(DATA, CONFIG) + + +def info(): + for gpu in installer.gpu_info: + gpu['db'] = DATA.get('MIOPEN_SYSTEM_DB_PATH', '') + return installer.gpu_info diff --git a/scripts/rocm_ext.py b/scripts/rocm_ext.py new file mode 100644 index 000000000..520aedb40 --- /dev/null +++ b/scripts/rocm_ext.py @@ -0,0 +1,42 @@ +import gradio as gr +import installer +from modules import scripts_manager, shared + + +class Script(scripts_manager.Script): + def title(self): + return "ROCm: Advanced Config" + + def show(self, _is_img2img): + if shared.cmd_opts.use_rocm or installer.torch_info.get('type') == 'rocm': + return scripts_manager.AlwaysVisible # script should be visible only if rocm is detected or forced + return False + + def ui(self, _is_img2img): + # all ui elements go here + # logic should go into scripts/rocm/rocm_mgr.py and be called from here + if not shared.cmd_opts.use_rocm and not installer.torch_info.get('type') == 'rocm': # skip ui creation if not rocm + return [] + from scripts.rocm import rocm_mgr # pylint: disable=no-name-in-module + rocm_mgr.load() # load config before ui creation so we can populate fields with current values + with gr.Accordion('ROCM: Advanced Config', open=False, elem_id='rocm_config'): # set all ui in this accordion + with gr.Row(): + gr.HTML('Advanced configuration for ROCm users') + with gr.Row(): + btn_info = gr.Button("Refresh") # refresh info and populate with additional fields + btn_apply = gr.Button("Apply") # apply changes and save config + btn_reset = gr.Button("Reset") # reset config and save config + with gr.Row(): + info = gr.JSON(installer.gpu_info, label="ROCm Info") # just an example how to display info we already have + with gr.Row(): + db_path = gr.Textbox(label="MiOpen SystemDB Path", value=rocm_mgr.DATA.get('MIOPEN_SYSTEM_DB_PATH', ''), lines=1) + + args = [ # list all params here and note that it *must* match with scripts/rocm/rocm_mgr.apply() args + db_path, + ] + + btn_info.click(fn=rocm_mgr.info, inputs=[], outputs=[info]) + btn_apply.click(fn=rocm_mgr.apply, inputs=args, outputs=[]) + btn_reset.click(fn=rocm_mgr.reset, inputs=[], outputs=[]) + + return args From 0d248c45e7d755447f79aa8074882799a527ae72 Mon Sep 17 00:00:00 2001 From: CalamitousFelicitousness Date: Mon, 23 Mar 2026 02:12:59 +0000 Subject: [PATCH 09/33] fix(upscaler): convert non-RGB images before ESRGAN forward pass --- modules/postprocess/esrgan_model.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/postprocess/esrgan_model.py b/modules/postprocess/esrgan_model.py index c11fa7ddd..7aaffc124 100644 --- a/modules/postprocess/esrgan_model.py +++ b/modules/postprocess/esrgan_model.py @@ -176,6 +176,8 @@ class UpscalerESRGAN(Upscaler): def upscale_without_tiling(model, img): + if img.mode != 'RGB': + img = img.convert('RGB') img = np.array(img) img = img[:, :, ::-1] img = np.ascontiguousarray(np.transpose(img, (2, 0, 1))) / 255 From 091f31d4bf90ca298daf9686e2e899c4f1f19e8c Mon Sep 17 00:00:00 2001 From: CalamitousFelicitousness Date: Sat, 21 Mar 2026 19:07:25 +0000 Subject: [PATCH 10/33] add Flux2/Klein LoRA support - detect f2 model type for LoRAs via metadata, architecture, and filename/folder - preprocess bare BFL-format keys with diffusion_model prefix for Flux2LoraLoaderMixin - handle LoKR format via native NetworkModuleLokr with on-the-fly kron(w1, w2) - add NetworkModuleLokrChunk for fused QKV split into separate Q/K/V modules - activate native modules loaded via diffusers path - improve error message for Flux1/Flux2 architecture mismatch --- modules/lora/lora_load.py | 18 +++- modules/lora/network.py | 6 ++ modules/lora/network_lokr.py | 37 +++++++ pipelines/flux/flux2_lora.py | 177 +++++++++++++++++++++++++++++++++ pipelines/model_flux2.py | 3 + pipelines/model_flux2_klein.py | 3 + 6 files changed, 242 insertions(+), 2 deletions(-) create mode 100644 pipelines/flux/flux2_lora.py diff --git a/modules/lora/lora_load.py b/modules/lora/lora_load.py index e69ecc2fb..ae89ab8b5 100644 --- a/modules/lora/lora_load.py +++ b/modules/lora/lora_load.py @@ -257,7 +257,11 @@ def network_load(names, te_multipliers=None, unet_multipliers=None, dyn_dims=Non shared.compiled_model_state.lora_model.append(f"{name}:{lora_scale}") lora_method = lora_overrides.get_method(shorthash) if lora_method == 'diffusers': - net = lora_diffusers.load_diffusers(name, network_on_disk, lora_scale, lora_module) + if shared.sd_model_type == 'f2': + from pipelines.flux import flux2_lora + net = flux2_lora.try_load_lokr(name, network_on_disk, lora_scale) + if net is None: + net = lora_diffusers.load_diffusers(name, network_on_disk, lora_scale, lora_module) elif lora_method == 'nunchaku': pass # handled directly from extra_networks_lora.load_nunchaku else: @@ -272,7 +276,11 @@ def network_load(names, te_multipliers=None, unet_multipliers=None, dyn_dims=Non continue if net is None: failed_to_load_networks.append(name) - log.error(f'Network load: type=LoRA name="{name}" detected={network_on_disk.sd_version if network_on_disk is not None else None} not found') + lora_ver = network_on_disk.sd_version if network_on_disk is not None else None + if lora_ver in ('f1', '') and shared.sd_model_type == 'f2': + log.error(f'Network load: type=LoRA name="{name}" incompatible: Flux1 LoRA cannot be used with Flux2/Klein') + else: + log.error(f'Network load: type=LoRA name="{name}" detected={lora_ver} not found') continue if hasattr(sd_model, 'embedding_db'): sd_model.embedding_db.load_diffusers_embedding(None, net.bundle_embeddings) @@ -309,6 +317,12 @@ def network_load(names, te_multipliers=None, unet_multipliers=None, dyn_dims=Non errors.display(e, 'LoRA') shared.sd_model = sd_models.apply_balanced_offload(shared.sd_model, force=True, silent=True) # some layers may end up on cpu without hook + # Activate native modules loaded via diffusers path (e.g., LoKR on Flux2) + native_nets = [net for net in l.loaded_networks if len(net.modules) > 0] + if native_nets: + from modules.lora import networks + networks.network_activate() + if len(l.loaded_networks) > 0 and l.debug: log.debug(f'Network load: type=LoRA loaded={[n.name for n in l.loaded_networks]} cache={list(lora_cache)} fuse={shared.opts.lora_fuse_native}:{shared.opts.lora_fuse_diffusers}') diff --git a/modules/lora/network.py b/modules/lora/network.py index a7942aa25..5d3fd9fc7 100644 --- a/modules/lora/network.py +++ b/modules/lora/network.py @@ -58,6 +58,8 @@ class NetworkOnDisk: return 'sc' if base.startswith("sd3"): return 'sd3' + if base.startswith("flux2") or "klein" in base: + return 'f2' if base.startswith("flux"): return 'f1' if base.startswith("hunyuan_video"): @@ -75,6 +77,8 @@ class NetworkOnDisk: return 'xl' if arch.startswith("stable-cascade"): return 'sc' + if arch.startswith("flux2") or "klein" in arch: + return 'f2' if arch.startswith("flux"): return 'f1' if arch.startswith("hunyuan-video"): @@ -86,6 +90,8 @@ class NetworkOnDisk: return 'sd1' if str(self.metadata.get('ss_v2', "")) == "True": return 'sd2' + if 'klein' in self.name.lower() or 'klein' in self.fullname.lower(): + return 'f2' if 'flux' in self.name.lower(): return 'f1' if 'xl' in self.name.lower(): diff --git a/modules/lora/network_lokr.py b/modules/lora/network_lokr.py index 877d4005b..fcb6037e3 100644 --- a/modules/lora/network_lokr.py +++ b/modules/lora/network_lokr.py @@ -55,3 +55,40 @@ class NetworkModuleLokr(network.NetworkModule): # pylint: disable=abstract-metho output_shape = target.shape updown = make_kron(output_shape, w1, w2) return self.finalize_updown(updown, target, output_shape) + + +class NetworkModuleLokrChunk(NetworkModuleLokr): + """LoKR module that returns one chunk of the Kronecker product. + + Used when a LoKR adapter targets a fused weight (e.g., QKV) but the model + has separate modules (Q, K, V). Computes kron(w1, w2) on-the-fly and + returns only the designated chunk, keeping memory usage minimal. + """ + def __init__(self, net, weights, chunk_index, num_chunks): + super().__init__(net, weights) + self.chunk_index = chunk_index + self.num_chunks = num_chunks + + def calc_updown(self, target): + if self.w1 is not None: + w1 = self.w1.to(target.device, dtype=target.dtype) + else: + w1a = self.w1a.to(target.device, dtype=target.dtype) + w1b = self.w1b.to(target.device, dtype=target.dtype) + w1 = w1a @ w1b + if self.w2 is not None: + w2 = self.w2.to(target.device, dtype=target.dtype) + elif self.t2 is None: + w2a = self.w2a.to(target.device, dtype=target.dtype) + w2b = self.w2b.to(target.device, dtype=target.dtype) + w2 = w2a @ w2b + else: + t2 = self.t2.to(target.device, dtype=target.dtype) + w2a = self.w2a.to(target.device, dtype=target.dtype) + w2b = self.w2b.to(target.device, dtype=target.dtype) + w2 = lyco_helpers.make_weight_cp(t2, w2a, w2b) + full_shape = [w1.size(0) * w2.size(0), w1.size(1) * w2.size(1)] + updown = make_kron(full_shape, w1, w2) + updown = torch.chunk(updown, self.num_chunks, dim=0)[self.chunk_index] + output_shape = list(updown.shape) + return self.finalize_updown(updown, target, output_shape) diff --git a/pipelines/flux/flux2_lora.py b/pipelines/flux/flux2_lora.py new file mode 100644 index 000000000..c0fc20961 --- /dev/null +++ b/pipelines/flux/flux2_lora.py @@ -0,0 +1,177 @@ +"""Flux2/Klein-specific LoRA loading. + +Handles: +- Bare BFL-format keys in state dicts (adds diffusion_model. prefix for converter) +- LoKR adapters via native module loading (bypasses diffusers PEFT system) + +Installed via apply_patch() during pipeline loading. +""" + +import os +import time +from modules import shared, sd_models +from modules.logger import log +from modules.lora import network, network_lokr, lora_convert +from modules.lora import lora_common as l + + +BARE_FLUX_PREFIXES = ("single_blocks.", "double_blocks.", "img_in.", "txt_in.", + "final_layer.", "time_in.", "single_stream_modulation.", + "double_stream_modulation_") + +# BFL -> diffusers module path mapping for Flux2/Klein +F2_SINGLE_MAP = { + 'linear1': 'attn.to_qkv_mlp_proj', + 'linear2': 'attn.to_out', +} +F2_DOUBLE_MAP = { + 'img_attn.proj': 'attn.to_out.0', + 'txt_attn.proj': 'attn.to_add_out', + 'img_mlp.0': 'ff.linear_in', + 'img_mlp.2': 'ff.linear_out', + 'txt_mlp.0': 'ff_context.linear_in', + 'txt_mlp.2': 'ff_context.linear_out', +} +F2_QKV_MAP = { + 'img_attn.qkv': ('attn', ['to_q', 'to_k', 'to_v']), + 'txt_attn.qkv': ('attn', ['add_q_proj', 'add_k_proj', 'add_v_proj']), +} + + +def preprocess_f2_keys(state_dict): + """Add 'diffusion_model.' prefix to bare BFL-format keys so + Flux2LoraLoaderMixin's format detection routes them to the converter.""" + if any(k.startswith("diffusion_model.") or k.startswith("base_model.model.") for k in state_dict): + return state_dict + if any(k.startswith(p) for k in state_dict for p in BARE_FLUX_PREFIXES): + log.debug('Network load: type=LoRA adding diffusion_model prefix for bare BFL-format keys') + return {f"diffusion_model.{k}": v for k, v in state_dict.items()} + return state_dict + + +def try_load_lokr(name, network_on_disk, lora_scale): + """Try loading a Flux2/Klein LoRA as LoKR native modules. + + Returns a Network with native modules if the state dict contains LoKR keys, + or None to fall through to the generic diffusers path. + """ + t0 = time.time() + state_dict = sd_models.read_state_dict(network_on_disk.filename, what='network') + if not any('.lokr_w1' in k for k in state_dict): + return None + net = load_lokr_native(name, network_on_disk, state_dict) + if len(net.modules) == 0: + log.error(f'Network load: type=LoKR name="{name}" no modules matched') + return None + log.debug(f'Network load: type=LoKR name="{name}" native modules={len(net.modules)} scale={lora_scale}') + l.timer.activate += time.time() - t0 + return net + + +def load_lokr_native(name, network_on_disk, state_dict): + """Load Flux2 LoKR as native modules applied at inference time. + + Stores only the compact LoKR factors (w1, w2) and computes kron(w1, w2) + on-the-fly during weight application. For fused QKV modules in double + blocks, NetworkModuleLokrChunk computes the full Kronecker product and + returns only its designated Q/K/V chunk, then frees the temporary. + """ + prefix = "diffusion_model." + sd_model = getattr(shared.sd_model, "pipe", shared.sd_model) + lora_convert.assign_network_names_to_compvis_modules(sd_model) + net = network.Network(name, network_on_disk) + net.mtime = os.path.getmtime(network_on_disk.filename) + + for key in list(state_dict.keys()): + if not key.endswith('.lokr_w1'): + continue + if not key.startswith(prefix): + continue + + base = key[len(prefix):].rsplit('.lokr_w1', 1)[0] + lokr_weights = {} + for suffix in ['lokr_w1', 'lokr_w2', 'lokr_w1_a', 'lokr_w1_b', 'lokr_w2_a', 'lokr_w2_b', 'lokr_t2', 'alpha']: + full_key = f'{prefix}{base}.{suffix}' + if full_key in state_dict: + lokr_weights[suffix] = state_dict[full_key] + + parts = base.split('.') + block_type, block_idx, module_suffix = parts[0], parts[1], '.'.join(parts[2:]) + + targets = [] # (module_path, chunk_index, num_chunks) + if block_type == 'single_blocks' and module_suffix in F2_SINGLE_MAP: + path = f'single_transformer_blocks.{block_idx}.{F2_SINGLE_MAP[module_suffix]}' + targets.append((path, None, None)) + elif block_type == 'double_blocks': + if module_suffix in F2_DOUBLE_MAP: + path = f'transformer_blocks.{block_idx}.{F2_DOUBLE_MAP[module_suffix]}' + targets.append((path, None, None)) + elif module_suffix in F2_QKV_MAP: + attn_prefix, proj_keys = F2_QKV_MAP[module_suffix] + for i, proj_key in enumerate(proj_keys): + path = f'transformer_blocks.{block_idx}.{attn_prefix}.{proj_key}' + targets.append((path, i, len(proj_keys))) + + for module_path, chunk_index, num_chunks in targets: + network_key = "lora_transformer_" + module_path.replace(".", "_") + sd_module = sd_model.network_layer_mapping.get(network_key) + if sd_module is None: + log.warning(f'Network load: type=LoKR module not found in mapping: {network_key}') + continue + weights = network.NetworkWeights( + network_key=network_key, + sd_key=network_key, + w=dict(lokr_weights), + sd_module=sd_module, + ) + if chunk_index is not None: + net.modules[network_key] = network_lokr.NetworkModuleLokrChunk(net, weights, chunk_index, num_chunks) + else: + net.modules[network_key] = network_lokr.NetworkModuleLokr(net, weights) + + return net + + +patched = False + + +def apply_patch(): + """Patch Flux2LoraLoaderMixin.lora_state_dict to handle bare BFL-format keys. + + When a LoRA file has bare BFL keys (no diffusion_model. prefix), the original + lora_state_dict won't detect them as AI toolkit format. This patch checks for + bare keys after the original returns and adds the prefix + re-runs conversion. + """ + global patched + if patched: + return + patched = True + + from diffusers.loaders.lora_pipeline import Flux2LoraLoaderMixin + original_lora_state_dict = Flux2LoraLoaderMixin.lora_state_dict.__func__ + + @classmethod # pylint: disable=no-self-argument + def patched_lora_state_dict(cls, pretrained_model_name_or_path_or_dict, **kwargs): + if isinstance(pretrained_model_name_or_path_or_dict, dict): + pretrained_model_name_or_path_or_dict = preprocess_f2_keys(pretrained_model_name_or_path_or_dict) + elif isinstance(pretrained_model_name_or_path_or_dict, (str, os.PathLike)): + path = str(pretrained_model_name_or_path_or_dict) + if path.endswith('.safetensors'): + try: + from safetensors import safe_open + with safe_open(path, framework="pt") as f: + keys = list(f.keys()) + needs_prefix = ( + not any(k.startswith("diffusion_model.") or k.startswith("base_model.model.") for k in keys) + and any(k.startswith(p) for k in keys for p in BARE_FLUX_PREFIXES) + ) + if needs_prefix: + log.debug('Network load: type=LoRA adding diffusion_model prefix for bare BFL-format keys') + from safetensors.torch import load_file + sd = load_file(path) + pretrained_model_name_or_path_or_dict = {f"diffusion_model.{k}": v for k, v in sd.items()} + except Exception: + pass + return original_lora_state_dict(cls, pretrained_model_name_or_path_or_dict, **kwargs) + + Flux2LoraLoaderMixin.lora_state_dict = patched_lora_state_dict diff --git a/pipelines/model_flux2.py b/pipelines/model_flux2.py index c2963c316..dd6c364b0 100644 --- a/pipelines/model_flux2.py +++ b/pipelines/model_flux2.py @@ -31,6 +31,9 @@ def load_flux2(checkpoint_info, diffusers_load_config=None): diffusers.pipelines.auto_pipeline.AUTO_IMAGE2IMAGE_PIPELINES_MAPPING["flux2"] = diffusers.Flux2Pipeline diffusers.pipelines.auto_pipeline.AUTO_INPAINT_PIPELINES_MAPPING["flux2"] = diffusers.Flux2Pipeline + from pipelines.flux import flux2_lora + flux2_lora.apply_patch() + del text_encoder del transformer sd_hijack_te.init_hijack(pipe) diff --git a/pipelines/model_flux2_klein.py b/pipelines/model_flux2_klein.py index 34ccc1f67..31e539128 100644 --- a/pipelines/model_flux2_klein.py +++ b/pipelines/model_flux2_klein.py @@ -34,6 +34,9 @@ def load_flux2_klein(checkpoint_info, diffusers_load_config=None): diffusers.pipelines.auto_pipeline.AUTO_IMAGE2IMAGE_PIPELINES_MAPPING["flux2klein"] = diffusers.Flux2KleinPipeline diffusers.pipelines.auto_pipeline.AUTO_INPAINT_PIPELINES_MAPPING["flux2klein"] = diffusers.Flux2KleinPipeline + from pipelines.flux import flux2_lora + flux2_lora.apply_patch() + del text_encoder del transformer sd_hijack_te.init_hijack(pipe) From 9719290ceb51de222af437594d3b67d48490017a Mon Sep 17 00:00:00 2001 From: CalamitousFelicitousness Date: Sun, 22 Mar 2026 21:03:14 +0000 Subject: [PATCH 11/33] fix(lora): handle kohya-format alpha keys in Flux2/Klein LoRA loading --- pipelines/flux/flux2_lora.py | 54 +++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 7 deletions(-) diff --git a/pipelines/flux/flux2_lora.py b/pipelines/flux/flux2_lora.py index c0fc20961..048d60857 100644 --- a/pipelines/flux/flux2_lora.py +++ b/pipelines/flux/flux2_lora.py @@ -9,6 +9,7 @@ Installed via apply_patch() during pipeline loading. import os import time +import torch from modules import shared, sd_models from modules.logger import log from modules.lora import network, network_lokr, lora_convert @@ -38,6 +39,43 @@ F2_QKV_MAP = { } +def apply_lora_alphas(state_dict): + """Bake kohya-format .alpha scaling into lora_down weights and remove alpha keys. + + Diffusers' Flux2 converter only handles lora_A/lora_B (or lora_down/lora_up) keys. + Kohya-format LoRAs store per-layer alpha values as separate .alpha keys that the + converter doesn't consume, causing a ValueError on leftover keys. This matches the + approach used by _convert_kohya_flux_lora_to_diffusers for Flux 1. + """ + alpha_keys = [k for k in state_dict if k.endswith('.alpha')] + if not alpha_keys: + return state_dict + for alpha_key in alpha_keys: + base = alpha_key[:-len('.alpha')] + down_key = f'{base}.lora_down.weight' + if down_key not in state_dict: + continue + down_weight = state_dict[down_key] + rank = down_weight.shape[0] + alpha = state_dict.pop(alpha_key).item() + scale = alpha / rank + scale_down = scale + scale_up = 1.0 + while scale_down * 2 < scale_up: + scale_down *= 2 + scale_up /= 2 + state_dict[down_key] = down_weight * scale_down + up_key = f'{base}.lora_up.weight' + if up_key in state_dict: + state_dict[up_key] = state_dict[up_key] * scale_up + remaining = [k for k in state_dict if k.endswith('.alpha')] + if remaining: + log.debug(f'Network load: type=LoRA stripped {len(remaining)} orphaned alpha keys') + for k in remaining: + del state_dict[k] + return state_dict + + def preprocess_f2_keys(state_dict): """Add 'diffusion_model.' prefix to bare BFL-format keys so Flux2LoraLoaderMixin's format detection routes them to the converter.""" @@ -45,7 +83,7 @@ def preprocess_f2_keys(state_dict): return state_dict if any(k.startswith(p) for k in state_dict for p in BARE_FLUX_PREFIXES): log.debug('Network load: type=LoRA adding diffusion_model prefix for bare BFL-format keys') - return {f"diffusion_model.{k}": v for k, v in state_dict.items()} + state_dict = {f"diffusion_model.{k}": v for k, v in state_dict.items()} return state_dict @@ -154,6 +192,7 @@ def apply_patch(): def patched_lora_state_dict(cls, pretrained_model_name_or_path_or_dict, **kwargs): if isinstance(pretrained_model_name_or_path_or_dict, dict): pretrained_model_name_or_path_or_dict = preprocess_f2_keys(pretrained_model_name_or_path_or_dict) + pretrained_model_name_or_path_or_dict = apply_lora_alphas(pretrained_model_name_or_path_or_dict) elif isinstance(pretrained_model_name_or_path_or_dict, (str, os.PathLike)): path = str(pretrained_model_name_or_path_or_dict) if path.endswith('.safetensors'): @@ -161,15 +200,16 @@ def apply_patch(): from safetensors import safe_open with safe_open(path, framework="pt") as f: keys = list(f.keys()) - needs_prefix = ( - not any(k.startswith("diffusion_model.") or k.startswith("base_model.model.") for k in keys) - and any(k.startswith(p) for k in keys for p in BARE_FLUX_PREFIXES) + needs_load = ( + any(k.endswith('.alpha') for k in keys) + or (not any(k.startswith("diffusion_model.") or k.startswith("base_model.model.") for k in keys) + and any(k.startswith(p) for k in keys for p in BARE_FLUX_PREFIXES)) ) - if needs_prefix: - log.debug('Network load: type=LoRA adding diffusion_model prefix for bare BFL-format keys') + if needs_load: from safetensors.torch import load_file sd = load_file(path) - pretrained_model_name_or_path_or_dict = {f"diffusion_model.{k}": v for k, v in sd.items()} + sd = preprocess_f2_keys(sd) + pretrained_model_name_or_path_or_dict = apply_lora_alphas(sd) except Exception: pass return original_lora_state_dict(cls, pretrained_model_name_or_path_or_dict, **kwargs) From 57990fd8c06fdb01312844094132f7cc7e32c3fb Mon Sep 17 00:00:00 2001 From: vladmandic Date: Mon, 23 Mar 2026 06:41:46 +0100 Subject: [PATCH 12/33] add FireRed-Image-Edit-1.1 Signed-off-by: vladmandic --- CHANGELOG.md | 12 +++++++----- data/reference-community.json | 10 +++++++++- modules/lora/lora_load.py | 5 +---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7951844f0..13fd02cbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,13 @@ # Change Log for SD.Next -## Update for 2026-03-22 +## Update for 2026-03-23 -### Highlights for 2026-03-22 +### Highlights for 2026-03-23 This release brings massive code refactoring to modernize codebase and removal of some obsolete features. Leaner & Faster! And since its a bit quieter period when it comes to new models, notable additions would be : *FireRed-Image-Edit* *SkyWorks-UniPic-3* and *Anima-Preview-2* -If you're on Windows platform, we have a brand new [All-in-one Installer & Launcher](https://github.com/vladmandic/sdnext-launcher): simply download `exe` or `zip` and done! +If you're on Windows platform, we have a brand new [All-in-one Installer & Launcher](https://github.com/vladmandic/sdnext-launcher): simply download [exe or zip](https://github.com/vladmandic/sdnext-launcher/releases) and done! *What else*? Really a lot! New color grading module, updated localization with new languages and improved translations, new civitai integration module, new finetunes loader, several new upscalers, improvements to LLM/VLM in captioning and prompt enhance, a lot of new control preprocessors, new realtime server info panel, some new UI themes @@ -16,11 +16,11 @@ But also many smaller quality-of-life improvements - for full details, see [Chan [ReadMe](https://github.com/vladmandic/automatic/blob/master/README.md) | [ChangeLog](https://github.com/vladmandic/automatic/blob/master/CHANGELOG.md) | [Docs](https://vladmandic.github.io/sdnext-docs/) | [WiKi](https://github.com/vladmandic/automatic/wiki) | [Discord](https://discord.com/invite/sd-next-federal-batch-inspectors-1101998836328697867) | [Sponsor](https://github.com/sponsors/vladmandic) -### Details for 2026-03-22 +### Details for 2026-03-23 - **Models** - [Google Flash 3.1 Image](https://ai.google.dev/gemini-api/docs/models/gemini-3-flash-preview) a.k.a. *Nano Banana 2* - - [FireRed Image Edit](https://huggingface.co/FireRedTeam/FireRed-Image-Edit-1.0) + - [FireRed Image Edit](https://huggingface.co/FireRedTeam/FireRed-Image-Edit-1.0) *1.0 and 1.1* *Note*: FireRed is a fine-tune of Qwen-Image-Edit regardless of its claim as a new base-model - [Skyworks UniPic-3](https://huggingface.co/Skywork/Unipic3), *Consistency and DMD* variants to reference/community section *Note*: UniPic-3 is a fine-tune of Qwen-Image-Edit with new distillation regardless of its claim of major changes @@ -79,6 +79,7 @@ But also many smaller quality-of-life improvements - for full details, see [Chan - new `/sdapi/v1/torch` endpoint for torch info (backend, version, etc.) - new `/sdapi/v1/gpu` endpoint for GPU info - new `/sdapi/v1/rembg` endpoint for background removal + - new `/sdadpi/v1/unet` endpoint to list available unets/dits - use rate limiting for api logging - **Internal** - `python==3.13` full support @@ -150,6 +151,7 @@ But also many smaller quality-of-life improvements - for full details, see [Chan - improve video generation progress tracking - handle startup with bad `scripts` more gracefully - thread-safety for `error-limiter`, thanks @awsr + - add `lora` support for flux2-klein ## Update for 2026-02-04 diff --git a/data/reference-community.json b/data/reference-community.json index 19b0e1510..1161648f3 100644 --- a/data/reference-community.json +++ b/data/reference-community.json @@ -148,7 +148,7 @@ "date": "2026 March", "skip": true }, - "FireRed Image Edit": { + "FireRed Image Edit 1.0": { "path": "FireRedTeam/FireRed-Image-Edit-1.0", "preview": "FireRedTeam--FireRed-Image-Edit-1.0.jpg", "desc": "FireRed-Image-Edit is a general-purpose image editing model that delivers high-fidelity and consistent editing across a wide range of scenarios. FireRed is a fine-tune of Qwen-Image-Edit.", @@ -156,6 +156,14 @@ "date": "2026 February", "skip": true }, + "FireRed Image Edit 1.1": { + "path": "FireRedTeam/FireRed-Image-Edit-1.1", + "preview": "FireRedTeam--FireRed-Image-Edit-1.0.jpg", + "desc": "FireRed-Image-Edit is a general-purpose image editing model that delivers high-fidelity and consistent editing across a wide range of scenarios. FireRed is a fine-tune of Qwen-Image-Edit.", + "tags": "community", + "date": "2026 February", + "skip": true + }, "Skywork UniPic3": { "path": "Skywork/Unipic3", "preview": "Skywork--Unipic3.jpg", diff --git a/modules/lora/lora_load.py b/modules/lora/lora_load.py index ae89ab8b5..33dc8c1b9 100644 --- a/modules/lora/lora_load.py +++ b/modules/lora/lora_load.py @@ -277,10 +277,7 @@ def network_load(names, te_multipliers=None, unet_multipliers=None, dyn_dims=Non if net is None: failed_to_load_networks.append(name) lora_ver = network_on_disk.sd_version if network_on_disk is not None else None - if lora_ver in ('f1', '') and shared.sd_model_type == 'f2': - log.error(f'Network load: type=LoRA name="{name}" incompatible: Flux1 LoRA cannot be used with Flux2/Klein') - else: - log.error(f'Network load: type=LoRA name="{name}" detected={lora_ver} not found') + log.error(f'Network load: type=LoRA name="{name}" detected={lora_ver} not loaded') continue if hasattr(sd_model, 'embedding_db'): sd_model.embedding_db.load_diffusers_embedding(None, net.bundle_embeddings) From 3261e2eeae06ff72085e7da510a519d3835b4def Mon Sep 17 00:00:00 2001 From: vladmandic Date: Mon, 23 Mar 2026 07:27:50 +0100 Subject: [PATCH 13/33] update requirements and introduce constraints Signed-off-by: vladmandic --- .gitignore | 1 + TODO.md | 1 - constraints.txt | 0 installer.py | 3 ++- package.json | 2 +- requirements.txt | 6 +++--- 6 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 constraints.txt diff --git a/.gitignore b/.gitignore index 8a581342d..a29980f78 100644 --- a/.gitignore +++ b/.gitignore @@ -58,6 +58,7 @@ tunableop_results*.csv !webui.sh !package.json !requirements.txt +!constraints.txt !/data !/models/VAE-approx !/models/VAE-approx/model.pt diff --git a/TODO.md b/TODO.md index c4b820105..2c035e628 100644 --- a/TODO.md +++ b/TODO.md @@ -2,7 +2,6 @@ ## Release -- Bumb packages - Implement `unload_auxiliary_models` - Release **Launcher** - Release **Enso** diff --git a/constraints.txt b/constraints.txt new file mode 100644 index 000000000..e69de29bb diff --git a/installer.py b/installer.py index 6617596d6..090bc0748 100644 --- a/installer.py +++ b/installer.py @@ -475,7 +475,7 @@ def check_diffusers(): t_start = time.time() if args.skip_all: return - target_commit = "e5aa719241f9b74d6700be3320a777799bfab70a" # diffusers commit hash + target_commit = "c02c17c6ee7ac508c56925dde4d4a3c587650dc3" # diffusers commit hash # if args.use_rocm or args.use_zluda or args.use_directml: # sha = '043ab2520f6a19fce78e6e060a68dbc947edb9f9' # lock diffusers versions for now pkg = package_spec('diffusers') @@ -1235,6 +1235,7 @@ def install_requirements(): # set environment variables controling the behavior of various libraries def set_environment(): log.debug('Setting environment tuning') + os.environ.setdefault('PIP_CONSTRAINT', os.path.abspath('constraints.txt')) os.environ.setdefault('ACCELERATE', 'True') os.environ.setdefault('ATTN_PRECISION', 'fp16') os.environ.setdefault('ClDeviceGlobalMemSizeAvailablePercent', '100') diff --git a/package.json b/package.json index e3e948c65..9fe57fd1a 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "venv": ". venv/bin/activate", "start": ". venv/bin/activate; python launch.py --debug", "localize": "node cli/localize.js", - "packages": ". venv/bin/activate && pip install --upgrade transformers accelerate huggingface_hub safetensors tokenizers peft pytorch_lightning pylint ruff", + "packages": ". venv/bin/activate && pip install --upgrade accelerate huggingface_hub safetensors tokenizers peft pytorch_lightning pylint ruff", "format": ". venv/bin/activate && pre-commit run --all-files", "format-win": "venv\\scripts\\activate && pre-commit run --all-files", "eslint": "eslint . javascript/", diff --git a/requirements.txt b/requirements.txt index 67c45ac46..e8ca68aba 100644 --- a/requirements.txt +++ b/requirements.txt @@ -27,13 +27,13 @@ peft==0.18.1 httpx==0.28.1 requests==2.32.3 tqdm==4.67.3 -accelerate==1.12.0 +accelerate==1.13.0 einops==0.8.1 -huggingface_hub==1.5.0 +huggingface_hub==1.7.2 numpy==2.1.2 pandas==2.3.1 protobuf==6.33.5 -pytorch_lightning==2.6.0 +pytorch_lightning==2.6.1 urllib3==1.26.19 Pillow==10.4.0 timm==1.0.24 From 09b9ae32c10267952c493b5d947c1670237eb9a1 Mon Sep 17 00:00:00 2001 From: vladmandic Date: Mon, 23 Mar 2026 08:44:07 +0100 Subject: [PATCH 14/33] add color grading to processing Signed-off-by: vladmandic --- CHANGELOG.md | 9 ++++++- TODO.md | 3 ++- extensions-builtin/sdnext-modernui | 2 +- modules/processing.py | 2 +- modules/processing_grading.py | 16 ++++++------ modules/scripts_postprocessing.py | 41 ++++++++++++++++++++---------- modules/ui_models.py | 1 - modules/ui_sections.py | 8 +++--- pipelines/flux/flux2_lora.py | 3 +-- scripts/color_grading.py | 15 +++++++++++ scripts/nudenet_ext.py | 4 +-- scripts/postprocessing_video.py | 6 ++--- test/test-grading.py | 2 +- 13 files changed, 74 insertions(+), 38 deletions(-) create mode 100644 scripts/color_grading.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 13fd02cbb..7c4cab49a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,14 @@ But also many smaller quality-of-life improvements - for full details, see [Chan - [Anima Preview-v2](https://huggingface.co/circlestone-labs/Anima) - **Image manipulation** - new **color grading** module - - update **latent corrections** *(former HDR Corrections)* and expand allowed models + apply basic corrections to your images: brightness,contrast,saturation,shadows,highlights + move to professional photo corrections: hue,gamma,sharpness,temperature + correct tone: shadows,midtones,highlights + add effects: vignette,grain + apply professional lut-table using .cube file + *hint* color grading is available as step during generate or as processing item for already existing images + - update **latent corrections** *(former HDR Corrections)* + expand allowed models - add support for [spandrel](https://github.com/chaiNNer-org/spandrel) **upscaling** engine with suport for new upscaling model families - add two new ai upscalers: *RealPLKSR NomosWebPhoto* and *RealPLKSR AnimeSharpV2* diff --git a/TODO.md b/TODO.md index 2c035e628..218e99b60 100644 --- a/TODO.md +++ b/TODO.md @@ -12,7 +12,6 @@ ## Internal - Integrate: [Depth3D](https://github.com/vladmandic/sd-extension-depth3d) -- Feature: Color grading in processing - Feature: RIFE update - Feature: RIFE in processing - Feature: SeedVR2 in processing @@ -146,3 +145,5 @@ TODO: Investigate which models are diffusers-compatible and prioritize! - modules/modular_guiders.py:65:58: W0511: TODO: guiders - processing: remove duplicate mask params - resize image: enable full VAE mode for resize-latent + +modules/sd_samplers_diffusers.py:353:31: W0511: TODO enso-required (fixme) diff --git a/extensions-builtin/sdnext-modernui b/extensions-builtin/sdnext-modernui index d3f63ee8c..0861ae00f 160000 --- a/extensions-builtin/sdnext-modernui +++ b/extensions-builtin/sdnext-modernui @@ -1 +1 @@ -Subproject commit d3f63ee8c3b6220f290e5fa54dc172a772b8c108 +Subproject commit 0861ae00f2ad057a914ca82e45fe6635dde7417e diff --git a/modules/processing.py b/modules/processing.py index 22ef90f62..e4119a9f8 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -360,7 +360,7 @@ def process_samples(p: StableDiffusionProcessing, samples): split_tone_balance=getattr(p, 'grading_split_tone_balance', 0.5), vignette=getattr(p, 'grading_vignette', 0.0), grain=getattr(p, 'grading_grain', 0.0), - lut_file=getattr(p, 'grading_lut_file', ''), + lut_cube_file=getattr(p, 'grading_lut_file', ''), lut_strength=getattr(p, 'grading_lut_strength', 1.0), ) if processing_grading.is_active(grading_params): diff --git a/modules/processing_grading.py b/modules/processing_grading.py index 003f93f07..c0fe0fe09 100644 --- a/modules/processing_grading.py +++ b/modules/processing_grading.py @@ -66,7 +66,7 @@ class GradingParams: vignette: float = 0.0 grain: float = 0.0 # lut - lut_file: str = "" + lut_cube_file: str = "" lut_strength: float = 1.0 def __post_init__(self): @@ -179,17 +179,17 @@ def _apply_color_temp(img: torch.Tensor, kelvin: float) -> torch.Tensor: return (img * scales).clamp(0, 1) -def _apply_lut(image: Image.Image, lut_file: str, strength: float) -> Image.Image: +def _apply_lut(image: Image.Image, lut_cube_file: str, strength: float) -> Image.Image: """Apply .cube LUT file via pillow-lut-tools.""" - if not lut_file or not os.path.isfile(lut_file): + if not lut_cube_file or not os.path.isfile(lut_cube_file): return image pillow_lut = _ensure_pillow_lut() try: - cube = pillow_lut.load_cube_file(lut_file) + cube = pillow_lut.load_cube_file(lut_cube_file) if strength != 1.0: cube = pillow_lut.amplify_lut(cube, strength) result = image.filter(cube) - debug(f'Grading LUT: file={os.path.basename(lut_file)} strength={strength}') + debug(f'Grading LUT: file={os.path.basename(lut_cube_file)} strength={strength}') return result except Exception as e: log.error(f'Grading LUT: {e}') @@ -198,8 +198,8 @@ def _apply_lut(image: Image.Image, lut_file: str, strength: float) -> Image.Imag def grade_image(image: Image.Image, params: GradingParams) -> Image.Image: """Full grading pipeline: PIL -> GPU tensor -> kornia ops -> PIL.""" + log.debug(f"Grading: params={params}") kornia = _ensure_kornia() - debug(f'Grading: params={params}') arr = np.array(image).astype(np.float32) / 255.0 tensor = torch.from_numpy(arr).permute(2, 0, 1).unsqueeze(0) tensor = tensor.to(device=devices.device, dtype=devices.dtype) @@ -246,7 +246,7 @@ def grade_image(image: Image.Image, params: GradingParams) -> Image.Image: result = Image.fromarray(arr) # LUT applied last (CPU, via pillow-lut-tools) - if params.lut_file: - result = _apply_lut(result, params.lut_file, params.lut_strength) + if params.lut_cube_file: + result = _apply_lut(result, params.lut_cube_file, params.lut_strength) return result diff --git a/modules/scripts_postprocessing.py b/modules/scripts_postprocessing.py index 33726232d..70410826a 100644 --- a/modules/scripts_postprocessing.py +++ b/modules/scripts_postprocessing.py @@ -76,9 +76,14 @@ class ScriptPostprocessingRunner: script.controls = wrap_call(script.ui, script.filename, "ui") if script.controls is None: script.controls = {} - for control in script.controls.values(): - control.custom_script_source = os.path.basename(script.filename) - inputs += list(script.controls.values()) + if isinstance(script.controls, list) or isinstance(script.controls, tuple): + for control in script.controls: + control.custom_script_source = os.path.basename(script.filename) + inputs += script.controls + else: + for control in script.controls.values(): + control.custom_script_source = os.path.basename(script.filename) + inputs += list(script.controls.values()) script.args_to = len(inputs) def scripts_in_preferred_order(self): @@ -109,11 +114,16 @@ class ScriptPostprocessingRunner: for script in self.scripts_in_preferred_order(): jobid = shared.state.begin(script.name) script_args = args[script.args_from:script.args_to] - process_args = {} - for (name, _component), value in zip(script.controls.items(), script_args, strict=False): - process_args[name] = value - log.debug(f'Process: script="{script.name}" args={process_args}') - script.process(pp, **process_args) + process_args = [] + process_kwargs = {} + if isinstance(script.controls, list) or isinstance(script.controls, tuple): + for _control, value in zip(script.controls, script_args, strict=False): + process_args.append(value) + else: + for (name, _component), value in zip(script.controls.items(), script_args, strict=False): + process_kwargs[name] = value + log.debug(f'Process: script="{script.name}" args={process_args} kwargs={process_kwargs}') + script.process(pp, *process_args, **process_kwargs) shared.state.end(jobid) def create_args_for_run(self, scripts_args): @@ -139,9 +149,14 @@ class ScriptPostprocessingRunner: continue jobid = shared.state.begin(script.name) script_args = args[script.args_from:script.args_to] - process_args = {} - for (name, _component), value in zip(script.controls.items(), script_args, strict=False): - process_args[name] = value - log.debug(f'Postprocess: script={script.name} args={process_args}') - script.postprocess(filenames, **process_args) + process_args = [] + process_kwargs = {} + if isinstance(script.controls, list) or isinstance(script.controls, tuple): + for _control, value in zip(script.controls, script_args, strict=False): + process_args.append(value) + else: + for (name, _component), value in zip(script.controls.items(), script_args, strict=False): + process_kwargs[name] = value + log.debug(f'Postprocess: script={script.name} args={process_args} kwargs={process_kwargs}') + script.postprocess(filenames, *process_args, **process_kwargs) shared.state.end(jobid) diff --git a/modules/ui_models.py b/modules/ui_models.py index 2edfd0ade..d512cfe9c 100644 --- a/modules/ui_models.py +++ b/modules/ui_models.py @@ -17,7 +17,6 @@ def update_model_hashes(): unets = {} for k, v in sd_unet.unet_dict.items(): unets[k] = sd_checkpoint.CheckpointInfo(name=k, filename=v, model_type='unet') - print('HERE3', unets[k]) yield from sd_models.update_model_hashes(unets, model_type='unet') yield from sd_models.update_model_hashes(model_type='checkpoint') diff --git a/modules/ui_sections.py b/modules/ui_sections.py index 4a6b2d05a..d8cb25127 100644 --- a/modules/ui_sections.py +++ b/modules/ui_sections.py @@ -197,7 +197,7 @@ def create_color_inputs(tab): grading_hue = gr.Slider(minimum=0.0, maximum=1.0, step=0.05, value=0, label='Hue', elem_id=f"{tab}_grading_hue") grading_gamma = gr.Slider(minimum=0.1, maximum=10.0, step=0.1, value=1.0, label='Gamma', elem_id=f"{tab}_grading_gamma") grading_sharpness = gr.Slider(minimum=0.0, maximum=2.0, step=0.05, value=0, label='Sharpness', elem_id=f"{tab}_grading_sharpness") - grading_color_temp = gr.Slider(minimum=2000, maximum=12000, step=100, value=6500, label='Color temp (K)', elem_id=f"{tab}_grading_color_temp") + grading_color_temp = gr.Slider(minimum=2000, maximum=12000, step=100, value=6500, label='Color temp', elem_id=f"{tab}_grading_color_temp") with gr.Group(): gr.HTML('

Tone

') with gr.Row(elem_id=f"{tab}_grading_tone_row"): @@ -211,7 +211,7 @@ def create_color_inputs(tab): with gr.Row(elem_id=f"{tab}_grading_split_row"): grading_shadows_tint = gr.ColorPicker(label="Shadows tint", value="#000000", elem_id=f"{tab}_grading_shadows_tint") grading_highlights_tint = gr.ColorPicker(label="Highlights tint", value="#ffffff", elem_id=f"{tab}_grading_highlights_tint") - grading_split_tone_balance = gr.Slider(minimum=0.0, maximum=1.0, step=0.05, value=0.5, label='Balance', elem_id=f"{tab}_grading_split_tone_balance") + grading_split_tone_balance = gr.Slider(minimum=0.0, maximum=1.0, step=0.05, value=0.5, label='Split tone balance', elem_id=f"{tab}_grading_split_tone_balance") with gr.Group(): gr.HTML('

Effects

') with gr.Row(elem_id=f"{tab}_grading_effects_row"): @@ -220,9 +220,9 @@ def create_color_inputs(tab): with gr.Group(): gr.HTML('

LUT

') with gr.Row(elem_id=f"{tab}_grading_lut_row"): - grading_lut_file = gr.File(label='LUT .cube file', file_types=['.cube'], elem_id=f"{tab}_grading_lut_file") + grading_lut_cube_file = gr.File(label='LUT .cube file', file_types=['.cube'], elem_id=f"{tab}_grading_lut_file") grading_lut_strength = gr.Slider(minimum=0.0, maximum=2.0, step=0.05, value=1.0, label='LUT strength', elem_id=f"{tab}_grading_lut_strength") - return grading_brightness, grading_contrast, grading_saturation, grading_hue, grading_gamma, grading_sharpness, grading_color_temp, grading_shadows, grading_midtones, grading_highlights, grading_clahe_clip, grading_clahe_grid, grading_shadows_tint, grading_highlights_tint, grading_split_tone_balance, grading_vignette, grading_grain, grading_lut_file, grading_lut_strength + return grading_brightness, grading_contrast, grading_saturation, grading_hue, grading_gamma, grading_sharpness, grading_color_temp, grading_shadows, grading_midtones, grading_highlights, grading_clahe_clip, grading_clahe_grid, grading_shadows_tint, grading_highlights_tint, grading_split_tone_balance, grading_vignette, grading_grain, grading_lut_cube_file, grading_lut_strength def create_sampler_and_steps_selection(choices, tabname, default_steps:int=20): diff --git a/pipelines/flux/flux2_lora.py b/pipelines/flux/flux2_lora.py index 048d60857..a2d433992 100644 --- a/pipelines/flux/flux2_lora.py +++ b/pipelines/flux/flux2_lora.py @@ -9,7 +9,6 @@ Installed via apply_patch() during pipeline loading. import os import time -import torch from modules import shared, sd_models from modules.logger import log from modules.lora import network, network_lokr, lora_convert @@ -180,7 +179,7 @@ def apply_patch(): lora_state_dict won't detect them as AI toolkit format. This patch checks for bare keys after the original returns and adds the prefix + re-runs conversion. """ - global patched + global patched # pylint: disable=global-statement if patched: return patched = True diff --git a/scripts/color_grading.py b/scripts/color_grading.py new file mode 100644 index 000000000..7ef518662 --- /dev/null +++ b/scripts/color_grading.py @@ -0,0 +1,15 @@ +from modules import scripts_postprocessing, ui_sections, processing_grading + + +class ScriptPostprocessingColorGrading(scripts_postprocessing.ScriptPostprocessing): + name = "Color Grading" + + def ui(self): + ui_controls = ui_sections.create_color_inputs('process') + ui_controls_dict = {control.label.replace(" ", "_").replace(".", "").lower(): control for control in ui_controls} + return ui_controls_dict + + def process(self, pp: scripts_postprocessing.PostprocessedImage, *args, **kwargs): # pylint: disable=arguments-differ + grading_params = processing_grading.GradingParams(*args, **kwargs) + if processing_grading.is_active(grading_params): + pp.image = processing_grading.grade_image(pp.image, grading_params) diff --git a/scripts/nudenet_ext.py b/scripts/nudenet_ext.py index be24ea1ed..3a735ba32 100644 --- a/scripts/nudenet_ext.py +++ b/scripts/nudenet_ext.py @@ -124,7 +124,7 @@ def process( # defines script for dual-mode usage -class Script(scripts.Script): +class ScriptNudeNet(scripts.Script): # see below for all available options and callbacks # @@ -148,7 +148,7 @@ class Script(scripts.Script): # defines postprocessing script for dual-mode usage -class ScriptPostprocessing(scripts_postprocessing.ScriptPostprocessing): +class ScriptPostprocessingNudeNet(scripts_postprocessing.ScriptPostprocessing): name = 'NudeNet' order = 10000 diff --git a/scripts/postprocessing_video.py b/scripts/postprocessing_video.py index 84836abca..d855be5d5 100644 --- a/scripts/postprocessing_video.py +++ b/scripts/postprocessing_video.py @@ -2,8 +2,8 @@ import gradio as gr from modules import video, scripts_postprocessing -class ScriptPostprocessingUpscale(scripts_postprocessing.ScriptPostprocessing): - name = "Video" +class ScriptPostprocessingVideo(scripts_postprocessing.ScriptPostprocessing): + name = "Create Video" def ui(self): with gr.Accordion('Create video', open = False, elem_id="postprocess_video_accordion"): @@ -18,7 +18,7 @@ class ScriptPostprocessingUpscale(scripts_postprocessing.ScriptPostprocessing): ] with gr.Row(): - gr.HTML("  Video
") + gr.HTML("  Create video from generated images
") with gr.Row(): video_type = gr.Dropdown(label='Video file', choices=['None', 'GIF', 'PNG', 'MP4'], value='None', elem_id="extras_video_type") duration = gr.Slider(label='Duration', minimum=0.25, maximum=10, step=0.25, value=2, visible=False, elem_id="extras_video_duration") diff --git a/test/test-grading.py b/test/test-grading.py index 2018519c6..0334faba6 100644 --- a/test/test-grading.py +++ b/test/test-grading.py @@ -95,7 +95,7 @@ def test_grading_params_defaults(): assert p.split_tone_balance == 0.5 assert p.vignette == 0.0 assert p.grain == 0.0 - assert p.lut_file == "" + assert p.lut_cube_file == "" assert p.lut_strength == 1.0 return True From 41fddce2e93697bb823b20f4d8262a8c6e489354 Mon Sep 17 00:00:00 2001 From: vladmandic Date: Mon, 23 Mar 2026 09:22:01 +0100 Subject: [PATCH 15/33] update wiki and todo Signed-off-by: vladmandic --- TODO.md | 11 +++++------ wiki | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/TODO.md b/TODO.md index 218e99b60..1f7667751 100644 --- a/TODO.md +++ b/TODO.md @@ -2,12 +2,11 @@ ## Release -- Implement `unload_auxiliary_models` -- Release **Launcher** -- Release **Enso** -- Update **ROCm** -- Tips **Color Grading** -- Regen **Localization** +- Implement: `unload_auxiliary_models` +- Add notes: **Enso** +- Update: **ROCm** +- Tips: **Color Grading** +- Regen: **Localization** ## Internal diff --git a/wiki b/wiki index 33dbd026a..99f4e13d0 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit 33dbd026a2e2fb7311d545a3b2d2db0363bb887f +Subproject commit 99f4e13d03191b5269b869c71283d7fcf9c98f60 From 73b854e4cf05b4ef0e963a6de756630b24a8eeba Mon Sep 17 00:00:00 2001 From: resonantsky Date: Sun, 22 Mar 2026 23:18:22 +0200 Subject: [PATCH 16/33] ROCm: Advanced Config --- data/rocm-config.json | 115 +++++++++++ scripts/rocm/rocm_mgr.py | 326 +++++++++++++++++++++++++++-- scripts/rocm/rocm_profiles.py | 218 ++++++++++++++++++++ scripts/rocm/rocm_vars.py | 374 ++++++++++++++++++++++++++++++++++ scripts/rocm_ext.py | 243 +++++++++++++++++++--- 5 files changed, 1232 insertions(+), 44 deletions(-) create mode 100644 data/rocm-config.json create mode 100644 scripts/rocm/rocm_profiles.py create mode 100644 scripts/rocm/rocm_vars.py diff --git a/data/rocm-config.json b/data/rocm-config.json new file mode 100644 index 000000000..30bf96ea9 --- /dev/null +++ b/data/rocm-config.json @@ -0,0 +1,115 @@ +{ + "MIOPEN_GEMM_ENFORCE_BACKEND": "1", + "MIOPEN_FIND_MODE": "2", + "MIOPEN_FIND_ENFORCE": "1", + "MIOPEN_SEARCH_CUTOFF": "0", + "MIOPEN_SYSTEM_DB_PATH": "{VIRTUAL_ENV}\\Lib\\site-packages\\_rocm_sdk_devel\\bin\\", + "MIOPEN_LOG_LEVEL": "0", + "MIOPEN_DEBUG_ENABLE": "0", + "ROCBLAS_LAYER": "0", + "HIPBLASLT_LOG_LEVEL": "0", + "MIOPEN_DEBUG_CONVOLUTION_DETERMINISTIC": "0", + "MIOPEN_DEBUG_CONV_FFT": "1", + "MIOPEN_DEBUG_CONV_DIRECT": "1", + "MIOPEN_DEBUG_CONV_GEMM": "1", + "MIOPEN_DEBUG_CONV_WINOGRAD": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM": "1", + "MIOPEN_DEBUG_CONV_IMMED_FALLBACK": "1", + "MIOPEN_DEBUG_ENABLE_AI_IMMED_MODE_FALLBACK": "1", + "MIOPEN_DEBUG_FORCE_IMMED_MODE_FALLBACK": "0", + "MIOPEN_DEBUG_GCN_ASM_KERNELS": "1", + "MIOPEN_DEBUG_HIP_KERNELS": "1", + "MIOPEN_DEBUG_OPENCL_CONVOLUTIONS": "1", + "MIOPEN_DEBUG_OPENCL_WAVE64_NOWGP": "1", + "MIOPEN_DEBUG_ATTN_SOFTMAX": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_3X3U": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1UV2": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_5X10U2V2": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_7X7C3H224W224": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW3X3": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW1X1": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_PERF_VALS": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_SEARCH_OPTIMIZED": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_AI_HEUR": "1", + "MIOPEN_DEBUG_CONV_DIRECT_NAIVE_CONV_FWD": "1", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD": "1", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD1X1": "1", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD11X11": "1", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWDGEN": "1", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW2": "1", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW53": "1", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW1X1": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_3X3": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_FWD_BWD": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_WRW": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3_G1": "1", + "MIOPEN_DEBUG_AMD_FUSED_WINOGRAD": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3_PERF_VALS": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F2X3": "0", + "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F3X2": "0", + "MIOPEN_DEBUG_AMD_WINOGRAD_RAGE_RXS_F2X3": "0", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X2": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X3": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X4": "0", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X5": "0", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X6": "0", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X3": "0", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X4": "0", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X2": "0", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F2X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F3X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F4X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F5X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F6X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F2X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F3X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F4X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F5X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F6X3": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1_1X1": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_V4R1": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_V4R1": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS_NHWC": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS_NHWC": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS_NHWC": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_DLOPS_NCHWC": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_GROUP_BWD_XDLOPS": "0", + "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS_AI_HEUR": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_FWD_V4R4_XDLOPS_ADD_VECTOR_LOAD_GEMMN_TUNE_PARAM": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R5_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_PADDED_GEMM_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_PADDED_GEMM_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS_EMULATE": "0", + "MIOPEN_DEBUG_IMPLICIT_GEMM_XDLOPS_INLINE_ASM": "0", + "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS": "0", + "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS": "0", + "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_V6R1_DLOPS_NCHW": "0", + "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_ACTIV": "0", + "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_RES_ADD_ACTIV": "0", + "MIOPEN_DEBUG_CONV_MLIR_IGEMM_WRW_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_MLIR_IGEMM_BWD_XDLOPS": "0" +} \ No newline at end of file diff --git a/scripts/rocm/rocm_mgr.py b/scripts/rocm/rocm_mgr.py index 507a73018..9b98d5405 100644 --- a/scripts/rocm/rocm_mgr.py +++ b/scripts/rocm/rocm_mgr.py @@ -1,32 +1,322 @@ import os +import sys +from pathlib import Path +from typing import Dict, Any, Optional + import installer from modules.logger import log from modules.json_helpers import readfile, writefile +from scripts.rocm.rocm_vars import ROCM_ENV_VARS, SOLVER_GROUPS # pylint: disable=no-name-in-module +from scripts.rocm import rocm_profiles # pylint: disable=no-name-in-module -CONFIG = os.path.join('data', 'rocm.json') -DATA = {} +def _check_rocm() -> bool: + try: + from modules import shared + if getattr(shared.cmd_opts, 'use_rocm', False): + return True + except Exception: + pass + try: + if installer.torch_info.get('type') == 'rocm': + return True + except Exception: + pass + try: + import torch + if hasattr(torch.version, 'hip') and torch.version.hip is not None: + return True + except Exception: + pass + return False -def load(): - global DATA # pylint: disable=global-statement - DATA = readfile(CONFIG, silent=True) or {} - log.debug(f'ROCm load: config={CONFIG} items={len(DATA)}') +is_rocm = _check_rocm() -def reset(): - log.info(f"ROCm reset: config={CONFIG}") - DATA.clear() - writefile(DATA, CONFIG) +CONFIG = Path(os.path.abspath(os.path.join('data', 'rocm-config.json'))) + +_cache: Optional[Dict[str, str]] = None # loaded once, invalidated on save + +# Vars that must never be set — they interfere with PyTorch dtype handling +_UNSET_VARS = { + "MIOPEN_DEBUG_CONVOLUTION_ATTRIB_FP16_ALT_IMPL", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_EXPEREMENTAL_FP16_TRANSFORM", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_PK_ATOMIC_ADD_FP16", +} -def apply(db_path): - DATA["MIOPEN_SYSTEM_DB_PATH"] = db_path - log.info(f'ROCm apply: config={CONFIG} items={len(DATA)}') - writefile(DATA, CONFIG) +# --- venv helpers --- + +def _get_venv() -> str: + return os.environ.get("VIRTUAL_ENV", "") or sys.prefix -def info(): - for gpu in installer.gpu_info: - gpu['db'] = DATA.get('MIOPEN_SYSTEM_DB_PATH', '') - return installer.gpu_info +def _expand_venv(value: str) -> str: + return value.replace("{VIRTUAL_ENV}", _get_venv()) + + +def _collapse_venv(value: str) -> str: + venv = _get_venv() + if venv and value.startswith(venv): + return "{VIRTUAL_ENV}" + value[len(venv):] + return value + + +# --- dropdown helpers --- + +def _dropdown_display(stored_val: str, options) -> str: + if options and isinstance(options[0], tuple): + return next((label for label, val in options if val == str(stored_val)), str(stored_val)) + return str(stored_val) + + +def _dropdown_stored(display_val: str, options) -> str: + if options and isinstance(options[0], tuple): + return next((val for label, val in options if label == str(display_val)), str(display_val)) + return str(display_val) + + +def _dropdown_choices(options): + if options and isinstance(options[0], tuple): + return [label for label, _ in options] + return options + + +# --- config I/O --- + +def load_config() -> Dict[str, str]: + global _cache # pylint: disable=global-statement + if _cache is None: + if CONFIG.exists(): + data = readfile(str(CONFIG), lock=True, as_type="dict") + _cache = data if data else {k: v["default"] for k, v in ROCM_ENV_VARS.items()} + else: + _cache = {k: v["default"] for k, v in ROCM_ENV_VARS.items()} + log.debug(f'ROCm load_config: path={CONFIG} items={len(_cache)}') + return _cache + + +def save_config(config: Dict[str, str]) -> None: + global _cache # pylint: disable=global-statement + writefile(config, str(CONFIG)) + _cache = config + + +def apply_env(config: Optional[Dict[str, str]] = None) -> None: + if config is None: + config = load_config() + applied = 0 + skipped = 0 + for var in _UNSET_VARS: + if var in os.environ: + del os.environ[var] + for var, value in config.items(): + if var in _UNSET_VARS: + skipped += 1 + continue + expanded = _expand_venv(str(value)) + if expanded == "": + skipped += 1 + continue + os.environ[var] = expanded + applied += 1 + + +def apply_all(names: list, values: list) -> None: + config = load_config().copy() + for name, value in zip(names, values): + if name not in ROCM_ENV_VARS: + log.warning(f'ROCm apply_all: unknown variable={name}') + continue + meta = ROCM_ENV_VARS[name] + if meta["widget"] == "checkbox": + if value is None: + pass # Gradio passed None (component not interacted with) — leave config unchanged + else: + config[name] = "1" if value else "0" + elif meta["widget"] == "radio": + stored = _dropdown_stored(str(value), meta["options"]) + valid = {v for _, v in meta["options"]} if meta["options"] and isinstance(meta["options"][0], tuple) else set(meta["options"] or []) + if stored in valid: + config[name] = stored + # else: value was None/invalid — leave the existing saved value untouched + else: + config[name] = _collapse_venv(str(value)) + save_config(config) + apply_env(config) + + +def reset_defaults() -> None: + defaults = {k: v["default"] for k, v in ROCM_ENV_VARS.items()} + save_config(defaults) + apply_env(defaults) + log.info('ROCm reset_defaults: config reset to defaults') + + +def clear_env() -> None: + """Remove all managed ROCm vars from os.environ without writing to disk.""" + cleared = 0 + for var in ROCM_ENV_VARS: + if var in os.environ: + del os.environ[var] + cleared += 1 + for var in _UNSET_VARS: + if var in os.environ: + del os.environ[var] + log.info(f'ROCm clear_env: cleared={cleared}') + + +def delete_config() -> None: + """Delete the saved config file and clear all vars from the environment.""" + global _cache # pylint: disable=global-statement + clear_env() + if CONFIG.exists(): + CONFIG.unlink() + log.info(f'ROCm delete_config: deleted {CONFIG}') + _cache = None + + +def apply_profile(name: str) -> None: + """Merge an architecture profile on top of the current config, then save and apply.""" + profile = rocm_profiles.PROFILES.get(name) + if profile is None: + log.warning(f'ROCm apply_profile: unknown profile={name}') + return + config = load_config().copy() + config.update(profile) + save_config(config) + apply_env(config) + log.info(f'ROCm apply_profile: profile={name} overrides={len(profile)}') + + +def _hip_version_from_file(db_path: Path) -> str: + """Parse HIP_VERSION_* keys from .hipVersion in the SDK bin folder.""" + hip_ver_file = db_path / ".hipVersion" + if not hip_ver_file.exists(): + return "" + kv = {} + for line in hip_ver_file.read_text(errors="ignore").splitlines(): + if "=" in line and not line.startswith("#"): + k, _, v = line.partition("=") + kv[k.strip()] = v.strip() + major = kv.get("HIP_VERSION_MAJOR", "") + minor = kv.get("HIP_VERSION_MINOR", "") + patch = kv.get("HIP_VERSION_PATCH", "") + git = kv.get("HIP_VERSION_GITHASH", "") + if major: + return f"{major}.{minor}.{patch} ({git})" + return "" + + +def _pkg_version(name: str) -> str: + try: + import importlib.metadata as _m # pylint: disable=import-outside-toplevel + return _m.version(name) + except Exception: + return "n/a" + + +def _db_file_summary(path: Path, patterns: list) -> dict: + """Return {filename: 'N KB'} for files matching any of the given glob patterns.""" + out = {} + for pat in patterns: + for f in sorted(path.glob(pat)): + kb = f.stat().st_size // 1024 + out[f.name] = f"{kb} KB" + return out + + +def _user_db_summary(path: Path) -> dict: + """Return {filename: 'N KB, M entries'} for user MIOpen DB txt files.""" + out = {} + for pat in ("*.udb.txt", "*.ufdb.txt"): + for f in sorted(path.glob(pat)): + kb = f.stat().st_size // 1024 + try: + lines = sum(1 for _ in f.open(errors="ignore")) + except Exception: + lines = 0 + out[f.name] = f"{kb} KB, {lines} entries" + return out + + +def info() -> dict: + config = load_config() + db_path = Path(_expand_venv(config.get("MIOPEN_SYSTEM_DB_PATH", ""))) + + # --- ROCm / HIP package versions --- + rocm_pkgs = {} + for pkg in ("rocm", "rocm-sdk-core", "rocm-sdk-devel"): + v = _pkg_version(pkg) + if v != "n/a": + rocm_pkgs[pkg] = v + libs_pkg = _pkg_version("rocm-sdk-libraries-gfx103x-dgpu") + if libs_pkg != "n/a": + rocm_pkgs["rocm-sdk-libraries (gfx103x)"] = libs_pkg + + hip_ver = _hip_version_from_file(db_path) + if not hip_ver: + try: + import torch # pylint: disable=import-outside-toplevel + hip_ver = getattr(torch.version, "hip", "") or "" + except Exception: + pass + + rocm_section = {} + if hip_ver: + rocm_section["hip_version"] = hip_ver + rocm_section.update(rocm_pkgs) + + # --- Torch --- + torch_section = {} + try: + import torch # pylint: disable=import-outside-toplevel + torch_section["version"] = torch.__version__ + torch_section["hip"] = getattr(torch.version, "hip", None) or "n/a" + except Exception: + pass + + # --- GPU --- + gpu_section = [dict(g) for g in installer.gpu_info] + + # --- System DB --- + sdb = {"path": str(db_path)} + if db_path.exists(): + solver_db = _db_file_summary(db_path, ["*.db.txt"]) + find_db = _db_file_summary(db_path, ["*.HIP.fdb.txt", "*.fdb.txt"]) + kernel_db = _db_file_summary(db_path, ["*.kdb"]) + if solver_db: + sdb["solver_db"] = solver_db + if find_db: + sdb["find_db"] = find_db + if kernel_db: + sdb["kernel_db"] = kernel_db + else: + sdb["exists"] = False + + # --- User DB (~/.miopen/db) --- + user_db_path = Path.home() / ".miopen" / "db" + udb = {"path": str(user_db_path), "exists": user_db_path.exists()} + if user_db_path.exists(): + ufiles = _user_db_summary(user_db_path) + if ufiles: + udb["files"] = ufiles + + return { + "rocm": rocm_section, + "torch": torch_section, + "gpu": gpu_section, + "system_db": sdb, + "user_db": udb, + } + + +# Apply saved config to os.environ at import time (only when ROCm is present) +if is_rocm: + try: + apply_env() + except Exception as _e: + print(f"[rocm_mgr] Warning: failed to apply env at import: {_e}", file=sys.stderr) +else: + log.debug('ROCm is not installed — skipping rocm_mgr env apply') diff --git a/scripts/rocm/rocm_profiles.py b/scripts/rocm/rocm_profiles.py new file mode 100644 index 000000000..9e714d1f7 --- /dev/null +++ b/scripts/rocm/rocm_profiles.py @@ -0,0 +1,218 @@ +""" +Architecture-specific MIOpen solver profiles for AMD GCN/RDNA GPUs. + +Sources: + https://rocm.docs.amd.com/projects/MIOpen/en/develop/reference/env_variables.html + +Key axis: consumer RDNA GPUs have NO XDLOPS hardware (that's CDNA/Instinct only). + RDNA2 (gfx1030): RX 6000 series + RDNA3 (gfx1100): RX 7000 series — adds Fury Winograd, wider MPASS + RDNA4 (gfx1200): RX 9000 series — adds Rage Winograd, wider MPASS + +Each profile is a dict of {var: value} that will be MERGED on top of the +current config (general vars like DB path / log level are preserved). +""" + +from typing import Dict + +# --------------------------------------------------------------------------- +# Shared: everything that must be OFF on ALL consumer RDNA (no XDLOPS hw) +# --------------------------------------------------------------------------- +_XDLOPS_OFF: Dict[str, str] = { + # GTC XDLOPS (CDNA-only) + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS_NHWC": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS_NHWC": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS_NHWC": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_DLOPS_NCHWC": "0", + # HIP XDLOPS variants (CDNA-only) + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R5_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_PADDED_GEMM_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_PADDED_GEMM_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS_EMULATE": "0", + "MIOPEN_DEBUG_IMPLICIT_GEMM_XDLOPS_INLINE_ASM": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_GROUP_BWD_XDLOPS": "0", + "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS_AI_HEUR": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_FWD_V4R4_XDLOPS_ADD_VECTOR_LOAD_GEMMN_TUNE_PARAM": "0", + # 3D XDLOPS (CDNA-only; no 3D conv XDLOPS on consumer RDNA) + "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS": "0", + "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS": "0", + "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS": "0", + # Composable Kernel (requires XDLOPS / CDNA) + "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_V6R1_DLOPS_NCHW": "0", + "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_ACTIV": "0", + "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_RES_ADD_ACTIV": "0", + # MLIR (CDNA-only in practice) + "MIOPEN_DEBUG_CONV_MLIR_IGEMM_WRW_XDLOPS": "0", + "MIOPEN_DEBUG_CONV_MLIR_IGEMM_BWD_XDLOPS": "0", + # MP BD Winograd (Multi-pass Block-Decomposed — CDNA / high-end only) + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F2X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F3X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F4X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F5X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F6X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F2X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F3X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F4X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F5X3": "0", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F6X3": "0", +} + +# --------------------------------------------------------------------------- +# RDNA2 — gfx1030 (RX 6000 series) +# No XDLOPS, no Fury/Rage Winograd, MPASS limited to F3x2/F3x3 +# ASM IGEMM: V4R1 variants only; HIP IGEMM: non-XDLOPS V4R1/R4 only +# --------------------------------------------------------------------------- +RDNA2: Dict[str, str] = { + **_XDLOPS_OFF, + # General settings (architecture-independent; set here so all profiles cover them) + "MIOPEN_SEARCH_CUTOFF": "0", + "MIOPEN_DEBUG_CONVOLUTION_DETERMINISTIC": "0", + # Core algo enables + "MIOPEN_DEBUG_CONV_FFT": "1", + "MIOPEN_DEBUG_CONV_DIRECT": "1", + "MIOPEN_DEBUG_CONV_GEMM": "1", + "MIOPEN_DEBUG_CONV_WINOGRAD": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM": "1", + "MIOPEN_DEBUG_CONV_IMMED_FALLBACK": "1", + "MIOPEN_DEBUG_ENABLE_AI_IMMED_MODE_FALLBACK": "1", + "MIOPEN_DEBUG_FORCE_IMMED_MODE_FALLBACK": "0", + # Kernel backends + "MIOPEN_DEBUG_GCN_ASM_KERNELS": "1", + "MIOPEN_DEBUG_HIP_KERNELS": "1", + "MIOPEN_DEBUG_OPENCL_CONVOLUTIONS": "1", + "MIOPEN_DEBUG_OPENCL_WAVE64_NOWGP": "1", + "MIOPEN_DEBUG_ATTN_SOFTMAX": "1", + # Direct ASM — all work on RDNA2 + "MIOPEN_DEBUG_CONV_DIRECT_ASM_3X3U": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1UV2": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_5X10U2V2": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_7X7C3H224W224": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW3X3": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW1X1": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_PERF_VALS": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_SEARCH_OPTIMIZED": "1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_AI_HEUR": "1", + "MIOPEN_DEBUG_CONV_DIRECT_NAIVE_CONV_FWD": "1", + # Direct OCL — all work on RDNA2 + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD": "1", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD1X1": "1", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD11X11": "1", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWDGEN": "1", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW2": "1", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW53": "1", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW1X1": "1", + # Winograd RxS — all base variants work on RDNA2 + "MIOPEN_DEBUG_AMD_WINOGRAD_3X3": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_FWD_BWD": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_WRW": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3_G1": "1", + "MIOPEN_DEBUG_AMD_FUSED_WINOGRAD": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3_PERF_VALS": "1", + # Fury/Rage Winograd — NOT available on RDNA2 + "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F2X3": "0", + "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F3X2": "0", + "MIOPEN_DEBUG_AMD_WINOGRAD_RAGE_RXS_F2X3": "0", + # MPASS — only F3x2 and F3x3 are safe on RDNA2 + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X2": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X3": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X4": "0", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X5": "0", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X6": "0", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X3": "0", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X4": "0", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X2": "0", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X3": "0", + # ASM Implicit GEMM — V4R1 only; no GTC/XDLOPS on RDNA2 + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1_1X1": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_V4R1": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_V4R1": "1", + # HIP Implicit GEMM — non-XDLOPS V4R1/R4 only + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4": "1", +} + +# --------------------------------------------------------------------------- +# RDNA3 — gfx1100 (RX 7000 series) +# Fury Winograd added; MPASS F3x4 enabled +# --------------------------------------------------------------------------- +RDNA3: Dict[str, str] = { + **RDNA2, + # Fury Winograd — introduced for gfx1100 (RDNA3) + "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F2X3": "1", + "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F3X2": "1", + # Wider MPASS on RDNA3 + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X4": "1", +} + +# --------------------------------------------------------------------------- +# RDNA4 — gfx1200 (RX 9000 series) +# Rage Winograd added; MPASS F3x5 enabled +# --------------------------------------------------------------------------- +RDNA4: Dict[str, str] = { + **RDNA3, + # Rage Winograd — introduced for gfx1200 (RDNA4) + "MIOPEN_DEBUG_AMD_WINOGRAD_RAGE_RXS_F2X3": "1", + # Wider MPASS on RDNA4 + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X5": "1", +} + +PROFILES: Dict[str, Dict[str, str]] = { + "RDNA2": RDNA2, + "RDNA3": RDNA3, + "RDNA4": RDNA4, +} + +# Vars that are architecturally unavailable (no supporting hardware) per arch. +# These will be visually marked in the UI with strikethrough. +_UNAVAILABLE_ALL_RDNA = set(_XDLOPS_OFF.keys()) + +UNAVAILABLE: Dict[str, set] = { + "RDNA2": _UNAVAILABLE_ALL_RDNA | { + "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F2X3", + "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F3X2", + "MIOPEN_DEBUG_AMD_WINOGRAD_RAGE_RXS_F2X3", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X4", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X5", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X6", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X3", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X4", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X2", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X3", + }, + "RDNA3": _UNAVAILABLE_ALL_RDNA | { + "MIOPEN_DEBUG_AMD_WINOGRAD_RAGE_RXS_F2X3", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X5", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X6", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X3", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X4", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X2", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X3", + }, + "RDNA4": _UNAVAILABLE_ALL_RDNA | { + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X6", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X3", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X4", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X2", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X3", + }, +} diff --git a/scripts/rocm/rocm_vars.py b/scripts/rocm/rocm_vars.py new file mode 100644 index 000000000..dc768f88e --- /dev/null +++ b/scripts/rocm/rocm_vars.py @@ -0,0 +1,374 @@ +from typing import Dict, Any, List, Tuple + +# --- General MIOpen/rocBLAS variables (dropdown/textbox/checkbox) --- +GENERAL_VARS: Dict[str, Dict[str, Any]] = { + + "MIOPEN_GEMM_ENFORCE_BACKEND": { + "default": "1", + "desc": "Enforce GEMM backend", + "widget": "dropdown", + "options": [("1 - rocBLAS", "1"), ("5 - hipBLASLt", "5")], + "restart_required": False, + }, + "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", + "widget": "dropdown", + "options": [("0 - Off", "0"), ("1 - On", "1")], + "restart_required": True, + }, + "MIOPEN_SYSTEM_DB_PATH": { + "default": "{VIRTUAL_ENV}\\Lib\\site-packages\\_rocm_sdk_devel\\bin\\", + "desc": "MIOpen system DB path", + "widget": "textbox", + "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, + }, + "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, + }, + "MIOPEN_DEBUG_CONVOLUTION_DETERMINISTIC": { + "default": "0", + "desc": "Deterministic convolution (reproducible results, may be slower)", + "widget": "dropdown", + "options": [("0 - Off", "0"), ("1 - On", "1")], + "restart_required": False, + }, +} + +# --- Solver toggles: name -> description string --- +# These are all checkbox widgets; default "1" unless in _SOLVER_DISABLED_BY_DEFAULT. +_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({ + "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_5X10U2V2": "Enable Direct ASM 5x10U2V2", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_7X7C3H224W224": "Enable Direct ASM 7x7C3H224W224", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW3X3": "Enable Direct ASM WRW3X3", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW1X1": "Enable Direct ASM WRW1X1", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_PERF_VALS": "Enable Direct ASM 1x1U Perf Vals", + "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", + "MIOPEN_DEBUG_CONV_DIRECT_NAIVE_CONV_FWD": "Enable Direct Naive Conv FWD", +}) +_SOLVER_DESCS.update({ + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD": "Enable Direct OCL FWD", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD1X1": "Enable Direct OCL FWD1X1", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD11X11": "Enable Direct OCL FWD11X11", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWDGEN": "Enable Direct OCL FWDGEN", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW2": "Enable Direct OCL WRW2", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW53": "Enable Direct OCL WRW53", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW1X1": "Enable Direct OCL WRW1X1", +}) +_SOLVER_DESCS.update({ + "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/BWD", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_WRW": "Enable AMD Winograd RxS WRW", + "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_RXS_F2X3_PERF_VALS":"Enable AMD Winograd RxS F2x3 Perf Vals", + "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({ + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X2": "Enable AMD Winograd MPASS F3x2", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X3": "Enable AMD Winograd MPASS F3x3", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X4": "Enable AMD Winograd MPASS F3x4", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X5": "Enable AMD Winograd MPASS F3x5", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X6": "Enable AMD Winograd MPASS F3x6", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X3": "Enable AMD Winograd MPASS F5x3", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X4": "Enable AMD Winograd MPASS F5x4", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X2": "Enable AMD Winograd MPASS F7x2", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X3": "Enable AMD Winograd MPASS F7x3", +}) +_SOLVER_DESCS.update({ + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F2X3": "Enable AMD MP BD Winograd F2x3", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F3X3": "Enable AMD MP BD Winograd F3x3", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F4X3": "Enable AMD MP BD Winograd F4x3", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F5X3": "Enable AMD MP BD Winograd F5x3", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F6X3": "Enable AMD MP BD Winograd F6x3", +}) +_SOLVER_DESCS.update({ + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F2X3": "Enable AMD MP BD XDLOPS Winograd F2x3", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F3X3": "Enable AMD MP BD XDLOPS Winograd F3x3", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F4X3": "Enable AMD MP BD XDLOPS Winograd F4x3", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F5X3": "Enable AMD MP BD XDLOPS Winograd F5x3", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F6X3": "Enable AMD MP BD XDLOPS Winograd F6x3", +}) +_SOLVER_DESCS.update({ + "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_ASM_BWD_V4R1": "Enable ASM Implicit GEMM BWD V4R1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_V4R1": "Enable ASM Implicit GEMM WRW V4R1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS": "Enable ASM Implicit GEMM FWD GTC XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS": "Enable ASM Implicit GEMM BWD GTC XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS": "Enable ASM Implicit GEMM WRW GTC XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS_NHWC": "Enable ASM Implicit GEMM FWD GTC XDLOPS NHWC", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS_NHWC": "Enable ASM Implicit GEMM BWD GTC XDLOPS NHWC", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS_NHWC": "Enable ASM Implicit GEMM WRW GTC XDLOPS NHWC", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_DLOPS_NCHWC": "Enable ASM Implicit GEMM FWD GTC DLOPS NCHWC", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_GROUP_BWD_XDLOPS": "Enable HIP Group BWD XDLOPS", + "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS_AI_HEUR": "Enable Group HIP BWD XDLOPS AI Heuristic", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_FWD_V4R4_XDLOPS_ADD_VECTOR_LOAD_GEMMN_TUNE_PARAM": "Enable FWD V4R4 XDLOPS Add Vector Load GEMMN Tune Param", +}) +_SOLVER_DESCS.update({ + "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", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1": "Enable HIP Implicit GEMM BWD V1R1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1": "Enable HIP Implicit GEMM BWD V4R1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1": "Enable HIP Implicit GEMM WRW V4R1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4": "Enable HIP Implicit GEMM WRW V4R4", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_XDLOPS": "Enable HIP Implicit GEMM FWD V4R4 XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R5_XDLOPS": "Enable HIP Implicit GEMM FWD V4R5 XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1_XDLOPS": "Enable HIP Implicit GEMM BWD V1R1 XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1_XDLOPS": "Enable HIP Implicit GEMM BWD V4R1 XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_XDLOPS": "Enable HIP Implicit GEMM WRW V4R4 XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_PADDED_GEMM_XDLOPS": "Enable HIP Implicit GEMM FWD V4R4 Padded GEMM XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_PADDED_GEMM_XDLOPS": "Enable HIP Implicit GEMM WRW V4R4 Padded GEMM XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS": "Enable HIP Implicit GEMM FWD XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS": "Enable HIP Implicit GEMM BWD XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS": "Enable HIP Implicit GEMM WRW XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS": "Enable Implicit GEMM XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS_EMULATE": "Enable Implicit GEMM XDLOPS Emulation", + "MIOPEN_DEBUG_IMPLICIT_GEMM_XDLOPS_INLINE_ASM": "Enable Implicit GEMM XDLOPS Inline ASM", +}) +_SOLVER_DESCS.update({ + "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS": "Enable 3D HIP Implicit GEMM FWD XDLOPS", + "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS": "Enable 3D HIP Implicit GEMM BWD XDLOPS", + "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS": "Enable 3D HIP Implicit GEMM WRW XDLOPS", +}) +_SOLVER_DESCS.update({ + "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_V6R1_DLOPS_NCHW": "Enable CK iGEMM FWD V6R1 DLOPS NCHW", + "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_ACTIV": "Enable CK iGEMM FWD Bias Activation", + "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_RES_ADD_ACTIV": "Enable CK iGEMM FWD Bias Res Add Activation", +}) +_SOLVER_DESCS.update({ + "MIOPEN_DEBUG_CONV_MLIR_IGEMM_WRW_XDLOPS": "Enable MLIR iGEMM WRW XDLOPS", + "MIOPEN_DEBUG_CONV_MLIR_IGEMM_BWD_XDLOPS": "Enable MLIR iGEMM BWD XDLOPS", +}) + +# Vars whose solver default is "0" (disabled) — CDNA-only, RDNA3/4-only, experimental, or not used in SD inference +_SOLVER_DISABLED_BY_DEFAULT = { + "MIOPEN_DEBUG_FORCE_IMMED_MODE_FALLBACK", + "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F2X3", + "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F3X2", + "MIOPEN_DEBUG_AMD_WINOGRAD_RAGE_RXS_F2X3", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X4", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X5", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X6", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X3", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X4", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X2", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X3", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F2X3", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F3X3", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F4X3", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F5X3", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F6X3", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F2X3", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F3X3", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F4X3", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F5X3", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F6X3", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS_NHWC", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS_NHWC", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS_NHWC", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_DLOPS_NCHWC", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_GROUP_BWD_XDLOPS", + "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS_AI_HEUR", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_FWD_V4R4_XDLOPS_ADD_VECTOR_LOAD_GEMMN_TUNE_PARAM", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R5_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_PADDED_GEMM_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_PADDED_GEMM_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS_EMULATE", + "MIOPEN_DEBUG_IMPLICIT_GEMM_XDLOPS_INLINE_ASM", + "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS", + "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS", + "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS", + "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_V6R1_DLOPS_NCHW", + "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_ACTIV", + "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_RES_ADD_ACTIV", + "MIOPEN_DEBUG_CONV_MLIR_IGEMM_WRW_XDLOPS", + "MIOPEN_DEBUG_CONV_MLIR_IGEMM_BWD_XDLOPS", +} + +# Build full merged var registry +ROCM_ENV_VARS: Dict[str, Dict[str, Any]] = {} +ROCM_ENV_VARS.update(GENERAL_VARS) +for _var, _desc in _SOLVER_DESCS.items(): + ROCM_ENV_VARS[_var] = { + "default": "0" if _var in _SOLVER_DISABLED_BY_DEFAULT else "1", + "desc": _desc, + "widget": "checkbox", + "options": None, + "restart_required": False, + } + +# UI group ordering for solver sections +SOLVER_GROUPS: List[Tuple[str, List[str]]] = [ + ("Algorithm/Solver Group Enables", [ + "MIOPEN_DEBUG_CONV_FFT", "MIOPEN_DEBUG_CONV_DIRECT", "MIOPEN_DEBUG_CONV_GEMM", + "MIOPEN_DEBUG_CONV_WINOGRAD", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM", + ]), + ("Immediate Fallback Mode", [ + "MIOPEN_DEBUG_CONV_IMMED_FALLBACK", "MIOPEN_DEBUG_ENABLE_AI_IMMED_MODE_FALLBACK", + "MIOPEN_DEBUG_FORCE_IMMED_MODE_FALLBACK", + ]), + ("Build Method Toggles", [ + "MIOPEN_DEBUG_GCN_ASM_KERNELS", "MIOPEN_DEBUG_HIP_KERNELS", + "MIOPEN_DEBUG_OPENCL_CONVOLUTIONS", "MIOPEN_DEBUG_OPENCL_WAVE64_NOWGP", + "MIOPEN_DEBUG_ATTN_SOFTMAX", + ]), + ("Direct ASM Solver Toggles", [ + "MIOPEN_DEBUG_CONV_DIRECT_ASM_3X3U", "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1UV2", "MIOPEN_DEBUG_CONV_DIRECT_ASM_5X10U2V2", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_7X7C3H224W224", "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW3X3", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW1X1", "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_PERF_VALS", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_SEARCH_OPTIMIZED", "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_AI_HEUR", + "MIOPEN_DEBUG_CONV_DIRECT_NAIVE_CONV_FWD", + ]), + ("Direct OpenCL Solver Toggles", [ + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD", "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD1X1", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD11X11", "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWDGEN", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW2", "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW53", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW1X1", + ]), + ("Winograd Solver Toggles", [ + "MIOPEN_DEBUG_AMD_WINOGRAD_3X3", "MIOPEN_DEBUG_AMD_WINOGRAD_RXS", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_FWD_BWD", "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_WRW", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3_G1", "MIOPEN_DEBUG_AMD_FUSED_WINOGRAD", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3_PERF_VALS", "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F2X3", + "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F3X2", "MIOPEN_DEBUG_AMD_WINOGRAD_RAGE_RXS_F2X3", + ]), + ("Multi-pass Winograd Toggles", [ + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X2", "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X3", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X4", "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X5", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X6", "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X3", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X4", "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X2", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X3", + ]), + ("MP BD Winograd Toggles", [ + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F2X3", "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F3X3", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F4X3", "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F5X3", + "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F6X3", + ]), + ("MP BD XDLOPS Winograd Toggles", [ + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F2X3", "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F3X3", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F4X3", "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F5X3", + "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F6X3", + ]), + ("ASM Implicit GEMM Toggles", [ + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1_1X1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_V4R1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS_NHWC", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS_NHWC", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS_NHWC", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_DLOPS_NCHWC", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_GROUP_BWD_XDLOPS", + "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS_AI_HEUR", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_FWD_V4R4_XDLOPS_ADD_VECTOR_LOAD_GEMMN_TUNE_PARAM", + ]), + ("HIP Implicit GEMM Toggles", [ + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_XDLOPS", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R5_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1_XDLOPS", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_PADDED_GEMM_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_PADDED_GEMM_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS_EMULATE", "MIOPEN_DEBUG_IMPLICIT_GEMM_XDLOPS_INLINE_ASM", + ]), + ("3D Implicit GEMM Toggles", [ + "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS", + "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS", + "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS", + ]), + ("CK Implicit GEMM Toggles", [ + "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_V6R1_DLOPS_NCHW", + "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_ACTIV", + "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_RES_ADD_ACTIV", + ]), + ("MLIR Implicit GEMM Toggles", [ + "MIOPEN_DEBUG_CONV_MLIR_IGEMM_WRW_XDLOPS", + "MIOPEN_DEBUG_CONV_MLIR_IGEMM_BWD_XDLOPS", + ]), +] diff --git a/scripts/rocm_ext.py b/scripts/rocm_ext.py index 520aedb40..b899cc4db 100644 --- a/scripts/rocm_ext.py +++ b/scripts/rocm_ext.py @@ -1,6 +1,14 @@ import gradio as gr import installer -from modules import scripts_manager, shared +from modules import scripts_manager + + +def _is_rocm() -> bool: + try: + from scripts.rocm import rocm_mgr # pylint: disable=no-name-in-module + return rocm_mgr.is_rocm + except Exception: + return False class Script(scripts_manager.Script): @@ -8,35 +16,218 @@ class Script(scripts_manager.Script): return "ROCm: Advanced Config" def show(self, _is_img2img): - if shared.cmd_opts.use_rocm or installer.torch_info.get('type') == 'rocm': - return scripts_manager.AlwaysVisible # script should be visible only if rocm is detected or forced + if _is_rocm(): + return scripts_manager.AlwaysVisible return False def ui(self, _is_img2img): - # all ui elements go here - # logic should go into scripts/rocm/rocm_mgr.py and be called from here - if not shared.cmd_opts.use_rocm and not installer.torch_info.get('type') == 'rocm': # skip ui creation if not rocm + from scripts.rocm import rocm_mgr, rocm_vars # pylint: disable=no-name-in-module + + if not rocm_mgr.is_rocm: + with gr.Accordion('ROCm: Advanced Config', open=False, elem_id='rocm_config'): + gr.HTML("

ROCm is not installed. This section is disabled.

") return [] - from scripts.rocm import rocm_mgr # pylint: disable=no-name-in-module - rocm_mgr.load() # load config before ui creation so we can populate fields with current values - with gr.Accordion('ROCM: Advanced Config', open=False, elem_id='rocm_config'): # set all ui in this accordion - with gr.Row(): - gr.HTML('Advanced configuration for ROCm users') - with gr.Row(): - btn_info = gr.Button("Refresh") # refresh info and populate with additional fields - btn_apply = gr.Button("Apply") # apply changes and save config - btn_reset = gr.Button("Reset") # reset config and save config - with gr.Row(): - info = gr.JSON(installer.gpu_info, label="ROCm Info") # just an example how to display info we already have - with gr.Row(): - db_path = gr.Textbox(label="MiOpen SystemDB Path", value=rocm_mgr.DATA.get('MIOPEN_SYSTEM_DB_PATH', ''), lines=1) - args = [ # list all params here and note that it *must* match with scripts/rocm/rocm_mgr.apply() args - db_path, - ] + config = rocm_mgr.load_config() + var_names = [] + components = [] - btn_info.click(fn=rocm_mgr.info, inputs=[], outputs=[info]) - btn_apply.click(fn=rocm_mgr.apply, inputs=args, outputs=[]) - btn_reset.click(fn=rocm_mgr.reset, inputs=[], outputs=[]) + def _make_component(name, meta, cfg): + val = cfg.get(name, meta["default"]) + if meta["widget"] == "checkbox": + return gr.Checkbox(label=meta["desc"], value=(val == "1"), elem_id=f"rocm_var_{name.lower()}") + elif meta["widget"] == "dropdown": + choices = rocm_mgr._dropdown_choices(meta["options"]) + display = rocm_mgr._dropdown_display(val, meta["options"]) + if display not in choices: # corrupted stored value — fall back to default + display = rocm_mgr._dropdown_display(meta["default"], meta["options"]) + return gr.Dropdown(label=meta["desc"], choices=choices, value=display, elem_id=f"rocm_var_{name.lower()}") + else: # textbox + return gr.Textbox(label=meta["desc"], value=rocm_mgr._expand_venv(val), lines=1) - return args + def _info_html(): + d = rocm_mgr.info() + ts = "" + rows = [] + def section(title): + rows.append(f"
") + def row(k, v): + rows.append(f"") + section("ROCm / HIP") + for k, v in d.get("rocm", {}).items(): + row(k, v) + section("System DB") + sdb = d.get("system_db", {}) + row("path", sdb.get("path", "")) + for sub in ("solver_db", "find_db", "kernel_db"): + for fname, sz in sdb.get(sub, {}).items(): + row(sub.replace("_", " "), f"{fname}   {sz}") + section("User DB (~/.miopen/db)") + udb = d.get("user_db", {}) + row("path", udb.get("path", "")) + for fname, finfo in udb.get("files", {}).items(): + row(fname, finfo) + return ts + f"
{title}
{k}{v}
{''.join(rows)}
" + + with gr.Accordion('ROCm: Advanced Config', open=False, elem_id='rocm_config'): + gr.HTML("""""") + with gr.Row(): + gr.HTML("

Advanced configuration for ROCm users.


Set Your database and solver selections based on GPU profile or individually.


Enable cuDNN in Backend Settings to activate MIOpen.

") + with gr.Row(): + btn_info = gr.Button("Refresh Info", variant="primary", elem_id="rocm_btn_info") + btn_apply = gr.Button("Apply", elem_id="rocm_btn_apply") + btn_reset = gr.Button("Defaults") + btn_clear = gr.Button("Clear Runtime") + btn_delete = gr.Button("Delete", elem_id="rocm_btn_delete") + with gr.Row(): + btn_rdna2 = gr.Button("RDNA2 (RX 6000)", elem_id="rocm_btn_rdna2") + btn_rdna3 = gr.Button("RDNA3 (RX 7000)", elem_id="rocm_btn_rdna3") + btn_rdna4 = gr.Button("RDNA4 (RX 9000)", elem_id="rocm_btn_rdna4") + style_out = gr.HTML("") + info_out = gr.HTML(value=_info_html, elem_id="rocm_info_table") + + # General vars (dropdowns, textboxes, checkboxes) + with gr.Group(): + gr.HTML("

MIOpen Settings


") + for name, meta in rocm_vars.GENERAL_VARS.items(): + comp = _make_component(name, meta, config) + var_names.append(name) + components.append(comp) + + # Solver groups (all checkboxes, grouped by section) + for group_name, varlist in rocm_vars.SOLVER_GROUPS: + with gr.Group(): + gr.HTML(f"

{group_name}


") + for name in varlist: + meta = rocm_vars.ROCM_ENV_VARS[name] + comp = _make_component(name, meta, config) + var_names.append(name) + components.append(comp) + gr.HTML("
📄 MIOpen Environment Variables Reference

") + + def _autosave_dropdown(name, value): + meta = rocm_vars.ROCM_ENV_VARS[name] + if meta["widget"] == "dropdown": + stored = rocm_mgr._dropdown_stored(str(value), meta["options"]) + config = rocm_mgr.load_config() + config[name] = stored + rocm_mgr.save_config(config) + rocm_mgr.apply_env(config) + + for name, comp in zip(var_names, components): + meta = rocm_vars.ROCM_ENV_VARS[name] + if meta["widget"] == "dropdown": + comp.change(fn=lambda v, n=name: _autosave_dropdown(n, v), inputs=[comp], outputs=[]) + + def apply_fn(*values): + rocm_mgr.apply_all(var_names, list(values)) + saved = rocm_mgr.load_config() + result = [gr.update(value="")] + for name in var_names: + meta = rocm_vars.ROCM_ENV_VARS[name] + val = saved.get(name, meta["default"]) + if meta["widget"] == "checkbox": + result.append(gr.update(value=(val == "1"))) + elif meta["widget"] == "dropdown": + result.append(gr.update(value=rocm_mgr._dropdown_display(val, meta["options"]))) + else: + result.append(gr.update(value=rocm_mgr._expand_venv(val))) + return result + + def _build_style(unavailable): + if not unavailable: + return "" + rules = " ".join( + f"#rocm_var_{v.lower()} label {{ text-decoration: line-through; opacity: 0.5; }}" + for v in unavailable + ) + return f"" + + def reset_fn(): + rocm_mgr.reset_defaults() + updated = rocm_mgr.load_config() + result = [gr.update(value="")] + for name in var_names: + meta = rocm_vars.ROCM_ENV_VARS[name] + val = updated.get(name, meta["default"]) + if meta["widget"] == "checkbox": + result.append(gr.update(value=(val == "1"))) + elif meta["widget"] == "radio": + result.append(gr.update(value=rocm_mgr._dropdown_display(val, meta["options"]))) + else: + result.append(gr.update(value=rocm_mgr._expand_venv(val))) + return result + + def clear_fn(): + rocm_mgr.clear_env() + result = [gr.update(value="")] + for name in var_names: + meta = rocm_vars.ROCM_ENV_VARS[name] + if meta["widget"] == "checkbox": + result.append(gr.update(value=False)) + elif meta["widget"] == "radio": + choices = rocm_mgr._dropdown_choices(meta["options"]) + result.append(gr.update(value=choices[0] if choices else None)) + else: + result.append(gr.update(value="")) + return result + + def delete_fn(): + rocm_mgr.delete_config() + result = [gr.update(value="")] + for name in var_names: + meta = rocm_vars.ROCM_ENV_VARS[name] + if meta["widget"] == "checkbox": + result.append(gr.update(value=False)) + elif meta["widget"] == "radio": + choices = rocm_mgr._dropdown_choices(meta["options"]) + result.append(gr.update(value=choices[0] if choices else None)) + else: + result.append(gr.update(value="")) + return result + + def profile_fn(arch): + from scripts.rocm import rocm_profiles # pylint: disable=no-name-in-module + rocm_mgr.apply_profile(arch) + updated = rocm_mgr.load_config() + unavailable = rocm_profiles.UNAVAILABLE.get(arch, set()) + result = [gr.update(value=_build_style(unavailable))] + for pname in var_names: + meta = rocm_vars.ROCM_ENV_VARS[pname] + val = updated.get(pname, meta["default"]) + if meta["widget"] == "checkbox": + result.append(gr.update(value=(val == "1"))) + elif meta["widget"] == "radio": + result.append(gr.update(value=rocm_mgr._dropdown_display(val, meta["options"]))) + else: + result.append(gr.update(value=rocm_mgr._expand_venv(val))) + return result + + btn_info.click(fn=_info_html, inputs=[], outputs=[info_out]) + btn_apply.click(fn=apply_fn, inputs=components, outputs=[style_out] + components) + btn_reset.click(fn=reset_fn, inputs=[], outputs=[style_out] + components) + btn_clear.click(fn=clear_fn, inputs=[], outputs=[style_out] + components) + btn_delete.click(fn=delete_fn, inputs=[], outputs=[style_out] + components) + btn_rdna2.click(fn=lambda: profile_fn("RDNA2"), inputs=[], outputs=[style_out] + components) + btn_rdna3.click(fn=lambda: profile_fn("RDNA3"), inputs=[], outputs=[style_out] + components) + btn_rdna4.click(fn=lambda: profile_fn("RDNA4"), inputs=[], outputs=[style_out] + components) + + return components From 9033095be60f735efc474c01e9ebd5507f9eec30 Mon Sep 17 00:00:00 2001 From: resonantsky Date: Mon, 23 Mar 2026 12:03:38 +0200 Subject: [PATCH 17/33] ROCm: Advanced Configuration Script --- data/rocm-config.json | 115 ------------- scripts/rocm/rocm_mgr.py | 171 +++++++++++++++++--- scripts/rocm/rocm_profiles.py | 74 ++++++--- scripts/rocm/rocm_vars.py | 297 +++++++++------------------------- scripts/rocm_ext.py | 93 +++++++---- 5 files changed, 340 insertions(+), 410 deletions(-) delete mode 100644 data/rocm-config.json diff --git a/data/rocm-config.json b/data/rocm-config.json deleted file mode 100644 index 30bf96ea9..000000000 --- a/data/rocm-config.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "MIOPEN_GEMM_ENFORCE_BACKEND": "1", - "MIOPEN_FIND_MODE": "2", - "MIOPEN_FIND_ENFORCE": "1", - "MIOPEN_SEARCH_CUTOFF": "0", - "MIOPEN_SYSTEM_DB_PATH": "{VIRTUAL_ENV}\\Lib\\site-packages\\_rocm_sdk_devel\\bin\\", - "MIOPEN_LOG_LEVEL": "0", - "MIOPEN_DEBUG_ENABLE": "0", - "ROCBLAS_LAYER": "0", - "HIPBLASLT_LOG_LEVEL": "0", - "MIOPEN_DEBUG_CONVOLUTION_DETERMINISTIC": "0", - "MIOPEN_DEBUG_CONV_FFT": "1", - "MIOPEN_DEBUG_CONV_DIRECT": "1", - "MIOPEN_DEBUG_CONV_GEMM": "1", - "MIOPEN_DEBUG_CONV_WINOGRAD": "1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM": "1", - "MIOPEN_DEBUG_CONV_IMMED_FALLBACK": "1", - "MIOPEN_DEBUG_ENABLE_AI_IMMED_MODE_FALLBACK": "1", - "MIOPEN_DEBUG_FORCE_IMMED_MODE_FALLBACK": "0", - "MIOPEN_DEBUG_GCN_ASM_KERNELS": "1", - "MIOPEN_DEBUG_HIP_KERNELS": "1", - "MIOPEN_DEBUG_OPENCL_CONVOLUTIONS": "1", - "MIOPEN_DEBUG_OPENCL_WAVE64_NOWGP": "1", - "MIOPEN_DEBUG_ATTN_SOFTMAX": "1", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_3X3U": "1", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U": "1", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1UV2": "1", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_5X10U2V2": "1", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_7X7C3H224W224": "1", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW3X3": "1", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW1X1": "1", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_PERF_VALS": "1", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_SEARCH_OPTIMIZED": "1", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_AI_HEUR": "1", - "MIOPEN_DEBUG_CONV_DIRECT_NAIVE_CONV_FWD": "1", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD": "1", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD1X1": "1", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD11X11": "1", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWDGEN": "1", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW2": "1", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW53": "1", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW1X1": "1", - "MIOPEN_DEBUG_AMD_WINOGRAD_3X3": "1", - "MIOPEN_DEBUG_AMD_WINOGRAD_RXS": "1", - "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_FWD_BWD": "1", - "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_WRW": "1", - "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2": "1", - "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3": "1", - "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3_G1": "1", - "MIOPEN_DEBUG_AMD_FUSED_WINOGRAD": "1", - "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3_PERF_VALS": "1", - "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F2X3": "0", - "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F3X2": "0", - "MIOPEN_DEBUG_AMD_WINOGRAD_RAGE_RXS_F2X3": "0", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X2": "1", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X3": "1", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X4": "0", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X5": "0", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X6": "0", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X3": "0", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X4": "0", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X2": "0", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X3": "0", - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F2X3": "0", - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F3X3": "0", - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F4X3": "0", - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F5X3": "0", - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F6X3": "0", - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F2X3": "0", - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F3X3": "0", - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F4X3": "0", - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F5X3": "0", - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F6X3": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1": "1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1_1X1": "1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_V4R1": "1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_V4R1": "1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS_NHWC": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS_NHWC": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS_NHWC": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_DLOPS_NCHWC": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_GROUP_BWD_XDLOPS": "0", - "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS_AI_HEUR": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_FWD_V4R4_XDLOPS_ADD_VECTOR_LOAD_GEMMN_TUNE_PARAM": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1": "1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4": "1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1": "1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1": "1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1": "1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4": "1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_XDLOPS": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R5_XDLOPS": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1_XDLOPS": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1_XDLOPS": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_XDLOPS": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_PADDED_GEMM_XDLOPS": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_PADDED_GEMM_XDLOPS": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS": "0", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS_EMULATE": "0", - "MIOPEN_DEBUG_IMPLICIT_GEMM_XDLOPS_INLINE_ASM": "0", - "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS": "0", - "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS": "0", - "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS": "0", - "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_V6R1_DLOPS_NCHW": "0", - "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_ACTIV": "0", - "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_RES_ADD_ACTIV": "0", - "MIOPEN_DEBUG_CONV_MLIR_IGEMM_WRW_XDLOPS": "0", - "MIOPEN_DEBUG_CONV_MLIR_IGEMM_BWD_XDLOPS": "0" -} \ No newline at end of file diff --git a/scripts/rocm/rocm_mgr.py b/scripts/rocm/rocm_mgr.py index 9b98d5405..af07396a3 100644 --- a/scripts/rocm/rocm_mgr.py +++ b/scripts/rocm/rocm_mgr.py @@ -6,7 +6,7 @@ from typing import Dict, Any, Optional import installer from modules.logger import log from modules.json_helpers import readfile, writefile -from scripts.rocm.rocm_vars import ROCM_ENV_VARS, SOLVER_GROUPS # pylint: disable=no-name-in-module +from scripts.rocm.rocm_vars import ROCM_ENV_VARS, SOLVER_GROUPS, SOLVER_DISABLED_BY_DEFAULT # pylint: disable=no-name-in-module from scripts.rocm import rocm_profiles # pylint: disable=no-name-in-module @@ -34,16 +34,96 @@ def _check_rocm() -> bool: is_rocm = _check_rocm() -CONFIG = Path(os.path.abspath(os.path.join('data', 'rocm-config.json'))) +CONFIG = Path(os.path.abspath(os.path.join('data', 'rocm.json'))) _cache: Optional[Dict[str, str]] = None # loaded once, invalidated on save -# Vars that must never be set — they interfere with PyTorch dtype handling -_UNSET_VARS = { +# Metadata key written into rocm.json to record which architecture profile is active. +# Not an environment variable — always skipped during env application but preserved in the +# saved config so that arch-safety enforcement is consistent across restarts. +_ARCH_KEY = "_rocm_arch" + +# Vars that must never appear in the process environment. +# +# _DTYPE_UNSAFE: alter FP16 inference dtype — must be cleared regardless of config +# MIOPEN_DEBUG_CONVOLUTION_ATTRIB_FP16_ALT_IMPL — DEBUG alias: routes all FP16 convs through BF16 exponent math +# MIOPEN_CONVOLUTION_ATTRIB_FP16_ALT_IMPL — API-level alias: same BF16-exponent effect +# MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_EXPEREMENTAL_FP16_TRANSFORM — unstable experimental FP16 path +# MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_PK_ATOMIC_ADD_FP16 — changes FP16 WrW atomic accumulation +# +# SOLVER_DISABLED_BY_DEFAULT: every solver known to be incompatible with this runtime +# (FP32-only, training-only WrW/BWD, fixed-geometry mismatches, XDLOPS/CDNA-only, arch-specific). +# Actively unsetting these ensures no inherited shell value can re-enable them. +_DTYPE_UNSAFE = { "MIOPEN_DEBUG_CONVOLUTION_ATTRIB_FP16_ALT_IMPL", + "MIOPEN_CONVOLUTION_ATTRIB_FP16_ALT_IMPL", "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_EXPEREMENTAL_FP16_TRANSFORM", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_PK_ATOMIC_ADD_FP16", } +# _UNSET_VARS: hard-blocked vars that are DELETED from the process env and never written, +# regardless of saved config. Limited to dtype-corrupting vars only. +# IMPORTANT: SOLVER_DISABLED_BY_DEFAULT is intentionally NOT included here. +# When a solver var is absent (unset) MIOpen still calls IsApplicable() on every +# conv-find — wasted probing overhead. When a var is explicitly "0" MIOpen skips +# IsApplicable() immediately. Solver defaults flow through the config loop as "0" +# (their ROCM_ENV_VARS default is "0") so they are explicitly set to "0" in the env. +_UNSET_VARS = _DTYPE_UNSAFE + +# Additional environment vars that must be removed from the process before MIOpen loads. +# These are not MIOpen solver toggles but can corrupt MIOpen's runtime behaviour: +# HIP_PATH / HIP_PATH_71 — point to the system AMD ROCm install; override the venv-bundled +# _rocm_sdk_devel DLLs with a potentially mismatched system version +# QML_*/QT_* — QtQuick shader/disk-cache flags leaked from Qt tools; harmless for +# PyTorch but can conflict with Gradio's embedded Qt helpers +# PYENV_VIRTUALENV_DISABLE_PROMPT — pyenv noise that confuses venv detection +_EXTRA_CLEAR_VARS = { + "HIP_PATH", + "HIP_PATH_71", + "PYENV_VIRTUALENV_DISABLE_PROMPT", + "QML_DISABLE_DISK_CACHE", + "QML_FORCE_DISK_CACHE", + "QT_DISABLE_SHADER_DISK_CACHE", + # PERF_VALS vars are NOT boolean toggles — MIOpen reads them as perf-config strings. + # If inherited from a parent shell with value "1", MIOpen's GetPerfConfFromEnv parses + # "1" as a degenerate config and can return dtype=float32 output from FP16 tensors. + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_PERF_VALS", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3_PERF_VALS", +} + +# Solvers whose MIOpen IsApplicable() explicitly rejects non-FP32 tensors. +# They are safe to leave enabled in FP32 mode. When the active dtype is FP16 or BF16 +# we force them OFF so MIOpen skips the IsApplicable probe entirely — avoids overhead on +# every conv shape find. These are NOT in _UNSET_VARS because they are valid in FP32. +_FP32_ONLY_SOLVERS = { + "MIOPEN_DEBUG_CONV_FFT", # FFT convolution — FP32 only (MIOpen source: IsFp32 check) + "MIOPEN_DEBUG_AMD_WINOGRAD_3X3", # Winograd 3x3 — FP32 only + "MIOPEN_DEBUG_AMD_FUSED_WINOGRAD", # Fused Winograd — FP32 only +} + + +def _resolve_dtype() -> str: + """Return the resolved active compute dtype: 'FP16', 'BF16', 'FP32', or '' (not yet known). + Prefers the resolved devices.dtype (post test_fp16/bf16) over the raw opts string.""" + try: + import torch # pylint: disable=import-outside-toplevel + from modules import devices as _dev # pylint: disable=import-outside-toplevel + if _dev.dtype is not None: + if _dev.dtype == torch.float16: + return 'FP16' + if _dev.dtype == torch.bfloat16: + return 'BF16' + if _dev.dtype == torch.float32: + return 'FP32' + except Exception: + pass + try: + from modules import shared as _sh # pylint: disable=import-outside-toplevel + v = getattr(getattr(_sh, 'opts', None), 'cuda_dtype', None) + if v in ('FP16', 'BF16', 'FP32'): + return v + except Exception: + pass + return '' # --- venv helpers --- @@ -88,47 +168,86 @@ def _dropdown_choices(options): def load_config() -> Dict[str, str]: global _cache # pylint: disable=global-statement if _cache is None: - if CONFIG.exists(): + file_existed = CONFIG.exists() + if file_existed: data = readfile(str(CONFIG), lock=True, as_type="dict") _cache = data if data else {k: v["default"] for k, v in ROCM_ENV_VARS.items()} + # Purge unsafe vars from a stale saved config and re-persist only if the file existed. + # When running without a saved config (first run / after Delete), load_config() must + # never create the file — that only happens via save_config() on Apply or Apply Profile. + 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} + writefile(_cache, str(CONFIG)) + log.debug(f'ROCm load_config: purged {len(dirty)} stale/unsafe var(s) from saved config') else: _cache = {k: v["default"] for k, v in ROCM_ENV_VARS.items()} - log.debug(f'ROCm load_config: path={CONFIG} items={len(_cache)}') + log.debug(f'ROCm load_config: path={CONFIG} existed={file_existed} items={len(_cache)}') return _cache def save_config(config: Dict[str, str]) -> None: global _cache # pylint: disable=global-statement - writefile(config, str(CONFIG)) - _cache = config + sanitized = {k: v for k, v in config.items() if k not in _UNSET_VARS} + # 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, "") + unavailable = rocm_profiles.UNAVAILABLE.get(arch, set()) + for var in unavailable: + if var in sanitized and sanitized[var] != "0": + sanitized[var] = "0" + log.debug(f'ROCm save_config: clamped arch-incompatible var={var} arch={arch}') + writefile(sanitized, str(CONFIG)) + _cache = sanitized def apply_env(config: Optional[Dict[str, str]] = None) -> None: if config is None: config = load_config() - applied = 0 - skipped = 0 for var in _UNSET_VARS: if var in os.environ: del os.environ[var] for var, value in config.items(): - if var in _UNSET_VARS: - skipped += 1 + if var == _ARCH_KEY: continue + if var in _UNSET_VARS: + continue + if var not in ROCM_ENV_VARS: + continue + meta = ROCM_ENV_VARS.get(var, {}) + if meta.get("options"): + value = _dropdown_stored(str(value), meta["options"]) expanded = _expand_venv(str(value)) if expanded == "": - skipped += 1 continue os.environ[var] = expanded - applied += 1 + # Arch safety net: hard-force all hardware-incompatible vars to "0" in the env. + # This runs *after* the config loop so it overrides any stale "1" that survived in the JSON. + # Source of truth: rocm_profiles.UNAVAILABLE[arch] — vars with no supporting hardware. + arch = config.get(_ARCH_KEY, "") + unavailable = rocm_profiles.UNAVAILABLE.get(arch, set()) + if unavailable: + for var in unavailable: + os.environ[var] = "0" + dtype_str = _resolve_dtype() + if dtype_str in ('FP16', 'BF16'): + for var in _FP32_ONLY_SOLVERS: + os.environ[var] = "0" def apply_all(names: list, values: list) -> None: config = load_config().copy() + arch = config.get(_ARCH_KEY, "") + unavailable = rocm_profiles.UNAVAILABLE.get(arch, set()) for name, value in zip(names, values): if name not in ROCM_ENV_VARS: log.warning(f'ROCm apply_all: unknown variable={name}') continue + # Arch safety net: silently clamp incompatible solvers back to "0". + # The UI may send the current checkbox state even for greyed-out vars. + if name in unavailable: + config[name] = "0" + continue meta = ROCM_ENV_VARS[name] if meta["widget"] == "checkbox": if value is None: @@ -142,6 +261,8 @@ def apply_all(names: list, values: list) -> None: config[name] = stored # else: value was None/invalid — leave the existing saved value untouched else: + if meta.get("options"): + value = _dropdown_stored(str(value), meta["options"]) config[name] = _collapse_venv(str(value)) save_config(config) apply_env(config) @@ -149,32 +270,45 @@ def apply_all(names: list, values: list) -> None: def reset_defaults() -> None: defaults = {k: v["default"] for k, v in ROCM_ENV_VARS.items()} + # Preserve the active arch key so safety nets survive a defaults reset. + arch = load_config().get(_ARCH_KEY, "") + if arch: + defaults[_ARCH_KEY] = arch save_config(defaults) apply_env(defaults) - log.info('ROCm reset_defaults: config reset to defaults') + log.info(f'ROCm reset_defaults: config reset to defaults arch={arch or "(none)"}') def clear_env() -> None: - """Remove all managed ROCm vars from os.environ without writing to disk.""" + """Remove all managed ROCm vars and known noise vars from os.environ without writing to disk.""" cleared = 0 for var in ROCM_ENV_VARS: if var in os.environ: del os.environ[var] cleared += 1 - for var in _UNSET_VARS: + for var in _UNSET_VARS | _EXTRA_CLEAR_VARS: if var in os.environ: del os.environ[var] + cleared += 1 log.info(f'ROCm clear_env: cleared={cleared}') def delete_config() -> None: - """Delete the saved config file and clear all vars from the environment.""" + """Delete the saved config file, clear all vars, and wipe the MIOpen user DB cache.""" + import shutil # pylint: disable=import-outside-toplevel global _cache # pylint: disable=global-statement clear_env() if CONFIG.exists(): CONFIG.unlink() log.info(f'ROCm delete_config: deleted {CONFIG}') _cache = None + # Delete the MIOpen user DB (~/.miopen/db) — stale entries can cause solver mismatches + miopen_db = Path(os.path.expanduser('~')) / '.miopen' / 'db' + if miopen_db.exists(): + shutil.rmtree(miopen_db, ignore_errors=True) + log.info(f'ROCm delete_config: wiped MIOpen user DB at {miopen_db}') + else: + log.debug(f'ROCm delete_config: MIOpen user DB not found at {miopen_db} — nothing to wipe') def apply_profile(name: str) -> None: @@ -185,6 +319,7 @@ def apply_profile(name: str) -> None: return config = load_config().copy() config.update(profile) + config[_ARCH_KEY] = name # stamp the active arch so safety nets survive restarts save_config(config) apply_env(config) log.info(f'ROCm apply_profile: profile={name} overrides={len(profile)}') diff --git a/scripts/rocm/rocm_profiles.py b/scripts/rocm/rocm_profiles.py index 9e714d1f7..3c9a52b7f 100644 --- a/scripts/rocm/rocm_profiles.py +++ b/scripts/rocm/rocm_profiles.py @@ -78,7 +78,7 @@ RDNA2: Dict[str, str] = { # General settings (architecture-independent; set here so all profiles cover them) "MIOPEN_SEARCH_CUTOFF": "0", "MIOPEN_DEBUG_CONVOLUTION_DETERMINISTIC": "0", - # Core algo enables + # Core algo enables — FFT is FP32-only but harmless (IsApplicable rejects it for fp16 tensors) "MIOPEN_DEBUG_CONV_FFT": "1", "MIOPEN_DEBUG_CONV_DIRECT": "1", "MIOPEN_DEBUG_CONV_GEMM": "1", @@ -93,36 +93,58 @@ RDNA2: Dict[str, str] = { "MIOPEN_DEBUG_OPENCL_CONVOLUTIONS": "1", "MIOPEN_DEBUG_OPENCL_WAVE64_NOWGP": "1", "MIOPEN_DEBUG_ATTN_SOFTMAX": "1", - # Direct ASM — all work on RDNA2 + # Direct ASM — dtype notes + # 3X3U / 1X1U / 1X1UV2: FP32/FP16 forward — enabled "MIOPEN_DEBUG_CONV_DIRECT_ASM_3X3U": "1", "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U": "1", "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1UV2": "1", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_5X10U2V2": "1", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_7X7C3H224W224": "1", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW3X3": "1", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW1X1": "1", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_PERF_VALS": "1", + # 5X10U2V2: fixed geometry (5×10 stride-2), no SD conv matches — disabled + "MIOPEN_DEBUG_CONV_DIRECT_ASM_5X10U2V2": "0", + # 7X7C3H224W224: hard-coded ImageNet stem (C=3, H=W=224, K=64) — never matches SD — disabled + "MIOPEN_DEBUG_CONV_DIRECT_ASM_7X7C3H224W224": "0", + # WRW3X3 / WRW1X1: FP32-only weight-gradient (training only) — disabled for inference + "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW3X3": "0", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW1X1": "0", + # PERF_VALS intentionally blank: MIOpen reads this as a config string not a boolean; + # setting to "1" causes GetPerfConfFromEnv to use a degenerate config and return float32 + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_PERF_VALS": "", "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_SEARCH_OPTIMIZED": "1", "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_AI_HEUR": "1", - "MIOPEN_DEBUG_CONV_DIRECT_NAIVE_CONV_FWD": "1", - # Direct OCL — all work on RDNA2 + # NAIVE_CONV_FWD: scalar FP32 reference solver — IsApplicable does NOT reliably filter for FP16; + # can be selected for unusual shapes (e.g. VAE decoder 3-ch output) and returns dtype=float32 + "MIOPEN_DEBUG_CONV_DIRECT_NAIVE_CONV_FWD": "0", + # Direct OCL — dtype notes + # FWD / FWD1X1: FP32/FP16 forward — enabled "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD": "1", "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD1X1": "1", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD11X11": "1", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWDGEN": "1", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW2": "1", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW53": "1", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW1X1": "1", - # Winograd RxS — all base variants work on RDNA2 + # FWD11X11: requires 11×11 kernel — no SD match — disabled + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD11X11": "0", + # FWDGEN: FP32 generic OCL fallback — IsApplicable does NOT reliably reject for FP16; + # can produce dtype=float32 output for FP16 inputs — disabled + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWDGEN": "0", + # WRW2 / WRW53 / WRW1X1: training-only weight-gradient — disabled + "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW2": "0", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW53": "0", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW1X1": "0", + # Winograd RxS — dtype per MIOpen docs + # WINOGRAD_3X3: FP32-only — harmless (IsApplicable rejects for fp16); enabled "MIOPEN_DEBUG_AMD_WINOGRAD_3X3": "1", + # RXS: covers FP32/FP16 F(3,3) Fwd/Bwd + FP32 F(3,2) WrW — keep enabled (fp16 fwd/bwd path exists) "MIOPEN_DEBUG_AMD_WINOGRAD_RXS": "1", + # RXS_FWD_BWD: FP32/FP16 — explicitly the fp16-capable subset "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_FWD_BWD": "1", - "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_WRW": "1", + # RXS_WRW: FP32 WrW only — training-only, disabled for inference fp16 profile + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_WRW": "0", + # RXS_F3X2: FP32/FP16 Fwd/Bwd "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2": "1", + # RXS_F2X3: FP32/FP16 Fwd/Bwd (group convolutions) "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3": "1", + # RXS_F2X3_G1: FP32/FP16 Fwd/Bwd (non-group convolutions) "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3_G1": "1", + # FUSED_WINOGRAD: FP32-only — harmless (IsApplicable rejects for fp16); enabled "MIOPEN_DEBUG_AMD_FUSED_WINOGRAD": "1", - "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3_PERF_VALS": "1", + # PERF_VALS intentionally blank: same reason as ASM_1X1U — not a boolean, config string + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3_PERF_VALS": "", # Fury/Rage Winograd — NOT available on RDNA2 "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F2X3": "0", "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F3X2": "0", @@ -137,18 +159,20 @@ RDNA2: Dict[str, str] = { "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X4": "0", "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X2": "0", "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X3": "0", - # ASM Implicit GEMM — V4R1 only; no GTC/XDLOPS on RDNA2 + # ASM Implicit GEMM — forward V4R1 only; no GTC/XDLOPS on RDNA2 + # BWD (backward data-gradient) and WrW (weight-gradient) are training-only — disabled "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1": "1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1_1X1": "1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_V4R1": "1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_V4R1": "1", - # HIP Implicit GEMM — non-XDLOPS V4R1/R4 only + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_V4R1": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_V4R1": "0", + # HIP Implicit GEMM — non-XDLOPS V4R1/R4 forward only + # BWD (backward data-gradient) and WrW (weight-gradient) are training-only — disabled "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1": "1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4": "1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1": "1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1": "1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1": "1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4": "1", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1": "0", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4": "0", } # --------------------------------------------------------------------------- diff --git a/scripts/rocm/rocm_vars.py b/scripts/rocm/rocm_vars.py index dc768f88e..b6fce4faa 100644 --- a/scripts/rocm/rocm_vars.py +++ b/scripts/rocm/rocm_vars.py @@ -75,8 +75,13 @@ GENERAL_VARS: Dict[str, Dict[str, Any]] = { }, } -# --- Solver toggles: name -> description string --- -# These are all checkbox widgets; default "1" unless in _SOLVER_DISABLED_BY_DEFAULT. +# --- Solver toggles (inference/FWD only, RDNA2/3/4 compatible) --- +# Removed entirely — not representable in the UI, cannot be set by users: +# WRW (weight-gradient) and BWD (data-gradient) — training passes only, never run during inference +# XDLOPS, CK (Composable Kernel), MLIR, MP BD — CDNA (MI100/MI200/MI300) matrix engine; not on RDNA +# Fixed-geometry (5x10, 7x7-ImageNet, 11x11) — shapes never appear in SD/video inference +# FP32-reference (NAIVE_CONV_FWD, FWDGEN) — IsApplicable() unreliable for FP16/BF16 +# Wide MPASS (F3x4..F7x3) — kernel sizes that cannot match any SD convolution shape _SOLVER_DESCS: Dict[str, str] = {} _SOLVER_DESCS.update({ @@ -87,184 +92,90 @@ _SOLVER_DESCS.update({ "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", + "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", + "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({ - "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_5X10U2V2": "Enable Direct ASM 5x10U2V2", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_7X7C3H224W224": "Enable Direct ASM 7x7C3H224W224", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW3X3": "Enable Direct ASM WRW3X3", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW1X1": "Enable Direct ASM WRW1X1", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_PERF_VALS": "Enable Direct ASM 1x1U Perf Vals", - "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", - "MIOPEN_DEBUG_CONV_DIRECT_NAIVE_CONV_FWD": "Enable Direct Naive Conv FWD", + # 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({ - "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD": "Enable Direct OCL FWD", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD1X1": "Enable Direct OCL FWD1X1", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD11X11": "Enable Direct OCL FWD11X11", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWDGEN": "Enable Direct OCL FWDGEN", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW2": "Enable Direct OCL WRW2", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW53": "Enable Direct OCL WRW53", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW1X1": "Enable Direct OCL WRW1X1", + # 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({ - "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/BWD", - "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_WRW": "Enable AMD Winograd RxS WRW", - "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_RXS_F2X3_PERF_VALS":"Enable AMD Winograd RxS F2x3 Perf Vals", - "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", + # 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", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X4": "Enable AMD Winograd MPASS F3x4", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X5": "Enable AMD Winograd MPASS F3x5", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X6": "Enable AMD Winograd MPASS F3x6", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X3": "Enable AMD Winograd MPASS F5x3", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X4": "Enable AMD Winograd MPASS F5x4", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X2": "Enable AMD Winograd MPASS F7x2", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X3": "Enable AMD Winograd MPASS F7x3", }) _SOLVER_DESCS.update({ - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F2X3": "Enable AMD MP BD Winograd F2x3", - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F3X3": "Enable AMD MP BD Winograd F3x3", - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F4X3": "Enable AMD MP BD Winograd F4x3", - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F5X3": "Enable AMD MP BD Winograd F5x3", - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F6X3": "Enable AMD MP BD Winograd F6x3", -}) -_SOLVER_DESCS.update({ - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F2X3": "Enable AMD MP BD XDLOPS Winograd F2x3", - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F3X3": "Enable AMD MP BD XDLOPS Winograd F3x3", - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F4X3": "Enable AMD MP BD XDLOPS Winograd F4x3", - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F5X3": "Enable AMD MP BD XDLOPS Winograd F5x3", - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F6X3": "Enable AMD MP BD XDLOPS Winograd F6x3", -}) -_SOLVER_DESCS.update({ - "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_ASM_BWD_V4R1": "Enable ASM Implicit GEMM BWD V4R1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_V4R1": "Enable ASM Implicit GEMM WRW V4R1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS": "Enable ASM Implicit GEMM FWD GTC XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS": "Enable ASM Implicit GEMM BWD GTC XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS": "Enable ASM Implicit GEMM WRW GTC XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS_NHWC": "Enable ASM Implicit GEMM FWD GTC XDLOPS NHWC", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS_NHWC": "Enable ASM Implicit GEMM BWD GTC XDLOPS NHWC", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS_NHWC": "Enable ASM Implicit GEMM WRW GTC XDLOPS NHWC", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_DLOPS_NCHWC": "Enable ASM Implicit GEMM FWD GTC DLOPS NCHWC", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_GROUP_BWD_XDLOPS": "Enable HIP Group BWD XDLOPS", - "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS_AI_HEUR": "Enable Group HIP BWD XDLOPS AI Heuristic", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_FWD_V4R4_XDLOPS_ADD_VECTOR_LOAD_GEMMN_TUNE_PARAM": "Enable FWD V4R4 XDLOPS Add Vector Load GEMMN Tune Param", -}) -_SOLVER_DESCS.update({ - "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", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1": "Enable HIP Implicit GEMM BWD V1R1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1": "Enable HIP Implicit GEMM BWD V4R1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1": "Enable HIP Implicit GEMM WRW V4R1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4": "Enable HIP Implicit GEMM WRW V4R4", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_XDLOPS": "Enable HIP Implicit GEMM FWD V4R4 XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R5_XDLOPS": "Enable HIP Implicit GEMM FWD V4R5 XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1_XDLOPS": "Enable HIP Implicit GEMM BWD V1R1 XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1_XDLOPS": "Enable HIP Implicit GEMM BWD V4R1 XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_XDLOPS": "Enable HIP Implicit GEMM WRW V4R4 XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_PADDED_GEMM_XDLOPS": "Enable HIP Implicit GEMM FWD V4R4 Padded GEMM XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_PADDED_GEMM_XDLOPS": "Enable HIP Implicit GEMM WRW V4R4 Padded GEMM XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS": "Enable HIP Implicit GEMM FWD XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS": "Enable HIP Implicit GEMM BWD XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS": "Enable HIP Implicit GEMM WRW XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS": "Enable Implicit GEMM XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS_EMULATE": "Enable Implicit GEMM XDLOPS Emulation", - "MIOPEN_DEBUG_IMPLICIT_GEMM_XDLOPS_INLINE_ASM": "Enable Implicit GEMM XDLOPS Inline ASM", -}) -_SOLVER_DESCS.update({ - "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS": "Enable 3D HIP Implicit GEMM FWD XDLOPS", - "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS": "Enable 3D HIP Implicit GEMM BWD XDLOPS", - "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS": "Enable 3D HIP Implicit GEMM WRW XDLOPS", -}) -_SOLVER_DESCS.update({ - "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_V6R1_DLOPS_NCHW": "Enable CK iGEMM FWD V6R1 DLOPS NCHW", - "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_ACTIV": "Enable CK iGEMM FWD Bias Activation", - "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_RES_ADD_ACTIV": "Enable CK iGEMM FWD Bias Res Add Activation", -}) -_SOLVER_DESCS.update({ - "MIOPEN_DEBUG_CONV_MLIR_IGEMM_WRW_XDLOPS": "Enable MLIR iGEMM WRW XDLOPS", - "MIOPEN_DEBUG_CONV_MLIR_IGEMM_BWD_XDLOPS": "Enable MLIR iGEMM BWD XDLOPS", + # Implicit GEMM FWD — BWD/WRW (training), all XDLOPS/CDNA 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", }) -# Vars whose solver default is "0" (disabled) — CDNA-only, RDNA3/4-only, experimental, or not used in SD inference -_SOLVER_DISABLED_BY_DEFAULT = { + +# Solvers still in the registry but disabled by default. +# FORCE_IMMED_MODE_FALLBACK — overrides FIND_MODE entirely, defeats tuning DB +# Fury RxS F2x3/F3x2 — RDNA3/4-only; harmless on RDNA2 but won't select +# Rage RxS F2x3 — RDNA4-only +SOLVER_DISABLED_BY_DEFAULT = { "MIOPEN_DEBUG_FORCE_IMMED_MODE_FALLBACK", "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F2X3", "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F3X2", "MIOPEN_DEBUG_AMD_WINOGRAD_RAGE_RXS_F2X3", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X4", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X5", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X6", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X3", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X4", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X2", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X3", - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F2X3", - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F3X3", - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F4X3", - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F5X3", - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F6X3", - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F2X3", - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F3X3", - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F4X3", - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F5X3", - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F6X3", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS_NHWC", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS_NHWC", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS_NHWC", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_DLOPS_NCHWC", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_GROUP_BWD_XDLOPS", - "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS_AI_HEUR", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_FWD_V4R4_XDLOPS_ADD_VECTOR_LOAD_GEMMN_TUNE_PARAM", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R5_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_PADDED_GEMM_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_PADDED_GEMM_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS_EMULATE", - "MIOPEN_DEBUG_IMPLICIT_GEMM_XDLOPS_INLINE_ASM", - "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS", - "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS", - "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS", - "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_V6R1_DLOPS_NCHW", - "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_ACTIV", - "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_RES_ADD_ACTIV", - "MIOPEN_DEBUG_CONV_MLIR_IGEMM_WRW_XDLOPS", - "MIOPEN_DEBUG_CONV_MLIR_IGEMM_BWD_XDLOPS", +} + +SOLVER_DTYPE_TAGS: Dict[str, str] = { + "MIOPEN_DEBUG_CONV_DIRECT_ASM_3X3U": "FP16/FP32", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U": "FP16/FP32", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1UV2": "FP16/FP32", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD": "FP16/FP32", + "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD1X1": "FP16/FP32", + "MIOPEN_DEBUG_AMD_WINOGRAD_3X3": "FP32", + "MIOPEN_DEBUG_AMD_FUSED_WINOGRAD": "FP32", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS": "FP16/FP32", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_FWD_BWD": "FP16/FP32", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2": "FP16/FP32", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3": "FP16/FP32", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3_G1": "FP16/FP32", + "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F2X3": "FP16/FP32", + "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F3X2": "FP16/FP32", + "MIOPEN_DEBUG_AMD_WINOGRAD_RAGE_RXS_F2X3": "FP16/FP32", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X2": "FP16/FP32", + "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X3": "FP16/FP32", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1": "FP16/FP32", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1_1X1": "FP16/FP32", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1": "FP16/FP32", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4": "FP16/FP32", } # Build full merged var registry @@ -272,10 +183,11 @@ ROCM_ENV_VARS: Dict[str, Dict[str, Any]] = {} ROCM_ENV_VARS.update(GENERAL_VARS) for _var, _desc in _SOLVER_DESCS.items(): ROCM_ENV_VARS[_var] = { - "default": "0" if _var in _SOLVER_DISABLED_BY_DEFAULT else "1", + "default": "0" if _var in SOLVER_DISABLED_BY_DEFAULT else "1", "desc": _desc, "widget": "checkbox", "options": None, + "dtype": SOLVER_DTYPE_TAGS.get(_var), "restart_required": False, } @@ -296,79 +208,26 @@ SOLVER_GROUPS: List[Tuple[str, List[str]]] = [ ]), ("Direct ASM Solver Toggles", [ "MIOPEN_DEBUG_CONV_DIRECT_ASM_3X3U", "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1UV2", "MIOPEN_DEBUG_CONV_DIRECT_ASM_5X10U2V2", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_7X7C3H224W224", "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW3X3", - "MIOPEN_DEBUG_CONV_DIRECT_ASM_WRW1X1", "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_PERF_VALS", + "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1UV2", "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_SEARCH_OPTIMIZED", "MIOPEN_DEBUG_CONV_DIRECT_ASM_1X1U_AI_HEUR", - "MIOPEN_DEBUG_CONV_DIRECT_NAIVE_CONV_FWD", ]), ("Direct OpenCL Solver Toggles", [ "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD", "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD1X1", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWD11X11", "MIOPEN_DEBUG_CONV_DIRECT_OCL_FWDGEN", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW2", "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW53", - "MIOPEN_DEBUG_CONV_DIRECT_OCL_WRW1X1", ]), ("Winograd Solver Toggles", [ "MIOPEN_DEBUG_AMD_WINOGRAD_3X3", "MIOPEN_DEBUG_AMD_WINOGRAD_RXS", - "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_FWD_BWD", "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_WRW", + "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_FWD_BWD", "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F3X2", "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3", "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3_G1", "MIOPEN_DEBUG_AMD_FUSED_WINOGRAD", - "MIOPEN_DEBUG_AMD_WINOGRAD_RXS_F2X3_PERF_VALS", "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F2X3", + "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F2X3", "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F3X2", "MIOPEN_DEBUG_AMD_WINOGRAD_RAGE_RXS_F2X3", ]), ("Multi-pass Winograd Toggles", [ "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X2", "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X3", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X4", "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X5", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X6", "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X3", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X4", "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X2", - "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X3", ]), - ("MP BD Winograd Toggles", [ - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F2X3", "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F3X3", - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F4X3", "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F5X3", - "MIOPEN_DEBUG_AMD_MP_BD_WINOGRAD_F6X3", - ]), - ("MP BD XDLOPS Winograd Toggles", [ - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F2X3", "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F3X3", - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F4X3", "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F5X3", - "MIOPEN_DEBUG_AMD_MP_BD_XDLOPS_WINOGRAD_F6X3", - ]), - ("ASM Implicit GEMM Toggles", [ + ("Implicit GEMM Toggles", [ "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1_1X1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_V4R1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_XDLOPS_NHWC", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_BWD_GTC_XDLOPS_NHWC", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_WRW_GTC_XDLOPS_NHWC", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_GTC_DLOPS_NCHWC", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_GROUP_BWD_XDLOPS", - "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS_AI_HEUR", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_FWD_V4R4_XDLOPS_ADD_VECTOR_LOAD_GEMMN_TUNE_PARAM", - ]), - ("HIP Implicit GEMM Toggles", [ "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_XDLOPS", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R5_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V1R1_XDLOPS", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4_PADDED_GEMM_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4_PADDED_GEMM_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS_EMULATE", "MIOPEN_DEBUG_IMPLICIT_GEMM_XDLOPS_INLINE_ASM", - ]), - ("3D Implicit GEMM Toggles", [ - "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS", - "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_BWD_XDLOPS", - "MIOPEN_DEBUG_3D_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS", - ]), - ("CK Implicit GEMM Toggles", [ - "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_V6R1_DLOPS_NCHW", - "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_ACTIV", - "MIOPEN_DEBUG_CONV_CK_IGEMM_FWD_BIAS_RES_ADD_ACTIV", - ]), - ("MLIR Implicit GEMM Toggles", [ - "MIOPEN_DEBUG_CONV_MLIR_IGEMM_WRW_XDLOPS", - "MIOPEN_DEBUG_CONV_MLIR_IGEMM_BWD_XDLOPS", ]), ] + diff --git a/scripts/rocm_ext.py b/scripts/rocm_ext.py index b899cc4db..307df918a 100644 --- a/scripts/rocm_ext.py +++ b/scripts/rocm_ext.py @@ -35,12 +35,12 @@ class Script(scripts_manager.Script): def _make_component(name, meta, cfg): val = cfg.get(name, meta["default"]) if meta["widget"] == "checkbox": - return gr.Checkbox(label=meta["desc"], value=(val == "1"), elem_id=f"rocm_var_{name.lower()}") + dtype_tag = meta.get("dtype") + label = f"[{dtype_tag}] {meta['desc']}" if dtype_tag else meta["desc"] + return gr.Checkbox(label=label, value=(val == "1"), elem_id=f"rocm_var_{name.lower()}") elif meta["widget"] == "dropdown": choices = rocm_mgr._dropdown_choices(meta["options"]) display = rocm_mgr._dropdown_display(val, meta["options"]) - if display not in choices: # corrupted stored value — fall back to default - display = rocm_mgr._dropdown_display(meta["default"], meta["options"]) return gr.Dropdown(label=meta["desc"], choices=choices, value=display, elem_id=f"rocm_var_{name.lower()}") else: # textbox return gr.Textbox(label=meta["desc"], value=rocm_mgr._expand_venv(val), lines=1) @@ -88,15 +88,45 @@ class Script(scripts_manager.Script): gap: 0 !important; } #rocm_config fieldset { border: none !important; padding: 0 !important; margin: 0 !important; box-shadow: none !important; background: transparent !important; } + /* No horizontal overflow on the container */ + #rocm_config { overflow-x: hidden !important; } + /* Smaller text for dense solver checkbox lists */ + #rocm_config .gradio-checkbox label { font-size: 11px !important; line-height: 1.4 !important; } + + /* CSS-only tooltips — script tags are sanitized by Gradio */ + #rocm_btn_info, #rocm_btn_apply, #rocm_btn_reset, #rocm_btn_clear, #rocm_btn_delete, + #rocm_btn_rdna2, #rocm_btn_rdna3, #rocm_btn_rdna4 { position: relative !important; overflow: visible !important; } + #rocm_btn_info::after { content: "Reload DB and device version info"; } + #rocm_btn_apply::after { content: "Save and apply current settings to runtime"; } + #rocm_btn_reset::after { content: "Reset all settings to built-in defaults"; } + #rocm_btn_clear::after { content: "Remove all MIOpen/HIP vars from runtime env"; } + #rocm_btn_delete::after { content: "Delete saved config + wipe MIOpen user DB cache"; } + #rocm_btn_rdna2::after { content: "Apply RDNA2 (RX 6000 series) solver profile"; } + #rocm_btn_rdna3::after { content: "Apply RDNA3 (RX 7000 series) solver profile"; } + #rocm_btn_rdna4::after { content: "Apply RDNA4 (RX 9000 series) solver profile"; } + #rocm_btn_info::after, #rocm_btn_apply::after, #rocm_btn_reset::after, + #rocm_btn_clear::after, #rocm_btn_delete::after, + #rocm_btn_rdna2::after, #rocm_btn_rdna3::after, #rocm_btn_rdna4::after { + display: block; position: absolute; top: calc(100% + 4px); left: 0; + background: var(--background-fill-secondary, #2a2a2a); + color: var(--body-text-color, #ddd); + border: 1px solid var(--border-color-primary, #555); + padding: 3px 8px; border-radius: 4px; font-size: 11px; + white-space: nowrap; pointer-events: none; + opacity: 0; transition: opacity 0.15s; z-index: 999; + } + #rocm_btn_info:hover::after, #rocm_btn_apply:hover::after, #rocm_btn_reset:hover::after, + #rocm_btn_clear:hover::after, #rocm_btn_delete:hover::after, + #rocm_btn_rdna2:hover::after, #rocm_btn_rdna3:hover::after, #rocm_btn_rdna4:hover::after { opacity: 1; } """) with gr.Row(): - gr.HTML("

Advanced configuration for ROCm users.


Set Your database and solver selections based on GPU profile or individually.


Enable cuDNN in Backend Settings to activate MIOpen.

") + gr.HTML("

Advanced configuration for ROCm users.


Set your database and solver selections based on GPU profile or individually.


Enable cuDNN in Backend Settings to activate MIOpen.

") with gr.Row(): - btn_info = gr.Button("Refresh Info", variant="primary", elem_id="rocm_btn_info") - btn_apply = gr.Button("Apply", elem_id="rocm_btn_apply") - btn_reset = gr.Button("Defaults") - btn_clear = gr.Button("Clear Runtime") - btn_delete = gr.Button("Delete", elem_id="rocm_btn_delete") + btn_info = gr.Button("Refresh Info", variant="primary", elem_id="rocm_btn_info", size="sm") + btn_apply = gr.Button("Apply", elem_id="rocm_btn_apply", size="sm") + btn_reset = gr.Button("Defaults", elem_id="rocm_btn_reset", size="sm") + btn_clear = gr.Button("Clear vEnv", elem_id="rocm_btn_clear", size="sm") + btn_delete = gr.Button("Delete UserDb", elem_id="rocm_btn_delete", size="sm") with gr.Row(): btn_rdna2 = gr.Button("RDNA2 (RX 6000)", elem_id="rocm_btn_rdna2") btn_rdna3 = gr.Button("RDNA3 (RX 7000)", elem_id="rocm_btn_rdna3") @@ -123,19 +153,18 @@ class Script(scripts_manager.Script): components.append(comp) gr.HTML("

") - def _autosave_dropdown(name, value): + def _autosave_field(name, value): meta = rocm_vars.ROCM_ENV_VARS[name] - if meta["widget"] == "dropdown": - stored = rocm_mgr._dropdown_stored(str(value), meta["options"]) - config = rocm_mgr.load_config() - config[name] = stored - rocm_mgr.save_config(config) - rocm_mgr.apply_env(config) + stored = rocm_mgr._dropdown_stored(str(value), meta["options"]) + cfg = rocm_mgr.load_config() + cfg[name] = stored + rocm_mgr.save_config(cfg) + rocm_mgr.apply_env(cfg) for name, comp in zip(var_names, components): meta = rocm_vars.ROCM_ENV_VARS[name] if meta["widget"] == "dropdown": - comp.change(fn=lambda v, n=name: _autosave_dropdown(n, v), inputs=[comp], outputs=[]) + comp.change(fn=lambda v, n=name: _autosave_field(n, v), inputs=[comp], outputs=[], show_progress='hidden') def apply_fn(*values): rocm_mgr.apply_all(var_names, list(values)) @@ -170,7 +199,7 @@ class Script(scripts_manager.Script): val = updated.get(name, meta["default"]) if meta["widget"] == "checkbox": result.append(gr.update(value=(val == "1"))) - elif meta["widget"] == "radio": + elif meta["widget"] == "dropdown": result.append(gr.update(value=rocm_mgr._dropdown_display(val, meta["options"]))) else: result.append(gr.update(value=rocm_mgr._expand_venv(val))) @@ -183,9 +212,8 @@ class Script(scripts_manager.Script): meta = rocm_vars.ROCM_ENV_VARS[name] if meta["widget"] == "checkbox": result.append(gr.update(value=False)) - elif meta["widget"] == "radio": - choices = rocm_mgr._dropdown_choices(meta["options"]) - result.append(gr.update(value=choices[0] if choices else None)) + elif meta["widget"] == "dropdown": + result.append(gr.update(value=rocm_mgr._dropdown_display(meta["default"], meta["options"]))) else: result.append(gr.update(value="")) return result @@ -197,9 +225,8 @@ class Script(scripts_manager.Script): meta = rocm_vars.ROCM_ENV_VARS[name] if meta["widget"] == "checkbox": result.append(gr.update(value=False)) - elif meta["widget"] == "radio": - choices = rocm_mgr._dropdown_choices(meta["options"]) - result.append(gr.update(value=choices[0] if choices else None)) + elif meta["widget"] == "dropdown": + result.append(gr.update(value=rocm_mgr._dropdown_display(meta["default"], meta["options"]))) else: result.append(gr.update(value="")) return result @@ -215,19 +242,19 @@ class Script(scripts_manager.Script): val = updated.get(pname, meta["default"]) if meta["widget"] == "checkbox": result.append(gr.update(value=(val == "1"))) - elif meta["widget"] == "radio": + elif meta["widget"] == "dropdown": result.append(gr.update(value=rocm_mgr._dropdown_display(val, meta["options"]))) else: result.append(gr.update(value=rocm_mgr._expand_venv(val))) return result - btn_info.click(fn=_info_html, inputs=[], outputs=[info_out]) - btn_apply.click(fn=apply_fn, inputs=components, outputs=[style_out] + components) - btn_reset.click(fn=reset_fn, inputs=[], outputs=[style_out] + components) - btn_clear.click(fn=clear_fn, inputs=[], outputs=[style_out] + components) - btn_delete.click(fn=delete_fn, inputs=[], outputs=[style_out] + components) - btn_rdna2.click(fn=lambda: profile_fn("RDNA2"), inputs=[], outputs=[style_out] + components) - btn_rdna3.click(fn=lambda: profile_fn("RDNA3"), inputs=[], outputs=[style_out] + components) - btn_rdna4.click(fn=lambda: profile_fn("RDNA4"), inputs=[], outputs=[style_out] + components) + 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_rdna2.click(fn=lambda: profile_fn("RDNA2"), inputs=[], outputs=[style_out] + components, show_progress='hidden') + btn_rdna3.click(fn=lambda: profile_fn("RDNA3"), inputs=[], outputs=[style_out] + components, show_progress='hidden') + btn_rdna4.click(fn=lambda: profile_fn("RDNA4"), inputs=[], outputs=[style_out] + components, show_progress='hidden') return components From 312d90973989625638af09fb66a66a702e826038 Mon Sep 17 00:00:00 2001 From: resonantsky Date: Mon, 23 Mar 2026 15:19:59 +0200 Subject: [PATCH 18/33] Restored rocm_ext.py IF checks for rocm to those supplied with the template --- scripts/rocm_ext.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/scripts/rocm_ext.py b/scripts/rocm_ext.py index 307df918a..9b514fba9 100644 --- a/scripts/rocm_ext.py +++ b/scripts/rocm_ext.py @@ -1,14 +1,6 @@ import gradio as gr import installer -from modules import scripts_manager - - -def _is_rocm() -> bool: - try: - from scripts.rocm import rocm_mgr # pylint: disable=no-name-in-module - return rocm_mgr.is_rocm - except Exception: - return False +from modules import scripts_manager, shared class Script(scripts_manager.Script): @@ -16,14 +8,14 @@ class Script(scripts_manager.Script): return "ROCm: Advanced Config" def show(self, _is_img2img): - if _is_rocm(): - return scripts_manager.AlwaysVisible + if shared.cmd_opts.use_rocm or installer.torch_info.get('type') == 'rocm': + return scripts_manager.AlwaysVisible # script should be visible only if rocm is detected or forced return False def ui(self, _is_img2img): from scripts.rocm import rocm_mgr, rocm_vars # pylint: disable=no-name-in-module - if not rocm_mgr.is_rocm: + if not shared.cmd_opts.use_rocm and not installer.torch_info.get('type') == 'rocm': # skip ui creation if not rocm with gr.Accordion('ROCm: Advanced Config', open=False, elem_id='rocm_config'): gr.HTML("

ROCm is not installed. This section is disabled.

") return [] From 0ee33ea60e2a17f36f7cf2efe8ce827d6d0fb6ff Mon Sep 17 00:00:00 2001 From: resonantsky Date: Mon, 23 Mar 2026 16:19:33 +0200 Subject: [PATCH 19/33] corrections as specified in PR conversation --- scripts/rocm/rocm_mgr.py | 25 ++++--------- scripts/rocm_ext.py | 76 +++++++--------------------------------- 2 files changed, 19 insertions(+), 82 deletions(-) diff --git a/scripts/rocm/rocm_mgr.py b/scripts/rocm/rocm_mgr.py index af07396a3..f517a7452 100644 --- a/scripts/rocm/rocm_mgr.py +++ b/scripts/rocm/rocm_mgr.py @@ -11,24 +11,13 @@ from scripts.rocm import rocm_profiles # pylint: disable=no-name-in-module def _check_rocm() -> bool: - try: - from modules import shared - if getattr(shared.cmd_opts, 'use_rocm', False): - return True - except Exception: - pass - try: - if installer.torch_info.get('type') == 'rocm': - return True - except Exception: - pass - try: - import torch - if hasattr(torch.version, 'hip') and torch.version.hip is not None: - return True - except Exception: - pass - return False + from modules import shared + if getattr(shared.cmd_opts, 'use_rocm', False): + return True + if installer.torch_info.get('type') == 'rocm': + return True + import torch # pylint: disable=import-outside-toplevel + return hasattr(torch.version, 'hip') and torch.version.hip is not None is_rocm = _check_rocm() diff --git a/scripts/rocm_ext.py b/scripts/rocm_ext.py index 9b514fba9..6cd664fbf 100644 --- a/scripts/rocm_ext.py +++ b/scripts/rocm_ext.py @@ -13,38 +13,35 @@ class Script(scripts_manager.Script): return False def ui(self, _is_img2img): - from scripts.rocm import rocm_mgr, rocm_vars # pylint: disable=no-name-in-module - if not shared.cmd_opts.use_rocm and not installer.torch_info.get('type') == 'rocm': # skip ui creation if not rocm - with gr.Accordion('ROCm: Advanced Config', open=False, elem_id='rocm_config'): - gr.HTML("

ROCm is not installed. This section is disabled.

") return [] + from scripts.rocm import rocm_mgr, rocm_vars # pylint: disable=no-name-in-module + config = rocm_mgr.load_config() var_names = [] components = [] def _make_component(name, meta, cfg): val = cfg.get(name, meta["default"]) - if meta["widget"] == "checkbox": + widget = meta["widget"] + if widget == "checkbox": dtype_tag = meta.get("dtype") label = f"[{dtype_tag}] {meta['desc']}" if dtype_tag else meta["desc"] return gr.Checkbox(label=label, value=(val == "1"), elem_id=f"rocm_var_{name.lower()}") - elif meta["widget"] == "dropdown": + if widget == "dropdown": choices = rocm_mgr._dropdown_choices(meta["options"]) display = rocm_mgr._dropdown_display(val, meta["options"]) return gr.Dropdown(label=meta["desc"], choices=choices, value=display, elem_id=f"rocm_var_{name.lower()}") - else: # textbox - return gr.Textbox(label=meta["desc"], value=rocm_mgr._expand_venv(val), lines=1) + return gr.Textbox(label=meta["desc"], value=rocm_mgr._expand_venv(val), lines=1) def _info_html(): d = rocm_mgr.info() - ts = "" rows = [] def section(title): - rows.append(f"{title}") + rows.append(f"{title}") def row(k, v): - rows.append(f"{k}{v}") + rows.append(f"{k}{v}") section("ROCm / HIP") for k, v in d.get("rocm", {}).items(): row(k, v) @@ -59,66 +56,17 @@ class Script(scripts_manager.Script): row("path", udb.get("path", "")) for fname, finfo in udb.get("files", {}).items(): row(fname, finfo) - return ts + f"{''.join(rows)}
" + return f"{''.join(rows)}
" with gr.Accordion('ROCm: Advanced Config', open=False, elem_id='rocm_config'): - gr.HTML("""""") with gr.Row(): gr.HTML("

Advanced configuration for ROCm users.


Set your database and solver selections based on GPU profile or individually.


Enable cuDNN in Backend Settings to activate MIOpen.

") with gr.Row(): btn_info = gr.Button("Refresh Info", variant="primary", elem_id="rocm_btn_info", size="sm") - btn_apply = gr.Button("Apply", elem_id="rocm_btn_apply", size="sm") + btn_apply = gr.Button("Apply", variant="primary", elem_id="rocm_btn_apply", size="sm") btn_reset = gr.Button("Defaults", elem_id="rocm_btn_reset", size="sm") - btn_clear = gr.Button("Clear vEnv", elem_id="rocm_btn_clear", size="sm") - btn_delete = gr.Button("Delete UserDb", elem_id="rocm_btn_delete", size="sm") + btn_clear = gr.Button("Clear Run Vars", elem_id="rocm_btn_clear", size="sm") + btn_delete = gr.Button("Delete UserDb", variant="stop", elem_id="rocm_btn_delete", size="sm") with gr.Row(): btn_rdna2 = gr.Button("RDNA2 (RX 6000)", elem_id="rocm_btn_rdna2") btn_rdna3 = gr.Button("RDNA3 (RX 7000)", elem_id="rocm_btn_rdna3") From eb4a1ec781c9d3f9801f7a2925b11ca696cc205c Mon Sep 17 00:00:00 2001 From: resonantsky Date: Mon, 23 Mar 2026 16:37:50 +0200 Subject: [PATCH 20/33] lint: fix ruff and pylint warnings in rocm_ext and rocm_mgr --- scripts/rocm/rocm_mgr.py | 4 ++-- scripts/rocm_ext.py | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/rocm/rocm_mgr.py b/scripts/rocm/rocm_mgr.py index f517a7452..a8eeb665e 100644 --- a/scripts/rocm/rocm_mgr.py +++ b/scripts/rocm/rocm_mgr.py @@ -1,12 +1,12 @@ import os import sys from pathlib import Path -from typing import Dict, Any, Optional +from typing import Dict, Optional import installer from modules.logger import log from modules.json_helpers import readfile, writefile -from scripts.rocm.rocm_vars import ROCM_ENV_VARS, SOLVER_GROUPS, SOLVER_DISABLED_BY_DEFAULT # pylint: disable=no-name-in-module +from scripts.rocm.rocm_vars import ROCM_ENV_VARS # pylint: disable=no-name-in-module from scripts.rocm import rocm_profiles # pylint: disable=no-name-in-module diff --git a/scripts/rocm_ext.py b/scripts/rocm_ext.py index 6cd664fbf..6e86bdecc 100644 --- a/scripts/rocm_ext.py +++ b/scripts/rocm_ext.py @@ -2,6 +2,9 @@ import gradio as gr import installer from modules import scripts_manager, shared +# rocm_mgr exposes package-internal helpers (prefixed _) that are intentionally called here +# pylint: disable=protected-access + class Script(scripts_manager.Script): def title(self): @@ -73,7 +76,7 @@ class Script(scripts_manager.Script): btn_rdna4 = gr.Button("RDNA4 (RX 9000)", elem_id="rocm_btn_rdna4") style_out = gr.HTML("") info_out = gr.HTML(value=_info_html, elem_id="rocm_info_table") - + # General vars (dropdowns, textboxes, checkboxes) with gr.Group(): gr.HTML("

MIOpen Settings


") @@ -92,7 +95,7 @@ class Script(scripts_manager.Script): var_names.append(name) components.append(comp) gr.HTML("

") - + def _autosave_field(name, value): meta = rocm_vars.ROCM_ENV_VARS[name] stored = rocm_mgr._dropdown_stored(str(value), meta["options"]) @@ -114,7 +117,7 @@ class Script(scripts_manager.Script): meta = rocm_vars.ROCM_ENV_VARS[name] val = saved.get(name, meta["default"]) if meta["widget"] == "checkbox": - result.append(gr.update(value=(val == "1"))) + result.append(gr.update(value=val == "1")) elif meta["widget"] == "dropdown": result.append(gr.update(value=rocm_mgr._dropdown_display(val, meta["options"]))) else: @@ -138,7 +141,7 @@ class Script(scripts_manager.Script): meta = rocm_vars.ROCM_ENV_VARS[name] val = updated.get(name, meta["default"]) if meta["widget"] == "checkbox": - result.append(gr.update(value=(val == "1"))) + result.append(gr.update(value=val == "1")) elif meta["widget"] == "dropdown": result.append(gr.update(value=rocm_mgr._dropdown_display(val, meta["options"]))) else: @@ -181,7 +184,7 @@ class Script(scripts_manager.Script): meta = rocm_vars.ROCM_ENV_VARS[pname] val = updated.get(pname, meta["default"]) if meta["widget"] == "checkbox": - result.append(gr.update(value=(val == "1"))) + result.append(gr.update(value=val == "1")) elif meta["widget"] == "dropdown": result.append(gr.update(value=rocm_mgr._dropdown_display(val, meta["options"]))) else: From c1e67a9c715437297feef18f7d84403c76fddd84 Mon Sep 17 00:00:00 2001 From: vladmandic Date: Mon, 23 Mar 2026 16:21:35 +0100 Subject: [PATCH 21/33] update changelog/todo Signed-off-by: vladmandic --- CHANGELOG.md | 7 +++++-- TODO.md | 2 +- installer.py | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c4cab49a..7572a142d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ ### Highlights for 2026-03-23 This release brings massive code refactoring to modernize codebase and removal of some obsolete features. Leaner & Faster! -And since its a bit quieter period when it comes to new models, notable additions would be : *FireRed-Image-Edit* *SkyWorks-UniPic-3* and *Anima-Preview-2* +And since its a bit quieter period when it comes to new models, notable additions would be : *FireRed-Image-Edit* *SkyWorks-UniPic-3* and new *Anima-Preview* If you're on Windows platform, we have a brand new [All-in-one Installer & Launcher](https://github.com/vladmandic/sdnext-launcher): simply download [exe or zip](https://github.com/vladmandic/sdnext-launcher/releases) and done! @@ -62,8 +62,11 @@ But also many smaller quality-of-life improvements - for full details, see [Chan instead of being used implicitly via quantization - improve image **metadata** parser for foreign metadata (e.g. XMP) - **Compute** + - **ROCm** advanced configuration and tuning, thanks @resonantsky + see *main interface -> scripts -> rocm advanced config* - **ROCm** support for additional AMD GPUs: `gfx103X`, thanks @crashingalexsan - - **Cuda** `torch==2.10` removed support for `rtx1000` series, use following before first startup: + - **Cuda** `torch==2.10` removed support for `rtx1000` series and older GPUs + use following before first startup to force installation of `torch==2.9.1` with `cuda==12.6`: > `set TORCH_COMMAND='torch==2.9.1 torchvision==0.24.1 torchaudio==2.9.1 --index-url https://download.pytorch.org/whl/cu126'` - **UI** - new panel: **server info** with detailed runtime informaton diff --git a/TODO.md b/TODO.md index 1f7667751..f20835b9c 100644 --- a/TODO.md +++ b/TODO.md @@ -4,7 +4,6 @@ - Implement: `unload_auxiliary_models` - Add notes: **Enso** -- Update: **ROCm** - Tips: **Color Grading** - Regen: **Localization** @@ -63,6 +62,7 @@ TODO: Investigate which models are diffusers-compatible and prioritize! ### Image-Edit +- [Bria FIBO-Edit](https://huggingface.co/briaai/Fibo-Edit-RMBG): Fully JSON-based instruction-following image editing framework - [Meituan LongCat-Image-Edit-Turbo](https://huggingface.co/meituan-longcat/LongCat-Image-Edit-Turbo):6B instruction-following image editing with high visual consistency - [VIBE Image-Edit](https://huggingface.co/iitolstykh/VIBE-Image-Edit): (Sana+Qwen-VL)Fast visual instruction-based image editing framework - [LucyEdit](https://github.com/huggingface/diffusers/pull/12340):Instruction-guided video editing while preserving motion and identity diff --git a/installer.py b/installer.py index 090bc0748..ac5f9c7e0 100644 --- a/installer.py +++ b/installer.py @@ -894,7 +894,7 @@ def check_torch(): elif torch.version.hip and allow_rocm: torch_info.set(type='rocm', hip=torch.version.hip) else: - log.warning('Unknown Torch backend') + log.warning('Torch backend: cannot detect type') log.info(f"Torch backend: {torch_info}") for device in [torch.cuda.device(i) for i in range(torch.cuda.device_count())]: gpu = { From f5fbc06fe43c4b6e38302954baacb24262491106 Mon Sep 17 00:00:00 2001 From: vladmandic Date: Mon, 23 Mar 2026 16:26:48 +0100 Subject: [PATCH 22/33] update changelog Signed-off-by: vladmandic --- CHANGELOG.md | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7572a142d..79770900b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ New color grading module, updated localization with new languages and improved t And major work on API hardening: security, rate limits, secrets handling, new endpoints, etc. But also many smaller quality-of-life improvements - for full details, see [ChangeLog](https://github.com/vladmandic/automatic/blob/master/CHANGELOG.md) +*Note*: Purely due to size of changes, clean install is recommended! + [ReadMe](https://github.com/vladmandic/automatic/blob/master/README.md) | [ChangeLog](https://github.com/vladmandic/automatic/blob/master/CHANGELOG.md) | [Docs](https://vladmandic.github.io/sdnext-docs/) | [WiKi](https://github.com/vladmandic/automatic/wiki) | [Discord](https://discord.com/invite/sd-next-federal-batch-inspectors-1101998836328697867) | [Sponsor](https://github.com/sponsors/vladmandic) ### Details for 2026-03-23 @@ -26,22 +28,21 @@ But also many smaller quality-of-life improvements - for full details, see [Chan *Note*: UniPic-3 is a fine-tune of Qwen-Image-Edit with new distillation regardless of its claim of major changes - [Anima Preview-v2](https://huggingface.co/circlestone-labs/Anima) - **Image manipulation** - - new **color grading** module + - new **Color grading** module apply basic corrections to your images: brightness,contrast,saturation,shadows,highlights move to professional photo corrections: hue,gamma,sharpness,temperature correct tone: shadows,midtones,highlights add effects: vignette,grain apply professional lut-table using .cube file *hint* color grading is available as step during generate or as processing item for already existing images - - update **latent corrections** *(former HDR Corrections)* + - **Upscaling** + add support for [spandrel](https://github.com/chaiNNer-org/spandrel) engine with suport for new upscaling model families + add two new ai upscalers: *RealPLKSR NomosWebPhoto* and *RealPLKSR AnimeSharpV2* + add two new **interpolation** methods: *HQX* and *ICB* + use high-quality [sharpfin](https://github.com/drhead/Sharpfin) accelerated library + extend `chainner` support for additional models + - update **Latent corrections** *(former HDR Corrections)* expand allowed models - - add support for [spandrel](https://github.com/chaiNNer-org/spandrel) - **upscaling** engine with suport for new upscaling model families - - add two new ai upscalers: *RealPLKSR NomosWebPhoto* and *RealPLKSR AnimeSharpV2* - - add two new **interpolation** methods: *HQX* and *ICB* - - use high-quality [sharpfin](https://github.com/drhead/Sharpfin) accelerated library - when available (*cuda-only*) - - **upscalers**: extend chainner support for additional models - **Captioning / Prompt Enhance** - new models: **Qwen-3.5**, **Mistral-3** in multiple variations - new models: multiple *heretic* and *abliterated* finetunes for **Qwen, Gemma, Mistral** @@ -52,15 +53,15 @@ But also many smaller quality-of-life improvements - for full details, see [Chan - new **pre-processors**: *anyline, depth_anything v2, dsine, lotus, marigold normals, oneformer, rtmlib pose, sam2, stablenormal, teed, vitpose* - **Features** - - **secrets** handling: new `secrets.json` and special handling for tokens/keys/passwords + - **Secrets** handling: new `secrets.json` and special handling for tokens/keys/passwords used to be treated like any other `config.json` param which can cause security issues - pipelines: add **ZImageInpaint** - - rewritten **civitai** module + - rewritten **CivitAI** module browse/discover mode with sort, period, type/base dropdowns; URL paste; subfolder sorting; auto-browse; dynamic dropdowns - - **hires**: allow using different lora in refiner prompt - - **nunchaku** models are now listed in networks tab as reference models + - **HiRes**: allow using different lora in refiner prompt + - **Nunchaku** models are now listed in networks tab as reference models instead of being used implicitly via quantization - - improve image **metadata** parser for foreign metadata (e.g. XMP) + - improve image **Metadata** parser for foreign metadata (e.g. XMP) - **Compute** - **ROCm** advanced configuration and tuning, thanks @resonantsky see *main interface -> scripts -> rocm advanced config* @@ -69,19 +70,19 @@ But also many smaller quality-of-life improvements - for full details, see [Chan use following before first startup to force installation of `torch==2.9.1` with `cuda==12.6`: > `set TORCH_COMMAND='torch==2.9.1 torchvision==0.24.1 torchaudio==2.9.1 --index-url https://download.pytorch.org/whl/cu126'` - **UI** - - new panel: **server info** with detailed runtime informaton - - **networks** add **UNet/DiT** - - **localization** improved translation quality and new translations locales: + - new panel: **Server Info** with detailed runtime informaton + - **Networks** add **UNet/DiT** + - **Localization** improved translation quality and new translations locales: *en, en1, en2, en3, en4, hr, es, it, fr, de, pt, ru, zh, ja, ko, hi, ar, bn, ur, id, vi, tr, sr, po, he, xx, yy, qq, tlh* yes, this now includes stuff like *latin, esperanto, arabic, hebrew, klingon* and a lot more! and also introduce some pseudo-locales such as: *techno-babbel*, *for-n00bs* *hint*: click on locale icon in bottom-left corner to cycle through available locales, or set default in *settings -> ui* - - **server settings** new section in *settings* - - **kanvas** add paste image from clipboard - - **themes** add *CTD-NT64Light*, *CTD-NT64Medium* and *CTD-NT64Dark*, thanks @resonantsky - - **themes** add *Vlad-Neomorph* - - **gallery** add option to auto-refresh gallery, thanks @awsr - - **token counters** add per-section display for supported models, thanks @awsr + - **Server settings** new section in *settings* + - **Kanvas** add paste image from clipboard + - **Themes** add *CTD-NT64Light*, *CTD-NT64Medium* and *CTD-NT64Dark*, thanks @resonantsky + - **Themes** add *Vlad-Neomorph* + - **Gallery** add option to auto-refresh gallery, thanks @awsr + - **Token counters** add per-section display for supported models, thanks @awsr - **API** - **rate limiting**: global for all endpoints, guards against abuse and denial-of-service type of attacks configurable in *settings -> server settings* From dbd2293586c8ccb5002388f844d7c12602ce89e3 Mon Sep 17 00:00:00 2001 From: vladmandic Date: Mon, 23 Mar 2026 17:53:47 +0100 Subject: [PATCH 23/33] remove hf token from load args Signed-off-by: vladmandic --- modules/sd_models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/sd_models.py b/modules/sd_models.py index b2f7f3c55..833c3c8a5 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -798,8 +798,8 @@ def load_diffuser(checkpoint_info=None, op='model', revision=None): # pylint: di "requires_safety_checker": False, # sd15 specific but we cant know ahead of time # "use_safetensors": True, } - if shared.opts.huggingface_token and len(shared.opts.huggingface_token) > 0: - diffusers_load_config['token'] = shared.opts.huggingface_token + # if shared.opts.huggingface_token and len(shared.opts.huggingface_token) > 0: + # diffusers_load_config['token'] = shared.opts.huggingface_token if revision is not None: diffusers_load_config['revision'] = revision if shared.opts.diffusers_model_load_variant != 'default': From bc22e0f0dc67fa8deaa4fbaad3b195628bf8e3a9 Mon Sep 17 00:00:00 2001 From: vladmandic Date: Mon, 23 Mar 2026 18:30:28 +0100 Subject: [PATCH 24/33] monkey patch transformers version checks Signed-off-by: vladmandic --- modules/loader.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/loader.py b/modules/loader.py index 5e7b5a0a8..aad66daff 100644 --- a/modules/loader.py +++ b/modules/loader.py @@ -3,6 +3,7 @@ from functools import partial import os import re import sys +import types import logging import warnings import urllib3 @@ -133,6 +134,12 @@ timer.startup.record("accelerate") import pydantic # pylint: disable=W0611,C0411 timer.startup.record("pydantic") +try: + fake_version_check = types.ModuleType("transformers.dependency_versions_check") + sys.modules["transformers.dependency_versions_check"] = fake_version_check # disable transformers version checks + fake_version_check.dep_version_check = lambda pkg, hint=None: None +except Exception: + pass import transformers # pylint: disable=W0611,C0411 from transformers import logging as transformers_logging # pylint: disable=W0611,C0411 transformers_logging.set_verbosity_error() From a5977f09f579d2fd25ba83f03924201a5a02fdfe Mon Sep 17 00:00:00 2001 From: Disty0 Date: Tue, 24 Mar 2026 13:36:52 +0300 Subject: [PATCH 25/33] Fix JPEG XL --- installer.py | 4 ++-- modules/loader.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/installer.py b/installer.py index ac5f9c7e0..834185bcd 100644 --- a/installer.py +++ b/installer.py @@ -735,7 +735,7 @@ def install_torch_addons(): if len(opts.get('torchao_quantization', [])): install('torchao==0.10.0', 'torchao') if opts.get('samples_format', 'jpg') == 'jxl' or opts.get('grid_format', 'jpg') == 'jxl': - install('pillow-jxl-plugin==1.3.5', 'pillow-jxl-plugin') + install('pillow-jxl-plugin==1.3.7', 'pillow-jxl-plugin') if not args.experimental: uninstall('wandb', quiet=True) uninstall('pynvml', quiet=True) @@ -1184,7 +1184,7 @@ def install_optional(): install('hf_transfer', ignore=True, quiet=True) install('hf_xet', ignore=True, quiet=True) install('nvidia-ml-py', ignore=True, quiet=True) - install('pillow-jxl-plugin==1.3.5', ignore=True, quiet=True) + install('pillow-jxl-plugin==1.3.7', ignore=True, quiet=True) install('ultralytics==8.3.40', ignore=True, quiet=True) install('open-clip-torch', no_deps=True, quiet=True) install('git+https://github.com/tencent-ailab/IP-Adapter.git', 'ip_adapter', ignore=True, quiet=True) diff --git a/modules/loader.py b/modules/loader.py index aad66daff..e1ce9a01a 100644 --- a/modules/loader.py +++ b/modules/loader.py @@ -182,9 +182,10 @@ except Exception as e: sys.exit(1) try: - pass # pylint: disable=W0611,C0411 + import pillow_jxl # pylint: disable=W0611,C0411 except Exception: pass +from PIL import Image # pylint: disable=W0611,C0411 timer.startup.record("pillow") From 4f8260e67079afecfe2cd17cbbb2b4dff0daacc9 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Tue, 24 Mar 2026 14:17:24 +0300 Subject: [PATCH 26/33] Update IPEX to Torch 2.11 --- installer.py | 2 +- modules/intel/ipex/__init__.py | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/installer.py b/installer.py index 834185bcd..7ac82a214 100644 --- a/installer.py +++ b/installer.py @@ -687,7 +687,7 @@ def install_ipex(): if args.use_nightly: torch_command = os.environ.get('TORCH_COMMAND', '--upgrade --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/xpu') else: - torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.10.0+xpu torchvision==0.25.0+xpu --index-url https://download.pytorch.org/whl/xpu') + torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.11.0+xpu torchvision==0.26.0+xpu --index-url https://download.pytorch.org/whl/xpu') ts('ipex', t_start) return torch_command diff --git a/modules/intel/ipex/__init__.py b/modules/intel/ipex/__init__.py index 6bd4cf9cd..0d12e349a 100644 --- a/modules/intel/ipex/__init__.py +++ b/modules/intel/ipex/__init__.py @@ -51,14 +51,11 @@ def ipex_init(): # pylint: disable=too-many-statements torch.cuda.default_generators = torch.xpu.default_generators torch.cuda.set_stream = torch.xpu.set_stream torch.cuda.torch = torch.xpu.torch - torch.cuda.Union = torch.xpu.Union torch.cuda.StreamContext = torch.xpu.StreamContext torch.cuda.random = torch.xpu.random torch.cuda._get_device_index = torch.xpu._get_device_index torch.cuda._lazy_init = torch.xpu._lazy_init torch.cuda._lazy_call = torch.xpu._lazy_call - torch.cuda._device = torch.xpu._device - torch.cuda._device_t = torch.xpu._device_t torch.cuda.is_current_stream_capturing = lambda: False torch.cuda.__annotations__ = torch.xpu.__annotations__ @@ -141,12 +138,23 @@ def ipex_init(): # pylint: disable=too-many-statements torch.cuda.memory_summary = torch.xpu.memory_summary torch.cuda.memory_snapshot = torch.xpu.memory_snapshot + if torch_version[0] < 2 or (torch_version[0] == 2 and torch_version[1] < 11): + torch.cuda.Union = torch.xpu.Union + torch.cuda._device = torch.xpu._device + torch.cuda._device_t = torch.xpu._device_t + # Memory: if "linux" in sys.platform and "WSL2" in os.popen("uname -a").read(): torch.xpu.empty_cache = lambda: None torch.cuda.empty_cache = torch.xpu.empty_cache - torch.cuda.memory = torch.xpu.memory + if torch_version[0] >= 2 and torch_version[1] >= 8: + old_cpa = torch.cuda.memory.CUDAPluggableAllocator + torch.cuda.memory = torch.xpu.memory + torch.xpu.memory.CUDAPluggableAllocator = old_cpa + else: + torch.cuda.memory = torch.xpu.memory + torch.cuda.memory_stats = torch.xpu.memory_stats torch.cuda.memory_allocated = torch.xpu.memory_allocated torch.cuda.max_memory_allocated = torch.xpu.max_memory_allocated From 903869b337ca2a5a215bc47f36977157c3668376 Mon Sep 17 00:00:00 2001 From: resonantsky Date: Tue, 24 Mar 2026 11:24:17 +0200 Subject: [PATCH 27/33] Added :Group Conv / CK Toggles (RDNA3/4+) --- scripts/rocm/rocm_profiles.py | 13 ++++++++++++- scripts/rocm/rocm_vars.py | 29 +++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/scripts/rocm/rocm_profiles.py b/scripts/rocm/rocm_profiles.py index 3c9a52b7f..899938068 100644 --- a/scripts/rocm/rocm_profiles.py +++ b/scripts/rocm/rocm_profiles.py @@ -173,11 +173,15 @@ RDNA2: Dict[str, str] = { "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_BWD_V4R1": "0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R1": "0", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_WRW_V4R4": "0", + # Group Conv XDLOPS / CK default kernels — RDNA3/4 only, not available on RDNA2 + "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS": "0", + "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS_AI_HEUR": "0", + "MIOPEN_DEBUG_CK_DEFAULT_KERNELS": "0", } # --------------------------------------------------------------------------- # RDNA3 — gfx1100 (RX 7000 series) -# Fury Winograd added; MPASS F3x4 enabled +# Fury Winograd added; MPASS F3x4 enabled; Group Conv XDLOPS + CK default kernels enabled # --------------------------------------------------------------------------- RDNA3: Dict[str, str] = { **RDNA2, @@ -186,6 +190,10 @@ RDNA3: Dict[str, str] = { "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F3X2": "1", # Wider MPASS on RDNA3 "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X4": "1", + # Group Conv XDLOPS / CK — available from gfx1100 (RDNA3) onwards + "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS": "1", + "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS_AI_HEUR": "1", + "MIOPEN_DEBUG_CK_DEFAULT_KERNELS": "1", } # --------------------------------------------------------------------------- @@ -222,6 +230,9 @@ UNAVAILABLE: Dict[str, set] = { "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F5X4", "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X2", "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F7X3", + "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS", + "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS_AI_HEUR", + "MIOPEN_DEBUG_CK_DEFAULT_KERNELS", }, "RDNA3": _UNAVAILABLE_ALL_RDNA | { "MIOPEN_DEBUG_AMD_WINOGRAD_RAGE_RXS_F2X3", diff --git a/scripts/rocm/rocm_vars.py b/scripts/rocm/rocm_vars.py index b6fce4faa..e23781998 100644 --- a/scripts/rocm/rocm_vars.py +++ b/scripts/rocm/rocm_vars.py @@ -78,10 +78,11 @@ GENERAL_VARS: Dict[str, Dict[str, Any]] = { # --- Solver toggles (inference/FWD only, RDNA2/3/4 compatible) --- # Removed entirely — not representable in the UI, cannot be set by users: # WRW (weight-gradient) and BWD (data-gradient) — training passes only, never run during inference -# XDLOPS, CK (Composable Kernel), MLIR, MP BD — CDNA (MI100/MI200/MI300) matrix engine; not on RDNA +# XDLOPS/CK CDNA-exclusive (MI100/MI200/MI300 matrix engine variants) — not on any RDNA # Fixed-geometry (5x10, 7x7-ImageNet, 11x11) — shapes never appear in SD/video inference # FP32-reference (NAIVE_CONV_FWD, FWDGEN) — IsApplicable() unreliable for FP16/BF16 # Wide MPASS (F3x4..F7x3) — kernel sizes that cannot match any SD convolution shape +# Disabled by default (added but off): RDNA3/4-only — Group Conv XDLOPS, CK default kernels _SOLVER_DESCS: Dict[str, str] = {} _SOLVER_DESCS.update({ @@ -135,23 +136,35 @@ _SOLVER_DESCS.update({ "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X3": "Enable AMD Winograd MPASS F3x3", }) _SOLVER_DESCS.update({ - # Implicit GEMM FWD — BWD/WRW (training), all XDLOPS/CDNA variants removed + # 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. # FORCE_IMMED_MODE_FALLBACK — overrides FIND_MODE entirely, defeats tuning DB # Fury RxS F2x3/F3x2 — RDNA3/4-only; harmless on RDNA2 but won't select # Rage RxS F2x3 — RDNA4-only +# Group Conv XDLOPS — RDNA3/4-only (gfx1100+) +# CK_DEFAULT_KERNELS — RDNA3/4-only (gfx1100+) SOLVER_DISABLED_BY_DEFAULT = { "MIOPEN_DEBUG_FORCE_IMMED_MODE_FALLBACK", "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F2X3", "MIOPEN_DEBUG_AMD_WINOGRAD_FURY_RXS_F3X2", "MIOPEN_DEBUG_AMD_WINOGRAD_RAGE_RXS_F2X3", + "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS", + "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS_AI_HEUR", + "MIOPEN_DEBUG_CK_DEFAULT_KERNELS", } SOLVER_DTYPE_TAGS: Dict[str, str] = { @@ -174,8 +187,11 @@ SOLVER_DTYPE_TAGS: Dict[str, str] = { "MIOPEN_DEBUG_AMD_WINOGRAD_MPASS_F3X3": "FP16/FP32", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1": "FP16/FP32", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1_1X1": "FP16/FP32", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1": "FP16/FP32", - "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4": "FP16/FP32", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1": "FP16/FP32", + "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4": "FP16/FP32", + "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS": "FP16/BF16", + "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS_AI_HEUR": "FP16/BF16", + "MIOPEN_DEBUG_CK_DEFAULT_KERNELS": "FP16/BF16/FP32", } # Build full merged var registry @@ -229,5 +245,10 @@ SOLVER_GROUPS: List[Tuple[str, List[str]]] = [ "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_ASM_FWD_V4R1_1X1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R1", "MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_FWD_V4R4", ]), + ("Group Conv / CK Toggles (RDNA3/4+)", [ + "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS", + "MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS_AI_HEUR", + "MIOPEN_DEBUG_CK_DEFAULT_KERNELS", + ]), ] From cff7f8d4a9e36a9dd4fff4c7786a99e23270842c Mon Sep 17 00:00:00 2001 From: Disty0 Date: Tue, 24 Mar 2026 14:36:58 +0300 Subject: [PATCH 28/33] IPEX remove the use of lambdas --- modules/intel/ipex/__init__.py | 53 +++++++++++++++++++++++++--------- modules/intel/ipex/hijacks.py | 6 ++-- 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/modules/intel/ipex/__init__.py b/modules/intel/ipex/__init__.py index 0d12e349a..523d19516 100644 --- a/modules/intel/ipex/__init__.py +++ b/modules/intel/ipex/__init__.py @@ -16,6 +16,28 @@ torch_version[0], torch_version[1] = int(torch_version[0]), int(torch_version[1] # pylint: disable=protected-access, missing-function-docstring, line-too-long +def return_true(*args, **kwargs): + return True + +def return_false(*args, **kwargs): + return False + +def return_none(*args, **kwargs): + return None + +def return_zero(*args, **kwargs): + return 0 + +def return_cuda_version(*args, **kwargs): + return (12,1) + +def return_xpu_string(*args, **kwargs): + return "xpu" + +def return_arch_list(*args, **kwargs): + return ["pvc", "dg2", "ats-m150"] + + def ipex_init(): # pylint: disable=too-many-statements try: if hasattr(torch, "cuda") and hasattr(torch.cuda, "is_xpu_hijacked") and torch.cuda.is_xpu_hijacked: @@ -26,9 +48,9 @@ def ipex_init(): # pylint: disable=too-many-statements # import inductor utils to get around lazy import from torch._inductor import utils as torch_inductor_utils # pylint: disable=import-error, unused-import # noqa: F401,RUF100 torch._inductor.utils.GPU_TYPES = ["xpu"] - torch._inductor.utils.get_gpu_type = lambda *args, **kwargs: "xpu" + torch._inductor.utils.get_gpu_type = return_xpu_string from triton import backends as triton_backends # pylint: disable=import-error - triton_backends.backends["nvidia"].driver.is_active = lambda *args, **kwargs: False + triton_backends.backends["nvidia"].driver.is_active = return_false except Exception: pass # Replace cuda with xpu: @@ -56,7 +78,7 @@ def ipex_init(): # pylint: disable=too-many-statements torch.cuda._get_device_index = torch.xpu._get_device_index torch.cuda._lazy_init = torch.xpu._lazy_init torch.cuda._lazy_call = torch.xpu._lazy_call - torch.cuda.is_current_stream_capturing = lambda: False + torch.cuda.is_current_stream_capturing = return_false torch.cuda.__annotations__ = torch.xpu.__annotations__ torch.cuda.__builtins__ = torch.xpu.__builtins__ @@ -145,7 +167,7 @@ def ipex_init(): # pylint: disable=too-many-statements # Memory: if "linux" in sys.platform and "WSL2" in os.popen("uname -a").read(): - torch.xpu.empty_cache = lambda: None + torch.xpu.empty_cache = return_none torch.cuda.empty_cache = torch.xpu.empty_cache if torch_version[0] >= 2 and torch_version[1] >= 8: @@ -180,21 +202,24 @@ def ipex_init(): # pylint: disable=too-many-statements torch.cuda.initial_seed = torch.xpu.initial_seed # Fix functions with ipex: - # torch.xpu.mem_get_info always returns the total memory as free memory torch.has_cuda = True torch.version.cuda = "12.1" - torch.backends.cuda.is_built = lambda *args, **kwargs: True - torch._utils._get_available_device_type = lambda: "xpu" + torch.backends.cuda.is_built = return_true + torch._utils._get_available_device_type = return_xpu_string - torch.xpu.mem_get_info = lambda device=None: [(torch.xpu.get_device_properties(device).total_memory - torch.xpu.memory_reserved(device)), torch.xpu.get_device_properties(device).total_memory] + # torch.xpu.mem_get_info always returns the total memory as free memory + def mem_get_info(device=None): + return [(torch.xpu.get_device_properties(device).total_memory - torch.xpu.memory_reserved(device)), torch.xpu.get_device_properties(device).total_memory] + torch.xpu.mem_get_info = mem_get_info torch.cuda.mem_get_info = torch.xpu.mem_get_info + torch.cuda.has_half = True - torch.cuda.is_bf16_supported = getattr(torch.xpu, "is_bf16_supported", lambda *args, **kwargs: True) - torch.cuda.is_fp16_supported = lambda *args, **kwargs: True - torch.cuda.get_arch_list = getattr(torch.xpu, "get_arch_list", lambda: ["pvc", "dg2", "ats-m150"]) - torch.cuda.get_device_capability = lambda *args, **kwargs: (12,1) - torch.cuda.ipc_collect = lambda *args, **kwargs: None - torch.cuda.utilization = lambda *args, **kwargs: 0 + torch.cuda.is_bf16_supported = getattr(torch.xpu, "is_bf16_supported", return_true) + torch.cuda.is_fp16_supported = getattr(torch.xpu, "is_fp16_supported", return_true) + torch.cuda.get_arch_list = getattr(torch.xpu, "get_arch_list", return_arch_list) + torch.cuda.get_device_capability = return_cuda_version + torch.cuda.ipc_collect = return_none + torch.cuda.utilization = return_zero device_supports_fp64 = ipex_hijacks() try: diff --git a/modules/intel/ipex/hijacks.py b/modules/intel/ipex/hijacks.py index 327d9f18a..e9f263a2c 100644 --- a/modules/intel/ipex/hijacks.py +++ b/modules/intel/ipex/hijacks.py @@ -15,8 +15,10 @@ torch_version[0], torch_version[1] = int(torch_version[0]), int(torch_version[1] device_supports_fp64 = torch.xpu.has_fp64_dtype() if hasattr(torch.xpu, "has_fp64_dtype") else torch.xpu.get_device_properties(devices.device).has_fp64 -# pylint: disable=protected-access, missing-function-docstring, line-too-long, unnecessary-lambda, no-else-return +# pylint: disable=protected-access, missing-function-docstring, line-too-long, no-else-return +def return_false(*args, **kwargs): + return False @property def is_cuda(self): @@ -437,6 +439,6 @@ def ipex_hijacks(): if not hasattr(torch.cuda.amp, "common"): torch.cuda.amp.common = nullcontext() - torch.cuda.amp.common.amp_definitely_not_available = lambda: False + torch.cuda.amp.common.amp_definitely_not_available = return_false return device_supports_fp64 From 670ca3a64469708e6b7d0992a7af2a4b8e758e21 Mon Sep 17 00:00:00 2001 From: resonantsky Date: Tue, 24 Mar 2026 13:39:35 +0200 Subject: [PATCH 29/33] ROCm: fix apply_env to clear _EXTRA_CLEAR_VARS; fix info table value cell color for light themes --- scripts/rocm/rocm_mgr.py | 2 +- scripts/rocm_ext.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/rocm/rocm_mgr.py b/scripts/rocm/rocm_mgr.py index a8eeb665e..b704fff03 100644 --- a/scripts/rocm/rocm_mgr.py +++ b/scripts/rocm/rocm_mgr.py @@ -193,7 +193,7 @@ 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() - for var in _UNSET_VARS: + for var in _UNSET_VARS | _EXTRA_CLEAR_VARS: if var in os.environ: del os.environ[var] for var, value in config.items(): diff --git a/scripts/rocm_ext.py b/scripts/rocm_ext.py index 6e86bdecc..6563387ce 100644 --- a/scripts/rocm_ext.py +++ b/scripts/rocm_ext.py @@ -44,7 +44,7 @@ class Script(scripts_manager.Script): def section(title): rows.append(f"{title}") def row(k, v): - rows.append(f"{k}{v}") + rows.append(f"{k}{v}") section("ROCm / HIP") for k, v in d.get("rocm", {}).items(): row(k, v) From 14c3cf9172612ab29874af8b80cc66d18ba08b0d Mon Sep 17 00:00:00 2001 From: Disty0 Date: Tue, 24 Mar 2026 16:58:53 +0300 Subject: [PATCH 30/33] IPEX fix transformers and disable torch.tensor hijack --- modules/intel/ipex/hijacks.py | 112 ++++++++++++++++++---------------- 1 file changed, 61 insertions(+), 51 deletions(-) diff --git a/modules/intel/ipex/hijacks.py b/modules/intel/ipex/hijacks.py index e9f263a2c..63b7fad25 100644 --- a/modules/intel/ipex/hijacks.py +++ b/modules/intel/ipex/hijacks.py @@ -26,7 +26,7 @@ def is_cuda(self): def check_device_type(device, device_type: str) -> bool: - if device is None or type(device) not in {str, int, torch.device}: + if device is None or not isinstance(device, (str, int, torch.device)): return False else: return bool(torch.device(device).type == device_type) @@ -139,24 +139,9 @@ def as_tensor(data, dtype=None, device=None): return original_as_tensor(data, dtype=dtype, device=device) -original_torch_tensor = torch.tensor -@wraps(torch.tensor) -def torch_tensor(data, *args, dtype=None, device=None, **kwargs): - global device_supports_fp64 - if check_cuda(device): - device = return_xpu(device) - if not device_supports_fp64 and check_device_type(device, "xpu"): - if dtype == torch.float64: - dtype = torch.float32 - elif dtype is None and (hasattr(data, "dtype") and (data.dtype == torch.float64 or data.dtype == float)): - dtype = torch.float32 - return original_torch_tensor(data, *args, dtype=dtype, device=device, **kwargs) - - torch.Tensor.original_Tensor_to = torch.Tensor.to @wraps(torch.Tensor.to) def Tensor_to(self, device=None, *args, **kwargs): - global device_supports_fp64 if check_cuda(device): device = return_xpu(device) if not device_supports_fp64: @@ -212,6 +197,24 @@ if torch_version[0] > 2 or (torch_version[0] == 2 and torch_version[1] >= 4): return original_UntypedStorage_cuda(self, device=device, non_blocking=non_blocking, **kwargs) +original_torch_tensor = torch.tensor +@wraps(torch.tensor) +def torch_tensor(data, *args, dtype=None, device=None, **kwargs): + if check_cuda(device): + if not device_supports_fp64 and (dtype == torch.float64 or (dtype is None and getattr(data, "dtype", None) in {torch.float64, float})): + return original_torch_tensor(data, *args, dtype=torch.float32, device=return_xpu(device), **kwargs) + else: + return original_torch_tensor(data, *args, dtype=dtype, device=return_xpu(device), **kwargs) + else: + if ( + not device_supports_fp64 and check_device_type(device, "xpu") + and (dtype == torch.float64 or (dtype is None and getattr(data, "dtype", None) in {torch.float64, float})) + ): + return original_torch_tensor(data, *args, dtype=torch.float32, device=device, **kwargs) + else: + return original_torch_tensor(data, *args, dtype=dtype, device=device, **kwargs) + + original_torch_empty = torch.empty @wraps(torch.empty) def torch_empty(*args, device=None, **kwargs): @@ -223,11 +226,11 @@ def torch_empty(*args, device=None, **kwargs): original_torch_randn = torch.randn @wraps(torch.randn) -def torch_randn(*args, device=None, dtype=None, **kwargs): +def torch_randn(*args, device=None, **kwargs): if check_cuda(device): - return original_torch_randn(*args, device=return_xpu(device), dtype=dtype, **kwargs) + return original_torch_randn(*args, device=return_xpu(device), **kwargs) else: - return original_torch_randn(*args, device=device, dtype=dtype, **kwargs) + return original_torch_randn(*args, device=device, **kwargs) original_torch_ones = torch.ones @@ -257,34 +260,6 @@ def torch_full(*args, device=None, **kwargs): return original_torch_full(*args, device=device, **kwargs) -original_torch_arange = torch.arange -@wraps(torch.arange) -def torch_arange(*args, device=None, dtype=None, **kwargs): - global device_supports_fp64 - if check_cuda(device): - if not device_supports_fp64 and dtype == torch.float64: - dtype = torch.float32 - return original_torch_arange(*args, device=return_xpu(device), dtype=dtype, **kwargs) - else: - if not device_supports_fp64 and check_device_type(device, "xpu") and dtype == torch.float64: - dtype = torch.float32 - return original_torch_arange(*args, device=device, dtype=dtype, **kwargs) - - -original_torch_linspace = torch.linspace -@wraps(torch.linspace) -def torch_linspace(*args, device=None, dtype=None, **kwargs): - global device_supports_fp64 - if check_cuda(device): - if not device_supports_fp64 and dtype == torch.float64: - dtype = torch.float32 - return original_torch_linspace(*args, device=return_xpu(device), dtype=dtype, **kwargs) - else: - if not device_supports_fp64 and check_device_type(device, "xpu") and dtype == torch.float64: - dtype = torch.float32 - return original_torch_linspace(*args, device=device, dtype=dtype, **kwargs) - - original_torch_eye = torch.eye @wraps(torch.eye) def torch_eye(*args, device=None, **kwargs): @@ -294,6 +269,36 @@ def torch_eye(*args, device=None, **kwargs): return original_torch_eye(*args, device=device, **kwargs) +original_torch_arange = torch.arange +@wraps(torch.arange) +def torch_arange(*args, dtype=None, device=None, **kwargs): + if check_cuda(device): + if not device_supports_fp64 and dtype == torch.float64: + return original_torch_arange(*args, dtype=torch.float32, device=return_xpu(device), **kwargs) + else: + return original_torch_arange(*args, dtype=dtype, device=return_xpu(device), **kwargs) + else: + if not device_supports_fp64 and check_device_type(device, "xpu") and dtype == torch.float64: + return original_torch_arange(*args, dtype=torch.float32, device=device, **kwargs) + else: + return original_torch_arange(*args, dtype=dtype, device=device, **kwargs) + + +original_torch_linspace = torch.linspace +@wraps(torch.linspace) +def torch_linspace(*args, dtype=None, device=None, **kwargs): + if check_cuda(device): + if not device_supports_fp64 and dtype == torch.float64: + return original_torch_linspace(*args, dtype=torch.float32, device=return_xpu(device), **kwargs) + else: + return original_torch_linspace(*args, dtype=dtype, device=return_xpu(device), **kwargs) + else: + if not device_supports_fp64 and check_device_type(device, "xpu") and dtype == torch.float64: + return original_torch_linspace(*args, dtype=torch.float32, device=device, **kwargs) + else: + return original_torch_linspace(*args, dtype=dtype, device=device, **kwargs) + + original_torch_load = torch.load @wraps(torch.load) def torch_load(f, map_location=None, *args, **kwargs): @@ -362,24 +367,29 @@ class torch_Generator(original_torch_Generator): # Hijack Functions: def ipex_hijacks(): - global device_supports_fp64 + torch.UntypedStorage.__init__ = UntypedStorage_init if torch_version[0] > 2 or (torch_version[0] == 2 and torch_version[1] >= 4): torch.UntypedStorage.cuda = UntypedStorage_cuda torch.UntypedStorage.to = UntypedStorage_to - torch.tensor = torch_tensor + torch.Tensor.to = Tensor_to torch.Tensor.cuda = Tensor_cuda torch.Tensor.pin_memory = Tensor_pin_memory - torch.UntypedStorage.__init__ = UntypedStorage_init + + # transformers completely breaks when anything is done to torch.tensor + # even straight passthroughs breaks transformers for some reason + #torch.tensor = torch_tensor + torch.empty = torch_empty torch.randn = torch_randn torch.ones = torch_ones torch.zeros = torch_zeros torch.full = torch_full + torch.eye = torch_eye torch.arange = torch_arange torch.linspace = torch_linspace - torch.eye = torch_eye torch.load = torch_load + torch.cuda.synchronize = torch_cuda_synchronize torch.cuda.device = torch_cuda_device torch.cuda.set_device = torch_cuda_set_device From acf475ee45829f8ac8fef3dc37444a6722dc251d Mon Sep 17 00:00:00 2001 From: vladmandic Date: Tue, 24 Mar 2026 09:50:38 +0100 Subject: [PATCH 31/33] update locales Signed-off-by: vladmandic --- html/locale_en.json | 3261 ++++++++++++++++++++++--------------------- modules/loader.py | 2 + test/reformat.js | 55 + 3 files changed, 1690 insertions(+), 1628 deletions(-) create mode 100644 test/reformat.js diff --git a/html/locale_en.json b/html/locale_en.json index ef16327f0..ee0ac7c75 100644 --- a/html/locale_en.json +++ b/html/locale_en.json @@ -1,1656 +1,1661 @@ { - "0": - [ - {"id":"","label":"1st Stage","localized":"","hint":"","ui":"script_freescale"}, - {"id":"","label":"2nd Stage","localized":"","hint":"","ui":"script_freescale"}, - {"id":"","label":"2nd Scale","localized":"","hint":"","ui":"script_freescale"}, - {"id":"","label":"2nd Restart step","localized":"","hint":"","ui":"script_freescale"}, - {"id":"","label":"3rd Stage","localized":"","hint":"","ui":"script_freescale"}, - {"id":"","label":"3rd Scale","localized":"","hint":"","ui":"script_freescale"}, - {"id":"","label":"3rd Restart step","localized":"","hint":"","ui":"script_freescale"}, - {"id":"","label":"4th Stage","localized":"","hint":"","ui":"script_freescale"}, - {"id":"","label":"4th Scale","localized":"","hint":"","ui":"script_freescale"}, - {"id":"","label":"4th Restart step","localized":"","hint":"","ui":"script_freescale"} + "0": [ + {"id":"","label":"1st Stage","localized":"","hint":"","ui":"script_freescale"}, + {"id":"","label":"2nd Stage","localized":"","hint":"","ui":"script_freescale"}, + {"id":"","label":"2nd Scale","localized":"","hint":"","ui":"script_freescale"}, + {"id":"","label":"2nd Restart step","localized":"","hint":"","ui":"script_freescale"}, + {"id":"","label":"3rd Stage","localized":"","hint":"","ui":"script_freescale"}, + {"id":"","label":"3rd Scale","localized":"","hint":"","ui":"script_freescale"}, + {"id":"","label":"3rd Restart step","localized":"","hint":"","ui":"script_freescale"}, + {"id":"","label":"4th Stage","localized":"","hint":"","ui":"script_freescale"}, + {"id":"","label":"4th Scale","localized":"","hint":"","ui":"script_freescale"}, + {"id":"","label":"4th Restart step","localized":"","hint":"","ui":"script_freescale"} ], - "_": - [ - {"id":"txt2img_styles_refresh","label":"⟲","localized":"","hint":"Refresh","ui":"txt2img"}, - {"id":"txt2img_styles_apply","label":"↶","localized":"","hint":"Apply selected style to prompt","ui":"txt2img"}, - {"id":"txt2img_styles_save","label":"↷","localized":"","hint":"Save current prompt to style","ui":"txt2img"}, - {"id":"txt2img_res_btn_swap","label":"⇅","localized":"","hint":"Swap values","ui":"txt2img"}, - {"id":"txt2img_seed_random","label":"🎲️","localized":"","hint":"Use random seed","ui":"txt2img"}, - {"id":"txt2img_seed_reuse","label":"⬅️","localized":"","hint":"Reuse seed from last known generated image","ui":"txt2img"}, - {"id":"txt2img_guider_docs","label":"🕮","localized":"","hint":"Save parameters from last generated image as style template","ui":"txt2img"}, - {"id":"txt2img_resize_detect_size","label":"📐","localized":"","hint":"Measure size from existing image","ui":"txt2img"}, - {"id":"txt2img_yolo_models_list","label":"☲","localized":"","hint":"Change view type","ui":"txt2img"}, - {"id":"xyz_grid_x_list","label":"⊜","localized":"","hint":"Fill","ui":"script_xyz_grid_script"}, - {"id":"txt2img_caption_output","label":"","localized":"","hint":"Caption image","ui":"txt2img"}, - {"id":"txt2img_image_fit","label":"⁜","localized":"","hint":"Cycle image fit method","ui":"txt2img"}, - {"id":"","label":"➠ Control","localized":"","hint":"Transfer image to control interface","ui":"txt2img"}, - {"id":"","label":"➠ Text","localized":"","hint":"Transfer image to text interface","ui":"txt2img"}, - {"id":"","label":"➠ Image","localized":"","hint":"Transfer image to image interface","ui":"txt2img"}, - {"id":"","label":"➠ Process","localized":"","hint":"Transfer image to process interface","ui":"txt2img"}, - {"id":"","label":"➠ Caption","localized":"","hint":"Transfer image to caption interface","ui":"txt2img"}, - {"id":"","label":"➠ Sketch","localized":"","hint":"Transfer image to sketch interface","ui":"img2img"}, - {"id":"","label":"➠ Inpaint","localized":"","hint":"Transfer image to inpaint interface","ui":"img2img"}, - {"id":"","label":"➠ Composite","localized":"","hint":"Transfer image to inpaint sketch interface","ui":"img2img"}, - {"id":"controlnet_unit-0-upload","label":"⬆️","localized":"","hint":"Upload image","ui":"control"}, - {"id":"controlnet_unit-0-reset","label":"🔄","localized":"","hint":"Reset values","ui":"control"}, - {"id":"controlnet_unit-0-preview","label":"🖼️","localized":"","hint":"Show preview","ui":"control"}, - {"id":"video_model_load","label":"↺","localized":"","hint":"Immediately apply selection","ui":"video"}, - {"id":"component-5772","label":"","localized":"","hint":"Sort by name, ascending","ui":"gallery"}, - {"id":"component-5773","label":"","localized":"","hint":"Sort by name, descending","ui":"gallery"}, - {"id":"component-5774","label":"","localized":"","hint":"Sort by size, ascending","ui":"gallery"}, - {"id":"component-5775","label":"","localized":"","hint":"Sort by size, descending","ui":"gallery"}, - {"id":"component-5776","label":"","localized":"","hint":"Sort by resolution, ascending","ui":"gallery"}, - {"id":"component-5777","label":"","localized":"","hint":"Sort by resolution, descending","ui":"gallery"}, - {"id":"component-5778","label":"","localized":"","hint":"Sort by time, ascending","ui":"gallery"}, - {"id":"component-5779","label":"","localized":"","hint":"Sort by time, descending","ui":"gallery"}, - {"id":"quicksettings_clear","label":"⊗","localized":"","hint":"Reset values"}, - {"id":"docs_btn_search","label":"🔍","localized":"","hint":"Search","ui":"system_tab_docs"}, - {"id":"component-5567","label":"⇨","localized":"","hint":"Apply preset","ui":"component-5560"}, - {"id":"txt2img_extra_model","label":"※","localized":"","hint":"Load model as refiner model when selected, otherwise load as base model"}, - {"id":"txt2img_extra_scan","label":"🔎︎","localized":"","hint":"Scan CivitAI for missing metadata and previews"}, - {"id":"txt2img_extra_sort","label":"⇕","localized":"","hint":"Sort by: Name asc/desc, Size largest/smallest, Time newest/oldest"}, - {"id":"txt2img_extra_close","label":"✕","localized":"","hint":"Close"} + "_": [ + {"id":"txt2img_styles_refresh","label":"⟲","localized":"","hint":"Refresh","ui":"txt2img"}, + {"id":"txt2img_styles_apply","label":"↶","localized":"","hint":"Apply selected style to prompt","ui":"txt2img"}, + {"id":"txt2img_styles_save","label":"↷","localized":"","hint":"Save current prompt to style","ui":"txt2img"}, + {"id":"txt2img_res_btn_swap","label":"⇅","localized":"","hint":"Swap values","ui":"txt2img"}, + {"id":"txt2img_seed_random","label":"🎲️","localized":"","hint":"Use random seed","ui":"txt2img"}, + {"id":"txt2img_seed_reuse","label":"⬅️","localized":"","hint":"Reuse seed from last known generated image","ui":"txt2img"}, + {"id":"txt2img_guider_docs","label":"🕮","localized":"","hint":"Save parameters from last generated image as style template","ui":"txt2img"}, + {"id":"txt2img_resize_detect_size","label":"📐","localized":"","hint":"Measure size from existing image","ui":"txt2img"}, + {"id":"txt2img_yolo_models_list","label":"☲","localized":"","hint":"Change view type","ui":"txt2img"}, + {"id":"xyz_grid_x_list","label":"⊜","localized":"","hint":"Fill","ui":"script_xyz_grid_script"}, + {"id":"txt2img_caption_output","label":"","localized":"","hint":"Caption image","ui":"txt2img"}, + {"id":"txt2img_image_fit","label":"⁜","localized":"","hint":"Cycle image fit method","ui":"txt2img"}, + {"id":"","label":"➠ Control","localized":"","hint":"Transfer image to control interface","ui":"txt2img"}, + {"id":"","label":"➠ Text","localized":"","hint":"Transfer image to text interface","ui":"txt2img"}, + {"id":"","label":"➠ Image","localized":"","hint":"Transfer image to image interface","ui":"txt2img"}, + {"id":"","label":"➠ Process","localized":"","hint":"Transfer image to process interface","ui":"txt2img"}, + {"id":"","label":"➠ Caption","localized":"","hint":"Transfer image to caption interface","ui":"txt2img"}, + {"id":"","label":"➠ Sketch","localized":"","hint":"Transfer image to sketch interface","ui":"img2img"}, + {"id":"","label":"➠ Inpaint","localized":"","hint":"Transfer image to inpaint interface","ui":"img2img"}, + {"id":"","label":"➠ Composite","localized":"","hint":"Transfer image to inpaint sketch interface","ui":"img2img"}, + {"id":"controlnet_unit-0-upload","label":"⬆️","localized":"","hint":"Upload image","ui":"control"}, + {"id":"controlnet_unit-0-reset","label":"🔄","localized":"","hint":"Reset values","ui":"control"}, + {"id":"controlnet_unit-0-preview","label":"🖼️","localized":"","hint":"Show preview","ui":"control"}, + {"id":"video_model_load","label":"↺","localized":"","hint":"Immediately apply selection","ui":"video"}, + {"id":"component-5878","label":"","localized":"","hint":"Sort by name, ascending","ui":"gallery"}, + {"id":"component-5879","label":"","localized":"","hint":"Sort by name, descending","ui":"gallery"}, + {"id":"component-5880","label":"","localized":"","hint":"Sort by size, ascending","ui":"gallery"}, + {"id":"component-5881","label":"","localized":"","hint":"Sort by size, descending","ui":"gallery"}, + {"id":"component-5882","label":"","localized":"","hint":"Sort by resolution, ascending","ui":"gallery"}, + {"id":"component-5883","label":"","localized":"","hint":"Sort by resolution, descending","ui":"gallery"}, + {"id":"component-5884","label":"","localized":"","hint":"Sort by time, ascending","ui":"gallery"}, + {"id":"component-5885","label":"","localized":"","hint":"Sort by time, descending","ui":"gallery"}, + {"id":"quicksettings_clear","label":"⊗","localized":"","hint":"Reset values"}, + {"id":"docs_btn_search","label":"🔍","localized":"","hint":"Search","ui":"system_tab_docs"}, + {"id":"component-5667","label":"⇨","localized":"","hint":"Apply preset","ui":"component-5660"}, + {"id":"txt2img_extra_model","label":"※","localized":"","hint":"Load model as refiner model when selected, otherwise load as base model"}, + {"id":"txt2img_extra_scan","label":"🔎︎","localized":"","hint":"Scan CivitAI for missing metadata and previews"}, + {"id":"txt2img_extra_sort","label":"⇕","localized":"","hint":"Sort by: Name asc/desc, Size largest/smallest, Time newest/oldest"}, + {"id":"txt2img_extra_close","label":"✕","localized":"","hint":"Close"}, + {"id":"","label":"_Guidance scale","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"_Guidance rescale","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"_Guidance start","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"_Guidance stop","localized":"","hint":"","ui":"txt2img"} ], - "a": - [ - {"id":"txt2img_advanced","label":"Advanced","localized":"","hint":"Advanced settings used to run image generation","ui":"txt2img"}, - {"id":"txt2img_adapters","label":"Adapters","localized":"","hint":"Settings related to IP Adapters","ui":"txt2img"}, - {"id":"component-941","label":"Apply to model","localized":"","hint":"","ui":"script_layerdiffuse"}, - {"id":"btn_clip_analyze_img","label":"Analyze","localized":"","hint":"","ui":"caption"}, - {"id":"component-8587","label":"Apply changes","localized":"","hint":"Apply all changes and restart server","ui":"component-8571"}, - {"id":"settings_submit","label":"Apply settings","localized":"","hint":"Save current settings, server restart is recommended"}, - {"id":"component-5478","label":"Analyze model","localized":"","hint":"","ui":"models_current_tab"}, - {"id":"","label":"All","localized":"","hint":"","ui":"component-98"}, - {"id":"","label":"artist","localized":"","hint":"","ui":"component-104"}, - {"id":"","label":"Alpha","localized":"","hint":"","ui":"component-5574"}, - {"id":"","label":"Advanced Options","localized":"","hint":"","ui":"settings_sd"}, - {"id":"","label":"Appearance","localized":"","hint":"","ui":"settings_ui"}, - {"id":"","label":"Answer","localized":"","hint":"","ui":"caption"}, - {"id":"","label":"Adjust start","localized":"","hint":"Starting step when sigma adjust occurs","ui":"txt2img"}, - {"id":"","label":"Adjust end","localized":"","hint":"Ending step when sigma adjust occurs","ui":"txt2img"}, - {"id":"","label":"AutoGuidance dropout","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"AutoGuidance layers","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"AutoGuidance config","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"APG momentum","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"APG rescale","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"Attention guidance","localized":"","hint":"CFG scale used for with PAG: Perturbed-Attention Guidance","ui":"txt2img"}, - {"id":"","label":"Adaptive scaling","localized":"","hint":"Adaptive modifier for attention guidance scale","ui":"txt2img"}, - {"id":"","label":"Active IP adapters","localized":"","hint":"Number of active IP adapter","ui":"txt2img"}, - {"id":"","label":"Adapter","localized":"","hint":"IP adapter model","ui":"txt2img"}, - {"id":"","label":"Anchor settings","localized":"","hint":"","ui":"script_consistory"}, - {"id":"","label":"Alpha preset","localized":"","hint":"","ui":"script_consistory"}, - {"id":"","label":"Append heatmaps to results","localized":"","hint":"","ui":"script_daam"}, - {"id":"","label":"Auto apply","localized":"","hint":"","ui":"script_flux_prompt_enhance_(legacy)"}, - {"id":"","label":"Amplify LUT","localized":"","hint":"","ui":"script_lut_color_grading"}, - {"id":"","label":"Add time info","localized":"","hint":"","ui":"script_xyz_grid_script"}, - {"id":"","label":"Add text info","localized":"","hint":"","ui":"script_xyz_grid_script"}, - {"id":"","label":"Add metadata","localized":"","hint":"","ui":"script_nudenet"}, - {"id":"","label":"Allowed languages","localized":"","hint":"","ui":"script_nudenet"}, - {"id":"","label":"Allowed alphabets","localized":"","hint":"","ui":"script_nudenet"}, - {"id":"","label":"Apply to prompt","localized":"","hint":"Automatically copy enhanced result to the prompt input box","ui":"script_prompt_enhance"}, - {"id":"","label":"Auto enhance","localized":"","hint":"Automatically enhance prompt before every image generation","ui":"script_prompt_enhance"}, - {"id":"","label":"ACI: Color to Mask","localized":"","hint":"Pick the color you want to mask and inpaint. Click on the color in the image to automatically select it.
Advised to use images like green screens to get precise results.","ui":"script_automatic_color_inpaint"}, - {"id":"","label":"ACI: Color tolerance","localized":"","hint":"Adjust the tolerance to include similar colors in the mask. Lower values = mask only very similar colors. Higher = values mask a wider range of similar colors.","ui":"script_automatic_color_inpaint"}, - {"id":"","label":"ACI: Denoising strength","localized":"","hint":"Change Denoising Strength to achieve desired inpaint amount.","ui":"script_automatic_color_inpaint"}, - {"id":"","label":"ACI: Mask dilate","localized":"","hint":"","ui":"script_automatic_color_inpaint"}, - {"id":"","label":"ACI: Mask erode","localized":"","hint":"Adjust padding to apply a inside offset to the mask. (Recommended value = 2 to remove leftovers at edges)","ui":"script_automatic_color_inpaint"}, - {"id":"","label":"ACI: Mask blur","localized":"","hint":"Adjust blur to apply a smooth transition between image and inpainted area. (Recommended value = 0 for sharpness)","ui":"script_automatic_color_inpaint"}, - {"id":"","label":"Adaptive restore","localized":"","hint":"","ui":"script_instantir"}, - {"id":"","label":"Apply noise","localized":"","hint":"","ui":"script_softfill"}, - {"id":"","label":"Auto min score","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Auto-segment","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Auto-mask","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Active","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Attention","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Adain","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Attention Adain","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Apply filter","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Alpha matting","localized":"","hint":"","ui":"extras"}, - {"id":"","label":"Append Caption Files","localized":"","hint":"Append to existing caption files instead of overwriting them.
Useful for adding additional descriptions or tags to images that already have captions.","ui":"caption"}, - {"id":"","label":"a1111","localized":"","hint":"","ui":"settings_text_encoder"}, - {"id":"","label":"Autocast","localized":"","hint":"Automatically determine precision during runtime","ui":"settings_cuda"}, - {"id":"","label":"Auto","localized":"","hint":"","ui":"settings_cuda"}, - {"id":"","label":"accuracy","localized":"","hint":"","ui":"settings_backends"}, - {"id":"","label":"atiadlxx (AMD only)","localized":"","hint":"","ui":"settings_backends"}, - {"id":"","label":"aot_ts_nvfuser","localized":"","hint":"","ui":"settings_compile"}, - {"id":"","label":"Additional image browser folders","localized":"","hint":"","ui":"settings_saving-images"}, - {"id":"","label":"Add system information to metadata","localized":"","hint":"","ui":"settings_image-metadata"}, - {"id":"","label":"Autolaunch browser upon startup","localized":"","hint":"","ui":"settings_ui"}, - {"id":"","label":"Allowed aspect ratios","localized":"","hint":"","ui":"settings_ui"}, - {"id":"","label":"Approximate","localized":"","hint":"Cheap neural network approximation. Very fast compared to VAE, but produces pictures with 4 times smaller horizontal/vertical resolution and lower quality","ui":"settings_live-preview"}, - {"id":"","label":"Additional postprocessing operations","localized":"","hint":"","ui":"settings_postprocessing"}, - {"id":"","label":"Apply color correction","localized":"","hint":"","ui":"settings_postprocessing"}, - {"id":"","label":"Apply mask as overlay","localized":"","hint":"","ui":"settings_postprocessing"}, - {"id":"","label":"Apply sRGB linearization","localized":"","hint":"","ui":"settings_postprocessing"}, - {"id":"","label":"Available networks","localized":"","hint":"","ui":"settings_extra_networks"}, - {"id":"","label":"Auto-convert SD15 embeddings to SDXL","localized":"","hint":"","ui":"settings_extra_networks"}, - {"id":"","label":"alias","localized":"","hint":"","ui":"settings_legacy_options"}, - {"id":"","label":"Attention query chunk size","localized":"","hint":"","ui":"settings_legacy_options"}, - {"id":"","label":"Attention kv chunk size","localized":"","hint":"","ui":"settings_legacy_options"}, - {"id":"","label":"Attention chunking threshold","localized":"","hint":"","ui":"settings_legacy_options"}, - {"id":"","label":"Attempt VAE roll back for NaN values","localized":"","hint":"Requires Torch 2.1 and NaN check enabled","ui":"settings_legacy_options"}, - {"id":"","label":"Add extended info to filename when saving grid","localized":"","hint":"","ui":"settings_legacy_options"}, - {"id":"","label":"Add LoRA to prompt","localized":"","hint":"","ui":"settings_legacy_options"}, - {"id":"","label":"Alpha Ratio","localized":"","hint":"","ui":"component-5555"}, - {"id":"","label":"ALPHA Block Weight Preset","localized":"","hint":"","ui":"component-5560"}, - {"id":"","label":"Automatically determine rank","localized":"","hint":"","ui":"component-5745"}, - {"id":"","label":"Autorank ratio","localized":"","hint":"","ui":"component-5745"}, - {"id":"","label":"Advanced guidance params","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"Adapter 1","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"Adapter 2","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"Adapter 3","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"Adapter 4","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"Audio","localized":"","hint":"","ui":"video"}, - {"id":"","label":"Advanced Options","localized":"","hint":"","ui":"caption"}, - {"id":"","label":"Advanced Options","localized":"","hint":"","ui":"caption"}, - {"id":"","label":"Advanced Options","localized":"","hint":"","ui":"caption"} + "a": [ + {"id":"txt2img_advanced","label":"Advanced","localized":"","hint":"Advanced settings used to run image generation","ui":"txt2img"}, + {"id":"txt2img_adapters","label":"Adapters","localized":"","hint":"Settings related to IP Adapters","ui":"txt2img"}, + {"id":"component-981","label":"Apply to model","localized":"","hint":"","ui":"script_layerdiffuse"}, + {"id":"btn_clip_analyze_img","label":"Analyze","localized":"","hint":"","ui":"caption"}, + {"id":"component-8740","label":"Apply changes","localized":"","hint":"Apply all changes and restart server","ui":"component-8724"}, + {"id":"settings_submit","label":"Apply settings","localized":"","hint":"Save current settings, server restart is recommended"}, + {"id":"component-5578","label":"Analyze model","localized":"","hint":"","ui":"models_current_tab"}, + {"id":"","label":"All","localized":"","hint":"","ui":"component-98"}, + {"id":"","label":"Alpha","localized":"","hint":"","ui":"component-5674"}, + {"id":"","label":"Advanced Options","localized":"","hint":"","ui":"settings_sd"}, + {"id":"","label":"Appearance","localized":"","hint":"","ui":"settings_ui"}, + {"id":"","label":"Answer","localized":"","hint":"","ui":"caption"}, + {"id":"","label":"Adjust start","localized":"","hint":"Starting step when sigma adjust occurs","ui":"txt2img"}, + {"id":"","label":"Adjust end","localized":"","hint":"Ending step when sigma adjust occurs","ui":"txt2img"}, + {"id":"","label":"AutoGuidance dropout","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"AutoGuidance layers","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"AutoGuidance config","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"APG momentum","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"APG rescale","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Attention guidance","localized":"","hint":"CFG scale used for with PAG: Perturbed-Attention Guidance","ui":"txt2img"}, + {"id":"","label":"Adaptive scaling","localized":"","hint":"Adaptive modifier for attention guidance scale","ui":"txt2img"}, + {"id":"","label":"Apply to hires","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Active IP adapters","localized":"","hint":"Number of active IP adapter","ui":"txt2img"}, + {"id":"","label":"Adapter","localized":"","hint":"IP adapter model","ui":"txt2img"}, + {"id":"","label":"Anchor settings","localized":"","hint":"","ui":"script_consistory"}, + {"id":"","label":"Alpha preset","localized":"","hint":"","ui":"script_consistory"}, + {"id":"","label":"Append heatmaps to results","localized":"","hint":"","ui":"script_daam"}, + {"id":"","label":"Auto apply","localized":"","hint":"","ui":"script_flux_prompt_enhance_(legacy)"}, + {"id":"","label":"Add time info","localized":"","hint":"","ui":"script_xyz_grid_script"}, + {"id":"","label":"Add text info","localized":"","hint":"","ui":"script_xyz_grid_script"}, + {"id":"","label":"Add metadata","localized":"","hint":"","ui":"script_nudenet"}, + {"id":"","label":"Allowed languages","localized":"","hint":"","ui":"script_nudenet"}, + {"id":"","label":"Allowed alphabets","localized":"","hint":"","ui":"script_nudenet"}, + {"id":"","label":"Apply to prompt","localized":"","hint":"Automatically copy enhanced result to the prompt input box","ui":"script_prompt_enhance"}, + {"id":"","label":"Auto enhance","localized":"","hint":"Automatically enhance prompt before every image generation","ui":"script_prompt_enhance"}, + {"id":"","label":"ACI: Color to Mask","localized":"","hint":"Pick the color you want to mask and inpaint. Click on the color in the image to automatically select it.
Advised to use images like green screens to get precise results.","ui":"script_automatic_color_inpaint"}, + {"id":"","label":"ACI: Color tolerance","localized":"","hint":"Adjust the tolerance to include similar colors in the mask. Lower values = mask only very similar colors. Higher = values mask a wider range of similar colors.","ui":"script_automatic_color_inpaint"}, + {"id":"","label":"ACI: Denoising strength","localized":"","hint":"Change Denoising Strength to achieve desired inpaint amount.","ui":"script_automatic_color_inpaint"}, + {"id":"","label":"ACI: Mask dilate","localized":"","hint":"","ui":"script_automatic_color_inpaint"}, + {"id":"","label":"ACI: Mask erode","localized":"","hint":"Adjust padding to apply a inside offset to the mask. (Recommended value = 2 to remove leftovers at edges)","ui":"script_automatic_color_inpaint"}, + {"id":"","label":"ACI: Mask blur","localized":"","hint":"Adjust blur to apply a smooth transition between image and inpainted area. (Recommended value = 0 for sharpness)","ui":"script_automatic_color_inpaint"}, + {"id":"","label":"Adaptive restore","localized":"","hint":"","ui":"script_instantir"}, + {"id":"","label":"Apply noise","localized":"","hint":"","ui":"script_softfill"}, + {"id":"","label":"Auto min score","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Auto-segment","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Auto-mask","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Active","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Attention","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Adain","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Attention Adain","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Apply filter","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Alpha matting","localized":"","hint":"","ui":"extras"}, + {"id":"","label":"Append Caption Files","localized":"","hint":"Append to existing caption files instead of overwriting them.
Useful for adding additional descriptions or tags to images that already have captions.","ui":"caption"}, + {"id":"","label":"a1111","localized":"","hint":"","ui":"settings_text_encoder"}, + {"id":"","label":"Autocast","localized":"","hint":"Automatically determine precision during runtime","ui":"settings_cuda"}, + {"id":"","label":"Auto","localized":"","hint":"","ui":"settings_cuda"}, + {"id":"","label":"Automatic server status monitor rate","localized":"","hint":"","ui":"settings_server"}, + {"id":"","label":"Automatic server memory monitor rate","localized":"","hint":"","ui":"settings_server"}, + {"id":"","label":"API base rate limit rate","localized":"","hint":"","ui":"settings_server"}, + {"id":"","label":"accuracy","localized":"","hint":"","ui":"settings_backends"}, + {"id":"","label":"atiadlxx (AMD only)","localized":"","hint":"","ui":"settings_backends"}, + {"id":"","label":"aot_ts_nvfuser","localized":"","hint":"","ui":"settings_compile"}, + {"id":"","label":"Additional image browser folders","localized":"","hint":"","ui":"settings_saving-images"}, + {"id":"","label":"Add system information to metadata","localized":"","hint":"","ui":"settings_image-metadata"}, + {"id":"","label":"Autolaunch browser upon startup","localized":"","hint":"","ui":"settings_ui"}, + {"id":"","label":"Allowed aspect ratios","localized":"","hint":"","ui":"settings_ui"}, + {"id":"","label":"Approximate","localized":"","hint":"Cheap neural network approximation. Very fast compared to VAE, but produces pictures with 4 times smaller horizontal/vertical resolution and lower quality","ui":"settings_live-preview"}, + {"id":"","label":"Additional postprocessing operations","localized":"","hint":"","ui":"settings_postprocessing"}, + {"id":"","label":"Apply color correction","localized":"","hint":"","ui":"settings_postprocessing"}, + {"id":"","label":"Apply mask as overlay","localized":"","hint":"","ui":"settings_postprocessing"}, + {"id":"","label":"Apply sRGB linearization","localized":"","hint":"","ui":"settings_postprocessing"}, + {"id":"","label":"Available networks","localized":"","hint":"","ui":"settings_extra_networks"}, + {"id":"","label":"Auto-convert SD15 embeddings to SDXL","localized":"","hint":"","ui":"settings_extra_networks"}, + {"id":"","label":"alias","localized":"","hint":"","ui":"settings_legacy_options"}, + {"id":"","label":"Attention query chunk size","localized":"","hint":"","ui":"settings_legacy_options"}, + {"id":"","label":"Attention kv chunk size","localized":"","hint":"","ui":"settings_legacy_options"}, + {"id":"","label":"Attention chunking threshold","localized":"","hint":"","ui":"settings_legacy_options"}, + {"id":"","label":"Attempt VAE roll back for NaN values","localized":"","hint":"Requires Torch 2.1 and NaN check enabled","ui":"settings_legacy_options"}, + {"id":"","label":"Add extended info to filename when saving grid","localized":"","hint":"","ui":"settings_legacy_options"}, + {"id":"","label":"Add LoRA to prompt","localized":"","hint":"","ui":"settings_legacy_options"}, + {"id":"","label":"Alpha Ratio","localized":"","hint":"","ui":"component-5655"}, + {"id":"","label":"ALPHA Block Weight Preset","localized":"","hint":"","ui":"component-5660"}, + {"id":"","label":"Automatically determine rank","localized":"","hint":"","ui":"component-5851"}, + {"id":"","label":"Autorank ratio","localized":"","hint":"","ui":"component-5851"}, + {"id":"","label":"Advanced guidance params","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Adapter 1","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Adapter 2","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Adapter 3","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Adapter 4","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Audio","localized":"","hint":"","ui":"video"} ], - "b": - [ - {"id":"","label":"Batch","localized":"","hint":"Batch processing settings","ui":"img2img"}, - {"id":"btn_vlm_caption_batch","label":"Batch Caption","localized":"","hint":"","ui":"caption"}, - {"id":"btn_wd_tag_batch","label":"Batch Tag","localized":"","hint":"","ui":"caption"}, - {"id":"","label":"Benchmark","localized":"","hint":"Run benchmarks"}, - {"id":"","label":"Backend Settings","localized":"","hint":"Settings related to compute backends: torch, onnx and olive"}, - {"id":"","label":"body","localized":"","hint":"","ui":"component-104"}, - {"id":"","label":"Beta","localized":"","hint":"","ui":"component-5574"}, - {"id":"","label":"Balanced Offload","localized":"","hint":"","ui":"settings_offload"}, - {"id":"","label":"BitsAndBytes","localized":"","hint":"","ui":"settings_quantization"}, - {"id":"","label":"Batch count","localized":"","hint":"How many batches of images to create (has no impact on generation performance or VRAM usage)","ui":"txt2img"}, - {"id":"","label":"Batch size","localized":"","hint":"How many image to create in a single batch (increases generation performance at cost of higher VRAM usage)","ui":"txt2img"}, - {"id":"","label":"Beta schedule","localized":"","hint":"Defines how beta (noise strength per step) grows. Options:
- default: the model default
- linear: evenly decays noise per step
- scaled: squared version of linear, used only by Stable Diffusion
- cosine: smoother decay, often better results with fewer steps
- sigmoid: sharp transition, experimental","ui":"txt2img"}, - {"id":"","label":"Base shift","localized":"","hint":"Minimum shift value for low resolutions when using dynamic shifting.","ui":"txt2img"}, - {"id":"","label":"Block","localized":"","hint":"","ui":"script_kohya_hires_fix"}, - {"id":"","label":"Block size","localized":"","hint":"","ui":"script_nudenet"}, - {"id":"","label":"Banned words","localized":"","hint":"","ui":"script_nudenet"}, - {"id":"","label":"Blur","localized":"","hint":"","ui":"img2img"}, - {"id":"","label":"Batch input directory","localized":"","hint":"","ui":"img2img"}, - {"id":"","label":"Batch output directory","localized":"","hint":"","ui":"img2img"}, - {"id":"","label":"Batch mask directory","localized":"","hint":"","ui":"img2img"}, - {"id":"","label":"Background threshold","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Boost","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Base","localized":"","hint":"Base settings used to run image generation","ui":"control"}, - {"id":"","label":"Blend strength","localized":"","hint":"","ui":"extras"}, - {"id":"","label":"Base model","localized":"","hint":"Main model used for all operations"}, - {"id":"","label":"Backend","localized":"","hint":"","ui":"component-8625"}, - {"id":"","label":"Benchmark steps","localized":"","hint":"","ui":"component-8669"}, - {"id":"","label":"Benchmark level","localized":"","hint":"","ui":"component-8669"}, - {"id":"","label":"balanced","localized":"","hint":"","ui":"settings_offload"}, - {"id":"","label":"block_level","localized":"","hint":"","ui":"settings_offload"}, - {"id":"","label":"Backend storage","localized":"","hint":"","ui":"settings_quantization"}, - {"id":"","label":"BF16","localized":"","hint":"Use modified 16-bit floating point precision for calculations","ui":"settings_cuda"}, - {"id":"","label":"Batch matrix-matrix","localized":"","hint":"Standard batched matrix multiplication for attention. Reliable but not VRAM-efficient.","ui":"settings_cuda"}, - {"id":"","label":"BCFHW","localized":"","hint":"","ui":"settings_advanced"}, - {"id":"","label":"BFCHW","localized":"","hint":"","ui":"settings_advanced"}, - {"id":"","label":"BCHW","localized":"","hint":"","ui":"settings_advanced"}, - {"id":"","label":"Batch mode uses sequential seeds","localized":"","hint":"","ui":"settings_advanced"}, - {"id":"","label":"Batch uses original name","localized":"","hint":"","ui":"settings_saving-paths"}, - {"id":"","label":"Base images folder","localized":"","hint":"","ui":"settings_saving-paths"}, - {"id":"","label":"Base grids folder","localized":"","hint":"","ui":"settings_saving-paths"}, - {"id":"","label":"Build info on first access","localized":"","hint":"Prevents server from building EN page on server startup and instead build it when requested","ui":"settings_extra_networks"}, - {"id":"","label":"Beta Ratio","localized":"","hint":"","ui":"component-5555"}, - {"id":"","label":"BETA Block Weight Preset","localized":"","hint":"","ui":"component-5560"}, - {"id":"","label":"Base model type","localized":"","hint":"","ui":"models_replace_tab"} + "b": [ + {"id":"","label":"Batch","localized":"","hint":"Batch processing settings","ui":"img2img"}, + {"id":"btn_vlm_caption_batch","label":"Batch Caption","localized":"","hint":"","ui":"caption"}, + {"id":"btn_wd_tag_batch","label":"Batch Tag","localized":"","hint":"","ui":"caption"}, + {"id":"","label":"Benchmark","localized":"","hint":"Run benchmarks"}, + {"id":"","label":"Backend Settings","localized":"","hint":"Settings related to compute backends: torch, onnx and olive"}, + {"id":"","label":"Beta","localized":"","hint":"","ui":"component-5674"}, + {"id":"","label":"Balanced Offload","localized":"","hint":"","ui":"settings_offload"}, + {"id":"","label":"BitsAndBytes","localized":"","hint":"","ui":"settings_quantization"}, + {"id":"","label":"Batch count","localized":"","hint":"How many batches of images to create (has no impact on generation performance or VRAM usage)","ui":"txt2img"}, + {"id":"","label":"Batch size","localized":"","hint":"How many image to create in a single batch (increases generation performance at cost of higher VRAM usage)","ui":"txt2img"}, + {"id":"","label":"Beta schedule","localized":"","hint":"Defines how beta (noise strength per step) grows. Options:
- default: the model default
- linear: evenly decays noise per step
- scaled: squared version of linear, used only by Stable Diffusion
- cosine: smoother decay, often better results with fewer steps
- sigmoid: sharp transition, experimental","ui":"txt2img"}, + {"id":"","label":"Base shift","localized":"","hint":"Minimum shift value for low resolutions when using dynamic shifting.","ui":"txt2img"}, + {"id":"","label":"Brightness","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Block","localized":"","hint":"","ui":"script_kohya_hires_fix"}, + {"id":"","label":"Block size","localized":"","hint":"","ui":"script_nudenet"}, + {"id":"","label":"Banned words","localized":"","hint":"","ui":"script_nudenet"}, + {"id":"","label":"Blur","localized":"","hint":"","ui":"img2img"}, + {"id":"","label":"Batch input directory","localized":"","hint":"","ui":"img2img"}, + {"id":"","label":"Batch output directory","localized":"","hint":"","ui":"img2img"}, + {"id":"","label":"Batch mask directory","localized":"","hint":"","ui":"img2img"}, + {"id":"","label":"Background threshold","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Body","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Boost","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Base","localized":"","hint":"Base settings used to run image generation","ui":"control"}, + {"id":"","label":"Blend strength","localized":"","hint":"","ui":"extras"}, + {"id":"","label":"Base model","localized":"","hint":"Main model used for all operations"}, + {"id":"","label":"Backend","localized":"","hint":"","ui":"component-8779"}, + {"id":"","label":"Benchmark steps","localized":"","hint":"","ui":"component-8823"}, + {"id":"","label":"Benchmark level","localized":"","hint":"","ui":"component-8823"}, + {"id":"","label":"Benchmark Image width","localized":"","hint":"","ui":"component-8823"}, + {"id":"","label":"Benchmark Image height","localized":"","hint":"","ui":"component-8823"}, + {"id":"","label":"balanced","localized":"","hint":"","ui":"settings_offload"}, + {"id":"","label":"block_level","localized":"","hint":"","ui":"settings_offload"}, + {"id":"","label":"Backend storage","localized":"","hint":"","ui":"settings_quantization"}, + {"id":"","label":"BF16","localized":"","hint":"Use modified 16-bit floating point precision for calculations","ui":"settings_cuda"}, + {"id":"","label":"Batch matrix-matrix","localized":"","hint":"Standard batched matrix multiplication for attention. Reliable but not VRAM-efficient.","ui":"settings_cuda"}, + {"id":"","label":"BCFHW","localized":"","hint":"","ui":"settings_advanced"}, + {"id":"","label":"BFCHW","localized":"","hint":"","ui":"settings_advanced"}, + {"id":"","label":"BCHW","localized":"","hint":"","ui":"settings_advanced"}, + {"id":"","label":"Batch mode uses sequential seeds","localized":"","hint":"","ui":"settings_advanced"}, + {"id":"","label":"Batch uses original name","localized":"","hint":"","ui":"settings_saving-paths"}, + {"id":"","label":"Base images folder","localized":"","hint":"","ui":"settings_saving-paths"}, + {"id":"","label":"Base grids folder","localized":"","hint":"","ui":"settings_saving-paths"}, + {"id":"","label":"Build info on first access","localized":"","hint":"Prevents server from building EN page on server startup and instead build it when requested","ui":"settings_extra_networks"}, + {"id":"","label":"Beta Ratio","localized":"","hint":"","ui":"component-5655"}, + {"id":"","label":"BETA Block Weight Preset","localized":"","hint":"","ui":"component-5660"}, + {"id":"","label":"Base model type","localized":"","hint":"","ui":"models_replace_tab"} ], - "c": - [ - {"id":"caption_nav","label":"Caption","localized":"","hint":"Analyze existing images and create text descriptions"}, - {"id":"contributors","label":"Contributors","localized":"","hint":""}, - {"id":"txt2img_clear_prompt_btn","label":"Clear","localized":"","hint":"Clear prompts","ui":"txt2img"}, - {"id":"component-940","label":"Check status","localized":"","hint":"","ui":"script_layerdiffuse"}, - {"id":"","label":"Composite","localized":"","hint":"","ui":"img2img"}, - {"id":"control_params_elements","label":"Control","localized":"","hint":"Create image with full guidance","ui":"control"}, - {"id":"","label":"ControlNet","localized":"","hint":"ControlNet is an advanced guidance model","ui":"control"}, - {"id":"caption_tab_controls","label":"Controls","localized":"","hint":"","ui":"caption"}, - {"id":"","label":"CaptionCaption","localized":"","hint":"","ui":"caption"}, - {"id":"btn_console","label":"Console","localized":"","hint":""}, - {"id":"ui_update_check","label":"Check for updates","localized":"","hint":"","ui":"tab_update"}, - {"id":"","label":"Change log","localized":"","hint":""}, - {"id":"","label":"Compute Settings","localized":"","hint":"Settings related to compute precision, cross attention, and optimizations for computing platforms"}, - {"id":"","label":"Current","localized":"","hint":"Analyze modules inside currently loaded model"}, - {"id":"","label":"CivitAI","localized":"","hint":"Search and download models from CitivAI"}, - {"id":"component-5503","label":"Calculate missing hashes","localized":"","hint":"","ui":"models_list_tab"}, - {"id":"","label":"Community","localized":"","hint":"","ui":"component-98"}, - {"id":"","label":"Cloud","localized":"","hint":"","ui":"component-98"}, - {"id":"txt2img_extra_details_close_desc","label":"Close","localized":"","hint":"","ui":"component-59"}, - {"id":"change_checkpoint","label":"Change model","localized":"","hint":""}, - {"id":"change_refiner","label":"Change refiner","localized":"","hint":""}, - {"id":"change_vae","label":"Change VAE","localized":"","hint":""}, - {"id":"change_reference","label":"Change reference","localized":"","hint":""}, - {"id":"","label":"Corrections","localized":"","hint":"Control image color/sharpen/brighness corrections during generate process","ui":"txt2img"}, - {"id":"","label":"Control Methods","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Control Media","localized":"","hint":"Add input image as separate initialization image for control processing","ui":"control"}, - {"id":"","label":"ChronoEdit","localized":"","hint":"","ui":"settings_model_options"}, - {"id":"","label":"Cross Attention","localized":"","hint":"","ui":"settings_cuda"}, - {"id":"","label":"CLiP Skip","localized":"","hint":"Early stopping parameter for CLIP model; 1 is stop at last layer as usual, 2 is stop at penultimate layer, etc","ui":"settings_advanced"}, - {"id":"","label":"Cache-DiT","localized":"","hint":"","ui":"settings_advanced"}, - {"id":"","label":"CFG-Zero","localized":"","hint":"","ui":"settings_advanced"}, - {"id":"","label":"Cache folders","localized":"","hint":"","ui":"settings_system-paths"}, - {"id":"","label":"Custom model loader","localized":"","hint":"","ui":"models_loader_tab"}, - {"id":"","label":"Client log","localized":"","hint":""}, - {"id":"","label":"CLIP Analysis","localized":"","hint":"","ui":"caption"}, - {"id":"","label":"Context","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"Correction mode","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"Color grading","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"Crop to portrait","localized":"","hint":"Crop input image to portrait-only before using it as IP adapter input","ui":"txt2img"}, - {"id":"","label":"Concept Tokens","localized":"","hint":"","ui":"script_consistory"}, - {"id":"","label":"Colormap","localized":"","hint":"","ui":"script_daam"}, - {"id":"","label":"Cosine scale 1","localized":"","hint":"","ui":"script_demofusion"}, - {"id":"","label":"Cosine scale 2","localized":"","hint":"","ui":"script_demofusion"}, - {"id":"","label":"Cosine scale 3","localized":"","hint":"","ui":"script_demofusion"}, - {"id":"","label":"Cache model","localized":"","hint":"","ui":"script_face"}, - {"id":"","label":"Cosine scale","localized":"","hint":"","ui":"script_freescale"}, - {"id":"","label":"Cosine Background","localized":"","hint":"","ui":"script_freescale"}, - {"id":"","label":"Control guidance","localized":"","hint":"","ui":"script_infiniteyou"}, - {"id":"","label":"Contrast","localized":"","hint":"","ui":"script_lut_color_grading"}, - {"id":"","label":"comma","localized":"","hint":"","ui":"script_prompt_matrix"}, - {"id":"","label":"Columns","localized":"","hint":"","ui":"script_regional_prompting"}, - {"id":"","label":"Create video","localized":"","hint":"","ui":"script_xyz_grid_script"}, - {"id":"","label":"Censor","localized":"","hint":"","ui":"script_nudenet"}, - {"id":"","label":"Check language","localized":"","hint":"","ui":"script_nudenet"}, - {"id":"","label":"Check policy violations","localized":"","hint":"","ui":"script_nudenet"}, - {"id":"","label":"Check banned words","localized":"","hint":"","ui":"script_nudenet"}, - {"id":"","label":"Control preprocess input images","localized":"","hint":"","ui":"script_flux_tools"}, - {"id":"","label":"Control override denoise strength","localized":"","hint":"","ui":"script_flux_tools"}, - {"id":"","label":"Color variation","localized":"","hint":"","ui":"script_outpainting"}, - {"id":"","label":"Change rate","localized":"","hint":"","ui":"script_video"}, - {"id":"","label":"Context after","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Context mask","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Control only","localized":"","hint":"This uses only the Control input below as the source for any ControlNet or IP Adapter type tasks based on any of our various options.","ui":"control"}, - {"id":"","label":"CN Mode","localized":"","hint":"","ui":"control"}, - {"id":"","label":"CN Strength","localized":"","hint":"","ui":"control"}, - {"id":"","label":"CN Start","localized":"","hint":"","ui":"control"}, - {"id":"","label":"CN End","localized":"","hint":"","ui":"control"}, - {"id":"","label":"CN Tiles","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Control factor","localized":"","hint":"","ui":"control"}, - {"id":"","label":"ControlNet-XS","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Coarse","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Color map","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Crop to fit","localized":"","hint":"If the dimensions of your source image (e.g. 512x510) deviate from your target dimensions (e.g. 1024x768) this function will fit your upscaled image into your target size image. Excess will be cropped","ui":"extras"}, - {"id":"","label":"CLiP Model","localized":"","hint":"CLIP model used for image-text similarity matching.
Larger models (ViT-L, ViT-H) are more accurate but slower and use more VRAM.","ui":"caption"}, - {"id":"","label":"Caption Model","localized":"","hint":"BLIP model used to generate the initial image caption.
The caption model describes the image content which CLiP then enriches with style and flavor terms.","ui":"caption"}, - {"id":"","label":"Chunk Size","localized":"","hint":"Batch size for processing description candidates (flavors). Higher values speed up interrogation but increase VRAM usage.","ui":"caption"}, - {"id":"","label":"CLiP Num Beams","localized":"","hint":"Number of beams for beam search during caption generation. Higher values search more possibilities but are slower.","ui":"caption"}, - {"id":"","label":"Character threshold","localized":"","hint":"Confidence threshold for character-specific tags (e.g., character names, specific traits).
Only tags with confidence above this threshold are included.
Higher values are more selective, lower values include more potential matches.
Not supported by DeepBooru models.","ui":"caption"}, - {"id":"","label":"Cross-attention","localized":"","hint":"","ui":"component-8625"}, - {"id":"","label":"cpu","localized":"","hint":"Uses cpu and RAM only: slowest but least likely to OOM","ui":"settings_sd"}, - {"id":"","label":"Cached models","localized":"","hint":"The number of models to store in RAM for quick access","ui":"settings_sd"}, - {"id":"","label":"combined","localized":"","hint":"","ui":"settings_model_options"}, - {"id":"","label":"Compress ratio","localized":"","hint":"","ui":"settings_quantization"}, - {"id":"","label":"compel","localized":"","hint":"","ui":"settings_text_encoder"}, - {"id":"","label":"Channels last","localized":"","hint":"","ui":"settings_backends"}, - {"id":"","label":"cuDNN full-depth benchmark","localized":"","hint":"","ui":"settings_backends"}, - {"id":"","label":"cuDNN benchmark limit","localized":"","hint":"","ui":"settings_backends"}, - {"id":"","label":"cudaMallocAsync","localized":"","hint":"Uses CUDA async memory allocator. Improves performance and VRAM fragmentation, but may cause instability on some GPUs.","ui":"settings_backends"}, - {"id":"","label":"CLiP skip enabled","localized":"","hint":"","ui":"settings_advanced"}, - {"id":"","label":"Cache-DiT enabled","localized":"","hint":"","ui":"settings_advanced"}, - {"id":"","label":"Cache-DiT F-compute blocks","localized":"","hint":"","ui":"settings_advanced"}, - {"id":"","label":"Cache-DiT B-compute blocks","localized":"","hint":"","ui":"settings_advanced"}, - {"id":"","label":"Cache-DiT residual diff threshold","localized":"","hint":"","ui":"settings_advanced"}, - {"id":"","label":"Cache-DiT warmup steps","localized":"","hint":"","ui":"settings_advanced"}, - {"id":"","label":"CFG-Zero enabled","localized":"","hint":"","ui":"settings_advanced"}, - {"id":"","label":"CFG-Zero star","localized":"","hint":"","ui":"settings_advanced"}, - {"id":"","label":"CFG-Zero steps","localized":"","hint":"","ui":"settings_advanced"}, - {"id":"","label":"cudagraphs","localized":"","hint":"","ui":"settings_compile"}, - {"id":"","label":"Cleanup temporary folder on startup","localized":"","hint":"","ui":"settings_system-paths"}, - {"id":"","label":"Create ZIP archive for multiple images","localized":"","hint":"","ui":"settings_saving-images"}, - {"id":"","label":"cover","localized":"","hint":"cover full area","ui":"settings_ui"}, - {"id":"","label":"Compact view","localized":"","hint":"","ui":"settings_ui"}, - {"id":"","label":"Cache text encoder results","localized":"","hint":"","ui":"settings_legacy_options"}, - {"id":"","label":"contain","localized":"","hint":"","ui":"settings_legacy_options"}, - {"id":"","label":"Ctrl+up/down word delimiters","localized":"","hint":"","ui":"settings_legacy_options"}, - {"id":"","label":"Ctrl+up/down precision when editing (attention:1.1)","localized":"","hint":"","ui":"settings_legacy_options"}, - {"id":"","label":"Ctrl+up/down precision when editing ","localized":"","hint":"","ui":"settings_legacy_options"}, - {"id":"","label":"Cached VAEs","localized":"","hint":"","ui":"settings_legacy_options"}, - {"id":"","label":"ckpt","localized":"","hint":"","ui":"models_merge_tab"}, - {"id":"","label":"Comma separated list with optional strength per LoRA","localized":"","hint":"","ui":"models_replace_tab"}, - {"id":"","label":"CivitAI token","localized":"","hint":"","ui":"models_civitai_tab"}, - {"id":"","label":"Custom pipeline","localized":"","hint":"","ui":"models_huggingface_tab"}, - {"id":"","label":"Custom model","localized":"","hint":"","ui":"script_prompt_enhance"}, - {"id":"","label":"ControlNet unit 1","localized":"","hint":"","ui":"control"}, - {"id":"","label":"ControlNet unit 2","localized":"","hint":"","ui":"control"}, - {"id":"","label":"ControlNet unit 3","localized":"","hint":"","ui":"control"}, - {"id":"","label":"ControlNet unit 4","localized":"","hint":"","ui":"control"}, - {"id":"","label":"ControlNet-XS unit 1","localized":"","hint":"","ui":"control"}, - {"id":"","label":"ControlNet-XS unit 2","localized":"","hint":"","ui":"control"}, - {"id":"","label":"ControlNet-XS unit 3","localized":"","hint":"","ui":"control"}, - {"id":"","label":"ControlNet-XS unit 4","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Control-LLLite unit 1","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Control-LLLite unit 2","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Control-LLLite unit 3","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Control-LLLite unit 4","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Control settings","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Canny","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Condition","localized":"","hint":"","ui":"video"}, - {"id":"","label":"Caption: Batch","localized":"","hint":"","ui":"caption"}, - {"id":"","label":"Control elements","localized":"","hint":"Control elements are advanced models that can guide generation towards desired outcome","ui":"tab_control"} + "c": [ + {"id":"caption_nav","label":"Caption","localized":"","hint":"Analyze existing images and create text descriptions"}, + {"id":"contributors","label":"Contributors","localized":"","hint":""}, + {"id":"txt2img_corrections","label":"Corrections","localized":"","hint":"Control image color/sharpen/brighness corrections during generate process","ui":"txt2img"}, + {"id":"txt2img_clear_prompt_btn","label":"Clear","localized":"","hint":"Clear prompts","ui":"txt2img"}, + {"id":"component-980","label":"Check status","localized":"","hint":"","ui":"script_layerdiffuse"}, + {"id":"","label":"Copy","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Composite","localized":"","hint":"","ui":"img2img"}, + {"id":"control_params_elements","label":"Control","localized":"","hint":"Create image with full guidance","ui":"control"}, + {"id":"","label":"ControlNet","localized":"","hint":"ControlNet is an advanced guidance model","ui":"control"}, + {"id":"caption_tab_controls","label":"Controls","localized":"","hint":"","ui":"caption"}, + {"id":"","label":"CaptionCaption","localized":"","hint":"","ui":"caption"}, + {"id":"btn_console","label":"Console","localized":"","hint":""}, + {"id":"ui_update_check","label":"Check for updates","localized":"","hint":"","ui":"tab_update"}, + {"id":"","label":"Change log","localized":"","hint":""}, + {"id":"","label":"Compute Settings","localized":"","hint":"Settings related to compute precision, cross attention, and optimizations for computing platforms"}, + {"id":"","label":"Current","localized":"","hint":"Analyze modules inside currently loaded model"}, + {"id":"","label":"CivitAI","localized":"","hint":"Search and download models from CitivAI"}, + {"id":"component-5603","label":"Calculate missing hashes","localized":"","hint":"","ui":"models_list_tab"}, + {"id":"","label":"Community","localized":"","hint":"","ui":"component-98"}, + {"id":"","label":"Cloud","localized":"","hint":"","ui":"component-98"}, + {"id":"txt2img_extra_details_close_desc","label":"Close","localized":"","hint":"","ui":"component-59"}, + {"id":"change_checkpoint","label":"Change model","localized":"","hint":""}, + {"id":"change_refiner","label":"Change refiner","localized":"","hint":""}, + {"id":"change_vae","label":"Change VAE","localized":"","hint":""}, + {"id":"change_unet","label":"Change UNet","localized":"","hint":""}, + {"id":"change_reference","label":"Change reference","localized":"","hint":""}, + {"id":"","label":"Color Grading","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Control Methods","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Control Media","localized":"","hint":"Add input image as separate initialization image for control processing","ui":"control"}, + {"id":"","label":"Create Video","localized":"","hint":"","ui":"extras"}, + {"id":"","label":"ChronoEdit","localized":"","hint":"","ui":"settings_model_options"}, + {"id":"","label":"Cross Attention","localized":"","hint":"","ui":"settings_cuda"}, + {"id":"","label":"CLiP Skip","localized":"","hint":"Early stopping parameter for CLIP model; 1 is stop at last layer as usual, 2 is stop at penultimate layer, etc","ui":"settings_advanced"}, + {"id":"","label":"Cache-DiT","localized":"","hint":"","ui":"settings_advanced"}, + {"id":"","label":"CFG-Zero","localized":"","hint":"","ui":"settings_advanced"}, + {"id":"","label":"Cache folders","localized":"","hint":"","ui":"settings_system-paths"}, + {"id":"","label":"Custom model loader","localized":"","hint":"","ui":"models_loader_tab"}, + {"id":"","label":"Client log","localized":"","hint":""}, + {"id":"","label":"CLIP Analysis","localized":"","hint":"","ui":"caption"}, + {"id":"","label":"Context","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Contrast","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Color temp","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"CLAHE clip","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"CLAHE grid","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Correction mode","localized":"","hint":"","ui":"txt2img"}, + {"id":"","label":"Crop to portrait","localized":"","hint":"Crop input image to portrait-only before using it as IP adapter input","ui":"txt2img"}, + {"id":"","label":"Concept Tokens","localized":"","hint":"","ui":"script_consistory"}, + {"id":"","label":"Colormap","localized":"","hint":"","ui":"script_daam"}, + {"id":"","label":"Cosine scale 1","localized":"","hint":"","ui":"script_demofusion"}, + {"id":"","label":"Cosine scale 2","localized":"","hint":"","ui":"script_demofusion"}, + {"id":"","label":"Cosine scale 3","localized":"","hint":"","ui":"script_demofusion"}, + {"id":"","label":"Cache model","localized":"","hint":"","ui":"script_face"}, + {"id":"","label":"Cosine scale","localized":"","hint":"","ui":"script_freescale"}, + {"id":"","label":"Cosine Background","localized":"","hint":"","ui":"script_freescale"}, + {"id":"","label":"Control guidance","localized":"","hint":"","ui":"script_infiniteyou"}, + {"id":"","label":"comma","localized":"","hint":"","ui":"script_prompt_matrix"}, + {"id":"","label":"Columns","localized":"","hint":"","ui":"script_regional_prompting"}, + {"id":"","label":"Censor","localized":"","hint":"","ui":"script_nudenet"}, + {"id":"","label":"Check language","localized":"","hint":"","ui":"script_nudenet"}, + {"id":"","label":"Check policy violations","localized":"","hint":"","ui":"script_nudenet"}, + {"id":"","label":"Check banned words","localized":"","hint":"","ui":"script_nudenet"}, + {"id":"","label":"Control preprocess input images","localized":"","hint":"","ui":"script_flux_tools"}, + {"id":"","label":"Control override denoise strength","localized":"","hint":"","ui":"script_flux_tools"}, + {"id":"","label":"Color variation","localized":"","hint":"","ui":"script_outpainting"}, + {"id":"","label":"Change rate","localized":"","hint":"","ui":"script_video"}, + {"id":"","label":"Context after","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Context mask","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Control only","localized":"","hint":"This uses only the Control input below as the source for any ControlNet or IP Adapter type tasks based on any of our various options.","ui":"control"}, + {"id":"","label":"CN Mode","localized":"","hint":"","ui":"control"}, + {"id":"","label":"CN Strength","localized":"","hint":"","ui":"control"}, + {"id":"","label":"CN Start","localized":"","hint":"","ui":"control"}, + {"id":"","label":"CN End","localized":"","hint":"","ui":"control"}, + {"id":"","label":"CN Tiles","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Control factor","localized":"","hint":"","ui":"control"}, + {"id":"","label":"ControlNet-XS","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Coarse","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Color map","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Crop to fit","localized":"","hint":"If the dimensions of your source image (e.g. 512x510) deviate from your target dimensions (e.g. 1024x768) this function will fit your upscaled image into your target size image. Excess will be cropped","ui":"extras"}, + {"id":"","label":"CLiP Model","localized":"","hint":"CLIP model used for image-text similarity matching.
Larger models (ViT-L, ViT-H) are more accurate but slower and use more VRAM.","ui":"caption"}, + {"id":"","label":"Caption Model","localized":"","hint":"BLIP model used to generate the initial image caption.
The caption model describes the image content which CLiP then enriches with style and flavor terms.","ui":"caption"}, + {"id":"","label":"clip: max length","localized":"","hint":"","ui":"caption"}, + {"id":"","label":"clip: chunk size","localized":"","hint":"","ui":"caption"}, + {"id":"","label":"clip: min flavors","localized":"","hint":"","ui":"caption"}, + {"id":"","label":"clip: max flavors","localized":"","hint":"","ui":"caption"}, + {"id":"","label":"clip: intermediates","localized":"","hint":"","ui":"caption"}, + {"id":"","label":"clip: num beams","localized":"","hint":"","ui":"caption"}, + {"id":"","label":"Character threshold","localized":"","hint":"Confidence threshold for character-specific tags (e.g., character names, specific traits).
Only tags with confidence above this threshold are included.
Higher values are more selective, lower values include more potential matches.
Not supported by DeepBooru models.","ui":"caption"}, + {"id":"","label":"Cross-attention","localized":"","hint":"","ui":"component-8779"}, + {"id":"","label":"cpu","localized":"","hint":"Uses cpu and RAM only: slowest but least likely to OOM","ui":"settings_sd"}, + {"id":"","label":"Cached models","localized":"","hint":"The number of models to store in RAM for quick access","ui":"settings_sd"}, + {"id":"","label":"combined","localized":"","hint":"","ui":"settings_model_options"}, + {"id":"","label":"Compress ratio","localized":"","hint":"","ui":"settings_quantization"}, + {"id":"","label":"compel","localized":"","hint":"","ui":"settings_text_encoder"}, + {"id":"","label":"Channels last","localized":"","hint":"","ui":"settings_backends"}, + {"id":"","label":"cuDNN full-depth benchmark","localized":"","hint":"","ui":"settings_backends"}, + {"id":"","label":"cuDNN benchmark limit","localized":"","hint":"","ui":"settings_backends"}, + {"id":"","label":"cudaMallocAsync","localized":"","hint":"Uses CUDA async memory allocator. Improves performance and VRAM fragmentation, but may cause instability on some GPUs.","ui":"settings_backends"}, + {"id":"","label":"CLiP skip enabled","localized":"","hint":"","ui":"settings_advanced"}, + {"id":"","label":"Cache-DiT enabled","localized":"","hint":"","ui":"settings_advanced"}, + {"id":"","label":"Cache-DiT F-compute blocks","localized":"","hint":"","ui":"settings_advanced"}, + {"id":"","label":"Cache-DiT B-compute blocks","localized":"","hint":"","ui":"settings_advanced"}, + {"id":"","label":"Cache-DiT residual diff threshold","localized":"","hint":"","ui":"settings_advanced"}, + {"id":"","label":"Cache-DiT warmup steps","localized":"","hint":"","ui":"settings_advanced"}, + {"id":"","label":"CFG-Zero enabled","localized":"","hint":"","ui":"settings_advanced"}, + {"id":"","label":"CFG-Zero star","localized":"","hint":"","ui":"settings_advanced"}, + {"id":"","label":"CFG-Zero steps","localized":"","hint":"","ui":"settings_advanced"}, + {"id":"","label":"cudagraphs","localized":"","hint":"","ui":"settings_compile"}, + {"id":"","label":"Cleanup temporary folder on startup","localized":"","hint":"","ui":"settings_system-paths"}, + {"id":"","label":"Create ZIP archive for multiple images","localized":"","hint":"","ui":"settings_saving-images"}, + {"id":"","label":"cover","localized":"","hint":"cover full area","ui":"settings_ui"}, + {"id":"","label":"Compact view","localized":"","hint":"","ui":"settings_ui"}, + {"id":"","label":"CivitAI token","localized":"","hint":"","ui":"settings_huggingface"}, + {"id":"","label":"CivitAI save to subfolders","localized":"","hint":"","ui":"settings_huggingface"}, + {"id":"","label":"CivitAI subfolder template","localized":"","hint":"","ui":"settings_huggingface"}, + {"id":"","label":"CivitAI discard downloads with hash mismatch","localized":"","hint":"","ui":"settings_huggingface"}, + {"id":"","label":"Cache text encoder results","localized":"","hint":"","ui":"settings_legacy_options"}, + {"id":"","label":"contain","localized":"","hint":"","ui":"settings_legacy_options"}, + {"id":"","label":"Ctrl+up/down word delimiters","localized":"","hint":"","ui":"settings_legacy_options"}, + {"id":"","label":"Ctrl+up/down precision when editing (attention:1.1)","localized":"","hint":"","ui":"settings_legacy_options"}, + {"id":"","label":"Ctrl+up/down precision when editing ","localized":"","hint":"","ui":"settings_legacy_options"}, + {"id":"","label":"Cached VAEs","localized":"","hint":"","ui":"settings_legacy_options"}, + {"id":"","label":"ckpt","localized":"","hint":"","ui":"models_merge_tab"}, + {"id":"","label":"Comma separated list with optional strength per LoRA","localized":"","hint":"","ui":"models_replace_tab"}, + {"id":"","label":"Custom pipeline","localized":"","hint":"","ui":"models_huggingface_tab"}, + {"id":"","label":"Custom model","localized":"","hint":"","ui":"script_prompt_enhance"}, + {"id":"","label":"ControlNet unit 1","localized":"","hint":"","ui":"control"}, + {"id":"","label":"ControlNet unit 2","localized":"","hint":"","ui":"control"}, + {"id":"","label":"ControlNet unit 3","localized":"","hint":"","ui":"control"}, + {"id":"","label":"ControlNet unit 4","localized":"","hint":"","ui":"control"}, + {"id":"","label":"ControlNet-XS unit 1","localized":"","hint":"","ui":"control"}, + {"id":"","label":"ControlNet-XS unit 2","localized":"","hint":"","ui":"control"}, + {"id":"","label":"ControlNet-XS unit 3","localized":"","hint":"","ui":"control"}, + {"id":"","label":"ControlNet-XS unit 4","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Control-LLLite unit 1","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Control-LLLite unit 2","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Control-LLLite unit 3","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Control-LLLite unit 4","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Control settings","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Canny","localized":"","hint":"","ui":"control"}, + {"id":"","label":"Condition","localized":"","hint":"","ui":"video"}, + {"id":"","label":"Caption: Advanced Options","localized":"","hint":"","ui":"caption"}, + {"id":"","label":"Caption: Batch","localized":"","hint":"","ui":"caption"}, + {"id":"","label":"Control elements","localized":"","hint":"Control elements are advanced models that can guide generation towards desired outcome","ui":"tab_control"} ], - "d": - [ - {"id":"","label":"Docs","localized":"","hint":""}, - {"id":"","label":"Discord","localized":"","hint":""}, - {"id":"txt2img_detail","label":"Detail","localized":"","hint":"Detailer runs additional generate at higher resolution for a detected objects","ui":"txt2img"}, - {"id":"","label":"Delete","localized":"","hint":"Delete image","ui":"txt2img"}, - {"id":"","label":"Default","localized":"","hint":"","ui":"caption"}, - {"id":"ui_update_apply","label":"Download updates","localized":"","hint":"","ui":"tab_update"}, - {"id":"civitai_download_btn","label":"Download model","localized":"","hint":"","ui":"models_civitai_tab"}, - {"id":"","label":"Diffusers","localized":"","hint":"","ui":"component-98"}, - {"id":"","label":"Distilled","localized":"","hint":"","ui":"component-98"}, - {"id":"","label":"Description","localized":"","hint":""}, - {"id":"txt2img_extra_details_btn","label":"Details","localized":"","hint":"","ui":"tab_txt2img"}, - {"id":"","label":"Detailer","localized":"","hint":"Detailer runs additional generate at higher resolution for a detected objects","ui":"txt2img"}, - {"id":"","label":"Denoise","localized":"","hint":"Denoising settings. Higher denoise means that more of existing image content is allowed to change during generate","ui":"img2img"}, - {"id":"","label":"DirectML","localized":"","hint":"","ui":"settings_backends"}, - {"id":"","label":"Download model from huggingface","localized":"","hint":"","ui":"models_huggingface_tab"}, - {"id":"","label":"Dropdown","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"dynamic","localized":"","hint":"Dynamic shifting automatically adjusts the denoising schedule based on your image resolution.

The scheduler interpolates between base_shift and max_shift based on actual image resolution.

Enabling disables static Flow shift.","ui":"txt2img"}, - {"id":"","label":"Detailer models","localized":"","hint":"Select detection models to use for detailing","ui":"txt2img"}, - {"id":"","label":"Detailer list","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"Detailer classes","localized":"","hint":"Specify specific classes to use if selected detailer model is a multi-class model","ui":"txt2img"}, - {"id":"","label":"Detailer prompt","localized":"","hint":"Use separate prompt for detailer. If not present, it will use primary prompt","ui":"txt2img"}, - {"id":"","label":"Detailer negative prompt","localized":"","hint":"Use separate negative prompt for detailer. If not present, it will use primary negative prompt","ui":"txt2img"}, - {"id":"","label":"Detailer steps","localized":"","hint":"Number of steps to run for detailer process","ui":"txt2img"}, - {"id":"","label":"Detailer strength","localized":"","hint":"Denoising strength of detailer process","ui":"txt2img"}, - {"id":"","label":"Detailer resolution","localized":"","hint":"","ui":"txt2img"}, - {"id":"","label":"Denoising batch size","localized":"","hint":"","ui":"script_demofusion"}, - {"id":"","label":"Dilate tau","localized":"","hint":"","ui":"script_freescale"}, - {"id":"","label":"Draw legend","localized":"","hint":"","ui":"script_xyz_grid_script"}, - {"id":"","label":"Denoising strength","localized":"","hint":"Determines how little respect the algorithm should have for image's content. At 0, nothing will change, and at 1 you'll get an unrelated image. With values below 1.0, processing will take less steps than the Sampling Steps slider specifies","ui":"img2img"}, - {"id":"","label":"Denoise start","localized":"","hint":"Override denoise strength by stating how early base model should finish and when refiner should start. Only applicable to refiner usage. If set to 0 or 1, denoising strength will be used","ui":"img2img"}, - {"id":"","label":"down","localized":"","hint":"","ui":"script_outpainting"}, - {"id":"","label":"Decode chunks","localized":"","hint":"","ui":"script_video"}, - {"id":"","label":"Dilate","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Depth and normal","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Distance threshold","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Depth threshold","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Denoising steps","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Depth map","localized":"","hint":"","ui":"control"}, - {"id":"","label":"Dynamic shift","localized":"","hint":"","ui":"video"}, - {"id":"","label":"Duration","localized":"","hint":"","ui":"extras"}, - {"id":"","label":"Device Info","localized":"","hint":"","ui":"component-8625"}, - {"id":"","label":"Diffusers load using Run:ai streamer","localized":"","hint":"","ui":"settings_sd"}, - {"id":"","label":"Disable accelerate","localized":"","hint":"","ui":"settings_sd"}, - {"id":"","label":"Disable T5 text encoder","localized":"","hint":"","ui":"settings_model_options"}, - {"id":"","label":"Dynamic loss threshold","localized":"","hint":"","ui":"settings_quantization"}, - {"id":"","label":"Dequantize using torch.compile","localized":"","hint":"","ui":"settings_quantization"}, - {"id":"","label":"Dequantize using full precision","localized":"","hint":"","ui":"settings_quantization"}, - {"id":"","label":"Disabled","localized":"","hint":"","ui":"settings_cuda"}, - {"id":"","label":"Dynamic Attention BMM","localized":"","hint":"Performs attention computation in steps instead of all at once. Slower inference times, but greatly reduced memory usage","ui":"settings_cuda"}, - {"id":"","label":"Dynamic attention","localized":"","hint":"Adjusts attention computation dynamically per step. Saves VRAM but slows generation.","ui":"settings_cuda"}, - {"id":"","label":"Dynamic Attention slicing rate","localized":"","hint":"","ui":"settings_cuda"}, - {"id":"","label":"Dynamic Attention trigger rate","localized":"","hint":"","ui":"settings_cuda"}, - {"id":"","label":"Deterministic mode","localized":"","hint":"Forces deterministic output across runs. Useful for reproducibility, but may disable some optimizations.","ui":"settings_backends"}, - {"id":"","label":"DirectML retry ops for NaN","localized":"","hint":"","ui":"settings_backends"}, - {"id":"","label":"deep-cache","localized":"","hint":"","ui":"settings_compile"}, - {"id":"","label":"DeepCache cache interval","localized":"","hint":"","ui":"settings_compile"}, - {"id":"","label":"Directory for temporary images; leave empty for default","localized":"","hint":"","ui":"settings_system-paths"}, - {"id":"","label":"Do not display video output in UI","localized":"","hint":"","ui":"settings_saving-images"}, - {"id":"","label":"Directory name pattern","localized":"","hint":"Use following tags to define how subdirectories for images and grids are chosen: [steps], [cfg],[prompt_hash], [prompt], [prompt_no_styles], [prompt_spaces], [width], [height], [styles], [sampler], [seed], [model_hash], [model_name], [prompt_words], [date], [datetime], [datetime], [datetime