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

Misnamed Function Attributes (required_num_* vs num_required_*) #250

Closed
bmhowe23 opened this issue Sep 18, 2023 · 2 comments
Closed

Misnamed Function Attributes (required_num_* vs num_required_*) #250

bmhowe23 opened this issue Sep 18, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@bmhowe23
Copy link
Contributor

Describe the bug

The Base Profile Spec specifies that the required_num_qubits and required_num_results attributes must be attached to the entry point function, and while pyqir uses those attribute names in some places (like for internal variable names), there are some important places (like the LLVM interface) where num_required_qubits and num_required_results are used instead.

To Reproduce

Steps to reproduce the behavior:

  1. Modify qirlib/resources/tests/rt/initialize.ll to match the Base Profile specification by applying this patch:
diff --git a/qirlib/resources/tests/rt/initialize.ll b/qirlib/resources/tests/rt/initialize.ll
index 5a88b41..9ba9b22 100644
--- a/qirlib/resources/tests/rt/initialize.ll
+++ b/qirlib/resources/tests/rt/initialize.ll
@@ -8,4 +8,4 @@ define void @main() #0 {

 declare void @__quantum__rt__initialize(i8*)

-attributes #0 = { "entry_point" "num_required_qubits"="0" "num_required_results"="0" "output_labeling_schema" "qir_profiles"="custom" }
+attributes #0 = { "entry_point" "output_labeling_schema" "qir_profiles"="custom" "required_num_qubits"="0" "required_num_results"="0" }
  1. Run build.ps1
  2. Look for this failure message:
test rt::tests::initialize ... FAILED

Expected behavior

The test should not fail when using spec-compliant attributes.

Screenshots

N/A

System information

  • Release version or commit for which the problem occurs: de2c8ed (current latest)
  • Your operating system and Python or Rust version: Ubuntu 22.04, rustc 1.72.0 (5680fa18f 2023-08-23)

Additional context

N/A

@idavis
Copy link
Collaborator

idavis commented Sep 26, 2023

Hi @bmhowe23 - I need to look at this. To my knowledge the base profile is only defined in qir-spec #25 PR which I just saw you had some comments on. Everything here is based on that PR trying to define the base profile.

@idavis
Copy link
Collaborator

idavis commented Oct 20, 2023

Fixed in #251, not yet released. Thanks @bmhowe23 !

@idavis idavis closed this as completed Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants