[GH-ISSUE #20] Triton not working for AMD #10

Closed
opened 2026-10-26 22:19:06 +00:00 by bsakaguchi · 2 comments
Owner

Originally created by @waltercool on GitHub (Jan 8, 2026).
Original GitHub issue: https://github.com/Comfy-Org/comfy-kitchen/issues/20

Hi there,

Just saw the new requirement into ComfyUI, and this is my output:

Found comfy_kitchen backend cuda: {'available': True, 'disabled': True, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8']}
Found comfy_kitchen backend eager: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'scaled_mm_nvfp4']}
Found comfy_kitchen backend triton: {'available': True, 'disabled': True, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8']}

Not sure why is not using the Triton backend, considering it's installed and working with FA.

  • Triton v3.6.0
  • Aotriton 0.11.1
  • FlashAttention v2.8.3
  • Torch v2.11.0
  • Comfy Kitchen v0.2.5
  • Using FLASH_ATTENTION_TRITON_AMD_ENABLE=TRUE

Thanks!

--

Using the example at the README, I got an ugly error by the way, probably related

$ FLASH_ATTENTION_TRITON_AMD_ENABLE=TRUE python
Python 3.13.11 (main, Jan  5 2026, 12:51:49) [Clang 20.1.8+libcxx ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import comfy_kitchen as ck
... import torch
... 
/opt/amdgpu/share/libdrm/amdgpu.ids: No such file or directory
>>> x = torch.randn(100, 100, device="cuda")
... scale = torch.tensor([1.0], device="cuda")
... result = ck.quantize_per_tensor_fp8(x, scale)
... 
Traceback (most recent call last):
  File "<python-input-1>", line 3, in <module>
    result = ck.quantize_per_tensor_fp8(x, scale)
  File "/my/home/directory/amdtorch/lib/python3.13/site-packages/comfy_kitchen/__init__.py", line 65, in quantize_per_tensor_fp8
    return torch.ops.comfy_kitchen.quantize_fp8(x, scale, dtype_code)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/my/home/directory/amdtorch/lib/python3.13/site-packages/torch/_ops.py", line 1243, in __call__
    return self._op(*args, **kwargs)
           ~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/my/home/directory/amdtorch/lib/python3.13/site-packages/torch/_library/autograd.py", line 112, in autograd_impl
    result = forward_no_grad(*args, Metadata(keyset, keyword_only_args))
  File "/my/home/directory/amdtorch/lib/python3.13/site-packages/torch/_library/autograd.py", line 41, in forward_no_grad
    result = op.redispatch(keyset & _C._after_autograd_keyset, *args, **kwargs)
  File "/my/home/directory/amdtorch/lib/python3.13/site-packages/torch/_ops.py", line 857, in redispatch
    return self._handle.redispatch_boxed(keyset, *args, **kwargs)  # type: ignore[return-value]
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/my/home/directory/amdtorch/lib/python3.13/site-packages/torch/_library/custom_ops.py", line 347, in backend_impl
    result = self._backend_fns[device_type](*args, **kwargs)
  File "/my/home/directory/amdtorch/lib/python3.13/site-packages/torch/_compile.py", line 54, in inner
    return disable_fn(*args, **kwargs)
  File "/my/home/directory/amdtorch/lib/python3.13/site-packages/torch/_dynamo/eval_frame.py", line 1220, in _fn
    return fn(*args, **kwargs)
  File "/my/home/directory/amdtorch/lib/python3.13/site-packages/torch/_library/custom_ops.py", line 382, in wrapped_fn
    return fn(*args, **kwargs)
  File "/my/home/directory/amdtorch/lib/python3.13/site-packages/comfy_kitchen/backends/eager/quantization.py", line 222, in _op_quantize_fp8
    return impl(**kwargs)
  File "/my/home/directory/amdtorch/lib/python3.13/site-packages/comfy_kitchen/backends/cuda/__init__.py", line 151, in quantize_per_tensor_fp8
    _C.quantize_per_tensor_fp8(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^
        _wrap_for_dlpack(x),
        ^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
        stream_ptr,
        ^^^^^^^^^^^
    )
    ^
TypeError: quantize_per_tensor_fp8(): incompatible function arguments. The following argument types are supported:
    1. quantize_per_tensor_fp8(input: ndarray[device='cuda'], scale: ndarray[device='cuda'], output: ndarray[device='cuda'], input_dtype_code: int, output_dtype_code: int, numel: int, stream_ptr: int) -> None

Invoked with types: PyCapsule, PyCapsule, PyCapsule, int, int, int, int

Originally created by @waltercool on GitHub (Jan 8, 2026). Original GitHub issue: https://github.com/Comfy-Org/comfy-kitchen/issues/20 Hi there, Just saw the new requirement into ComfyUI, and this is my output: ``` Found comfy_kitchen backend cuda: {'available': True, 'disabled': True, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8']} Found comfy_kitchen backend eager: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'scaled_mm_nvfp4']} Found comfy_kitchen backend triton: {'available': True, 'disabled': True, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8']} ``` Not sure why is not using the Triton backend, considering it's installed and working with FA. - Triton v3.6.0 - Aotriton 0.11.1 - FlashAttention v2.8.3 - Torch v2.11.0 - Comfy Kitchen v0.2.5 - Using FLASH_ATTENTION_TRITON_AMD_ENABLE=TRUE Thanks! -- Using the example at the README, I got an ugly error by the way, probably related ``` $ FLASH_ATTENTION_TRITON_AMD_ENABLE=TRUE python Python 3.13.11 (main, Jan 5 2026, 12:51:49) [Clang 20.1.8+libcxx ] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import comfy_kitchen as ck ... import torch ... /opt/amdgpu/share/libdrm/amdgpu.ids: No such file or directory >>> x = torch.randn(100, 100, device="cuda") ... scale = torch.tensor([1.0], device="cuda") ... result = ck.quantize_per_tensor_fp8(x, scale) ... Traceback (most recent call last): File "<python-input-1>", line 3, in <module> result = ck.quantize_per_tensor_fp8(x, scale) File "/my/home/directory/amdtorch/lib/python3.13/site-packages/comfy_kitchen/__init__.py", line 65, in quantize_per_tensor_fp8 return torch.ops.comfy_kitchen.quantize_fp8(x, scale, dtype_code) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^ File "/my/home/directory/amdtorch/lib/python3.13/site-packages/torch/_ops.py", line 1243, in __call__ return self._op(*args, **kwargs) ~~~~~~~~^^^^^^^^^^^^^^^^^ File "/my/home/directory/amdtorch/lib/python3.13/site-packages/torch/_library/autograd.py", line 112, in autograd_impl result = forward_no_grad(*args, Metadata(keyset, keyword_only_args)) File "/my/home/directory/amdtorch/lib/python3.13/site-packages/torch/_library/autograd.py", line 41, in forward_no_grad result = op.redispatch(keyset & _C._after_autograd_keyset, *args, **kwargs) File "/my/home/directory/amdtorch/lib/python3.13/site-packages/torch/_ops.py", line 857, in redispatch return self._handle.redispatch_boxed(keyset, *args, **kwargs) # type: ignore[return-value] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^ File "/my/home/directory/amdtorch/lib/python3.13/site-packages/torch/_library/custom_ops.py", line 347, in backend_impl result = self._backend_fns[device_type](*args, **kwargs) File "/my/home/directory/amdtorch/lib/python3.13/site-packages/torch/_compile.py", line 54, in inner return disable_fn(*args, **kwargs) File "/my/home/directory/amdtorch/lib/python3.13/site-packages/torch/_dynamo/eval_frame.py", line 1220, in _fn return fn(*args, **kwargs) File "/my/home/directory/amdtorch/lib/python3.13/site-packages/torch/_library/custom_ops.py", line 382, in wrapped_fn return fn(*args, **kwargs) File "/my/home/directory/amdtorch/lib/python3.13/site-packages/comfy_kitchen/backends/eager/quantization.py", line 222, in _op_quantize_fp8 return impl(**kwargs) File "/my/home/directory/amdtorch/lib/python3.13/site-packages/comfy_kitchen/backends/cuda/__init__.py", line 151, in quantize_per_tensor_fp8 _C.quantize_per_tensor_fp8( ~~~~~~~~~~~~~~~~~~~~~~~~~~^ _wrap_for_dlpack(x), ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... stream_ptr, ^^^^^^^^^^^ ) ^ TypeError: quantize_per_tensor_fp8(): incompatible function arguments. The following argument types are supported: 1. quantize_per_tensor_fp8(input: ndarray[device='cuda'], scale: ndarray[device='cuda'], output: ndarray[device='cuda'], input_dtype_code: int, output_dtype_code: int, numel: int, stream_ptr: int) -> None Invoked with types: PyCapsule, PyCapsule, PyCapsule, int, int, int, int ```
Author
Owner

@comfyanonymous commented on GitHub (Jan 9, 2026):

The comfy kitchen triton backend is currently disabled in comfyui because there's some issues with it on some configs. If you want to try enabling it you can comment out this: https://github.com/Comfy-Org/ComfyUI/blob/master/comfy/quant_ops.py#L24

<!-- gh-comment-id:3726601715 --> @comfyanonymous commented on GitHub (Jan 9, 2026): The comfy kitchen triton backend is currently disabled in comfyui because there's some issues with it on some configs. If you want to try enabling it you can comment out this: https://github.com/Comfy-Org/ComfyUI/blob/master/comfy/quant_ops.py#L24
Author
Owner

@waltercool commented on GitHub (Jan 9, 2026):

Thanks! Makes sense!

<!-- gh-comment-id:3727376301 --> @waltercool commented on GitHub (Jan 9, 2026): Thanks! Makes sense!
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/comfy-kitchen#10
No description provided.