Repository navigation
Conversation
Port SELECT-COPY and balanced packet bank transitions onto the current validated and pruned interpreter, preserving QROM.kernel as a property. Validate chain inputs before XOR and forward packet/budget choices through alias sampling. Add explicit coherent echoes for arbitrary borrowed banks in forced SELECT-SWAP and SELECT-COPY with clean/dirty workspace counts. Document the required inverse sector and chain interleaving contract; provide independent complex-state, downstream consumer and resource tests and a runnable controlled-rotation chain example. Co-authored-by: Scott Thornton <wsttiger@gmail.com> Signed-off-by: Kevin Mato <kmato@nvidia.com>
Replace the per-address walk-count loop with its closed form, so the automatic strategy search is polynomial in the address width (a one-entry 26-bit table took 6.4 s, now milliseconds), filter candidates by the ancilla budget before pricing, keep the winning price and check it against the minted tape, and reject bools for alpha, max_ancillas and block_size. QROMChain accepts any iterable table (numpy arrays included), validates the register widths once, wraps every option error with a chain-level prefix, requires a plain bool for fused, reuses the single lookup of a one-table chain, and builds its naive interior kernels as pair kernels over the step lookups instead of concatenated interpreters. Restore the SELECT-COPY and chain tests from the experimental branch (exhaustive packet readouts, variant agreement, compiled counts for select_copy, the documented formulas and margins, per-step compiled counts, prefix readout, step self-inverse), pin the closed-form prices against the minted tapes for both blocked variants and both bank modes, and share the test helpers already in the suite. Document that auto now returns select_copy for most shapes and may spend more workspace than the earlier default, with max_ancillas as the knob, state the budget and view-width contracts precisely, separate the chain's equivalence condition from its table-value invariant, and list the example and guide in the navigation. Signed-off-by: Kevin Mato <kmato@nvidia.com>
kvmto
force-pushed
the
pr/qrom-select-copy
branch
from
October 13, 2026 22:04
9ae4996 to
44644d5
Compare
kvmto
marked this pull request as ready for review
October 13, 2026 22:14
Signed-off-by: Kevin Mato <kmato@nvidia.com>
Signed-off-by: Kevin Mato <kmato@nvidia.com>
Collaborator
Author
|
@wsttiger Scott, the completion update is now pushed. In addition to the coherent implementation, this adds measurement-assisted SELECT-COPY, retained banks/cached offsets across caller operations, temporary-AND Restore, and known-image output erasure. Could you review this as the follow-up to #64? It reuses #64's foundation; #64 should merge first, after which this branch will be updated against main and revalidated. Local validation on the pushed tree: 299 host tests passed; 982 native tests passed, with 3 optional-dependency skips. The updated description explains the retained-epoch preconditions and logical resource accounting. |
This branch has not been deployed
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.
Add SELECT-COPY QROM and sequential lookup APIs with coherent packets, measured Restore, and a bank retained across caller operations.
QROM(variant="select_copy")supports balancedalphapackets, fused packet transitions, clean or borrowed banks, andmax_ancillas. Coherent auto-selection compares SELECT, SELECT-SWAP, and SELECT-COPY, so callers can set an explicit workspace budget.QROMChainsupplies consecutive XOR-difference steps on a shared clean ladder.AliasSamplingPrepareaccepts the coherent selection options and keeps its PREPARE/adjoint unitary.The adaptive APIs provide:
MeasuredQROM(variant="select_copy")with balancedalphaor fixedpacket_widthpackets, including a shorter remainder. Dirty-bank Restore uses a clean temporary AND, fanout, measurement, and feedback, with one separately budgeted scratch qubit. The borrowed bank is restored and never measured or reset.RetainedQROMChainwithbegin_kernel, all difference-step kernels, andend_kernel. A full-word bank and offset cache stay live; resources include both endpoints and the cache. Address/control computational-basis values must stay fixed and the ladder untouched throughout. Arbitrary output operations preserve XOR-sequence equivalence; zero final output requires initially zero output and interleavings preserving the encoded word.erase_kernelfor a known clean-copy table image, with runtime parity correction and zero output required on inactive-control and padded branches. Independenterase_resourcesand clean/borrowed layouts require separate ladders or proven compatible views; the load budget does not bound erase workspace.controlled=Truesupplies coherent controls; automatic control/adjoint of measured kernels is outside the contract. Whole-cache measurement cleanup remains restricted to clean SELECT-SWAP banks.The planners reuse #64's validation, geometry, operation/resource records, cache-erasure plumbing, and interpreter. Counts separate eligible temporary ANDs from generic Toffolis. The four-T model requires compatible synthesis; it does not establish native-backend synthesis or hardware costs. Guides and examples document the contracts and paper-accounting differences.
Validation: 299 host tests passed; 982 native tests passed, with three optional-dependency skips (OpenFermion/Psi4) and two SDK warnings. Independent channel, packet, retained-epoch, and resource tests passed, alongside CUDA-Q 0.16
qpp-cpuchecks, examples, formatting, and Sphinx with warnings as errors.Merge #64 first. These published branches currently have sibling histories based on main, and #65 includes the shared foundation. Update and revalidate #65 after #64 lands.