⚡️ Improve DD table hashing and capacity growth - #2561
Open
burgholzer wants to merge 1 commit into
Open
burgholzer wants to merge 1 commit into
burgholzer wants to merge 1 commit into
Conversation
Mix pointer operands before masking binary compute-table hashes so aligned node addresses do not waste cache buckets. Allow unique-table levels to grow independently without moving canonical nodes. Keep growth opt-in through a per-level bucket ceiling and retain grown capacities across reset. Reuse level initialization when constructing a unique table, and cover rehashing, roots, collection, and fixed hashing. Assisted-by: GPT-6 via Codex
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
🤖 AI text below 🤖
Description
Aligned node addresses can leave binary compute-table buckets unused, while
fixed unique-table directories waste memory on sparse levels and build long
chains on crowded levels. Mix pointer hashes with the existing
murmur64function and add bounded, per-level unique-table growth without moving nodes.
Growth remains opt-in through
DDPackageConfig::utMaxNumBucket(zero bydefault). Initial capacities and other compute-table defaults are unchanged.
Capacities must be powers of two; a nonzero ceiling must cover both initial
unique-table sizes. Grown directories survive collection and reset. Bucket
views can be invalidated by insertion, but canonical nodes and owned roots
remain stable. No new dependencies or migration are required.
For example, this profile starts small and grows populated levels:
For a 4,096-qubit zero state, this reduces unique bucket storage from 2,048 to
64 MiB. Larger multiplication caches remain an explicit choice through the
existing
ctMatVecMultNumBucketfield.Exploration against main at
dc78630f9d6f56a4cd1456ffa11502e12c07ec39(unchanged DD sources at this PR's base) used Clang 23 release builds on a DGX
Spark. Three runs per setting measured direct all-pairs RZZ twisting on 64
qubits at a median 1.896 s upstream versus 0.426 s with this profile and a
262,144-entry matrix-vector cache. Compiler overlap, mixed results on other
workloads, and one dense candidate timeout limit timing conclusions; this PR
does not change the default capacity profile.
Validation: all 194 native DD tests pass, covering rehashing, canonical identity,
owned roots, collection/reset, constructor levels, invalid capacities, and fixed
hashing before level allocation. Repository lint and C++ lint pass. Existing
upstream compiler/header diagnostics are unchanged. The complexity review
removed duplicate constructor setup by reusing
UniqueTable::resize.Codex assisted with implementation, review, validation, and this description.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).