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 cuda → hip API calls, device name adjustments, or torch.cuda → torch.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.
Findings by file
102 findings · 29 filesBxFormers dependencyimport 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.
--- 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 = FalseBxFormers dependencyimport 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.
--- 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 = FalseBFlashAttention dependencyfrom 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.
ADevice 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.
ADevice 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.
BxFormers dependencyimport 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.
- import xformers+ try:+ import xformers+ except ImportError:+ xformers = NoneBxFormers dependencyimport 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.
--- 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 = FalseAtorch.cuda API usagereturn 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).
Atorch.cuda API usagefor 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).
ADevice 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.
ADevice 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.
Atorch.cuda API usageprev = 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).
Atorch.cuda API usagetorch.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).
Atorch.cuda API usagetorch.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).
Atorch.cuda API usagestats = 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).
Atorch.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).
Atorch.cuda API usageOOM_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).
BxFormers dependencyimport 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.
- 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 = NoneBxFormers dependencyimport 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.
--- a/comfy/model_management.py+++ b/comfy/model_management.py@@ -403,1 +403,4 @@-import xformers.ops+try:+ import xformers.ops+except ImportError:+ xformers = NoneAtorch.cuda API usagearch = 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).
Atorch.cuda API usagearch = 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).
Atorch.cuda API usageif 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).
ADevice 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.
Atorch.cuda API usageallocator_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).
Atorch.cuda API usagereturn "{} {} : {}".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).
Atorch.cuda API usagereturn "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).
ADevice 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.
Atorch.cuda API usagereturn 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).
Atorch.cuda API usages1 = 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).
Atorch.cuda API usages1.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).
Atorch.cuda API usageif 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).
Atorch.cuda API usageif 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).
Atorch.cuda API usagestats = 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).
Atorch.cuda API usagemem_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).
ADevice 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.
Atorch.cuda API usagetorch.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).
Atorch.cuda API usageprops = 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).
Atorch.cuda API usagearch = 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).
Atorch.cuda API usageprops = 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).
Atorch.cuda API usagebf16_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).
Atorch.cuda API usageprops = 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).
Atorch.cuda API usageprops = 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).
Atorch.cuda API usageprops = 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).
Atorch.cuda API usageelif 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).
Atorch.cuda API usagetorch.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).
Atorch.cuda API usageelif 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).
Atorch.cuda API usagetorch.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).
Atorch.cuda API usagetorch.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).
Atorch.cuda API usagetorch.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).
Atorch.cuda API usagereturn 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).
ADevice 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.
ADevice 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.
BTriton dependencyimport 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.
Atorch.cuda API usagetorch.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).
Atorch.cuda API usagetorch.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).
Atorch.cuda API usagetorch.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).
Atorch.cuda API usagetorch.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).
Atorch.cuda API usagetorch.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).
ADevice 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.
ADevice 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.
Atorch.cuda API usagetorch.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).
ADevice 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.
ADevice 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.
A.cuda() tensor/module movedrop_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 movedrop_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 movedrop_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.
Atorch.cuda API usagebackbone_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).
Atorch.cuda API usagebackbone_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).
Atorch.cuda API usagewith 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).
Atorch.cuda API usagetorch.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).
Atorch.cuda API usagetorch.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).
ADevice 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.
Atorch.cuda API usageautocast_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).
ADevice 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.
Atorch.cuda API usagetorch.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).
Atorch.cuda API usageif 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).
Atorch.cuda API usageif 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).
Atorch.cuda API usageif 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).
Atorch.cuda API usageif 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).
Atorch.cuda API usageif 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).
Atorch.cuda API usageif 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).
Atorch.cuda API usageif 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).
Atorch.cuda API usageif 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).
Atorch.cuda API usageraise 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).
Atorch.cuda API usageif 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).
Atorch.cuda API usagereturn 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).
Atorch.cuda API usageif 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).
Atorch.cuda API usageif 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).
Atorch.cuda API usageif 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).
Atorch.cuda API usageif 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).
Atorch.cuda API usageif 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).
Atorch.cuda API usageif 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).
Atorch.cuda API usageraise 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).
Atorch.cuda API usageraise 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).
Atorch.cuda API usagetorch.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).
Atorch.cuda API usagetorch.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).
Atorch.cuda API usagetorch.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).
Atorch.cuda API usagetorch.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).
Atorch.cuda API usagetorch.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).
Atorch.cuda API usagetorch.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).
Atorch.cuda API usagetorch.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).
Atorch.cuda API usagetorch.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).