Repository navigation
Add scoped GPI posting controls and fix CBS cache removal - #257
Merged
Merged
Conversation
zayenz
marked this pull request as ready for review
October 14, 2026 09:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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::NoGPIkeeps information for newly posted propagators in the space, so it is released with the space.The matching
Space::UseGPIscope enables global information for selected postings inside aNoGPIscope. This lets theopen-cpbranch run materialization underNoGPIwhile 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
NoGPIretain 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.Support::uptrint_tinsupport/int-type.hppcentralizes unsigned pointer encodings. It selectsstd::uintptr_twhen available, otherwise the unsigned counterpart ofptrdiff_t, with a compile-time width check. The type is used by pointer helpers, tracing, range-list and view-value graph links, compact-table status, and Gist. Actual pointer differences retain signed types, and the existing tag-output API stays compatible.Support::funmark<2>(p)clears both GPI tag bits; existing calls default to one bit.Unsigned masks follow Core Guidelines ES.101. Tagging still assumes unused low alignment bits in the target's pointer representation, a limitation discussed in WG21's pointer-tagging proposal. The type comment records that assumption; Debug builds also check that joining a tag does not overwrite set pointer bits.
The
no_gpiflag sits after the CBS variable counter to use its alignment padding. On the tested arm64 build, this keepsSpaceat 296 bytes with CBS enabled. Without CBS, the flag increasesSpacefrom 288 to 296 bytes.This PR also fixes the CBS failure. Cache cleanup erased the current
unordered_mapentry inside a range loop, then incremented the invalid iterator. The loop now continues with the iterator returned byerase. 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:
node.cpppassed Qt syntax checks with both integer selections. The GUI was not exercised. Selected clang-tidy checks produced no new diagnostics; the five tuple-set diagnostics also reproduce on main.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 three measured pairs, alternating execution order. Magic square used a one-million-node budget; QCP used 100,000 nodes. Times include model construction and search.Search statistics matched in every pair, covering 6.6 million nodes per variant across the measured runs. These four cases show no consistent slowdown. Individual paired ratios ranged from 0.9404 to 1.0284; with three pairs per case, the small median differences do not establish a speedup. Timings include the pointer encoding cleanup.
For reproduction, the common options were
-mode stat -threads 1 -solutions 0 -interrupt false, with-branching afc-sizefor magic square and-branching afcfor QCP. Instance, decay, and node limits are given above.