Use Result comparison as source of dynamism in RCA#3355
Open
swernli wants to merge 1 commit into
Open
Conversation
This change adjusts how `Result` values are treated in Runtime Capability Analysis, shifting them from being treated as dynamic variable values by default to treating them as dynamic constant values. This matches the behavior for `Qubit` variables, as both are identifiers in QIR. Instead of counting on the `Result` value returned from measurement intrinsics as the source of dynamism, RCA instead tracks when a `Result` value is used in a comparison and marks the resulting `Bool` value as a dynamic variable. This more directly maps to how dynamism enters a program, and sets the stage for emitting constant `Result` arrays into the QIR in the same fashion as `Qubit` arrays. This builds off of the work in #3349 as we now track the difference between dynamic constants and dyanmic variables across function call boundaries, allowing RCA to properly detect comparison of dynamic constant results throughout the program.
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.
This change adjusts how
Resultvalues are treated in Runtime Capability Analysis, shifting them from being treated as dynamic variable values by default to treating them as dynamic constant values. This matches the behavior forQubitvariables, as both are identifiers in QIR. Instead of counting on theResultvalue returned from measurement intrinsics as the source of dynamism, RCA instead tracks when aResultvalue is used in a comparison and marks the resultingBoolvalue as a dynamic variable. This more directly maps to how dynamism enters a program, and sets the stage for emitting constantResultarrays into the QIR in the same fashion asQubitarrays. This builds off of the work in #3349 as we now track the difference between dynamic constants and dyanmic variables across function call boundaries, allowing RCA to properly detect comparison of dynamic constant results throughout the program.