-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[cirqflow] Add target_gateset
to QuantumRuntimeConfiguration
#5336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
86ba8be
Add `target_gateset` to QuantumRuntimeConfiguration
mpharrigan 32aebed
json test data
mpharrigan a0c53c3
types
mpharrigan c5b8fc5
json test data
mpharrigan f7843d5
test fixup
mpharrigan 108afa7
Merge branch 'master' into 2022-04-transform
CirqBot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
2 changes: 1 addition & 1 deletion
2
cirq-google/cirq_google/json_test_data/cirq.google.ExecutableGroupResult.repr
Large diffs are not rendered by default.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
cirq-google/cirq_google/json_test_data/cirq.google.QuantumRuntimeConfiguration.repr
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
cirq_google.QuantumRuntimeConfiguration(processor_record=cirq_google.SimulatedProcessorRecord(processor_id='rainbow', noise_strength=0), run_id='unit-test', random_seed=None, qubit_placer=cirq_google.NaiveQubitPlacer()) | ||
cirq_google.QuantumRuntimeConfiguration(processor_record=cirq_google.SimulatedProcessorRecord(processor_id='rainbow', noise_strength=0), run_id='unit-test', random_seed=None, qubit_placer=cirq_google.NaiveQubitPlacer(), target_gateset=cirq.CZTargetGateset(atol=1e-08, allow_partial_czs=False)) |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if we can also allow plumbing a transformer context here, which can be used to control many useful compilation behaviors like
context.tags_to_ignore
orcontext.deep
(to compile sub-circuits recursively instead of treating them as standalone operations).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds reasonable.
Now that I'm looking at TransformerContext it would be really nice if I could offer a transformer logger that logs into the
cg.RuntimeInfo
for each executable.Designing the API to enable this may be weird: because the TransformerLogger in the TransformerContext will need a reference to the RuntimeInfo which doesn't exist when the user is setting up their QuantumRuntimeConfiguration.
I could do something gross like define a subclass
WorkflowTransformerLogger
and do anisinstance
check during the execution loop. If it's an instance of this special class, call a method to plumb in the RuntimeInfo object.Any other ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TransformerContext
isn't json serializable, which blocks its use inQuantumRuntimeConfiguration
. We can plumb it through when that's doneThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, it's a dataclass but not a json_serializable_dataclass. Okay, let's open a new issue to track the change.
Also; for google devices (i.e. devices with GridDeviceMetadata), it should be possible to get the target gateset from
processor_record.device.metadata.compilation_target_gatesets[0]
-- but I think it's better to explicitly require a target_gateset here and the user can pick it from the device instead of creating a new instance if they want to.