[GH-ISSUE #125] Segfault in HIP dequantize_per_tensor_fp8 on gfx1201 (RDNA4) #40

Open
opened 2026-10-26 22:19:35 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @fgheorghe on GitHub (Aug 21, 2026).
Original GitHub issue: https://github.com/Comfy-Org/comfy-kitchen/issues/125

Environment

GPU AMD Radeon AI PRO R9700, gfx1201 (RDNA4), 32 GB
comfy-kitchen 0.2.31
PyTorch 2.13.0+rocm7.2
ROCm 7.2
Python 3.12.13
OS Ubuntu 22.04 (Docker, rocm/dev-ubuntu-22.04:7.2.4-complete)
ComfyUI 0.21.1

Description

Hard segfault (no Python exception, process dies) in the HIP backend's
dequantize_per_tensor_fp8 when an fp8-quantized text encoder runs its first
forward pass.

Setting COMFY_KITCHEN_DISABLE_HIP=1 avoids the crash entirely, and the same
workflow then completes correctly via the eager backend - so the inputs
themselves are fine.

This is not an architecture mismatch. comfy-kitchen was rebuilt explicitly
for the local target:

COMFY_KITCHEN_BUILD_HIP=1 COMFY_HIP_ARCHS=gfx1201 \
  uv pip install --no-build-isolation git+https://github.com/Comfy-Org/comfy-kitchen.git

The crash reproduces identically before and after that rebuild.

Steps to reproduce

  1. ComfyUI on ROCm 7.2 / gfx1201, comfy-kitchen with the HIP backend active
  2. Load an fp8-scaled text encoder (qwen3vl_4b_fp8_scaled.safetensors)
  3. Run any workflow that encodes a prompt through it
  4. Segfault at the first token generation step

Backend detection at startup

HIP reports available and enabled, and lists dequantize_per_tensor_fp8 among
its capabilities - so this is a kernel that claims support, not a fallback path:

Found comfy_kitchen backend hip: {'available': True, 'disabled': False,
 'unavailable_reason': None, 'capabilities': [..., 'dequantize_per_tensor_fp8', ...]}

Stack trace

Generating tokens:   0%|          | 0/512 [00:00<?, ?it/s]Fatal Python error: Segmentation fault
 
Stack (most recent call first):
  File ".../comfy_kitchen/backends/hip/__init__.py", line 310 in dequantize_per_tensor_fp8
  File ".../comfy_kitchen/backends/eager/quantization.py", line 461 in _op_dequantize_fp8
  File ".../torch/_library/custom_ops.py", line 502 in wrapped_fn
  File ".../torch/_dynamo/eval_frame.py", line 1446 in _fn
  File ".../torch/_compile.py", line 54 in inner
  File ".../torch/_library/custom_ops.py", line 441 in backend_impl
  File ".../torch/_ops.py", line 1279 in __call__
  File ".../comfy_kitchen/__init__.py", line 273 in dequantize_per_tensor_fp8
  File ".../comfy_kitchen/tensor/fp8.py", line 71 in dequantize
  File ".../comfy_kitchen/tensor/base.py", line 291 in dequantize
  File ".../comfy_kitchen/tensor/base.py", line 382 in dequantize_args
  File ".../comfy_kitchen/tensor/base.py", line 386 in <genexpr>
  File ".../comfy_kitchen/tensor/base.py", line 386 in dequantize_args
  File ".../comfy_kitchen/tensor/fp8.py", line 145 in _handle_fp8_linear
  File ".../comfy_kitchen/tensor/base.py", line 362 in __torch_dispatch__
  File "/ComfyUI/comfy/ops.py", line 1328 in _forward
  File "/ComfyUI/comfy/ops.py", line 1345 in forward_comfy_cast_weights
  File "/ComfyUI/comfy/ops.py", line 1414 in forward
  File "/ComfyUI/comfy/text_encoders/llama.py", line 554 in forward
  File "/ComfyUI/comfy/text_encoders/llama.py", line 673 in forward
  File "/ComfyUI/comfy/text_encoders/llama.py", line 914 in core
  File "/ComfyUI/comfy/model_prefetch.py", line 66 in prefetch_queue_pop
  File "/ComfyUI/comfy/text_encoders/llama.py", line 924 in forward
  File "/ComfyUI/comfy/text_encoders/llama.py", line 1052 in generate
  File "/ComfyUI/comfy/text_encoders/qwen3vl.py", line 136 in generate
  File "/ComfyUI/comfy/sd1_clip.py", line 750 in generate
  File "/ComfyUI/comfy/sd.py", line 477 in generate
  File "/ComfyUI/comfy_extras/nodes_textgen.py", line 64 in execute
  ...

Workaround

COMFY_KITCHEN_DISABLE_HIP=1

Originally created by @fgheorghe on GitHub (Aug 21, 2026). Original GitHub issue: https://github.com/Comfy-Org/comfy-kitchen/issues/125 ## Environment | | | |---|---| | GPU | AMD Radeon AI PRO R9700, gfx1201 (RDNA4), 32 GB | | comfy-kitchen | 0.2.31 | | PyTorch | 2.13.0+rocm7.2 | | ROCm | 7.2 | | Python | 3.12.13 | | OS | Ubuntu 22.04 (Docker, `rocm/dev-ubuntu-22.04:7.2.4-complete`) | | ComfyUI | 0.21.1 | ## Description Hard segfault (no Python exception, process dies) in the HIP backend's `dequantize_per_tensor_fp8` when an fp8-quantized text encoder runs its first forward pass. Setting `COMFY_KITCHEN_DISABLE_HIP=1` avoids the crash entirely, and the same workflow then completes correctly via the eager backend - so the inputs themselves are fine. **This is not an architecture mismatch.** comfy-kitchen was rebuilt explicitly for the local target: ``` COMFY_KITCHEN_BUILD_HIP=1 COMFY_HIP_ARCHS=gfx1201 \ uv pip install --no-build-isolation git+https://github.com/Comfy-Org/comfy-kitchen.git ``` The crash reproduces identically before and after that rebuild. ## Steps to reproduce 1. ComfyUI on ROCm 7.2 / gfx1201, comfy-kitchen with the HIP backend active 2. Load an fp8-scaled text encoder (`qwen3vl_4b_fp8_scaled.safetensors`) 3. Run any workflow that encodes a prompt through it 4. Segfault at the first token generation step ## Backend detection at startup HIP reports available and enabled, and lists `dequantize_per_tensor_fp8` among its capabilities - so this is a kernel that claims support, not a fallback path: ``` Found comfy_kitchen backend hip: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': [..., 'dequantize_per_tensor_fp8', ...]} ``` ## Stack trace ``` Generating tokens: 0%| | 0/512 [00:00<?, ?it/s]Fatal Python error: Segmentation fault Stack (most recent call first): File ".../comfy_kitchen/backends/hip/__init__.py", line 310 in dequantize_per_tensor_fp8 File ".../comfy_kitchen/backends/eager/quantization.py", line 461 in _op_dequantize_fp8 File ".../torch/_library/custom_ops.py", line 502 in wrapped_fn File ".../torch/_dynamo/eval_frame.py", line 1446 in _fn File ".../torch/_compile.py", line 54 in inner File ".../torch/_library/custom_ops.py", line 441 in backend_impl File ".../torch/_ops.py", line 1279 in __call__ File ".../comfy_kitchen/__init__.py", line 273 in dequantize_per_tensor_fp8 File ".../comfy_kitchen/tensor/fp8.py", line 71 in dequantize File ".../comfy_kitchen/tensor/base.py", line 291 in dequantize File ".../comfy_kitchen/tensor/base.py", line 382 in dequantize_args File ".../comfy_kitchen/tensor/base.py", line 386 in <genexpr> File ".../comfy_kitchen/tensor/base.py", line 386 in dequantize_args File ".../comfy_kitchen/tensor/fp8.py", line 145 in _handle_fp8_linear File ".../comfy_kitchen/tensor/base.py", line 362 in __torch_dispatch__ File "/ComfyUI/comfy/ops.py", line 1328 in _forward File "/ComfyUI/comfy/ops.py", line 1345 in forward_comfy_cast_weights File "/ComfyUI/comfy/ops.py", line 1414 in forward File "/ComfyUI/comfy/text_encoders/llama.py", line 554 in forward File "/ComfyUI/comfy/text_encoders/llama.py", line 673 in forward File "/ComfyUI/comfy/text_encoders/llama.py", line 914 in core File "/ComfyUI/comfy/model_prefetch.py", line 66 in prefetch_queue_pop File "/ComfyUI/comfy/text_encoders/llama.py", line 924 in forward File "/ComfyUI/comfy/text_encoders/llama.py", line 1052 in generate File "/ComfyUI/comfy/text_encoders/qwen3vl.py", line 136 in generate File "/ComfyUI/comfy/sd1_clip.py", line 750 in generate File "/ComfyUI/comfy/sd.py", line 477 in generate File "/ComfyUI/comfy_extras/nodes_textgen.py", line 64 in execute ... ``` ## Workaround `COMFY_KITCHEN_DISABLE_HIP=1`
Author
Owner

@0xDELUXA commented on GitHub (Aug 22, 2026):

Upgrade ROCm/PyTorch to the latest TheRock nightly.

<!-- gh-comment-id:5379109198 --> @0xDELUXA commented on GitHub (Aug 22, 2026): Upgrade ROCm/PyTorch to the latest [TheRock](https://github.com/ROCm/TheRock) nightly.
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#40
No description provided.