chore: Add changes to support AMD on Linux

This commit is contained in:
AKharytonchyk 2025-06-02 07:49:55 +02:00
parent aeba0b3a26
commit 926af8eb6f
2 changed files with 16 additions and 2 deletions

View File

@ -169,7 +169,7 @@ def get_torch_device():
elif is_mlu():
return torch.device("mlu", torch.mlu.current_device())
else:
return torch.device(torch.cuda.current_device())
return torch.device("cuda")
def get_total_memory(dev=None, torch_total_too=False):
global directml_enabled
@ -202,7 +202,7 @@ def get_total_memory(dev=None, torch_total_too=False):
mem_total = mem_total_mlu
else:
stats = torch.cuda.memory_stats(dev)
mem_reserved = stats['reserved_bytes.all.current']
mem_reserved = torch.cuda.memory_reserved(dev)
_, mem_total_cuda = torch.cuda.mem_get_info(dev)
mem_total_torch = mem_reserved
mem_total = mem_total_cuda

14
start.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# Start ComfyUI with AMD Radeon 7900 XTX (ROCm)
# Set ROCm architecture for Radeon 7900 XTX
echo "Setting ROCm environment for Radeon 7900 XTX (gfx1100)"
export PYTORCH_ROCM_ARCH=gfx1100
# Uncomment the next line if you encounter issues with ROCm version detection
export HSA_OVERRIDE_GFX_VERSION=11.0.0
# Optionally, activate your Python virtual environment here
source ../venv/bin/activate
# Start ComfyUI
python3 main.py --lowvram --use-split-cross-attention --fp16-unet --listen 0.0.0.0 "$@"