From 099522f85bcd8586eac4133c02f31c70dafe85d2 Mon Sep 17 00:00:00 2001 From: liminfei-amd <91481003+liminfei-amd@users.noreply.github.com> Date: Fri, 10 Jul 2026 11:11:52 +0800 Subject: [PATCH] Enable comfy-kitchen Triton backend by default on ROCm/AMD (#14862) On AMD/ROCm the CUDA backend is unavailable, so Triton is the only accelerated comfy-kitchen backend. It was disabled by default (opt-in --enable-triton-backend), leaving AMD on the slow eager path. Enable it by default when torch.version.hip is set AND Triton is >= 3.7 -- older Triton lacks libdevice.rint on the HIP backend and hard-crashes the INT8 path, so on Triton < 3.7 it stays disabled with a log line. NVIDIA behavior is unchanged; the explicit --enable-triton-backend flag still works as an override. Fixes #14861 --- comfy/quant_ops.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/comfy/quant_ops.py b/comfy/quant_ops.py index 53a0cb603..91b3e4fe9 100644 --- a/comfy/quant_ops.py +++ b/comfy/quant_ops.py @@ -25,10 +25,18 @@ try: ck.registry.disable("cuda") logging.warning("WARNING: You need pytorch with cu130 or higher to use optimized CUDA operations.") - if args.enable_triton_backend: + # On ROCm/AMD the CUDA backend is unavailable, so Triton is the only accelerated + # comfy-kitchen backend. Enable it by default there, but only on Triton >= 3.7: + # older Triton lacks libdevice.rint on the HIP backend and hard-crashes the INT8 path. + if args.enable_triton_backend or torch.version.hip is not None: try: import triton - logging.info("Found triton %s. Enabling comfy-kitchen triton backend.", triton.__version__) + triton_version = tuple(int(v) for v in triton.__version__.split(".")[:2]) + if args.enable_triton_backend or triton_version >= (3, 7): + logging.info("Found triton %s. Enabling comfy-kitchen triton backend.", triton.__version__) + else: + logging.info("Triton %s is too old for the ROCm INT8 path (needs >= 3.7); comfy-kitchen triton backend disabled.", triton.__version__) + ck.registry.disable("triton") except ImportError as e: logging.error(f"Failed to import triton, Error: {e}, the comfy-kitchen triton backend will not be available.") ck.registry.disable("triton")