sat: backport from main

This commit is contained in:
Corentin Le Molgat
2025-09-22 17:24:20 +02:00
parent 8df4d12bbf
commit b05315de21
59 changed files with 1904 additions and 1006 deletions

View File

@@ -235,7 +235,7 @@ void NonDeterministicLoop(std::vector<std::unique_ptr<SubSolver>>& subsolvers,
// TODO(user): We could also directly register callback to set stopping
// Boolean to false in a few places.
if (!condition) {
mutex.Unlock();
mutex.unlock();
SynchronizeAll(subsolvers);
continue;
}
@@ -243,7 +243,7 @@ void NonDeterministicLoop(std::vector<std::unique_ptr<SubSolver>>& subsolvers,
// The stopping condition is that we do not have anything else to generate
// once all the task are done and synchronized.
if (num_in_flight == 0) all_done = true;
mutex.Unlock();
mutex.unlock();
}
SynchronizeAll(subsolvers);
@@ -251,7 +251,7 @@ void NonDeterministicLoop(std::vector<std::unique_ptr<SubSolver>>& subsolvers,
{
// We need to do that while holding the lock since substask below might
// be currently updating the time via AddTaskDuration().
const absl::MutexLock mutex_lock(&mutex);
const absl::MutexLock mutex_lock(mutex);
ClearSubsolversThatAreDone(num_in_flight_per_subsolvers, subsolvers);
best = NextSubsolverToSchedule(subsolvers, /*deterministic=*/false);
if (VLOG_IS_ON(1) && time_limit->LimitReached()) {
@@ -283,7 +283,7 @@ void NonDeterministicLoop(std::vector<std::unique_ptr<SubSolver>>& subsolvers,
// Schedule next task.
subsolvers[best]->NotifySelection();
{
absl::MutexLock mutex_lock(&mutex);
absl::MutexLock mutex_lock(mutex);
num_in_flight++;
num_in_flight_per_subsolvers[best]++;
}
@@ -295,7 +295,7 @@ void NonDeterministicLoop(std::vector<std::unique_ptr<SubSolver>>& subsolvers,
timer.Start();
task();
const absl::MutexLock mutex_lock(&mutex);
const absl::MutexLock mutex_lock(mutex);
DCHECK(subsolvers[best] != nullptr);
DCHECK_GT(num_in_flight_per_subsolvers[best], 0);
num_in_flight_per_subsolvers[best]--;