[AMD ROCm] hipErrorInvalidValue in SDPA when running Anima models (gfx1201, torch 2.13.0+rocm10.0.0)
What happened
Generating with any Anima model fails. The workflow loads the model successfully and crashes during sampling with a ROCm/HIP error that surfaces inside the Anima model's own attention call.
This reproduces with a minimal graph (no custom nodes involved), and with 5 different Anima checkpoints.
F.scaled_dot_product_attention at comfy/ldm/anima/model.py:80 appears to be
the failing operation; the traceback surfaces one frame later at line 129.
Environment
| ComfyUI | 0.37.2 |
| comfyui-frontend-package | 1.52.7 |
| Python | 3.12.10 |
| torch | 2.13.0+rocm10.0.0 |
torch.version.hip |
7.15.26333 |
| GPU | AMD Radeon RX 9070 (gfx1201) |
torch.cuda.get_device_capability() |
(12, 0) |
| Driver | 32.0.31035.1003 (2026/7/24) |
| OS | Windows 11 |
| Launch args | --disable-dynamic-vram --disable-smart-memory --disable-pinned-memory |
Error
torch.AcceleratorError: CUDA error: invalid argument
Search for `hipErrorInvalidValue' in https://rocm.docs.amd.com/projects/HIP/en/latest/index.html for more information.
For more detailed error information, run with CUDA_LOG_FILE=stderr
Device-side assertion tracking was not enabled by user.Traceback (trimmed):
File "F:\AI\ComfyUI\comfy\ldm\anima\model.py", line 200, in preprocess_text_embeds
out = self.llm_adapter(text_embeds, text_ids)
File "F:\AI\ComfyUI\comfy\ldm\anima\model.py", line 189, in forward
x = block(x, context, target_attention_mask=target_attention_mask, ...)
File "F:\AI\ComfyUI\comfy\ldm\anima\model.py", line 129, in forward
x = x + attn_out
torch.AcceleratorError: CUDA error: invalid argumentcomfy/ldm/anima/model.py:80 is:
attn_output = F.scaled_dot_product_attention(query_states, key_states, value_states, attn_mask=mask)Minimal reproduction
Graph (no custom nodes):
UNETLoader(anima29B_v10_bf16.safetensors, weight_dtype=default)
CLIPLoader(qwen_3_06b_base.safetensors, type=stable_diffusion)
VAELoader(qwen_image_vae.safetensors)
CLIPTextEncode x2 -> KSampler(er_sde, beta, steps=24, cfg=5, denoise=1)
EmptyLatentImage 1400x1000 -> KSampler -> VAEDecode -> SaveImageSubmit via /prompt with min-kitchen.json. Result:
status: error, node_type: KSampler, exception_type: torch.AcceleratorError.
Things I already ruled out
Each was tested against the minimal graph:
- Custom attention backends are NOT involved. Removing the
XB_SageAttentionAcceleratornode entirely still fails identically.--use-pytorch-cross-attention/--use-split-cross-attentionmake no difference, because Anima callsF.scaled_dot_product_attentiondirectly rather than ComfyUI's attention functions. - Not a dtype issue. Same failure with
weight_dtype=default. - Not a broken checkpoint. All 5 of these fail identically:
anima29B_v10_bf16,anima_baseV10,anima_turboV11,JANIMA_v10,waiANIMAInt8Mxfp8_waiANIMAV10Int8(int8 quantised). - The GPU and the rest of the sampling path are fine. SD1.5 loaded through
CheckpointLoaderSimpleon the same server generates an image successfully.
Expected
Anima models should sample without a HIP error on gfx1201.
Notes
- Note the ROCm version skew: torch is built as
+rocm10.0.0whiletorch.version.hipreports7.15.26333. Not sure whether that is expected for this build. - Startup also logs a flash-attention failure, which looks unrelated:
Could not run flash attention, disabling it: CUDA error: invalid argument
Source: Comfy-Org/ComfyUI