#!/bin/bash
# Launch ComfyUI with BC-250 ROCm v17 patches
cd /home/fabian/ComfyUI
source venv/bin/activate

export HSA_OVERRIDE_GFX_VERSION=10.1.0
export HSA_ENABLE_SDMA=0
export HIP_VISIBLE_DEVICES=0
export MIOPEN_FIND_MODE=3
export BC250_SOFTMAX_THRESHOLD=4096
export PYTORCH_HIP_ALLOC_CONF=garbage_collection_threshold:0.8,max_split_size_mb:128
export TORCH_BLAS_PREFER_HIPBLASLT=0
export TORCHDYNAMO_DISABLE=1
export GPU_MAX_HEAP_SIZE=100
export GPU_MAX_ALLOC_PERCENT=100

nohup python main.py \
    --listen 0.0.0.0 --port 8188 \
    --normalvram \
    --force-fp16 \
    --cpu-vae \
    --disable-cuda-malloc \
    --use-pytorch-cross-attention \
    > /home/fabian/comfyui.log 2>&1 &
echo \$!
disown
