Skip to content
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

AutoQASM freeparameter usage with pulse instruction #794

Merged
merged 2 commits into from
Nov 14, 2023

Conversation

yitchen-tim
Copy link
Contributor

@yitchen-tim yitchen-tim commented Nov 13, 2023

Issue #, if available:
https://github.com/orgs/amazon-braket/projects/2/views/6?pane=issue&itemId=44479389

Description of changes:

  • Register the pulse usage of free parameter in program.
  • Enable binding value to free parameter for pulse instructions.

Testing done:
tox

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@yitchen-tim yitchen-tim changed the base branch from main to feature/autoqasm November 13, 2023 04:34
Copy link

codecov bot commented Nov 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (77690e6) 100.00% compared to head (f7ea029) 100.00%.

Additional details and impacted files
@@                Coverage Diff                 @@
##           feature/autoqasm      #794   +/-   ##
==================================================
  Coverage            100.00%   100.00%           
==================================================
  Files                   166       166           
  Lines                  9878      9870    -8     
  Branches               2095      2092    -3     
==================================================
- Hits                   9878      9870    -8     

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

@yitchen-tim yitchen-tim marked this pull request as ready for review November 13, 2023 16:52
@yitchen-tim yitchen-tim requested a review from a team as a code owner November 13, 2023 16:52
@@ -43,6 +43,7 @@ def _pulse_instruction(name: str, frame: Frame, *args) -> None:
"""
program_conversion_context = aq_program.get_program_conversion_context()
program_conversion_context._has_pulse_control = True
program_conversion_context.register_args(args)
Copy link
Contributor

@laurencap laurencap Nov 13, 2023

Choose a reason for hiding this comment

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

This might need to be replaced with the new _register_and_convert_parameters method of utils. I'm guessing it would only appear as a bug if a FreeParameter appeared in a pulse instruction first, and later was used in a conditional statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Conditional statements later in a program would not be affected by here. In conditional statement, variables are still converted by _register_and_convert_parameters in the compare operator. I added a unit test that the freeparameter for pulse is later used by a conditional statement. Here, we actually do want the variable to be freeparameter instead of FloatVar.

@yitchen-tim yitchen-tim merged commit c345fdb into feature/autoqasm Nov 14, 2023
22 checks passed
@yitchen-tim yitchen-tim deleted the yitchen/autoqasm-freeparameter-pulse branch November 14, 2023 21:15
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.

3 participants