Skip to content

Conversation

@dstrain115
Copy link
Collaborator

  • This addresses design review comments that the moment_index should be outside the Moment message to be consistent and avoid a message construction.
  • This PR also simplifies the code to deserialize all the constants first, which removes the need for lookup tables and logic later.
  • In addition, this puts the deserialization of a moment into its own function.

- This addresses design review comments that the moment_index should
be outside the Moment message to be consistent and avoid a message
construction.
- This PR also simplifies the code to deserialize all the constants
first, which removes the need for lookup tables and logic later.
- In addition, this puts the deserialization of a moment into its
own function.
@dstrain115 dstrain115 requested review from a team, verult, vtomole and wcourtney as code owners January 30, 2025 23:35
@CirqBot CirqBot added the size: L 250< lines changed <1000 label Jan 30, 2025
@codecov
Copy link

codecov bot commented Jan 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.89%. Comparing base (26b1f46) to head (ee28330).
Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7008      +/-   ##
==========================================
- Coverage   97.89%   97.89%   -0.01%     
==========================================
  Files        1085     1085              
  Lines       95131    95126       -5     
==========================================
- Hits        93124    93119       -5     
  Misses       2007     2007              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@pavoljuhas pavoljuhas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a couple of small changes.

msg.scheduling_strategy = v2.program_pb2.Circuit.MOMENT_BY_MOMENT
for moment in circuit:
if self.use_constants_table_for_moments:
if moment_index := raw_constants.get(moment, None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us handle corner case when moment is at index 0.

Suggested change
if moment_index := raw_constants.get(moment, None):
if moment_index := raw_constants.get(moment, None) is not None:

same for the similar constructs at lines 112, 135.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. Done.

@dstrain115 dstrain115 requested a review from pavoljuhas February 1, 2025 15:29
@dstrain115 dstrain115 added this pull request to the merge queue Feb 4, 2025
Merged via the queue into quantumlib:main with commit 6c9db55 Feb 4, 2025
38 checks passed
@dstrain115 dstrain115 deleted the move_circuit_index_up branch February 4, 2025 17:52
BichengYing pushed a commit to BichengYing/Cirq that referenced this pull request Jun 20, 2025
* Move moment index into circuit message

- This addresses design review comments that the moment_index should
be outside the Moment message to be consistent and avoid a message
construction.
- This PR also simplifies the code to deserialize all the constants
first, which removes the need for lookup tables and logic later.
- In addition, this puts the deserialization of a moment into its
own function.

* types

* typo]]]]

* Fix build protos to whatever version thing I was missing.

* Address review comments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: L 250< lines changed <1000

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants