PortPilot
Benchmark · pre-generated, always available← back to leaderboard
Migration Readiness Report

comfyanonymous/ComfyUI

https://github.com/comfyanonymous/ComfyUI
Ready to run on ROCm

ComfyUI is essentially ROCm-ready with a 96/100 readiness score — 94 components work as-is, 8 require only mechanical fixes, and there are zero manual blockers. To get running, first address the 8 bucket-B items, which are typically straightforward replacements like cudahip API calls, device name adjustments, or torch.cudatorch.amd / PyTorch ROCm equivalents. After those mechanical changes, the repo should run on AMD Instinct GPUs without deeper architectural intervention. No manual porting effort is expected, so focus on validating the bucket-B fixes against your target ROCm/PyTorch versions.

94Works as-is
8Mechanical change
0Manual blocker
Findings
102
Python files
709
Files scanned
977
Custom CUDA kernels
none

Findings by file

102 findings · 29 files
comfy/ldm/modules/attention.py· 5
B
xFormers dependency
import xformers
:19

xFormers is heavily optimized for NVIDIA CUDA and frequently lacks stable, pre-built wheels for ROCm, causing runtime or compilation failures. On AMD Instinct GPUs, it is highly recommended to bypass xFormers and rely on PyTorch's native scaled_dot_product_attention (SDPA), which has optimized ROCm backends. This requires wrapping the import in a try-except block or using environment flags to gracefully disable it.

RecommendPrefer torch SDPA; use a ROCm xFormers build where required.

Suggested change · advisory
--- a/comfy/ldm/modules/attention.py
+++ b/comfy/ldm/modules/attention.py
@@ -16,7 +16,11 @@
import torch
-import xformers
+try:
+ import xformers
+ XFORMERS_IS_AVAILABLE = True
+except ImportError:
+ XFORMERS_IS_AVAILABLE = False
B
xFormers dependency
import xformers.ops
:20

xFormers is not officially supported on ROCm/AMD Instinct and will fail to import or run correctly. The advisory change guards the import and falls back to PyTorch native scaleddotproduct_attention, which is supported on ROCm.

RecommendPrefer torch SDPA; use a ROCm xFormers build where required.

Suggested change · advisory
--- a/comfy/ldm/modules/attention.py
+++ b/comfy/ldm/modules/attention.py
@@ -17,7 +17,11 @@
import torch
from torch import nn
import torch.nn.functional as F
-import xformers.ops
+try:
+ import xformers.ops
+ HAS_XFORMERS = True
+except ImportError:
+ HAS_XFORMERS = False
B
FlashAttention dependency
from flash_attn import flash_attn_func
:45

The flash_attn package import path is compatible with ROCm, but the standard PyPI flash-attn wheel targets NVIDIA GPUs and will not build or run on AMD Instinct. Users must install AMD's ROCm fork of flash-attention (github.com/ROCm/flash-attention) which exposes the same flash_attn_func API, so no source change is strictly required if the correct package is installed.

RecommendInstall the ROCm FlashAttention build or fall back to torch SDPA.

A
Device string "cuda"
with torch.autocast(enabled=False, device_type = 'cuda'):
:394

PyTorch on ROCm maps the HIP backend to the cuda device namespace, so device_type='cuda' is actually compatible and required for torch.autocast on AMD GPUs. Replacing this with 'hip' will cause a runtime error. No code change is strictly necessary for ROCm migration, though dynamically inferring the device type from a tensor is a best practice for cross-platform compatibility.

RecommendNo change required on ROCm PyTorch.

