feat: Add Intel Arc GPU (XPU) support / 添加 Intel Arc GPU (XPU) 支持 - #9423
Open
wesd6r wants to merge 5 commits into
Open
feat: Add Intel Arc GPU (XPU) support / 添加 Intel Arc GPU (XPU) 支持#9423wesd6r wants to merge 5 commits into
wesd6r wants to merge 5 commits into
Conversation
wesd6r
requested review from
JPPhoto,
Pfannkuchensack,
blessedcoolant,
dunkeroni and
lstein
as code owners
July 31, 2026 18:08
wesd6r
force-pushed
the
intel-gpu-support
branch
from
August 2, 2026 01:12
d921a46 to
820f7b7
Compare
- devices.py: XPU device detection, choose_torch_device, bfloat16 default - config_default.py: device field accepts xpu/xpu:N patterns - run_app.py: guard CUDA memory allocator for non-CUDA devices - attention.py + diffusers_pipeline.py: XPU VRAM detection - hotfixes.py: disable xformers on XPU devices - model_cache.py: XPU memory tracking + OOM handling - invocation_stats + memory_snapshot: XPU VRAM reporting - pid/*: device-agnostic inference (autocast, .to(device)) - bnb_llm_int8.py + bnb_nf4.py: XPU quantization guards - ggml_tensor.py: XPU dispatch table - pidi/model.py: device-agnostic FloatTensor - anima_latents_to_image.py: XPU OOM detection + tiled decode - textual_inversion.py: .to() short-circuit fix - zh-CN.json: Simplified Chinese translations - scripts/patch_xpu.py: upstream-aware XPU patching tool - scripts/sync_and_patch.py: automated upstream sync + patching Tested on Intel Arc A730M with torch 2.13.0+xpu, IPEX 2.10.0
wesd6r
force-pushed
the
intel-gpu-support
branch
from
August 3, 2026 13:14
486ae5b to
94fb26b
Compare
- 8d (_get_vram_in_use): match from elif mps onwards (upstream has long comment block between 'if cuda:' and 'return' that broke the old pattern) - 8f (_log_cache_state): match the upstream ternary pattern 'allocated = (... if cuda else 0)' instead of the removed direct call - Both fixes verified against origin/main upstream code
- Add fork-specific title, description, and badges - Add Quick Start guide for Intel Arc GPU installation - Add complete list of 31 patched files - Add sync_and_patch.py workflow documentation - Add known limitations section - Keep original InvokeAI content at bottom - Update badge URLs to point to wesd6r/InvokeAI
- README.md: restore English version + add language switch link - README-zh_CN.md: complete Chinese translation with accurate patch data - 54 patches / 28 files documented with detailed categories - Test status table with actual A730M benchmark results - Full upstream InvokeAI content preserved
- Updated from origin/main (Weblate PR invoke-ai#9445, 2026-08-02) - New section: systemPrompts (17 keys) - Expanded: parameters (+18), popovers (+14), toast (+14), gallery (+9), modelManager (+8) - Total: 2914 translation keys across 35 sections
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary / 概述
This PR adds Intel Arc GPU (XPU/iGPU) support to InvokeAI, enabling image generation on Intel discrete and integrated GPUs via Intel Extension for PyTorch (IPEX).
本 PR 为 InvokeAI 添加 Intel Arc GPU(XPU/集显)支持,通过 Intel Extension for PyTorch (IPEX) 实现在 Intel 独立和集成显卡上生成图像。
Based on the community effort by ilmarille-prog/InvokeAI_intelGPU, ported and updated to the latest InvokeAI codebase.
基于 ilmarille-prog/InvokeAI_intelGPU 的社区工作,移植并更新到最新 InvokeAI 代码库。
Motivation / 动机
InvokeAI currently supports CUDA (NVIDIA) and MPS (Apple Silicon) GPUs but has no path for Intel GPU users. Intel Arc GPUs (A-series, Pro B-series, and newer integrated Arc graphics) expose a PyTorch backend via
torch.xputhrough IPEX. This PR integrates XPU support with minimal, non-invasive changes so that Intel GPU users can run InvokeAI without maintaining a separate fork.InvokeAI 目前支持 CUDA(NVIDIA)和 MPS(Apple Silicon)GPU,但没有 Intel GPU 用户的使用路径。Intel Arc GPU(A 系列、Pro B 系列及更新的集成 Arc 显卡)通过 IPEX 提供
torch.xpu后端。本 PR 以最小化、非侵入的方式集成 XPU 支持,使 Intel GPU 用户无需维护单独的分支即可运行 InvokeAI。Changes / 改动
Core device abstraction / 核心设备抽象 (
devices.py)_is_xpu_available()helper (guarded withhasattrfor safety on non-IPEX systems)_is_xpu_available()辅助函数(通过hasattr保护,确保无 IPEX 时安全运行)choose_torch_device()auto-selectsxpuwhen available and CUDA is notchoose_torch_device()在 XPU 可用且 CUDA 不可用时自动选择xpuchoose_torch_dtype()defaults XPU tofloat16choose_torch_dtype()XPU 默认使用float16empty_cache()includestorch.xpu.empty_cache()empty_cache()包含torch.xpu.empty_cache()Configuration / 配置 (
config_default.py)xputo the valid device pattern:^(auto|cpu|mps|cuda|xpu)(:\d+)?$xpu添加到有效设备模式:^(auto|cpu|mps|cuda|xpu)(:\d+)?$Attention & pipeline / 注意力与推理管线 (
diffusers_pipeline.py,attention.py)torch-sdporslicedattentiontorch-sdp或sliced注意力Model cache / 模型缓存 (
model_cache.py)torch.xpu.mem_get_info()andtorch.xpu.memory_allocated()for XPU VRAM trackingtorch.xpu.mem_get_info()和torch.xpu.memory_allocated()进行 XPU 显存追踪xformers compatibility / xformers 兼容性 (
hotfixes.py)diffusersto returnFalseforis_xformers_availableon XPU devicesdiffusers使其在 XPU 设备上返回False,防止加载不兼容的 xformersImage utilities / 图像工具
depth_anything,grounding_dino,segment_anything,segment_anything_2,pbr_maps: Allowxpuas valid devicexpu作为有效设备dw_openpose: Added comment noting ONNX Runtime XPU limitation (falls back to CPU)dw_openpose:添加注释说明 ONNX Runtime XPU 限制(回退到 CPU)Documentation / 文档
INSTALL_INTEL.md: Step-by-step Windows installation guide for Intel GPU usersINSTALL_INTEL.md:Intel GPU 用户的 Windows 分步安装指南Design principles / 设计原则
所有改动都是新增的——不修改现有的 CUDA/MPS/CPU 路径。
torch.xpucall is wrapped inhasattr(torch, "xpu")checks so the code runs safely on systems without IPEX.每个
torch.xpu调用都用hasattr(torch, "xpu")检查包裹,确保在没有 IPEX 的系统上安全运行。torch.xpuAPIs which gracefully no-op when absent.IPEX 是可选的安装时依赖;代码本身只引用
torch.xpuAPI,缺失时自动跳过。Testing / 测试
torch.xpuAPI calls are guarded for non-IPEX environmentstorch.xpuAPI 调用均已针对非 IPEX 环境做了保护Related / 相关项目