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

Handle impossible factories in RE API #1463

Merged
merged 1 commit into from
May 4, 2024
Merged

Handle impossible factories in RE API #1463

merged 1 commit into from
May 4, 2024

Conversation

msoeken
Copy link
Member

@msoeken msoeken commented May 2, 2024

Currently, the factory builder API returns a vector of factories for space-time evaluation. However, returning no factory may mean that the algorithm was too fast, and the optimizer will continue to search for some. But there are some cases in which no factory can be found given the input parameters, no matter of the duration of the algorithm.

This PR changes the API to allow to indicate if no magic factories can be computed by returning Option<Vec<...>> instead of Vec<...>.

Copy link

github-actions bot commented May 2, 2024

Benchmark for 851f8fc

Click to view benchmark
Test Base PR %
Array append evaluation 340.7±2.28µs 341.6±3.36µs +0.26%
Array literal evaluation 178.2±1.45µs 194.0±7.44µs +8.87%
Array update evaluation 421.2±5.45µs 424.5±2.84µs +0.78%
Core + Standard library compilation 16.6±0.04ms 17.0±0.48ms +2.41%
Deutsch-Jozsa evaluation 5.1±0.05ms 5.1±0.04ms 0.00%
Large file parity evaluation 33.7±0.16ms 33.8±0.61ms +0.30%
Large input file compilation 11.3±0.12ms 11.5±0.20ms +1.77%
Large input file compilation (interpreter) 46.3±1.78ms 43.7±1.48ms -5.62%
Large nested iteration 33.1±0.13ms 33.5±0.25ms +1.21%
Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample 1490.7±30.66µs 1488.3±36.29µs -0.16%
Perform Runtime Capabilities Analysis (RCA) on large file sample 7.6±0.10ms 7.6±0.10ms 0.00%
Perform Runtime Capabilities Analysis (RCA) on teleport sample 1405.4±31.56µs 1399.7±36.09µs -0.41%
Perform Runtime Capabilities Analysis (RCA) on the core and std libraries 21.1±0.18ms 21.3±0.31ms +0.95%
Teleport evaluation 89.0±4.08µs 88.9±3.34µs -0.11%

@ivanbasov
Copy link
Member

Is there any semantic difference in the case between returning an empty array vs returning None?

@msoeken
Copy link
Member Author

msoeken commented May 2, 2024

Is there any semantic difference in the case between returning an empty array vs returning None?

Yes, there is. In case of an empty array, we would increase the number of cycles and continue trying, see here:

https://github.com/microsoft/qsharp/blob/95019fd19483697037e24c19cfcbc6cead13a7f9/resource_estimator/src/estimates/physical_estimation.rs#L639C17-L641C18

and

https://github.com/microsoft/qsharp/blob/main/resource_estimator/src/estimates/physical_estimation.rs#L674

But, there are situations in which there aren't just any factories for the provided output error rate, then the factory has the chance to return None.

@msoeken msoeken added this pull request to the merge queue May 4, 2024
Merged via the queue into main with commit bb01a5c May 4, 2024
17 checks passed
@msoeken msoeken deleted the msoeken/re-api branch May 4, 2024 08:39
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.

None yet

2 participants