Sample hardware gateset project
This change creates a small sample project that provides operations corresponding to a native gateset for a hypothetical hardware device.
Benchmark for ceb1d02
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| Array append evaluation | 337.7±6.87µs | 354.0±20.14µs | +4.83% |
| Array literal evaluation | 198.4±7.72µs | 191.0±7.52µs | -3.73% |
| Array update evaluation | 418.2±7.35µs | 418.7±11.55µs | +0.12% |
| Core + Standard library compilation | 21.6±0.68ms | 21.5±1.48ms | -0.46% |
| Deutsch-Jozsa evaluation | 4.9±0.06ms | 5.0±0.21ms | +2.04% |
| Large file parity evaluation | 34.0±0.09ms | 34.6±1.13ms | +1.76% |
| Large input file compilation | 12.6±0.16ms | 13.1±0.71ms | +3.97% |
| Large input file compilation (interpreter) | 49.2±1.17ms | 53.4±4.83ms | +8.54% |
| Large nested iteration | 32.3±0.20ms | 33.3±2.25ms | +3.10% |
| Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1588.7±105.45µs | 1589.4±113.67µs | +0.04% |
| Perform Runtime Capabilities Analysis (RCA) on large file sample | 8.0±0.31ms | 7.8±0.33ms | -2.50% |
| Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1437.6±56.20µs | 1441.4±67.95µs | +0.26% |
| Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | 27.9±0.35ms | 27.6±1.48ms | -1.08% |
| Teleport evaluation | 91.3±4.44µs | 92.8±8.71µs | +1.64% |
Benchmark for fcea11b
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| Array append evaluation | 351.8±3.71µs | 339.4±6.34µs | -3.52% |
| Array literal evaluation | 196.3±3.46µs | 189.0±0.79µs | -3.72% |
| Array update evaluation | 418.3±3.64µs | 414.1±1.28µs | -1.00% |
| Core + Standard library compilation | 22.4±0.45ms | 22.0±0.47ms | -1.79% |
| Deutsch-Jozsa evaluation | 4.9±0.05ms | 4.9±0.06ms | 0.00% |
| Large file parity evaluation | 34.1±0.13ms | 34.2±0.51ms | +0.29% |
| Large input file compilation | 13.0±0.24ms | 13.2±0.46ms | +1.54% |
| Large input file compilation (interpreter) | 52.5±1.67ms | 53.4±1.90ms | +1.71% |
| Large nested iteration | 32.7±0.62ms | 32.4±0.77ms | -0.92% |
| Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1573.2±75.39µs | 1576.0±96.81µs | +0.18% |
| Perform Runtime Capabilities Analysis (RCA) on large file sample | 7.9±0.34ms | 7.8±0.09ms | -1.27% |
| Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1435.9±57.40µs | 1428.0±54.78µs | -0.55% |
| Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | 27.9±0.27ms | 27.8±0.28ms | -0.36% |
| Teleport evaluation | 92.2±3.40µs | 92.5±3.36µs | +0.33% |
Do we want the library projects in samples? I was thinking we'd perhaps want to use library for our libraries, where we have std currently.
Edit: #1801 sets us up if we want to go this route.
Benchmark for 8d1f005
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| Array append evaluation | 336.5±2.49µs | 341.5±8.33µs | +1.49% |
| Array literal evaluation | 192.7±0.71µs | 175.5±1.21µs | -8.93% |
| Array update evaluation | 411.6±2.68µs | 415.4±2.32µs | +0.92% |
| Core + Standard library compilation | 21.0±0.09ms | 21.8±0.74ms | +3.81% |
| Deutsch-Jozsa evaluation | 4.9±0.05ms | 4.9±0.05ms | 0.00% |
| Large file parity evaluation | 34.3±0.75ms | 34.1±0.17ms | -0.58% |
| Large input file compilation | 12.8±0.26ms | 13.0±0.34ms | +1.56% |
| Large input file compilation (interpreter) | 48.7±1.73ms | 51.5±2.15ms | +5.75% |
| Large nested iteration | 32.7±0.84ms | 33.3±0.31ms | +1.83% |
| Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1564.0±32.48µs | 1568.7±40.96µs | +0.30% |
| Perform Runtime Capabilities Analysis (RCA) on large file sample | 7.8±0.06ms | 7.7±0.08ms | -1.28% |
| Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1421.1±30.66µs | 1437.4±50.66µs | +1.15% |
| Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | 27.7±0.11ms | 27.7±0.45ms | 0.00% |
| Teleport evaluation | 91.6±3.29µs | 93.0±6.46µs | +1.53% |
Do we want the library projects in
samples? I was thinking we'd perhaps want to uselibraryfor our libraries, where we havestdcurrently.Edit: #1801 sets us up if we want to go this route.
Since this a sample library and not something we want people to rely on, I think it makes sense to keep it in the samples folder.
Benchmark for 6ef2f0b
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| Array append evaluation | 339.8±1.81µs | 342.1±2.18µs | +0.68% |
| Array literal evaluation | 169.2±2.84µs | 186.7±4.60µs | +10.34% |
| Array update evaluation | 415.5±1.94µs | 415.2±2.32µs | -0.07% |
| Core + Standard library compilation | 22.7±1.07ms | 22.8±0.95ms | +0.44% |
| Deutsch-Jozsa evaluation | 5.0±0.06ms | 5.1±0.34ms | +2.00% |
| Large file parity evaluation | 34.5±0.29ms | 34.5±0.45ms | 0.00% |
| Large input file compilation | 13.5±0.50ms | 13.4±0.40ms | -0.74% |
| Large input file compilation (interpreter) | 53.1±2.43ms | 53.0±3.33ms | -0.19% |
| Large nested iteration | 33.1±0.32ms | 33.2±0.37ms | +0.30% |
| Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1577.0±56.00µs | 1608.9±136.83µs | +2.02% |
| Perform Runtime Capabilities Analysis (RCA) on large file sample | 8.0±0.17ms | 7.9±0.13ms | -1.25% |
| Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1440.3±70.71µs | 1446.1±55.99µs | +0.40% |
| Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | 28.0±0.36ms | 28.0±0.33ms | 0.00% |
| Teleport evaluation | 93.6±10.15µs | 92.5±3.28µs | -1.18% |
Benchmark for bb23e30
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| Array append evaluation | 341.3±6.51µs | 339.6±12.33µs | -0.50% |
| Array literal evaluation | 175.2±1.78µs | 192.6±1.46µs | +9.93% |
| Array update evaluation | 418.1±6.22µs | 411.6±2.68µs | -1.55% |
| Core + Standard library compilation | 21.3±0.36ms | 21.3±0.40ms | 0.00% |
| Deutsch-Jozsa evaluation | 4.9±0.05ms | 4.9±0.04ms | 0.00% |
| Large file parity evaluation | 34.1±0.22ms | 34.2±0.31ms | +0.29% |
| Large input file compilation | 12.8±0.19ms | 12.7±0.25ms | -0.78% |
| Large input file compilation (interpreter) | 49.4±1.01ms | 49.3±1.07ms | -0.20% |
| Large nested iteration | 33.1±0.46ms | 32.8±0.23ms | -0.91% |
| Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1565.8±33.41µs | 1562.7±32.72µs | -0.20% |
| Perform Runtime Capabilities Analysis (RCA) on large file sample | 7.7±0.07ms | 7.7±0.07ms | 0.00% |
| Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1429.0±26.21µs | 1429.9±41.27µs | +0.06% |
| Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | 27.7±0.15ms | 27.7±0.27ms | 0.00% |
| Teleport evaluation | 90.4±3.12µs | 91.3±3.26µs | +1.00% |
Benchmark for c596a2b
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| Array append evaluation | 338.4±6.44µs | 344.8±11.98µs | +1.89% |
| Array literal evaluation | 188.3±10.67µs | 187.2±9.26µs | -0.58% |
| Array update evaluation | 413.7±3.34µs | 417.8±1.88µs | +0.99% |
| Core + Standard library compilation | 21.2±0.35ms | 21.3±0.65ms | +0.47% |
| Deutsch-Jozsa evaluation | 5.0±0.06ms | 5.0±0.06ms | 0.00% |
| Large file parity evaluation | 34.4±0.22ms | 34.7±0.40ms | +0.87% |
| Large input file compilation | 12.8±0.58ms | 12.8±0.18ms | 0.00% |
| Large input file compilation (interpreter) | 49.3±0.79ms | 50.1±1.45ms | +1.62% |
| Large nested iteration | 32.8±0.18ms | 33.3±1.20ms | +1.52% |
| Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1563.1±29.31µs | 1576.6±66.83µs | +0.86% |
| Perform Runtime Capabilities Analysis (RCA) on large file sample | 7.8±0.31ms | 7.7±0.04ms | -1.28% |
| Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1424.9±30.92µs | 1433.0±48.63µs | +0.57% |
| Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | 27.6±0.19ms | 27.6±0.27ms | 0.00% |
| Teleport evaluation | 92.2±3.18µs | 91.3±3.20µs | -0.98% |
Benchmark for 97bcad9
Click to view benchmark
| Test | Base | PR | % |
|---|---|---|---|
| Array append evaluation | 348.2±3.63µs | 327.4±4.38µs | -5.97% |
| Array literal evaluation | 185.9±1.19µs | 198.4±3.66µs | +6.72% |
| Array update evaluation | 415.7±4.69µs | 408.8±2.18µs | -1.66% |
| Core + Standard library compilation | 24.0±1.12ms | 24.2±1.16ms | +0.83% |
| Deutsch-Jozsa evaluation | 5.0±0.13ms | 4.9±0.05ms | -2.00% |
| Large file parity evaluation | 34.3±0.11ms | 34.4±0.42ms | +0.29% |
| Large input file compilation | 15.0±0.58ms | 14.9±0.95ms | -0.67% |
| Large input file compilation (interpreter) | 56.7±1.96ms | 56.9±2.17ms | +0.35% |
| Large nested iteration | 32.8±0.28ms | 32.6±0.55ms | -0.61% |
| Perform Runtime Capabilities Analysis (RCA) on Deutsch-Jozsa sample | 1612.1±150.18µs | 1580.9±53.61µs | -1.94% |
| Perform Runtime Capabilities Analysis (RCA) on large file sample | 8.2±0.47ms | 8.0±0.12ms | -2.44% |
| Perform Runtime Capabilities Analysis (RCA) on teleport sample | 1454.2±88.66µs | 1449.6±99.21µs | -0.32% |
| Perform Runtime Capabilities Analysis (RCA) on the core and std libraries | 28.8±0.89ms | 28.0±0.29ms | -2.78% |
| Teleport evaluation | 93.9±3.85µs | 93.6±3.24µs | -0.32% |
requesting changes pending comments around this project's use case -- see above
The use case for this kind of library is for someone developing a program for a particular target. The library project exposes the native gate set for a particular target in a way that an application that references this library can be simulated and also submitted to the target. This user would then only use quantum operations from the gate set project instead of operations from that are part of the Q# standard library.
I think there is a feature that might be missing to make this kind of library more useful:
- Have a way to enforce no quantum gates/operations from the standard library are used.
- One option that we can consider for this is to formally introduce the concept of gate set/instruction set.
- Ideally, we should allow the use of callables from the standard library that are not and do not depend on the Q# gate set/instruction set.
Having said this, I think it would still be valuable to merge a sample like this one since it can be used as a reference for hardware providers to create their own gate set libraries.
Closing for now until we have an agreement on how to handle this kind of scenario.