Few qubit optimisations#750
Draft
TysonRayJones wants to merge 6 commits into
Draft
Conversation
Also removed param-specific macros (like numCtrls vs numTargs), and instead made them generic (param)
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.
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.
(Still very much a draft, just triggering CI to see compiler compatibility)