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 qubit count tracking within Q# #1800

Merged
merged 1 commit into from
Aug 15, 2024
Merged

Support qubit count tracking within Q# #1800

merged 1 commit into from
Aug 15, 2024

Conversation

swernli
Copy link
Collaborator

@swernli swernli commented Jul 29, 2024

This introduces qubit count tracking APIs to the Diagnostics namespace that allow Q# code to get counts for how many unique qubits are used during a section of execution. This is useful in katas and auto-grading scenarios to verify that exercise restrictions are being appropriately followed.

Fixes #1155

@swernli swernli changed the title Swernli/issue1155 Support qubit count tracking within Q# Jul 29, 2024
@swernli swernli force-pushed the swernli/issue1155 branch from 0329c4f to 19af3dd Compare August 5, 2024 05:18
@swernli swernli requested a review from tcNickolas August 5, 2024 05:22
@swernli swernli force-pushed the swernli/issue1155 branch from 19af3dd to 5c3bdab Compare August 5, 2024 23:04
@swernli swernli marked this pull request as ready for review August 13, 2024 17:58
@tcNickolas
Copy link
Member

One more thing that needs a test case - in the chat we discussed "because multi-controlled gates are decomposed during simulation the same way they are for hardware, they will allocate additional auxiliary qubits proportional to the number of control qubits, which will show up in the count." - there is no test case with a controlled functor right now

@swernli swernli force-pushed the swernli/issue1155 branch from 5c3bdab to 30aa424 Compare August 15, 2024 06:08
Base automatically changed from swernli/issue1154 to main August 15, 2024 21:15
This introduces qubit count tracking APIs to the Diagnostics namespace that allow Q# code to get counts for how many unique qubits are used during a section of execution. This is useful in katas and auto-grading scenarios to verify that exercise restrictions are being appropriately followed.

Fixes #1155
@swernli swernli force-pushed the swernli/issue1155 branch from 30aa424 to 973ece3 Compare August 15, 2024 21:18
@swernli swernli enabled auto-merge August 15, 2024 21:18
Copy link

Change in memory usage detected by benchmark.

Memory Report for 5ee2b12

Test This Branch On Main Difference
compile core + standard lib 18000952 bytes 17991768 bytes 9184 bytes

@swernli swernli added this pull request to the merge queue Aug 15, 2024
Copy link

Benchmark for 5ee2b12

Click to view benchmark
Test Base PR %
Array append evaluation 327.2±4.15µs 336.9±2.71µs +2.96%
Array literal evaluation 171.7±1.14µs 186.6±0.73µs +8.68%
Array update evaluation 406.2±1.81µs 414.9±1.82µs +2.14%
Core + Standard library compilation 22.4±0.52ms 24.6±1.17ms +9.82%
Deutsch-Jozsa evaluation 4.9±0.04ms 5.0±0.10ms +2.04%
Large file parity evaluation 34.4±0.11ms 34.3±0.23ms -0.29%
Large input file compilation 14.4±0.41ms 15.5±0.68ms +7.64%
Large input file compilation (interpreter) 55.1±2.59ms 57.1±3.11ms +3.63%
Large nested iteration 32.8±0.65ms 32.9±0.42ms +0.30%
Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample 1573.2±38.36µs 1626.1±152.94µs +3.36%
Perform Runtime Capabilities Analysis (RCA) on large file sample 8.0±0.10ms 8.3±0.13ms +3.75%
Perform Runtime Capabilities Analysis (RCA) on teleport sample 1431.6±53.24µs 1482.2±129.92µs +3.53%
Perform Runtime Capabilities Analysis (RCA) on the core and std libraries 27.7±0.24ms 29.2±1.05ms +5.42%
Teleport evaluation 93.4±3.41µs 94.4±7.73µs +1.07%

Merged via the queue into main with commit 5e170e0 Aug 15, 2024
19 checks passed
@swernli swernli deleted the swernli/issue1155 branch August 15, 2024 21:42
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.

Support AllowAtMostNQubits operation to limit the number of qubits allocated in the code
3 participants