Skip to content
Draft
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
14 changes: 11 additions & 3 deletions StabilityMatrix.Core/Helper/Factory/PackageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using StabilityMatrix.Core.Models.Packages;
using StabilityMatrix.Core.Python;
using StabilityMatrix.Core.Services;
using StabilityMatrix.Core.Services.Rocm;

namespace StabilityMatrix.Core.Helper.Factory;

Expand All @@ -18,6 +19,7 @@ public class PackageFactory : IPackageFactory
private readonly IUvManager uvManager;
private readonly IPyInstallationManager pyInstallationManager;
private readonly IPipWheelService pipWheelService;
private readonly IRocmPackageHelper rocmPackageHelper;
Comment thread
NeuralFault marked this conversation as resolved.

/// <summary>
/// Mapping of package.Name to package
Expand All @@ -32,16 +34,20 @@ public PackageFactory(
IPrerequisiteHelper prerequisiteHelper,
IPyInstallationManager pyInstallationManager,
IPyRunner pyRunner,
IPipWheelService pipWheelService
IUvManager uvManager,
IPipWheelService pipWheelService,
IRocmPackageHelper rocmPackageHelper
)
{
this.githubApiCache = githubApiCache;
this.settingsManager = settingsManager;
this.downloadService = downloadService;
this.prerequisiteHelper = prerequisiteHelper;
this.pyRunner = pyRunner;
this.uvManager = uvManager;
this.pyInstallationManager = pyInstallationManager;
this.pipWheelService = pipWheelService;
this.rocmPackageHelper = rocmPackageHelper;
this.basePackages = basePackages.ToDictionary(x => x.Name);
}

Expand All @@ -55,7 +61,8 @@ public BasePackage GetNewBasePackage(InstalledPackage installedPackage)
downloadService,
prerequisiteHelper,
pyInstallationManager,
pipWheelService
pipWheelService,
rocmPackageHelper
),
"Fooocus" => new Fooocus(
githubApiCache,
Expand Down Expand Up @@ -280,7 +287,8 @@ public BasePackage GetNewBasePackage(InstalledPackage installedPackage)
downloadService,
prerequisiteHelper,
pyInstallationManager,
pipWheelService
pipWheelService,
rocmPackageHelper
),
_ => throw new ArgumentOutOfRangeException(nameof(installedPackage)),
};
Expand Down
25 changes: 18 additions & 7 deletions StabilityMatrix.Core/Helper/HardwareInfo/GpuInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace StabilityMatrix.Core.Helper.HardwareInfo;
using StabilityMatrix.Core.Models.Rocm;

namespace StabilityMatrix.Core.Helper.HardwareInfo;

public record GpuInfo
{
Expand Down Expand Up @@ -62,11 +64,7 @@ public bool IsLegacyNvidiaGpu()

public bool IsWindowsRocmSupportedGpu()
{
var gfx = GetAmdGfxArch();
if (gfx is null)
return false;

return gfx.StartsWith("gfx110") || gfx.StartsWith("gfx120") || gfx.Equals("gfx1151");
return WindowsRocmSupport.IsSupportedGpu(this);
}

public bool IsAmd => Name?.Contains("amd", StringComparison.OrdinalIgnoreCase) ?? false;
Expand All @@ -84,7 +82,7 @@ public bool IsWindowsRocmSupportedGpu()
return name switch
{
// RDNA4
_ when Has("R9700") || Has("9070") => "gfx1201",
_ when Has("R9700") || Has("R9600") || Has("9070") => "gfx1201",
_ when Has("9060") => "gfx1200",

// RDNA3.5 APUs
Expand Down Expand Up @@ -112,6 +110,9 @@ _ when Has("660M") || Has("680M") => "gfx1035",
_ when Has("6300") || Has("6400") || Has("6450") || Has("6500") || Has("6550") || Has("6500M") =>
"gfx1034",

// RDNA2 Steam Deck APU
_ when Has("Van Gogh") || Has("Sephiroth") => "gfx1033",

// RDNA2 Navi23
_ when Has("6600") || Has("6650") || Has("6700S") || Has("6800S") || Has("6600M") => "gfx1032",

Expand All @@ -121,6 +122,16 @@ _ when Has("6700") || Has("6750") || Has("6800M") || Has("6850M") => "gfx1031",
// RDNA2 Navi21 (big die)
_ when Has("6800") || Has("6900") || Has("6950") => "gfx1030",

// RDNA1 Navi10 XT (incl. Pro card)
_ when Has("5600") || Has("5700") || Has("v520") => "gfx1010",

// RDNA1 Navi10 XTX
_ when Has("5500") => "gfx1012",

// Vega/GCN5 Dedicated GPUs
_ when Has("pro vii") || HasNoSpace("provii") => "gfx90X",
_ when Has("rx vega") || Has("vega 64") || Has("vega 56") || Has("vega frontier") => "gfx900",
_ when Has("radeon vii") || HasNoSpace("radeonvii") => "gfx906",
_ => null,
};

Expand Down
6 changes: 3 additions & 3 deletions StabilityMatrix.Core/Helper/HardwareInfo/HardwareHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Microsoft.Win32;
using NLog;
using StabilityMatrix.Core.Extensions;
using StabilityMatrix.Core.Models.Rocm;

namespace StabilityMatrix.Core.Helper.HardwareInfo;

Expand Down Expand Up @@ -316,12 +317,11 @@ public static bool HasAmdGpu()
return IterGpuInfo().Any(gpu => gpu.IsAmd);
}

public static bool HasWindowsRocmSupportedGpu() =>
IterGpuInfo().Any(gpu => gpu is { IsAmd: true, Name: not null } && gpu.IsWindowsRocmSupportedGpu());
public static bool HasWindowsRocmSupportedGpu() => IterGpuInfo().Any(WindowsRocmSupport.IsSupportedGpu);

public static GpuInfo? GetWindowsRocmSupportedGpu()
{
return IterGpuInfo().FirstOrDefault(gpu => gpu.IsWindowsRocmSupportedGpu());
return IterGpuInfo().FirstOrDefault(WindowsRocmSupport.IsSupportedGpu);
}

public static bool HasIntelGpu() => IterGpuInfo().Any(gpu => gpu.IsIntel);
Expand Down
Loading
Loading