Add Intel Arc XPU backend support#443
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds an explicit runtime backend abstraction to support Intel Arc (PyTorch XPU/oneAPI) alongside existing CUDA/ROCm/DirectML paths, with new install/bridge scripts, documentation, and targeted tests.
Changes:
- Introduces
HordeRuntimeBackendto centralize backend selection, environment setup (ONEAPI selector), ComfyUI args, and torch device/cache handling. - Threads the backend configuration through worker startup, process management, inference cache clearing, and model download flows.
- Adds Intel XPU micromamba environment + Linux scripts, plus README documentation and a focused backend unit test.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
update-runtime-xpu.sh |
Adds micromamba-based Intel XPU runtime installer/updater. |
runtime-xpu.sh |
Wrapper to auto-install XPU runtime then run commands in the micromamba env. |
horde-bridge-xpu.sh |
New bridge script to download models + start worker with --xpu (and optional oneAPI selector). |
environment.xpu.yaml |
Minimal conda env definition for the Intel XPU runtime. |
horde_worker_regen/runtime_backend.py |
New backend abstraction + torch device enumeration/cache clearing helpers. |
horde_worker_regen/run_worker.py |
CLI adds --xpu/--oneapi-device-selector; passes backend through startup. |
horde_worker_regen/process_management/main_entry_point.py |
Threads backend into HordeWorkerProcessManager. |
horde_worker_regen/process_management/process_manager.py |
Uses backend for device discovery and safety-on-GPU behavior gating; passes backend to child processes. |
horde_worker_regen/process_management/worker_entry_points.py |
Applies backend env + ComfyUI args when launching inference workers; routes safety behavior via backend. |
horde_worker_regen/process_management/inference_process.py |
Clears torch cache via backend-aware helper (CUDA vs XPU vs DirectML). |
horde_worker_regen/download_models.py |
Applies backend env + ComfyUI args during model download initialization. |
download_models.py |
Adds --xpu/--oneapi-device-selector CLI plumbing for model downloads. |
tests/test_runtime_backend.py |
Adds unit tests for backend validation and torch device/cache routing. |
README.md |
Documents Intel Arc/XPU setup and usage, including oneAPI selector guidance and config notes. |
README_advanced.md |
Adds manual Intel XPU install/run instructions and pip index guidance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| CONDA_ENVIRONMENT_FILE=environment.xpu.yaml | ||
| PYTORCH_XPU_INDEX=https://download.pytorch.org/whl/xpu | ||
| PYPI_INDEX=https://pypi.org/simple | ||
|
|
||
| wget -qO- https://github.com/mamba-org/micromamba-releases/releases/latest/download/micromamba-linux-64.tar.bz2 | tar -xvj -C "${SCRIPT_DIR}" | ||
| if [ ! -f "$SCRIPT_DIR/conda/envs/linux/bin/python" ]; then | ||
| ${SCRIPT_DIR}/bin/micromamba create --no-shortcuts -r "$SCRIPT_DIR/conda" -n linux -f ${CONDA_ENVIRONMENT_FILE} -y | ||
| fi | ||
| ${SCRIPT_DIR}/bin/micromamba update --no-shortcuts -r "$SCRIPT_DIR/conda" -n linux -f ${CONDA_ENVIRONMENT_FILE} -y |
There was a problem hiding this comment.
CONDA_ENVIRONMENT_FILE is set to a relative path (environment.xpu.yaml). If this script is invoked from a different working directory (e.g., via an absolute path or from another script), micromamba will fail to find the env file. Prefer building an absolute path using SCRIPT_DIR for the -f argument (and any other repo-local files).
| if len(selected_backends) > 1: | ||
| raise ValueError( | ||
| "Backend flags are mutually exclusive. " | ||
| f"Choose only one of: {', '.join(selected_backends)}.", | ||
| ) |
There was a problem hiding this comment.
The mutually-exclusive backend error message currently lists only the flags that were already selected (via selected_backends), which can read oddly as “Choose only one of: --amd, --xpu” when both were passed. Consider listing the full set of supported backend flags in the message (and optionally include what was provided) to make the parser error more actionable.
| - Not all updates require this, but run it if unsure | ||
| - **Advanced users**: see [README_advanced.md](README_advanced.md) for manual options |
There was a problem hiding this comment.
The nested bullets under “Run update-runtime for your OS…” are mis-indented, so the Markdown list renders inconsistently (the “Not all updates…” and “Advanced users…” bullets don’t align under step 4). Align the indentation so these remain sub-bullets of step 4.
| - Not all updates require this, but run it if unsure | |
| - **Advanced users**: see [README_advanced.md](README_advanced.md) for manual options | |
| - Not all updates require this, but run it if unsure | |
| - **Advanced users**: see [README_advanced.md](README_advanced.md) for manual options |
Summary
Validation