Comfy-Org / Comfy-Org/ComfyUI

Pytorch ROCm 7.13 PyTorch reports incorrect VRAM with ROCm 7.14/10.0 driver on Radeon AI PRO R9700

Open
#16,123 1 comment 0 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

### Custom Node Testing

- [x] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)

### Expected Behavior

ComfyUI /Pytorch should detect the full 32 GB of VRAM available on the AMD Radeon AI PRO R9700 and use it for model inference.

PyTorch should report consistent memory values, with the reported free memory never exceeding the reported total memory.

### Actual Behavior

Running ComfyUI Wan workflow triggering the OutOfMemoryError CUDA out of memory. Tried to allocate 2.00 GiB. GPU 0 has a total capacity of 15.63 GiB of which 1.77 GiB

The reported memory values are inconsistent:

- Reported total VRAM: 15.63 GiB
- Reported free VRAM: 31.78 GiB

ComfyUI then uses the incorrect 15.63-GiB capacity and eventually reports an out-of-memory error, even though the GPU has 32 GB of physical VRAM.

The installed PyTorch package is a ROCm 7.13 nightly build, while the host ROCm installation is now 10.0.0.

### Steps to Reproduce

1. Use an AMD Radeon AI PRO R9700 with 32 GB VRAM.
2. Install the host ROCm installation 7.14 or 10.0.0.

`torch 2.13.0a0+rocm7.13.0a20260416`

```
python - <<'PY'
import torch

p = torch.cuda.get_device_properties(0)
free, total = torch.cuda.mem_get_info()

print("device:", p.name)
print("property total:", p.total_memory / 1024**3, "GiB")
print("mem_get_info total:", total / 1024**3, "GiB")
print("mem_get_info free:", free / 1024**3, "GiB")
PY
device: AMD Radeon AI PRO R9700
property total: 15.631065368652344 GiB
mem_get_info total: 15.631065368652344 GiB
mem_get_info free: 31.779296875 GiB
```

```

python - <<'PY'
import torch

x = []
try:
while True:
t = torch.empty((1024, 1024, 1024), dtype=torch.float16, device="cuda")
x.append(t)
print(
"allocated:",
round(torch.cuda.memory_allocated() / 1024**3, 2),
"GiB"
)
except Exception as e:
print(type(e).__name__, e)
PY
allocated: 2.0 GiB
allocated: 4.0 GiB
allocated: 6.0 GiB
allocated: 8.0 GiB
allocated: 10.0 GiB
allocated: 12.0 GiB
allocated: 14.0 GiB
allocated: 16.0 GiB
allocated: 18.0 GiB
allocated: 20.0 GiB
allocated: 22.0 GiB
allocated: 24.0 GiB
allocated: 26.0 GiB
allocated: 28.0 GiB
allocated: 30.0 GiB
OutOfMemoryError CUDA out of memory. Tried to allocate 2.00 GiB. GPU 0 has a total capacity of 15.63 GiB of which 1.77 GiB is free. Of the allocated memory 30.00 GiB is allocated by PyTorch, and 0 bytes is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://docs.pytorch.org/docs/stable/notes/cuda.html#optimizing-memory-usage-with-pytorch-cuda-alloc-conf)

```

```

pip freeze | grep -Ei '^(torch|torchvision|torchaudio|torchtext|torchmetrics|triton|pytorch|rocm|amd-.*rocm)'
rocm==7.13.0a20260416
rocm-sdk-core==7.13.0a20260416
rocm-sdk-libraries-gfx120X-all==7.13.0a20260416
torch==2.13.0a0+rocm7.13.0a20260416
torchaudio==2.11.0+rocm7.13.0a20260425
torchsde==0.2.6
torchvision==0.27.0a0+rocm7.13.0a20260416
triton==3.7.0+git9e2c158e.rocm7.13.0a20260416
```

Contributor guide

Open the contributing guide

Research direction

Start by running the two provided Python snippets with the reported torch and ROCm package versions on the Radeon AI PRO R9700. Compare torch.cuda.get_device_properties(0).total_memory with torch.cuda.mem_get_info() and the allocation test. Done means PyTorch reports consistent total and free VRAM values and ComfyUI no longer treats the 32 GiB device as a 15.63 GiB device.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.