⚡️ Improve DD table hashing and capacity growth - #2561
Merged
Merged
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! |
Start unique-table levels with 1,024 buckets and grow them to a ceiling of 1,048,576. Fixed capacity uses equal initial and maximum sizes, so hashing and validation no longer need a zero-capacity sentinel. Mix pointer hashes in unary compute tables as well as binary tables. Cover default growth, fixed sizing, invalid ceilings, and aligned-key cache lookup and invalidation. Assisted-by: GPT-6 via Codex
burgholzer
commented
Sep 17, 2026
burgholzer
left a comment
Member
Author
There was a problem hiding this comment.
Getting this in now. This is quite a measurable improvement in memory and runtime performance across the board.
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 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 inboth binary and unary compute tables. Let populated unique-table levels grow
independently without moving canonical nodes.
Vector and matrix unique tables now start with 1,024 buckets per level and
grow up to 1,048,576, using the general profile selected in the table study.
DDPackageConfig::utMaxNumBucketsets the ceiling. Initial and maximumcapacities must be powers of two; the maximum must cover both initial sizes.
Equal initial and maximum capacities give fixed sizing without a zero sentinel.
Grown directories survive collection and reset. Bucket views can be invalidated
by insertion, but canonical nodes and owned roots remain stable.
UniqueTable::hashrequires an allocated level. Custom initial capacities abovethe default ceiling require a correspondingly larger maximum. No dependencies
were added.
For a 4,096-qubit zero state, default unique bucket storage falls from 2,048 to
64 MiB. The matrix-vector compute cache remains at 16,384 entries: the tested
262,144-entry option helped some reuse-heavy workloads but had mixed timing
results. Real-number canonicalization is unchanged; its sorted buckets and
tolerance-based boundary matching require a separate growth implementation.
Validation: all 196 native DD tests pass, including automatic default growth,
fixed sizing, invalid ceilings, canonical identity, owned roots, collection/reset,
and unary cache lookup/invalidation with aligned keys. On this host, the focused
unary check occupied 1 of 64 buckets before mixing and 39 of 64 afterward.
Repository lint and C++ lint pass. Existing upstream build diagnostics remain.
Codex assisted with implementation, review, validation, and this description.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).