A
Device string "cuda"
if (q.device.type != "cuda" or
:623

Hard-coded "cuda" device type checks will fail on AMD Instinct GPUs where the device type is "hip" (or "rocm" in some contexts), causing the conditional to take the wrong branch and potentially skip optimized attention paths. Replace the literal with a portable check that accepts both CUDA and HIP/ROCm backends.

RecommendNo change required on ROCm PyTorch.

comfy/ldm/modules/diffusionmodules/model.py· 2
B
xFormers dependency
import xformers
:13

xFormers is primarily optimized for NVIDIA CUDA and may not be available or perform optimally on AMD Instinct GPUs. For ROCm, it is highly recommended to bypass xFormers and rely on PyTorch 2.0+ native F.scaled_dot_product_attention (SDPA), which includes dedicated ROCm optimizations. Guarding the import prevents hard crashes on systems where xFormers is not built for ROCm.

RecommendPrefer torch SDPA; use a ROCm xFormers build where required.

Suggested change · advisory
- import xformers
+ try:
+ import xformers
+ except ImportError:
+ xformers = None
B
xFormers dependency
import xformers.ops
:14

xFormers has limited/experimental ROCm support and is not guaranteed to work on AMD Instinct GPUs. The recommended migration path is to replace xformers.ops memoryefficientattention with PyTorch's native torch.nn.functional.scaleddotproduct_attention, which has ROCm-optimized backends (CK/MIOpen). This import will fail or produce wrong results if xFormers is unavailable, so it must be guarded or replaced.

RecommendPrefer torch SDPA; use a ROCm xFormers build where required.

Suggested change · advisory
--- a/comfy/ldm/modules/diffusionmodules/model.py
+++ b/comfy/ldm/modules/diffusionmodules/model.py
@@ -14,1 +14,5 @@
-import xformers.ops
+try:
+ import xformers.ops
+ HAS_XFORMERS = True
+except ImportError:
+ HAS_XFORMERS = False
comfy/model_management.py· 43
A
torch.cuda API usage
return torch.device(torch.cuda.current_device())
:211

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
for i in range(torch.cuda.device_count()):
:221

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
Device string "cuda"
devices.append(torch.device("cuda", i))
:222

The literal device string "cuda" resolves to the active AMD GPU on ROCm PyTorch. .to("cuda") / device="cuda" need no edits.

RecommendNo change required on ROCm PyTorch.

A
Device string "cuda"
if device.type == "cuda" and device.index is not None:
:302

The literal device string "cuda" resolves to the active AMD GPU on ROCm PyTorch. .to("cuda") / device="cuda" need no edits.

RecommendNo change required on ROCm PyTorch.

A
torch.cuda API usage
prev = torch.cuda.current_device()
:303

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
torch.cuda.set_device(device)
:305

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
torch.cuda.set_device(prev)
:312

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
stats = torch.cuda.memory_stats(dev)
:345

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
_, mem_total_cuda = torch.cuda.mem_get_info(dev)
:347

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
OOM_EXCEPTION = torch.cuda.OutOfMemoryError
:375

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

B
xFormers dependency
import xformers
:402

xFormers is primarily optimized for NVIDIA CUDA and often lacks stable support or performance benefits on AMD ROCm. Migrating this requires replacing xFormers-specific attention mechanisms with PyTorch's native scaleddotproduct_attention or ROCm-optimized Flash Attention. Failing to handle this will likely cause runtime errors or suboptimal performance on Instinct GPUs.

RecommendPrefer torch SDPA; use a ROCm xFormers build where required.

Suggested change · advisory
- import xformers
+ import torch
+ # xFormers is not reliably supported on ROCm; fallback to native PyTorch SDPA
+ if torch.version.hip is None:
+ try:
+ import xformers
+ except ImportError:
+ xformers = None
+ else:
+ xformers = None
B
xFormers dependency
import xformers.ops
:403

xFormers is not built or supported for ROCm on AMD Instinct GPUs, so this import will fail at runtime. The import should be guarded with a try/except and call sites should fall back to PyTorch native scaleddotproduct_attention (SDPA) or AMD's ROCm flash-attention port.

RecommendPrefer torch SDPA; use a ROCm xFormers build where required.

Suggested change · advisory
--- a/comfy/model_management.py
+++ b/comfy/model_management.py
@@ -403,1 +403,4 @@
-import xformers.ops
+try:
+ import xformers.ops
+except ImportError:
+ xformers = None
A
torch.cuda API usage
arch = torch.cuda.get_device_properties(device).gcnArchName
:442

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
arch = torch.cuda.get_device_properties(get_torch_device()).gcnArchName.split(':')[0]
:481

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
if torch.cuda.is_available() and torch.backends.cudnn.is_available():
:539

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
Device string "cuda"
if device.type == "cuda":
:581

The literal device string "cuda" resolves to the active AMD GPU on ROCm PyTorch. .to("cuda") / device="cuda" need no edits.

RecommendNo change required on ROCm PyTorch.

A
torch.cuda API usage
allocator_backend = torch.cuda.get_allocator_backend()
:583

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
return "{} {} : {}".format(device, torch.cuda.get_device_name(device), allocator_backend)
:586

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
return "CUDA {}: {}".format(device, torch.cuda.get_device_name(device))
:598

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
Device string "cuda"
return "cuda"
:1226

The literal device string "cuda" resolves to the active AMD GPU on ROCm PyTorch. .to("cuda") / device="cuda" need no edits.

RecommendNo change required on ROCm PyTorch.

A
torch.cuda API usage
return torch.cuda.current_stream()
:1307

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
s1 = torch.cuda.Stream(device=device, priority=0)
:1414

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
s1.as_context = torch.cuda.stream
:1415

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
if torch.cuda.cudart().cudaHostRegister(ptr, size, 1) == 0:
:1554

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
if torch.cuda.cudart().cudaHostUnregister(ptr) == 0:
:1584

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
stats = torch.cuda.memory_stats(dev)
:1698

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
mem_free_cuda, _ = torch.cuda.mem_get_info(dev)
:1701

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
Device string "cuda"
return is_device_type(device, 'cuda')
:1734

The literal device string "cuda" resolves to the active AMD GPU on ROCm PyTorch. .to("cuda") / device="cuda" need no edits.

RecommendNo change required on ROCm PyTorch.

A
torch.cuda API usage
torch.cuda.set_device(device)
:1739

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
props = torch.cuda.get_device_properties(device)
:1785

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
arch = torch.cuda.get_device_properties(device).gcnArchName
:1846

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
props = torch.cuda.get_device_properties(device)
:1852

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
bf16_works = torch.cuda.is_bf16_supported()
:1861

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
props = torch.cuda.get_device_properties(device)
:1877

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
props = torch.cuda.get_device_properties(device)
:1898

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
props = torch.cuda.get_device_properties(device)
:1911

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
elif torch.cuda.is_available():
:1958

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
torch.cuda.synchronize()
:1959

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
elif torch.cuda.is_available():
:1974

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
torch.cuda.synchronize()
:1975

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
torch.cuda.empty_cache()
:1976

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
torch.cuda.ipc_collect()
:1977

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
return torch.cuda.memory.memory_summary()
:2011

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

comfy/quant_ops.py· 3
A
Device string "cuda"
ck.registry.disable("cuda")
:21

The literal device string "cuda" resolves to the active AMD GPU on ROCm PyTorch. .to("cuda") / device="cuda" need no edits.

RecommendNo change required on ROCm PyTorch.

A
Device string "cuda"
ck.registry.disable("cuda")
:25

The literal device string "cuda" resolves to the active AMD GPU on ROCm PyTorch. .to("cuda") / device="cuda" need no edits.

RecommendNo change required on ROCm PyTorch.

B
Triton dependency
import triton
:33

Triton supports AMD Instinct GPUs via ROCm, so this import is generally compatible provided a ROCm-enabled version of Triton is installed in the environment. However, any custom Triton kernels used in this file may require tuning for AMD architecture differences, such as warp size (64 on AMD vs 32 on NVIDIA).

RecommendInstall the ROCm-enabled Triton build.

comfy_extras/nodes_train.py· 5
A
torch.cuda API usage
torch.cuda.empty_cache()
:60

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
torch.cuda.empty_cache()
:345

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
torch.cuda.empty_cache()
:381

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
torch.cuda.empty_cache()
:1222

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
torch.cuda.empty_cache()
:1228

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

comfy/ldm/hunyuan3d/vae.py· 2
A
Device string "cuda"
def load_surface_sharpedge(mesh, num_points=4096, num_sharp_points=4096, sharpedge_flag = True, device = "cuda"):
:317

The hardcoded default device string "cuda" will still function under ROCm since PyTorch maps the "cuda" device namespace to HIP, but it is not portable across non-CUDA backends. For maintainability and future-proofing, consider defaulting to a device-agnostic resolution (e.g., via torch or a framework helper) rather than a literal CUDA string.

RecommendNo change required on ROCm PyTorch.

A
Device string "cuda"
def __call__(self, mesh_input, device = "cuda"):
:386

The default argument device="cuda" hardcodes a CUDA device string, which should be changed to "hip" for ROCm or made configurable. On ROCm, PyTorch may still accept "cuda" via its compatibility layer, but using "hip" is the correct and explicit convention for AMD Instinct GPUs.

RecommendNo change required on ROCm PyTorch.

comfy/ldm/modules/diffusionmodules/util.py· 1
A
torch.cuda API usage
torch.cuda.amp.autocast(**ctx.gpu_autocast_kwargs):
:211

torch.cuda.amp.autocast is deprecated since PyTorch 1.13 and should be replaced with the device-agnostic torch.amp.autocast, which accepts a devicetype argument. On ROCm, devicetype='cuda' works because PyTorch's HIP layer maps the 'cuda' device string, so this change is portable across NVIDIA and AMD. Advisory only — verify ctx.gpuautocastkwargs contents (e.g., enabled, dtype) remain compatible with the new signature.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

comfy/ldm/modules/sub_quadratic_attention.py· 2
A
Device string "cuda"
with torch.autocast(enabled=False, device_type = 'cuda'):
:67

The literal device string "cuda" resolves to the active AMD GPU on ROCm PyTorch. .to("cuda") / device="cuda" need no edits.

RecommendNo change required on ROCm PyTorch.

A
Device string "cuda"
with torch.autocast(enabled=False, device_type = 'cuda'):
:148

The hardcoded device_type='cuda' in torch.autocast will not enable ROCm's native autocast path; on AMD Instinct it should be 'rocm' or dynamically derived. A portable fix is to read the device type from a tensor in scope so the same code works on both CUDA and ROCm.

RecommendNo change required on ROCm PyTorch.

comfy/ldm/pixart/blocks.py· 3
A
.cuda() tensor/module move
drop_ids = torch.rand(labels.shape[0]).cuda() < self.dropout_prob
:299

Using .cuda() hardcodes the tensor allocation to NVIDIA GPUs and relies on HIP's compatibility layer on ROCm, which can break device-agnostic execution. Replacing it with device=labels.device ensures the tensor is allocated directly on the correct active device, improving portability across CUDA, ROCm, and CPU.

RecommendNo change required on ROCm PyTorch.

A
.cuda() tensor/module move
drop_ids = torch.rand(caption.shape[0]).cuda() < self.uncond_prob
:331

The .cuda() call hardcodes the CUDA device backend and will fail or be non-portable on ROCm. Replace it with a device-agnostic pattern that respects the module's or tensor's existing device, or use torch.cuda.current_device() only if explicitly targeting the HIP device.

RecommendNo change required on ROCm PyTorch.

A
.cuda() tensor/module move
drop_ids = torch.rand(global_caption.shape[0]).cuda() < self.uncond_prob
:366

The hardcoded .cuda() forces CUDA device placement; on ROCm, PyTorch/HIP usually maps .cuda() to the current AMD device, but this is not device-agnostic and can break in CPU-fallback or multi-device contexts. Deriving the device from an existing tensor (e.g., global_caption.device) is the recommended advisory change.

RecommendNo change required on ROCm PyTorch.

comfy/ldm/sam3/tracker.py· 5
A
torch.cuda API usage
backbone_stream = torch.cuda.Stream(device=device)
:1672

PyTorch's ROCm implementation aliases the torch.cuda namespace to HIP, meaning torch.cuda.Stream will generally work as-is on AMD Instinct GPUs. No code modification is strictly required for this specific API call, provided the PyTorch build includes ROCm support.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
backbone_stream.wait_stream(torch.cuda.current_stream(device))
:1683

torch.cuda.currentstream is part of PyTorch's CUDA stream API, which is supported on ROCm through PyTorch's HIP compatibility layer — no source change is required for functionality. However, if you want to make the code explicitly ROCm-aware or device-agnostic, you could use torch.cuda.currentstream with a device argument (already present here) or wrap it in a helper that abstracts the backend.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
with torch.cuda.stream(backbone_stream):
:1684

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
torch.cuda.current_stream(device).wait_stream(backbone_stream)
:1735

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
torch.cuda.current_stream(device).wait_stream(backbone_stream)
:1785

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

comfy/ldm/seedvr/model.py· 2
A
Device string "cuda"
autocast_device = "cuda" if torch.cuda.is_available() else "cpu"
:445

The literal device string "cuda" resolves to the active AMD GPU on ROCm PyTorch. .to("cuda") / device="cuda" need no edits.

RecommendNo change required on ROCm PyTorch.

A
torch.cuda API usage
autocast_device = "cuda" if torch.cuda.is_available() else "cpu"
:445

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

comfy/model_patcher.py· 3
A
Device string "cuda"
aimdo_device = device.index if getattr(device, "type", None) == "cuda" else None
:375

The literal device string "cuda" resolves to the active AMD GPU on ROCm PyTorch. .to("cuda") / device="cuda" need no edits.

RecommendNo change required on ROCm PyTorch.

A
torch.cuda API usage
torch.cuda.synchronize()
:1024

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
if torch.cuda.cudart().cudaHostUnregister(module._pin.data_ptr()) != 0:
:1964

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

comfy/ops.py· 1
A
torch.cuda API usage
if torch.cuda.is_available() and comfy.model_management.WINDOWS:
:44

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

comfy/pinned_memory.py· 3
A
torch.cuda API usage
if torch.cuda.cudart().cudaHostRegister(pin.data_ptr(), size, 1) != 0:
:56

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
if torch.cuda.cudart().cudaHostRegister(pin.data_ptr(), size, 1) != 0:
:98

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
if torch.cuda.cudart().cudaHostRegister(pin.data_ptr(), size, 1) != 0:
:101

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

tests-unit/comfy_extras_test/test_seedvr2_conditioning.py· 1
A
torch.cuda API usage
if not torch.cuda.is_available():
:14

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

tests-unit/comfy_extras_test/test_seedvr2_nodes.py· 1
A
torch.cuda API usage
if not torch.cuda.is_available():
:10

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

tests-unit/comfy_extras_test/test_seedvr2_post_processing.py· 2
A
torch.cuda API usage
if not torch.cuda.is_available():
:8

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
raise torch.cuda.OutOfMemoryError("CUDA out of memory")
:32

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

tests-unit/comfy_extras_test/test_seedvr2_temporal_chunk.py· 1
A
torch.cuda API usage
if not torch.cuda.is_available():
:16

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

tests-unit/comfy_quant/test_mixed_precision.py· 1
A
torch.cuda API usage
return torch.cuda.is_available()
:11

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

tests-unit/comfy_test/seedvr_vae_forward_test.py· 1
A
torch.cuda API usage
if not torch.cuda.is_available():
:9

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

tests-unit/comfy_test/test_seedvr2_dtype.py· 1
A
torch.cuda API usage
if not torch.cuda.is_available():
:5

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

tests-unit/comfy_test/test_seedvr2_internals.py· 1
A
torch.cuda API usage
if not torch.cuda.is_available():
:12

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

tests-unit/comfy_test/test_seedvr2_model.py· 1
A
torch.cuda API usage
if not torch.cuda.is_available():
:13

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

tests-unit/comfy_test/test_seedvr2_vae_decode.py· 1
A
torch.cuda API usage
if not torch.cuda.is_available():
:9

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

tests-unit/comfy_test/test_seedvr2_vae_tiled.py· 3
A
torch.cuda API usage
if not torch.cuda.is_available():
:10

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
raise torch.cuda.OutOfMemoryError("forced OOM for dispatcher test")
:226

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
raise torch.cuda.OutOfMemoryError("forced OOM for dispatcher test")
:338

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

tests/execution/test_async_nodes.py· 2
A
torch.cuda API usage
torch.cuda.empty_cache()
:37

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
torch.cuda.empty_cache()
:54

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

tests/execution/test_execution.py· 2
A
torch.cuda API usage
torch.cuda.empty_cache()
:205

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
torch.cuda.empty_cache()
:228

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

tests/execution/test_public_api.py· 2
A
torch.cuda API usage
torch.cuda.empty_cache()
:36

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
torch.cuda.empty_cache()
:53

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

tests/inference/test_inference.py· 2
A
torch.cuda API usage
torch.cuda.empty_cache()
:162

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).

A
torch.cuda API usage
torch.cuda.empty_cache()
:198

Calls under torch.cuda.* are aliased by ROCm builds of PyTorch. The same code runs on AMD Instinct GPUs unchanged — torch.cuda.is_available(), streams, events and AMP all map onto HIP.

RecommendNo change required. Install the ROCm build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/rocm6.1).