Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions StabilityMatrix.Core/Models/Packages/InvokeAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ IRocmPackageHelper rocmPackageHelper
];

public override IEnumerable<TorchIndex> AvailableTorchIndices =>
[TorchIndex.Cpu, TorchIndex.Cuda, TorchIndex.Rocm, TorchIndex.Mps];
[TorchIndex.Cpu, TorchIndex.Cuda, TorchIndex.Ipex, TorchIndex.Rocm, TorchIndex.Mps];

public override PyVersion RecommendedPythonVersion => Python.PyInstallationManager.Python_3_12_10;

Expand Down Expand Up @@ -244,6 +244,7 @@ public override async Task InstallPackage(
TorchIndex.Cuda when isLegacyNvidiaGpu => "https://download.pytorch.org/whl/cu126",
TorchIndex.Cuda => "https://download.pytorch.org/whl/cu128",
TorchIndex.Rocm when Compat.IsLinux => "https://download.pytorch.org/whl/rocm7.2",
TorchIndex.Ipex when Compat.IsLinux || Compat.IsWindows => "https://download.pytorch.org/whl/xpu",
_ => string.Empty,
};

Expand All @@ -264,9 +265,10 @@ public override async Task InstallPackage(
Compat.IsWindows ? "win32"
: Compat.IsMacOS ? "darwin"
: "linux";
var index = pins?["torchIndexUrl"]?[platform]?[
torchVersion.ToString().ToLowerInvariant()
]?.GetValue<string>();
// InvokeAI's pins.json calls the Intel Arc PyTorch index "xpu"; TorchIndex names it Ipex.
var torchIndexKey =
torchVersion == TorchIndex.Ipex ? "xpu" : torchVersion.ToString().ToLowerInvariant();
var index = pins?["torchIndexUrl"]?[platform]?[torchIndexKey]?.GetValue<string>();

if (isSupportedWindowsRocmInstall)
{
Expand Down
57 changes: 57 additions & 0 deletions StabilityMatrix.Tests/Models/Packages/InvokeAITorchIndexTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System.Linq;
using NSubstitute;
using StabilityMatrix.Core.Helper;
using StabilityMatrix.Core.Helper.Cache;
using StabilityMatrix.Core.Helper.HardwareInfo;
using StabilityMatrix.Core.Models;
using StabilityMatrix.Core.Models.Packages;
using StabilityMatrix.Core.Models.Settings;
using StabilityMatrix.Core.Python;
using StabilityMatrix.Core.Services;
using StabilityMatrix.Core.Services.Rocm;

namespace StabilityMatrix.Tests.Models.Packages;

[TestClass]
public class InvokeAITorchIndexTests
{
[TestMethod]
public void OffersIpexTorchIndex()
{
var invoke = new InvokeAI(
Substitute.For<IGithubApiCache>(),
Substitute.For<ISettingsManager>(),
Substitute.For<IDownloadService>(),
Substitute.For<IPrerequisiteHelper>(),
Substitute.For<IPyInstallationManager>(),
Substitute.For<IPipWheelService>(),
Substitute.For<IRocmPackageHelper>()
);

CollectionAssert.Contains(invoke.AvailableTorchIndices.ToList(), TorchIndex.Ipex);
}

[TestMethod]
public void RecommendsIpexForIntelArc()
{
if (Compat.IsMacOS)
{
Assert.Inconclusive("Intel Arc is not a macOS backend.");
}

var settings = Substitute.For<ISettingsManager>();
settings.Settings.Returns(new Settings { PreferredGpu = new GpuInfo { Name = "Intel Arc A730M" } });

var invoke = new InvokeAI(
Substitute.For<IGithubApiCache>(),
settings,
Substitute.For<IDownloadService>(),
Substitute.For<IPrerequisiteHelper>(),
Substitute.For<IPyInstallationManager>(),
Substitute.For<IPipWheelService>(),
Substitute.For<IRocmPackageHelper>()
);

Assert.AreEqual(TorchIndex.Ipex, invoke.GetRecommendedTorchVersion());
}
}
2 changes: 1 addition & 1 deletion docs/advanced/hardware-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ IPEX is the Intel Extension for PyTorch, targeting Intel's discrete and integrat
- Recommends IPEX when an Intel Arc GPU is detected and the package supports it.
- For SD.Next, the Intel path runs the package's own `--use-ipex` install/launch flow.
- **Caveats:** Because detection keys off the "Arc" name, older non-Arc Intel integrated graphics are not recognized as IPEX-capable.
- **Packages:** ComfyUI and SD.Next list IPEX support.
- **Packages:** ComfyUI, InvokeAI and SD.Next list IPEX support.

## Apple Silicon (MPS)

Expand Down
Loading