Skip to content

Commit

Permalink
Multithreaded TT clearing now actually uses more than 1 thread
Browse files Browse the repository at this point in the history
bench: 5142788
  • Loading branch information
liamt19 committed Sep 3, 2024
1 parent 4d426b7 commit bcb7325
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
17 changes: 7 additions & 10 deletions Logic/UCI/UCIClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -510,22 +510,19 @@ private void HandleSetOption(string optName, string optValue)
{
if (newValue >= opt.MinValue && newValue <= opt.MaxValue)
{
opt.FieldHandle.SetValue(null, newValue);

if (opt.Name == nameof(Threads))
{
GlobalSearchPool.Resize(newValue);
GlobalSearchPool.Resize(SearchOptions.Threads);
LogString("Changed '" + key + "' from " + prevValue + " to " + GlobalSearchPool.ThreadCount);
}
else
if (opt.Name == nameof(Hash))
{
opt.FieldHandle.SetValue(null, newValue);

if (opt.Name == nameof(Hash))
{
GlobalSearchPool.TTable.Initialize(Hash);
}

LogString("Changed '" + key + "' from " + prevValue + " to " + opt.FieldHandle.GetValue(null));
GlobalSearchPool.TTable.Initialize(SearchOptions.Hash);
}

LogString("Changed '" + key + "' from " + prevValue + " to " + opt.FieldHandle.GetValue(null));
}
else
{
Expand Down
5 changes: 4 additions & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ private static void DoInputLoop()
else if (input.StartsWithIgnoreCase("threads"))
{
if (int.TryParse(param[1], out int threadCount))
GlobalSearchPool.Resize(threadCount);
{
Threads = threadCount;
GlobalSearchPool.Resize(Threads);
}
}
else if (input.StartsWithIgnoreCase("multipv"))
{
Expand Down

0 comments on commit bcb7325

Please sign in to comment.