- Added mitigation for when the mapping from physical cores to logical cores failed

- Changed the version number to (probably) reflect the release version
This commit is contained in:
sp00n 2025-04-06 00:00:08 +02:00
parent 298526378c
commit 85d2aeb680
2 changed files with 31 additions and 10 deletions

View File

@ -153,6 +153,11 @@ namespace ryzen_smu_cli
{ {
Dictionary<int, int> mappedCores = []; Dictionary<int, int> mappedCores = [];
int maxTries = 3;
for (int currentTry = 1; currentTry <= maxTries; currentTry++)
{
mappedCores.Clear();
int logicalCoreIter = 0; int logicalCoreIter = 0;
for (var i = 0; i < ryzen.info.topology.physicalCores; i++) for (var i = 0; i < ryzen.info.topology.physicalCores; i++)
@ -161,7 +166,22 @@ namespace ryzen_smu_cli
if (ryzen.GetPsmMarginSingleCore((uint) (((mapIndex << 8) | ((i % 8) & 0xF)) << 20)) != null) if (ryzen.GetPsmMarginSingleCore((uint) (((mapIndex << 8) | ((i % 8) & 0xF)) << 20)) != null)
{ {
mappedCores.Add(logicalCoreIter, i); mappedCores.Add(logicalCoreIter, i);
logicalCoreIter += 1; logicalCoreIter++;
}
}
// The mapped cores should match the amount of physical cores
if (mappedCores.Count == ryzen.info.topology.cores)
{
break;
}
// Something weird is happening if we cannot find the logical cores for all the physical ones even after three attempts
if (currentTry >= maxTries)
{
Console.Error.WriteLine($"Did not find the expected amount of cores for mapping ({ryzen.info.topology.cores} expected but found only {mappedCores.Count})!");
Environment.Exit(8);
} }
} }
@ -243,6 +263,7 @@ namespace ryzen_smu_cli
Environment.Exit(3); Environment.Exit(3);
} }
string validArgFormat = @"^(-?\d{1,2}(,-?\d{1,2})*|\d{1,2}:-?\d{1,2}(,\d{1,2}:-?\d{1,2})*)$"; string validArgFormat = @"^(-?\d{1,2}(,-?\d{1,2})*|\d{1,2}:-?\d{1,2}(,\d{1,2}:-?\d{1,2})*)$";
if (!Regex.IsMatch(offsetArgs, validArgFormat)) if (!Regex.IsMatch(offsetArgs, validArgFormat))

View File

@ -6,7 +6,7 @@
<RootNamespace>ryzen_smu_cli</RootNamespace> <RootNamespace>ryzen_smu_cli</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Version>0.1.2</Version> <Version>0.0.3</Version>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>