# Ray Worker for AMD Strix Halo (gfx1151 / RDNA 3.5) # Pre-bakes all dependencies for fast startup # # Build from llm-workflows root: # docker build -t git.daviestechlabs.io/daviestechlabs/ray-worker-strixhalo:latest -f dockerfiles/Dockerfile.ray-worker-strixhalo . # # Multi-stage build to ensure Python 3.11.11 matches Ray head node # Stage 1: Extract ROCm 7.1 libraries from vendor image FROM docker.io/rocm/pytorch:rocm7.1_ubuntu24.04_py3.12_pytorch_release_2.9.1 AS rocm-libs # Stage 2: Build on Ray base with Python 3.11 FROM rayproject/ray:2.53.0-py311 AS base # Copy ROCm stack from vendor image COPY --from=rocm-libs /opt/rocm /opt/rocm # Set up ROCm environment ENV ROCM_HOME=/opt/rocm ENV PATH="${ROCM_HOME}/bin:${ROCM_HOME}/llvm/bin:${PATH}" ENV LD_LIBRARY_PATH="${ROCM_HOME}/lib:${ROCM_HOME}/lib64:${LD_LIBRARY_PATH}" ENV HSA_PATH="${ROCM_HOME}/hsa" ENV HIP_PATH="${ROCM_HOME}/hip" # ROCm environment for AMD Strix Halo (gfx1151 / RDNA 3.5) ENV HIP_VISIBLE_DEVICES=0 ENV HSA_ENABLE_SDMA=0 ENV PYTORCH_HIP_ALLOC_CONF=expandable_segments:True,max_split_size_mb:512 ENV HSA_OVERRIDE_GFX_VERSION=11.0.0 ENV ROCM_TARGET_LST=gfx1151,gfx1100 ENV PYTHONPATH=/app WORKDIR /app # Install ROCm system dependencies USER root RUN apt-get update && apt-get install -y --no-install-recommends \ libelf1 \ libnuma1 \ libdrm2 \ libdrm-amdgpu1 \ kmod \ && rm -rf /var/lib/apt/lists/* USER ray # WORKAROUND: ROCm/ROCm#5853 - Standard PyTorch ROCm wheels cause segfault # in libhsa-runtime64.so during VRAM allocation on gfx1151 (Strix Halo). # TheRock gfx110X-all packages provide Python 3.11 compatible wheels. RUN pip install --no-cache-dir \ --index-url https://rocm.nightlies.amd.com/v2/gfx110X-all/ \ torch torchaudio torchvision # Install Ray Serve and AI inference dependencies RUN pip install --no-cache-dir \ vllm \ transformers \ accelerate \ sentence-transformers \ httpx \ numpy \ scipy # Pre-download common models for faster cold starts RUN python3 -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('BAAI/bge-large-en-v1.5')" || true # Copy Ray Serve Python code COPY ray-serve/ /app/ray_serve/ # Ray worker entrypoint COPY --chmod=755 dockerfiles/ray-entrypoint.sh /app/ray-entrypoint.sh ENTRYPOINT ["/app/ray-entrypoint.sh"]