[ROCm] Intermittent HIP error at the first dtype cast on a cold process — LongCat Avatar INT8, RX 7800 XT
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- backend, machine-learning
Research direction
Start with the reported tensor copy in comfy/model_base.py (_apply_model and convert_tensor) and the weight cast path in comfy/ops.py (forward_comfy_cast_weights, cast_bias_weight, and cast_to). Compare a failing first run in a fresh process with a successful later run, capturing HIP traces and logs as requested in the issue. Done means isolating whether the first large GPU transfers fail in ComfyUI or ROCm/HIP; the issue provides no confirmed cause.
Written by the indexing model from the issue text.
Description
Summary
Running a merged single-file build of LongCat-Video-Avatar 1.6 (INT8 ConvRot) on the official ComfyUI AMD portable build, the process intermittently dies with a HIP error right at the start of sampling, at the first dtype cast. The failure only strikes the first run of a fresh process; the second and later runs in the same process pass.
We are posting this as a case report for triage, not as a confirmed bug in ComfyUI: the root cause is undetermined, and we could not isolate whether it sits on the ComfyUI side or the ROCm/HIP side. We are hoping for pointers on how to narrow it down.
Environment
- GPU: Radeon RX 7800 XT (16GB VRAM)
- CPU: Ryzen 7 7700 / RAM: 32GB
- OS: Windows
- ComfyUI v0.45.0, official AMD portable build
- torch 2.9.1+rocm7.2.1
- Adrenalin 26.11.2 (driver 32.0.32029.2010)
Model
- LongCat-Video-Avatar 1.6 (upstream: MIT License, Meituan), merged with its DMD distillation LoRA and quantized to INT8 ConvRot as a single .safetensors file, loaded in ComfyUI as-is.
Symptom
- The crash happens immediately after sampling starts, at the first dtype cast (cast_to family; the first observed instance was
audio_embeds, fp32→bf16, ~11.9MB). - The failure surfaces as
torch.AcceleratorError: HIP error: invalid argument (hipErrorInvalidValue), raised from a tensor copy insidecast_to_devicecalled byconvert_tensorincomfy/model_base.py(_apply_model, line 242), at the very start of sampling on the first run of a fresh process. Instrumented runs identified the failing operation as the process's first dtype conversion: theaudio_embedsconditioning tensor (fp32, [1, 93, 5, 5, 1280], 11.9 MB) cast to bf16. The identical conversion succeeds on every subsequent run in the same process. - A second form of the same exception occurs on the weight-cast path (
comfy/ops.py, forward_comfy_cast_weights → cast_bias_weight → cast_to), and this one kills the server process itself: the server log ends with a ROCm CLR line ("Memobj map does not have ptr"), and Windows records Application Error (Id 1000) for python.exe — faulting module amdhip64_7.dll, exception code 0xc0000409 (fail-fast abort); WER (Id 1001) reports BEX64, subcode 7. - Similar failures were also observed at other copy points within the same start-of-sampling window; the failing copy differs per run, but all belong to the first large GPU transfers right after sampling starts.
- It only occurs on the first run of a new process. If the first run survives, subsequent runs in the same process are stable.
- A related observation: around model unload, the commit charge can surge sharply (one captured case: +13.5GB within seconds after a step completed, also recorded in Windows Event 2004). With the pagefile fixed at 80GB (commit limit 111.09GB) this class of death largely disappeared; an explicit /free between runs brings commit back down (measured 66.46GB → 40.03GB within 15 seconds).
Statistics (measured over several weeks of testing)
- Cold first run of a fresh process: crashed in 14 of 26 attempts.
- Second run in the same process: passed 22 of 23.
- After adopting a workaround routine — start a fresh process, run one dummy generation with identical inputs first (it takes the fall if there is one), wait, then run the real job — warm entries completed 22 of 22.
What we ruled out
Each of the following was tested and did not fix the entry crash on its own:
- Synchronous dtype conversion
- Switching the allocator backend (cudaMallocAsync) — froze silently instead
- expandable_segments
- Adjusting memory occupancy / reservation levels
- Any single transfer type in isolation
The failures cluster on one call family (cast_to), but we could not distinguish a ComfyUI-side cause from a ROCm/HIP-side cause with the measurements available to us.
What we are asking
- Does this signature (first-run-only HIP error at the first cast, stable afterwards) match any known issue?
- Any pointers on where to look next for isolating the layer at fault?
- If there are specific logs or traces (HIP traces, etc.) we should capture on the next occurrence, please tell us what to collect — we can reproduce the setup and gather them.
Thank you for reading. We are happy to run additional tests on this hardware.
- Dominant language
- Python
- Stars
- 150k
- Forks
- 17.9k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 181
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Comfy-Org/ComfyUI
-
UnboundLocalError on a dangling symlink in custom_nodesPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Feature
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
ModelMergeSimple and all merge nodes are O(N²)Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Comfy-Org/ComfyUI#17823 · 1 reaction ·
Maintainers usually reply within 1 day
-
[Ascend NPU] Trellis2 shape stage aborts: aten::max.dim has no INT32 kernel (EZ1001)Possibly taken @harmehak0173 claimed this 13 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
All issues in Comfy-Org/ComfyUI
Similar issues
-
Test: to_hijri() accepts datetime.datetime and uses only the date partPossibly taken A pull request linked to this issue is open or already merged. Opengood first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
omarelshamy25x/shamy-hijri#63 · 3 comments ·
Maintainers usually reply within 1 day
-
polish
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
521xueweihan/HelloGitHub#4729 ·
-
[Bug]: Score parser reads parts of scientific notation as valid scoresPossibly taken @AshutoshSingh840 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
UKGovernmentBEIS/control-arena#992 ·
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
mvalentsev/awesome-free-ai-coding#70 ·
Maintainers usually reply within 1 day