Merge solver code with static interface

- Breaks backwards compat solver code with last version. Concurrent broke backwards compat because of race conditions with rng, but single is now broken too, despite it being 2x faster (!!!!)
- Literally twice as fast as Rust now in single thread
- Concurrent doesn't work yet, deadlocks somewhere..?
This commit is contained in:
Asriel Camora
2023-07-07 09:58:47 +02:00
parent 2894867195
commit d5a8288439
9 changed files with 332 additions and 145 deletions
+8 -1
View File
@@ -9,10 +9,17 @@ public struct NodeScores
public float MaxScore;
public int Visits;
public void Visit(float score)
public void VisitConcurrent(float score)
{
Intrinsics.CASAdd(ref ScoreSum, score);
Intrinsics.CASMax(ref MaxScore, score);
Interlocked.Increment(ref Visits);
}
public void Visit(float score)
{
ScoreSum += score;
MaxScore = Math.Max(MaxScore, score);
Visits++;
}
}