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

Support operations with return type Unit in Resource Estimator #1196

Closed
tcNickolas opened this issue Feb 23, 2024 · 1 comment
Closed

Support operations with return type Unit in Resource Estimator #1196

tcNickolas opened this issue Feb 23, 2024 · 1 comment
Labels
enhancement New feature or request needs triage

Comments

@tcNickolas
Copy link
Contributor

tcNickolas commented Feb 23, 2024

I realized that this happens only if I run resource estimator after doing qsharp.init(target_profile=qsharp.TargetProfile.Base). This feels very odd, since I'm trying to estimate the same code with the same tool, and I do qsharp.init is needed only for qsharp.compile that I use to submit the same code to Azure Quantum for a different target - it doesn't feel like it should affect the behavior of resource estimator.

Is your feature request related to a problem? Please describe.
Currently resource estimator requires that the program estimated returns a Result type or array of it. Very often I want to estimate a part of the program that doesn't result in measurements, for example, a single application of a quantum oracle. In the classic QDK, with resource estimator running as a service, it was possible to estimate a program that consisted of qubit allocation and the routine I needed to estimate. Now I have to add to it measurements and returning them, without getting any benefit from this, and increasing the estimates by the number of measurements I add. I cannot even return Zero, because "result literals One and Zero are not supported when performing base profile QIR generation".

Describe the solution you'd like
Allow resource estimator to run for programs that return Unit.

Describe alternatives you've considered
The alternative is to write a wrapper for the program I want to estimate to add measurements. This is not ideal, since this changes the resources required to run the program (single-qubit measurements affect the resource counts).

@billti
Copy link
Member

billti commented Feb 23, 2024

If you initialize the compiler to target base profile, then it will error if you try to do anything that isn't base profile compliant. I think it would be more odd if it didn't.

That said, this area still seems to be confusing a few folks, so we do need to think through how to make the profile distinctions more intuitive. Open to ideas! (See #1198 just opened).

@billti billti closed this as completed Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage
Projects
None yet
Development

No branches or pull requests

2 participants