3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-15 03:25:43 +00:00
z3/src/solver
Copilot efe5e946f1
Fix unsigned overflow in parallel solver conflict budget escalation (#10076)
Z3 4.16.0 introduced a cube-and-conquer parallel solver that regressed
easy QF_LIRA problems from <1s to hanging indefinitely. Workers start
with a 1000-conflict budget and multiply by 1.5× on each timeout, but
after ~38 escalations the `unsigned` cast overflows, causing the budget
to oscillate chaotically (e.g. 3.27B → 618M → 927M → … never reaching a
stable large value). For sub-cubes that require more conflicts than any
value in the oscillation window, the worker loops forever.

## Changes

- **`src/smt/smt_parallel.h`** – `update_max_thread_conflicts()`:
replace raw `(unsigned)(mul * val)` cast with saturating arithmetic that
caps at `UINT_MAX`, eliminating the UB and the oscillation:
  ```cpp
// Before – UB when product > UINT_MAX, budget oscillates after ~38
escalations
  m_config.m_threads_max_conflicts =
(unsigned)(m_config.m_max_conflict_mul *
m_config.m_threads_max_conflicts);

  // After – saturates at UINT_MAX
double next = m_config.m_max_conflict_mul *
m_config.m_threads_max_conflicts;
m_config.m_threads_max_conflicts = (next >= (double)UINT_MAX) ? UINT_MAX
: (unsigned)next;
  ```

- **`src/solver/parallel_tactical.cpp`** – Identical
saturating-arithmetic fix in the `parallel_tactical2` worker's
`update_max_thread_conflicts()`, which is the code path actually
exercised for QF_LIRA problems.

- **`src/smt/smt_parallel.cpp`** – Worker's initial per-cube conflict
budget is now sourced from `m_smt_params.m_threads_max_conflicts` (the
user-visible `smt.threads.max_conflicts` parameter) instead of being
hardcoded to 1000, so users who leave the parameter at its default get
an unlimited initial budget matching Z3 4.12.x portfolio behaviour.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-07-10 15:25:57 -07:00
..
assertions fix pattern inference to deal with binders properly, pin sorts in tptp_frontend 2026-07-08 15:29:05 -07:00
check_logic.cpp stop complaining abot Char in QF_S benchmarks 2026-07-04 14:27:34 -07:00
check_logic.h debug arith/mbi 2020-11-02 12:13:19 -08:00
check_sat_result.cpp refactor solver to include settable stats 2026-06-07 14:17:38 -07:00
check_sat_result.h refactor solver to include settable stats 2026-06-07 14:17:38 -07:00
CMakeLists.txt Parallel tactic (#9824) (#9825) 2026-06-26 10:36:15 -06:00
combined_solver.cpp refactor solver to include settable stats 2026-06-07 14:17:38 -07:00
combined_solver.h booyah 2020-07-04 15:56:30 -07:00
combined_solver_params.pyg solver factories, cleanup solver API, simplified strategic solver, added combined solver 2012-12-11 17:47:27 -08:00
mus.cpp Remove copies (#8583) 2026-02-18 21:02:22 -08:00
mus.h booyah 2020-07-04 15:56:30 -07:00
parallel_params.pyg Parallel tactic (#9824) (#9825) 2026-06-26 10:36:15 -06:00
parallel_tactical.cpp Fix unsigned overflow in parallel solver conflict budget escalation (#10076) 2026-07-10 15:25:57 -07:00
parallel_tactical.h Parallel tactic (#9824) (#9825) 2026-06-26 10:36:15 -06:00
preferred_value_propagator.h Remove redundant non-virtual destructors with = default (#8462) 2026-02-18 20:58:01 -08:00
progress_callback.h Use = default for virtual constructors. 2022-08-05 18:11:46 +03:00
simplifier_solver.cpp refactor solver to include settable stats 2026-06-07 14:17:38 -07:00
simplifier_solver.h Add simplification customization for SMTLIB2 2023-01-30 22:38:51 -08:00
slice_solver.cpp refactor solver to include settable stats 2026-06-07 14:17:38 -07:00
slice_solver.h A slice solver option for interactive use case 2024-10-08 09:24:52 -07:00
smt_logics.cpp benchmark patching 2026-05-20 13:32:23 -07:00
smt_logics.h SMT2 front-end: accept HO_ALL and normalize curried expression-head applications (#9636) 2026-05-26 18:39:38 -07:00
solver.cpp #7468 - add option (get-info :parameters) to display solver parameters that were updated globally and distinct from defaults 2025-02-10 11:57:14 -08:00
solver.h Parallel tactic (#9824) (#9825) 2026-06-26 10:36:15 -06:00
solver2tactic.cpp Standardize for-loop increments to prefix form (++i) (#8199) 2026-02-18 20:57:29 -08:00
solver2tactic.h move model and proof converters to self-contained module 2022-11-03 05:23:01 -07:00
solver_na2as.cpp display assumptions used 2025-09-11 10:20:55 -07:00
solver_na2as.h remove default destructors & some default constructors 2024-09-04 22:30:23 +01:00
solver_pool.cpp refactor solver to include settable stats 2026-06-07 14:17:38 -07:00
solver_pool.h booyah 2020-07-04 15:56:30 -07:00
solver_preprocess.cpp move smt params to params directory, update release.yml 2025-06-09 10:47:22 -07:00
solver_preprocess.h add unconstrained elimination for sequences 2023-03-20 17:07:04 +01:00
tactic2solver.cpp refactor solver to include settable stats 2026-06-07 14:17:38 -07:00
tactic2solver.h booyah 2020-07-04 15:56:30 -07:00