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

Add DumpRegister #1173

Merged
merged 9 commits into from Feb 28, 2024
Merged

Add DumpRegister #1173

merged 9 commits into from Feb 28, 2024

Conversation

swernli
Copy link
Collaborator

@swernli swernli commented Feb 17, 2024

This change adds an implementation of DumpRegister as an intrinsic in the standard library with matching implementation in the evaluator. It works by getting a full state dump and calculating if the state corresponding to the given qubits is separable from the rest, returning an error if it is not.

Fixes #1138

This change adds an implementation of `DumpRegister` as an intrinsic in the standard library with matching implementation in the evaluator. It works by getting a full state dump and calculating if the state corresponding to the given qubits is separable from the rest, returning an error if it is not.

Fixes #1138
Copy link

Change in memory usage detected by benchmark.
## Memory Report for e596ccb
| Test | This Branch | On Main |
|-----------------------------|-------------|----------|
| compile core + standard lib | 15952797 bytes | 15946457 bytes |

Copy link

Change in memory usage detected by benchmark.
## Memory Report for 15d1487
| Test | This Branch | On Main |
|-----------------------------|-------------|----------|
| compile core + standard lib | 15952797 bytes | 15946457 bytes |

Copy link

Benchmark for 15d1487

Click to view benchmark
Test Base PR %
Array append evaluation 752.4±9.31µs 759.8±6.09µs +0.98%
Array literal evaluation 517.6±33.88µs 550.1±42.07µs +6.28%
Array update evaluation 749.3±5.51µs 754.1±5.55µs +0.64%
Deutsch-Jozsa evaluation 30.4±0.18ms 30.3±0.19ms -0.33%
Large file parity evaluation 35.1±0.06ms 35.2±0.60ms +0.28%
Large input file 40.6±0.86ms 40.0±0.76ms -1.48%
Large nested iteration 74.8±1.30ms 74.9±1.20ms +0.13%
Standard library 23.3±0.87ms 22.9±0.74ms -1.72%
Teleport evaluation 93.9±1.60µs 95.3±2.84µs +1.49%

@swernli swernli requested a review from billti as a code owner February 17, 2024 00:45
Copy link

Change in memory usage detected by benchmark.
## Memory Report for d4516b4
| Test | This Branch | On Main |
|-----------------------------|-------------|----------|
| compile core + standard lib | 15952797 bytes | 15946457 bytes |

Copy link

Benchmark for d4516b4

Click to view benchmark
Test Base PR %
Array append evaluation 755.6±10.25µs 759.1±6.18µs +0.46%
Array literal evaluation 512.8±35.43µs 516.4±24.96µs +0.70%
Array update evaluation 754.0±6.28µs 752.8±3.96µs -0.16%
Deutsch-Jozsa evaluation 30.6±0.72ms 30.3±0.16ms -0.98%
Large file parity evaluation 35.2±0.15ms 35.1±0.76ms -0.28%
Large input file 40.3±1.20ms 39.8±0.71ms -1.24%
Large nested iteration 78.2±5.38ms 74.5±1.62ms -4.73%
Standard library 23.0±0.54ms 22.9±0.65ms -0.43%
Teleport evaluation 94.4±2.05µs 95.5±1.66µs +1.17%

Copy link

Change in memory usage detected by benchmark.
## Memory Report for 8230bce
| Test | This Branch | On Main |
|-----------------------------|-------------|----------|
| compile core + standard lib | 15952797 bytes | 15946457 bytes |

Copy link

Benchmark for 8230bce

Click to view benchmark
Test Base PR %
Array append evaluation 777.8±6.66µs 763.1±20.94µs -1.89%
Array literal evaluation 515.8±36.00µs 540.2±22.77µs +4.73%
Array update evaluation 773.9±12.67µs 754.5±9.50µs -2.51%
Deutsch-Jozsa evaluation 30.5±0.30ms 30.4±0.32ms -0.33%
Large file parity evaluation 35.2±0.07ms 35.1±0.12ms -0.28%
Large input file 42.2±1.72ms 41.8±1.02ms -0.95%
Large nested iteration 79.0±2.31ms 74.9±2.57ms -5.19%
Standard library 23.9±0.76ms 23.9±0.98ms 0.00%
Teleport evaluation 95.5±3.47µs 95.4±1.90µs -0.10%

library/std/diagnostics.qs Outdated Show resolved Hide resolved
@minestarks
Copy link
Member

Should we add some sample code for this? In samples/language/Diagnostics.qs maybe?

github-merge-queue bot pushed a commit that referenced this pull request Feb 22, 2024
I noticed in #1173 that the formatting for the memory benchmark is
broken. This PR fixes that. See below comment for updated formatting.
Copy link

Change in memory usage detected by benchmark.

Memory Report for 89f5ace

Test This Branch On Main
compile core + standard lib 15952749 bytes 15946457 bytes

Copy link

Benchmark for 89f5ace

Click to view benchmark
Test Base PR %
Array append evaluation 754.8±5.42µs 755.9±3.93µs +0.15%
Array literal evaluation 535.5±23.36µs 507.9±24.60µs -5.15%
Array update evaluation 753.3±4.10µs 753.1±6.81µs -0.03%
Deutsch-Jozsa evaluation 30.3±0.21ms 30.4±0.18ms +0.33%
Large file parity evaluation 35.0±0.11ms 35.2±0.26ms +0.57%
Large input file 40.5±1.25ms 42.1±0.74ms +3.95%
Large nested iteration 75.7±0.94ms 75.6±1.71ms -0.13%
Standard library 24.2±0.81ms 23.1±0.66ms -4.55%
Teleport evaluation 94.1±1.95µs 96.3±1.89µs +2.34%

@swernli
Copy link
Collaborator Author

swernli commented Feb 23, 2024

Should we add some sample code for this? In samples/language/Diagnostics.qs maybe?

Probably, though likely not until we have actually released a version with DumpRegister.

@billti billti mentioned this pull request Feb 23, 2024
Copy link

Change in memory usage detected by benchmark.

Memory Report for ef5a9e2

Test This Branch On Main
compile core + standard lib 15971041 bytes 15964749 bytes

Copy link

Benchmark for ef5a9e2

Click to view benchmark
Test Base PR %
Array append evaluation 756.1±7.65µs 755.5±10.55µs -0.08%
Array literal evaluation 502.8±21.83µs 529.8±25.75µs +5.37%
Array update evaluation 755.2±11.27µs 756.2±4.73µs +0.13%
Deutsch-Jozsa evaluation 7.0±0.05ms 7.1±0.05ms +1.43%
Large file parity evaluation 35.1±0.06ms 35.4±0.30ms +0.85%
Large input file 41.1±0.85ms 41.2±1.14ms +0.24%
Large nested iteration 76.5±0.57ms 74.4±0.67ms -2.75%
Standard library 23.1±0.47ms 22.6±0.45ms -2.16%
Teleport evaluation 95.8±1.58µs 96.6±7.97µs +0.84%

@swernli swernli added this pull request to the merge queue Feb 28, 2024
Merged via the queue into main with commit bed9d8e Feb 28, 2024
14 checks passed
@swernli swernli deleted the swernli/issue1138 branch February 28, 2024 19:24
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.

Add DumpRegister
7 participants