Skip to content

Add scoped GPI posting controls and fix CBS cache removal - #257

Open
zayenz wants to merge 3 commits into
mainfrom
feature/no-gpi
Open

zayenz wants to merge 3 commits into
mainfrom
feature/no-gpi

Conversation

@zayenz

@zayenz zayenz commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Posting propagators during search can leave their global propagator information (GPI) allocated after the space is deleted. Repeated posting can therefore retain information for propagators that no longer exist. Space::NoGPI keeps information for newly posted propagators in the space, so it is released with the space.

The matching Space::UseGPI scope enables global information for selected postings inside a NoGPI scope. This lets the open-cp branch run materialization under NoGPI while allowing users to opt in where they need GPI. Both scopes restore the previous setting when they exit, including on exceptions. The materialization call itself is outside this PR.

Propagators posted under NoGPI retain normal IDs and groups, but their AFC stays zero. Cloning copies their information, and group changes stay local to each space. Rewriting preserves the original propagator's information regardless of the active scope. Ordinary GPI posting remains the default, including in newly cloned spaces.

The no_gpi flag sits after the CBS variable counter to use its alignment padding. On the tested arm64 build, this keeps Space at 296 bytes with CBS enabled. Without CBS, the flag increases Space from 288 to 296 bytes.

This PR also fixes the CBS failure. Cache cleanup erased the current unordered_map entry inside a range loop, then incremented the invalid iterator. The loop now continues with the iterator returned by erase. The regression test reproduces the original assertion and checks all 576 solutions of two independent permutations, with and without GPI. Changelog entries cover both changes.

Validation uses the Gecode test infrastructure:

  • Release without CBS: 449 check cases passed.
  • Debug with CBS, ASan, and UBSan: 450 check cases and 23 fault cases passed.
  • After the field relocation, both builds passed the focused AFC and group tests twice, plus the CBS regression where enabled: 14 cases without CBS and 15 with CBS.
  • Dense and sparse integer brancher tests passed, including AFC selection. Selected clang-tidy checks reported no findings.

The AFC benchmarks compare ordinary posting against main (8df771e51a) using matching Release builds without CBS. Each case ran serially with one search thread, one warmup pair, and seven measured pairs, alternating execution order. Magic square used a one-million-node budget; QCP used 100,000 nodes. Times include model construction and search.

Workload Decay Main median (ms) PR median (ms) Median paired PR/main ratio
Magic square, size 7 1.0 1804.701 1801.107 0.9993
Magic square, size 7 0.99 1847.137 1833.188 0.9932
QCP 30-374-1 0.99 4041.157 4069.129 1.0055
QCP 30-375-21 0.95 4466.529 4500.194 1.0060

Search statistics matched in every pair, covering 15.4 million nodes per variant across the measured runs. These four cases show no consistent slowdown. Individual paired ratios ranged from 0.8783 to 1.0143, so the small median differences do not establish a speedup or regression. Timings are from ef525f1692, before the field relocation.

For reproduction, the common options were -mode stat -threads 1 -solutions 0 -interrupt false, with -branching afc-size for magic square and -branching afc for QCP. Instance, decay, and node limits are given above.

@zayenz
zayenz marked this pull request as ready for review October 14, 2026 09:35
@zayenz zayenz mentioned this pull request Oct 14, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant