Skip to content

Few qubit optimisations#750

Draft
TysonRayJones wants to merge 6 commits into
develfrom
few-qubit-optimisation
Draft

Few qubit optimisations#750
TysonRayJones wants to merge 6 commits into
develfrom
few-qubit-optimisation

Conversation

@TysonRayJones
Copy link
Copy Markdown
Member

(Still very much a draft, just triggering CI to see compiler compatibility)

Also removed param-specific macros (like numCtrls vs numTargs), and instead made them generic (param)
@TysonRayJones TysonRayJones marked this pull request as draft May 18, 2026 00:59
Previously, even when global_isValidationEnabled=0, the validate functions would continue to their assertThat() inner functions, which would itself consult global_isValidationEnabled and discontinue. This meant everything within the validation function body would be executed, even when validation was actually disabled. For most functions, this was deemed a minor expense, outweighed by the boilerplate of early exit everywhere. Several relatively expensive validation functions explicitly checked global_isValidationEnabled upfront.

Alas, the relative cost of validation vs the backend of an API function changes with varying Qureg size. For small quregs (less than 10 qubits), some of the validation deemed trivial (at-scale) becomes significant. It is hard to judge this by eye. This commit makes ALL validate functions check global_isValidationEnabled upfront and exit early when validation is disabled. This consistency means more duplication (wah), but removes small-qureg performance pitfalls.
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