From 4bc7c97d5ba1b832e158e86742708c0d5cb956b0 Mon Sep 17 00:00:00 2001 From: silveroxides Date: Wed, 25 Feb 2026 16:22:35 +0100 Subject: [PATCH 1/4] Add launch argument for keeping comfy-kitchen triton backend enabled --- comfy/cli_args.py | 1 + comfy/quant_ops.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index 63daca861..32296db22 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -90,6 +90,7 @@ parser.add_argument("--directml", type=int, nargs="?", metavar="DIRECTML_DEVICE" parser.add_argument("--oneapi-device-selector", type=str, default=None, metavar="SELECTOR_STRING", help="Sets the oneAPI device(s) this instance will use.") parser.add_argument("--disable-ipex-optimize", action="store_true", help="Disables ipex.optimize default when loading models with Intel's Extension for Pytorch.") parser.add_argument("--supports-fp8-compute", action="store_true", help="ComfyUI will act like if the device supports fp8 compute.") +parser.add_argument("--enable-triton-backend", action="store_true", help="ComfyUI will enable the use of Triton backend in comfy-kitchen Is disabled at launch by default.") class LatentPreviewMethod(enum.Enum): NoPreviews = "none" diff --git a/comfy/quant_ops.py b/comfy/quant_ops.py index 15a4f457b..a06c532be 100644 --- a/comfy/quant_ops.py +++ b/comfy/quant_ops.py @@ -1,6 +1,8 @@ import torch import logging +from comfy.cli_args import args + try: import comfy_kitchen as ck from comfy_kitchen.tensor import ( @@ -21,7 +23,15 @@ try: ck.registry.disable("cuda") logging.warning("WARNING: You need pytorch with cu130 or higher to use optimized CUDA operations.") - ck.registry.disable("triton") + if args.enable_triton_backend: + try: + import triton + logging.info(f"Found triton package installed. Enabling comfy-kitchen triton backend.") + except ImportError as e: + logging.error("Failed to import triton, Error: {e}, the comfy-kitchen triton backend will not be available.") + ck.registry.disable("triton") + else: + ck.registry.disable("triton") for k, v in ck.list_backends().items(): logging.info(f"Found comfy_kitchen backend {k}: {v}") except ImportError as e: From 7506c7baed52076c2ce983cb72d5968c32aa59b7 Mon Sep 17 00:00:00 2001 From: Silver <65376327+silveroxides@users.noreply.github.com> Date: Thu, 5 Mar 2026 11:33:05 +0100 Subject: [PATCH 2/4] Fix string not being f-string when printing logging error --- comfy/quant_ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/quant_ops.py b/comfy/quant_ops.py index a06c532be..22321f5de 100644 --- a/comfy/quant_ops.py +++ b/comfy/quant_ops.py @@ -28,7 +28,7 @@ try: import triton logging.info(f"Found triton package installed. Enabling comfy-kitchen triton backend.") except ImportError as e: - logging.error("Failed to import triton, Error: {e}, the comfy-kitchen triton backend will not be available.") + logging.error(f"Failed to import triton, Error: {e}, the comfy-kitchen triton backend will not be available.") ck.registry.disable("triton") else: ck.registry.disable("triton") From 2329f8c925a88e936aa9e786d2fa89ec63e24f80 Mon Sep 17 00:00:00 2001 From: silveroxides Date: Thu, 5 Mar 2026 11:44:52 +0100 Subject: [PATCH 3/4] run triton import with version check when enable_triton_backend launch arg is used to check if it actually works. --- comfy/quant_ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/quant_ops.py b/comfy/quant_ops.py index 22321f5de..ea8287dae 100644 --- a/comfy/quant_ops.py +++ b/comfy/quant_ops.py @@ -26,7 +26,7 @@ try: if args.enable_triton_backend: try: import triton - logging.info(f"Found triton package installed. Enabling comfy-kitchen triton backend.") + logging.info("Found triton %s. Enabling comfy-kitchen triton backend.", triton.__version__) 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") From c6052a11281156d665d55df6d7ce29037e34fcf4 Mon Sep 17 00:00:00 2001 From: Silver <65376327+silveroxides@users.noreply.github.com> Date: Sun, 8 Mar 2026 17:32:24 +0100 Subject: [PATCH 4/4] Update cli_args.py --- comfy/cli_args.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index 4b8252867..a4f6fbbcc 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -90,7 +90,7 @@ parser.add_argument("--directml", type=int, nargs="?", metavar="DIRECTML_DEVICE" parser.add_argument("--oneapi-device-selector", type=str, default=None, metavar="SELECTOR_STRING", help="Sets the oneAPI device(s) this instance will use.") parser.add_argument("--disable-ipex-optimize", action="store_true", help="Disables ipex.optimize default when loading models with Intel's Extension for Pytorch.") parser.add_argument("--supports-fp8-compute", action="store_true", help="ComfyUI will act like if the device supports fp8 compute.") -parser.add_argument("--enable-triton-backend", action="store_true", help="ComfyUI will enable the use of Triton backend in comfy-kitchen Is disabled at launch by default.") +parser.add_argument("--enable-triton-backend", action="store_true", help="ComfyUI will enable the use of Triton backend in comfy-kitchen. Is disabled at launch by default.") class LatentPreviewMethod(enum.Enum): NoPreviews = "none"