prism-q 0.21.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. prism_q-0.21.1/.github/ISSUE_TEMPLATE/BUG-REPORT.yml +109 -0
  2. prism_q-0.21.1/.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yml +99 -0
  3. prism_q-0.21.1/.github/PULL_REQUEST_TEMPLATE.md +69 -0
  4. prism_q-0.21.1/.github/labeler.yml +57 -0
  5. prism_q-0.21.1/.github/workflows/ci.yml +302 -0
  6. prism_q-0.21.1/.github/workflows/docs.yml +49 -0
  7. prism_q-0.21.1/.github/workflows/label.yml +12 -0
  8. prism_q-0.21.1/.github/workflows/python.yml +91 -0
  9. prism_q-0.21.1/.github/workflows/release.yml +122 -0
  10. prism_q-0.21.1/.gitignore +82 -0
  11. prism_q-0.21.1/CHANGELOG.md +450 -0
  12. prism_q-0.21.1/CODE_OF_CONDUCT.md +21 -0
  13. prism_q-0.21.1/CONTRIBUTING.md +129 -0
  14. prism_q-0.21.1/Cargo.lock +1878 -0
  15. prism_q-0.21.1/Cargo.toml +107 -0
  16. prism_q-0.21.1/LICENSE-APACHE +190 -0
  17. prism_q-0.21.1/LICENSE-MIT +21 -0
  18. prism_q-0.21.1/Makefile +40 -0
  19. prism_q-0.21.1/PKG-INFO +79 -0
  20. prism_q-0.21.1/README.md +306 -0
  21. prism_q-0.21.1/SECURITY.md +40 -0
  22. prism_q-0.21.1/benches/README.md +160 -0
  23. prism_q-0.21.1/benches/bench_driver.rs +560 -0
  24. prism_q-0.21.1/benches/bench_gpu.rs +774 -0
  25. prism_q-0.21.1/benches/bench_shots_perf.rs +812 -0
  26. prism_q-0.21.1/benches/circuits.rs +1559 -0
  27. prism_q-0.21.1/benches/qec_t_strategies.rs +797 -0
  28. prism_q-0.21.1/benches/svd_bench.rs +75 -0
  29. prism_q-0.21.1/bindings/python/Cargo.toml +25 -0
  30. prism_q-0.21.1/bindings/python/README.md +59 -0
  31. prism_q-0.21.1/bindings/python/src/backend.rs +75 -0
  32. prism_q-0.21.1/bindings/python/src/circuit.rs +447 -0
  33. prism_q-0.21.1/bindings/python/src/error.rs +41 -0
  34. prism_q-0.21.1/bindings/python/src/gate.rs +156 -0
  35. prism_q-0.21.1/bindings/python/src/lib.rs +54 -0
  36. prism_q-0.21.1/bindings/python/src/noise.rs +163 -0
  37. prism_q-0.21.1/bindings/python/src/numpy_util.rs +30 -0
  38. prism_q-0.21.1/bindings/python/src/qec.rs +321 -0
  39. prism_q-0.21.1/bindings/python/src/sim.rs +308 -0
  40. prism_q-0.21.1/bindings/python/tests/test_backends.py +58 -0
  41. prism_q-0.21.1/bindings/python/tests/test_core.py +150 -0
  42. prism_q-0.21.1/bindings/python/tests/test_noise.py +82 -0
  43. prism_q-0.21.1/bindings/python/tests/test_qec.py +83 -0
  44. prism_q-0.21.1/cliff.toml +49 -0
  45. prism_q-0.21.1/clippy.toml +2 -0
  46. prism_q-0.21.1/deny.toml +36 -0
  47. prism_q-0.21.1/docs/SUMMARY.md +38 -0
  48. prism_q-0.21.1/docs/architecture/api-surface.md +50 -0
  49. prism_q-0.21.1/docs/architecture/backends.md +59 -0
  50. prism_q-0.21.1/docs/architecture/engine.md +98 -0
  51. prism_q-0.21.1/docs/architecture/fusion.md +42 -0
  52. prism_q-0.21.1/docs/architecture/ir.md +53 -0
  53. prism_q-0.21.1/docs/architecture/overview.md +49 -0
  54. prism_q-0.21.1/docs/architecture/qec-ir.md +64 -0
  55. prism_q-0.21.1/docs/architecture/samplers.md +60 -0
  56. prism_q-0.21.1/docs/architecture/threading-simd.md +45 -0
  57. prism_q-0.21.1/docs/benchmarks.md +65 -0
  58. prism_q-0.21.1/docs/book.toml +36 -0
  59. prism_q-0.21.1/docs/diagrams/ghz_5.svg +44 -0
  60. prism_q-0.21.1/docs/diagrams/hea_4.svg +63 -0
  61. prism_q-0.21.1/docs/diagrams/qaoa_4.svg +40 -0
  62. prism_q-0.21.1/docs/diagrams/qft_4.svg +31 -0
  63. prism_q-0.21.1/docs/diagrams/qpe_4.svg +62 -0
  64. prism_q-0.21.1/docs/diagrams/w_state_4.svg +56 -0
  65. prism_q-0.21.1/docs/getting-started/choosing-a-backend.md +62 -0
  66. prism_q-0.21.1/docs/getting-started/first-circuit.md +64 -0
  67. prism_q-0.21.1/docs/getting-started/install.md +49 -0
  68. prism_q-0.21.1/docs/getting-started/shots.md +70 -0
  69. prism_q-0.21.1/docs/glossary.md +41 -0
  70. prism_q-0.21.1/docs/guides/backends.md +56 -0
  71. prism_q-0.21.1/docs/guides/capabilities.md +60 -0
  72. prism_q-0.21.1/docs/guides/clifford-t.md +58 -0
  73. prism_q-0.21.1/docs/guides/gpu.md +95 -0
  74. prism_q-0.21.1/docs/guides/openqasm.md +58 -0
  75. prism_q-0.21.1/docs/guides/performance.md +57 -0
  76. prism_q-0.21.1/docs/guides/qec.md +64 -0
  77. prism_q-0.21.1/docs/mdbook-admonish.css +356 -0
  78. prism_q-0.21.1/docs/mermaid-init.js +39 -0
  79. prism_q-0.21.1/docs/mermaid.min.js +2609 -0
  80. prism_q-0.21.1/docs/overview.md +47 -0
  81. prism_q-0.21.1/docs/reference/builders.md +37 -0
  82. prism_q-0.21.1/docs/theme/custom.css +79 -0
  83. prism_q-0.21.1/docs/theme/favicon.svg +6 -0
  84. prism_q-0.21.1/examples/backends.rs +40 -0
  85. prism_q-0.21.1/examples/bell_state.rs +18 -0
  86. prism_q-0.21.1/examples/bench_gpu_dispatch.rs +155 -0
  87. prism_q-0.21.1/examples/bench_gpu_vs_cpu.rs +112 -0
  88. prism_q-0.21.1/examples/bench_sparse_det.rs +47 -0
  89. prism_q-0.21.1/examples/bench_stabilizer.rs +336 -0
  90. prism_q-0.21.1/examples/bench_suite.rs +256 -0
  91. prism_q-0.21.1/examples/dist_mpi_check.rs +237 -0
  92. prism_q-0.21.1/examples/gen_doc_diagrams.rs +53 -0
  93. prism_q-0.21.1/examples/profile_circuit.rs +309 -0
  94. prism_q-0.21.1/examples/qft.rs +38 -0
  95. prism_q-0.21.1/examples/shots.rs +33 -0
  96. prism_q-0.21.1/pyproject.toml +33 -0
  97. prism_q-0.21.1/python/prism_q/__init__.py +57 -0
  98. prism_q-0.21.1/python/prism_q/_prism_q.pyi +307 -0
  99. prism_q-0.21.1/python/prism_q/py.typed +0 -0
  100. prism_q-0.21.1/rust-toolchain.toml +3 -0
  101. prism_q-0.21.1/scripts/bench_baseline.ps1 +51 -0
  102. prism_q-0.21.1/scripts/bench_baseline.sh +43 -0
  103. prism_q-0.21.1/scripts/bench_check.ps1 +299 -0
  104. prism_q-0.21.1/scripts/bench_check.sh +317 -0
  105. prism_q-0.21.1/scripts/bench_ci.sh +92 -0
  106. prism_q-0.21.1/scripts/bench_compare.ps1 +79 -0
  107. prism_q-0.21.1/scripts/bench_compare.sh +71 -0
  108. prism_q-0.21.1/scripts/flamegraph.ps1 +81 -0
  109. prism_q-0.21.1/scripts/flamegraph.sh +66 -0
  110. prism_q-0.21.1/scripts/flamegraph_report.ps1 +267 -0
  111. prism_q-0.21.1/scripts/mpi-env.ps1 +55 -0
  112. prism_q-0.21.1/scripts/test-mpi.ps1 +68 -0
  113. prism_q-0.21.1/src/backend/distributed_statevector/mod.rs +1475 -0
  114. prism_q-0.21.1/src/backend/distributed_statevector/tests.rs +1287 -0
  115. prism_q-0.21.1/src/backend/factored/mod.rs +1423 -0
  116. prism_q-0.21.1/src/backend/factored/tests.rs +801 -0
  117. prism_q-0.21.1/src/backend/factored_stabilizer/mod.rs +1365 -0
  118. prism_q-0.21.1/src/backend/factored_stabilizer/tests.rs +595 -0
  119. prism_q-0.21.1/src/backend/memory.rs +243 -0
  120. prism_q-0.21.1/src/backend/mod.rs +253 -0
  121. prism_q-0.21.1/src/backend/mps.rs +2593 -0
  122. prism_q-0.21.1/src/backend/product.rs +509 -0
  123. prism_q-0.21.1/src/backend/simd.rs +2927 -0
  124. prism_q-0.21.1/src/backend/sparse.rs +826 -0
  125. prism_q-0.21.1/src/backend/stabilizer/kernels/batch.rs +1101 -0
  126. prism_q-0.21.1/src/backend/stabilizer/kernels/mod.rs +1072 -0
  127. prism_q-0.21.1/src/backend/stabilizer/kernels/simd.rs +396 -0
  128. prism_q-0.21.1/src/backend/stabilizer/mod.rs +1514 -0
  129. prism_q-0.21.1/src/backend/stabilizer/tests.rs +1003 -0
  130. prism_q-0.21.1/src/backend/statevector/kernels.rs +3287 -0
  131. prism_q-0.21.1/src/backend/statevector/mod.rs +689 -0
  132. prism_q-0.21.1/src/backend/statevector/tests.rs +1517 -0
  133. prism_q-0.21.1/src/backend/tensornetwork.rs +1441 -0
  134. prism_q-0.21.1/src/backend/word_ops.rs +135 -0
  135. prism_q-0.21.1/src/circuit/builder.rs +321 -0
  136. prism_q-0.21.1/src/circuit/draw.rs +1236 -0
  137. prism_q-0.21.1/src/circuit/expr.rs +408 -0
  138. prism_q-0.21.1/src/circuit/fusion.rs +2564 -0
  139. prism_q-0.21.1/src/circuit/fusion_phase.rs +427 -0
  140. prism_q-0.21.1/src/circuit/fusion_rzz.rs +156 -0
  141. prism_q-0.21.1/src/circuit/mod.rs +1167 -0
  142. prism_q-0.21.1/src/circuit/openqasm.rs +2577 -0
  143. prism_q-0.21.1/src/circuit/openqasm_tests.rs +2586 -0
  144. prism_q-0.21.1/src/circuit/svg.rs +2316 -0
  145. prism_q-0.21.1/src/circuits.rs +397 -0
  146. prism_q-0.21.1/src/distributed/comm.rs +218 -0
  147. prism_q-0.21.1/src/distributed/mod.rs +119 -0
  148. prism_q-0.21.1/src/error.rs +53 -0
  149. prism_q-0.21.1/src/gates/mod.rs +1450 -0
  150. prism_q-0.21.1/src/gpu/device.rs +206 -0
  151. prism_q-0.21.1/src/gpu/kernels/bts.rs +1688 -0
  152. prism_q-0.21.1/src/gpu/kernels/dense.rs +1879 -0
  153. prism_q-0.21.1/src/gpu/kernels/mod.rs +219 -0
  154. prism_q-0.21.1/src/gpu/kernels/stabilizer.rs +1309 -0
  155. prism_q-0.21.1/src/gpu/memory.rs +80 -0
  156. prism_q-0.21.1/src/gpu/mod.rs +524 -0
  157. prism_q-0.21.1/src/lib.rs +114 -0
  158. prism_q-0.21.1/src/qec/camps_prefix.rs +2297 -0
  159. prism_q-0.21.1/src/qec/cut_selection.rs +462 -0
  160. prism_q-0.21.1/src/qec/mod.rs +982 -0
  161. prism_q-0.21.1/src/qec/noise.rs +727 -0
  162. prism_q-0.21.1/src/qec/observable_reroute.rs +139 -0
  163. prism_q-0.21.1/src/qec/parse.rs +708 -0
  164. prism_q-0.21.1/src/qec/result.rs +279 -0
  165. prism_q-0.21.1/src/qec/runner.rs +1093 -0
  166. prism_q-0.21.1/src/qec/t_sampler.rs +1034 -0
  167. prism_q-0.21.1/src/sim/compiled/accumulator.rs +1222 -0
  168. prism_q-0.21.1/src/sim/compiled/bts.rs +1304 -0
  169. prism_q-0.21.1/src/sim/compiled/mod.rs +3085 -0
  170. prism_q-0.21.1/src/sim/compiled/parity.rs +494 -0
  171. prism_q-0.21.1/src/sim/compiled/propagation.rs +2118 -0
  172. prism_q-0.21.1/src/sim/compiled/rng.rs +465 -0
  173. prism_q-0.21.1/src/sim/compiled/sign_truth_table_tests.rs +335 -0
  174. prism_q-0.21.1/src/sim/compiled/tests.rs +1798 -0
  175. prism_q-0.21.1/src/sim/decomposed.rs +247 -0
  176. prism_q-0.21.1/src/sim/dispatch.rs +611 -0
  177. prism_q-0.21.1/src/sim/homological.rs +1299 -0
  178. prism_q-0.21.1/src/sim/mod.rs +2938 -0
  179. prism_q-0.21.1/src/sim/noise.rs +2749 -0
  180. prism_q-0.21.1/src/sim/probability.rs +392 -0
  181. prism_q-0.21.1/src/sim/shots.rs +374 -0
  182. prism_q-0.21.1/src/sim/stabilizer_rank.rs +1701 -0
  183. prism_q-0.21.1/src/sim/terminal_sampling.rs +411 -0
  184. prism_q-0.21.1/src/sim/trajectory.rs +560 -0
  185. prism_q-0.21.1/src/sim/unified_pauli.rs +1375 -0
  186. prism_q-0.21.1/tests/backend_matrix.rs +161 -0
  187. prism_q-0.21.1/tests/common/circuits.rs +659 -0
  188. prism_q-0.21.1/tests/common/framework.rs +123 -0
  189. prism_q-0.21.1/tests/common/matrix.rs +133 -0
  190. prism_q-0.21.1/tests/common/mod.rs +153 -0
  191. prism_q-0.21.1/tests/factored_correctness.rs +365 -0
  192. prism_q-0.21.1/tests/fusion_correctness.rs +917 -0
  193. prism_q-0.21.1/tests/golden_gpu.rs +1842 -0
  194. prism_q-0.21.1/tests/golden_small_circuits.rs +1495 -0
  195. prism_q-0.21.1/tests/measurement_matrix.rs +144 -0
  196. prism_q-0.21.1/tests/mps_correctness.rs +176 -0
  197. prism_q-0.21.1/tests/noise_validation.rs +215 -0
  198. prism_q-0.21.1/tests/openqasm_goldens.rs +266 -0
  199. prism_q-0.21.1/tests/pauli_joint_observable.rs +168 -0
  200. prism_q-0.21.1/tests/product_correctness.rs +212 -0
  201. prism_q-0.21.1/tests/qec_ir.rs +951 -0
  202. prism_q-0.21.1/tests/qec_noisy_validation.rs +235 -0
  203. prism_q-0.21.1/tests/qec_observable_reroute.rs +203 -0
  204. prism_q-0.21.1/tests/qec_t_correctness.rs +666 -0
  205. prism_q-0.21.1/tests/qft_expansion_regression.rs +121 -0
  206. prism_q-0.21.1/tests/smoke_openqasm.rs +690 -0
  207. prism_q-0.21.1/tests/sparse_correctness.rs +131 -0
  208. prism_q-0.21.1/tests/stabilizer_correctness.rs +157 -0
  209. prism_q-0.21.1/tests/tensornetwork_correctness.rs +128 -0
  210. prism_q-0.21.1/tests/trajectory_correctness.rs +455 -0
@@ -0,0 +1,109 @@
1
+ name: Bug report
2
+ description: Report incorrect behavior, performance regressions, panics, or build failures.
3
+ title: "[Bug]: "
4
+ labels: ["bug"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for reporting a bug. Include enough detail to reproduce the issue and assess performance impact.
10
+
11
+ - type: textarea
12
+ id: summary
13
+ attributes:
14
+ label: Summary
15
+ description: Describe the problem and why it matters.
16
+ placeholder: "Example: Applying a controlled gate with adjacent qubits returns an incorrect amplitude."
17
+ validations:
18
+ required: true
19
+
20
+ - type: dropdown
21
+ id: bug-type
22
+ attributes:
23
+ label: Bug category
24
+ description: Select the primary category.
25
+ options:
26
+ - Incorrect simulation result
27
+ - Performance regression
28
+ - Panic or crash
29
+ - Build, CI, or tooling failure
30
+ - Documentation mismatch
31
+ - Other
32
+ validations:
33
+ required: true
34
+
35
+ - type: textarea
36
+ id: reproduction
37
+ attributes:
38
+ label: Reproduction steps
39
+ description: Provide a minimal command, circuit, test case, or code snippet that triggers the issue.
40
+ placeholder: |
41
+ 1. Run `cargo test ...`
42
+ 2. Execute this circuit:
43
+ ...
44
+ 3. Observe ...
45
+ validations:
46
+ required: true
47
+
48
+ - type: textarea
49
+ id: expected
50
+ attributes:
51
+ label: Expected behavior
52
+ description: State the correct result, timing, output, or error handling.
53
+ validations:
54
+ required: true
55
+
56
+ - type: textarea
57
+ id: actual
58
+ attributes:
59
+ label: Actual behavior
60
+ description: Paste the observed result, error output, panic, or benchmark regression.
61
+ render: shell
62
+ validations:
63
+ required: true
64
+
65
+ - type: textarea
66
+ id: affected-area
67
+ attributes:
68
+ label: Affected area
69
+ description: List the backend, gate, parser, fusion pass, benchmark, or public API involved.
70
+ placeholder: "Example: statevector backend, controlled-X kernel, benches/circuits.rs"
71
+ validations:
72
+ required: true
73
+
74
+ - type: textarea
75
+ id: environment
76
+ attributes:
77
+ label: Environment
78
+ description: Include enough system detail to reproduce correctness or performance issues.
79
+ value: |
80
+ - OS:
81
+ - CPU model:
82
+ - Rust version:
83
+ - PRISM-Q commit:
84
+ - Feature flags:
85
+ - Compiler flags:
86
+ validations:
87
+ required: true
88
+
89
+ - type: textarea
90
+ id: benchmarks
91
+ attributes:
92
+ label: Benchmark or profiling data
93
+ description: Required for performance regressions. Include before and after numbers if available.
94
+ placeholder: |
95
+ | Benchmark | Before | After | Change |
96
+ | --- | --- | --- | --- |
97
+ | | | | |
98
+
99
+ Regression verdict: PASS / FAIL / WAIVER
100
+ validations:
101
+ required: false
102
+
103
+ - type: textarea
104
+ id: additional-context
105
+ attributes:
106
+ label: Additional context
107
+ description: Add links, related issues, screenshots, logs, or proposed fixes.
108
+ validations:
109
+ required: false
@@ -0,0 +1,99 @@
1
+ name: Feature request
2
+ description: Propose a new capability, backend, gate, optimization, or developer workflow.
3
+ title: "[Feature]: "
4
+ labels: ["enhancement"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for proposing an improvement. Ground the request in performance, correctness, and maintainability impact.
10
+
11
+ - type: textarea
12
+ id: summary
13
+ attributes:
14
+ label: Summary
15
+ description: Describe the requested feature and the problem it solves.
16
+ placeholder: "Example: Add a sparse state backend for circuits with limited basis support."
17
+ validations:
18
+ required: true
19
+
20
+ - type: dropdown
21
+ id: feature-type
22
+ attributes:
23
+ label: Feature category
24
+ description: Select the primary category.
25
+ options:
26
+ - Simulation backend
27
+ - Gate or circuit operation
28
+ - Performance optimization
29
+ - Parser or input format
30
+ - Benchmarking or profiling
31
+ - Developer tooling
32
+ - Documentation
33
+ - Other
34
+ validations:
35
+ required: true
36
+
37
+ - type: textarea
38
+ id: motivation
39
+ attributes:
40
+ label: Motivation
41
+ description: Explain the use case, target workload, or limitation in the current implementation.
42
+ validations:
43
+ required: true
44
+
45
+ - type: textarea
46
+ id: proposed-solution
47
+ attributes:
48
+ label: Proposed solution
49
+ description: Describe the desired behavior, API, backend contract, or workflow.
50
+ validations:
51
+ required: true
52
+
53
+ - type: textarea
54
+ id: alternatives
55
+ attributes:
56
+ label: Alternatives considered
57
+ description: List other approaches and why this proposal is preferred.
58
+ validations:
59
+ required: false
60
+
61
+ - type: textarea
62
+ id: performance-impact
63
+ attributes:
64
+ label: Performance impact
65
+ description: Describe expected throughput, latency, memory, allocation, or benchmark impact.
66
+ placeholder: |
67
+ - Affected benchmark or workload:
68
+ - Expected speedup or tradeoff:
69
+ - Measurement plan:
70
+ validations:
71
+ required: true
72
+
73
+ - type: textarea
74
+ id: correctness-impact
75
+ attributes:
76
+ label: Correctness and testing plan
77
+ description: List the tests, golden comparisons, seeds, or numerical tolerances needed.
78
+ placeholder: |
79
+ - Unit tests:
80
+ - Golden tests:
81
+ - Fixed RNG seed:
82
+ validations:
83
+ required: true
84
+
85
+ - type: textarea
86
+ id: docs-impact
87
+ attributes:
88
+ label: Documentation impact
89
+ description: Note public API docs, architecture documentation, or benchmark notes that need updates.
90
+ validations:
91
+ required: false
92
+
93
+ - type: textarea
94
+ id: additional-context
95
+ attributes:
96
+ label: Additional context
97
+ description: Add links, examples, related issues, or implementation notes.
98
+ validations:
99
+ required: false
@@ -0,0 +1,69 @@
1
+ <!--
2
+ Review this template before deleting sections that do not apply. Keep the headings that
3
+ match the PR so reviewers know what was considered and skipped.
4
+ -->
5
+
6
+ ## Summary
7
+
8
+ Describe what changed and why in two or three sentences. Focus on the motivation, not the
9
+ diff. Link any related issue or discussion.
10
+
11
+ ## Scope
12
+
13
+ - [ ] Bug fix
14
+ - [ ] New feature
15
+ - [ ] Performance improvement
16
+ - [ ] Refactor or cleanup
17
+ - [ ] Documentation
18
+ - [ ] Build, CI, or tooling
19
+
20
+ ## Benchmarks (required for any change that touches a hot path)
21
+
22
+ Run from a quiet machine with `--features parallel` and paste the numbers below. If this
23
+ PR only changes documentation or non-performance code, write "N/A, no hot-path changes"
24
+ and skip the table.
25
+
26
+ | Benchmark | Before | After | Change | Within 5% threshold? |
27
+ | --- | --- | --- | --- | --- |
28
+ | | | | | |
29
+
30
+ Regression verdict: PASS / FAIL / WAIVER
31
+
32
+ If WAIVER, explain why the regression is acceptable and what future work will recover it.
33
+
34
+ ## Correctness
35
+
36
+ - [ ] `cargo test --all-features` passes locally
37
+ - [ ] `cargo clippy --all-targets --all-features -- -D warnings -D clippy::undocumented_unsafe_blocks` passes
38
+ - [ ] `cargo fmt --check` passes
39
+ - [ ] `cargo doc --no-deps --all-features` passes
40
+ - [ ] New public API has docstrings
41
+ - [ ] New gate, backend, or fusion pass has golden tests against the statevector backend
42
+ - [ ] GPU-affecting change runs `cargo test --features "parallel gpu" --test golden_gpu`
43
+
44
+ ## Hotspot notes
45
+
46
+ If the change touches a hot path, list the functions affected and attach profiler or
47
+ flamegraph output showing where time went. If no hot paths were touched, write "N/A".
48
+
49
+ ## Architecture or design changes
50
+
51
+ - [ ] `docs/architecture/` updated if the change is structural
52
+ - [ ] Design or research notes added where required for new subsystems
53
+
54
+ ## Breaking changes
55
+
56
+ List any public API breakage, config format changes, or behavioral differences a user
57
+ might hit after upgrading. Write "None" if there are none.
58
+
59
+ ## Risks and rollback
60
+
61
+ Describe the blast radius if this lands and turns out wrong. Note any feature flags or
62
+ dispatch guards that let the change be rolled back without reverting the commit.
63
+
64
+ ## Pre-merge checklist
65
+
66
+ - [ ] Commit messages follow the style rules
67
+ - [ ] No secrets, credentials, or local config added
68
+ - [ ] No new dependencies without a rationale
69
+ - [ ] CI is green
@@ -0,0 +1,57 @@
1
+ backend:
2
+ - changed-files:
3
+ - any-glob-to-any-file: 'src/backend/**/*'
4
+
5
+ simd:
6
+ - changed-files:
7
+ - any-glob-to-any-file: 'src/backend/simd.rs'
8
+
9
+ statevector:
10
+ - changed-files:
11
+ - any-glob-to-any-file: 'src/backend/statevector/**/*'
12
+
13
+ stabilizer:
14
+ - changed-files:
15
+ - any-glob-to-any-file: 'src/backend/stabilizer.rs'
16
+
17
+ mps:
18
+ - changed-files:
19
+ - any-glob-to-any-file: 'src/backend/mps.rs'
20
+
21
+ parser:
22
+ - changed-files:
23
+ - any-glob-to-any-file: 'src/circuit/openqasm.rs'
24
+
25
+ circuit:
26
+ - changed-files:
27
+ - any-glob-to-any-file: 'src/circuit/**/*'
28
+
29
+ fusion:
30
+ - changed-files:
31
+ - any-glob-to-any-file: 'src/circuit/fusion.rs'
32
+
33
+ gates:
34
+ - changed-files:
35
+ - any-glob-to-any-file: 'src/gates/**/*'
36
+
37
+ sim:
38
+ - changed-files:
39
+ - any-glob-to-any-file: 'src/sim/**/*'
40
+
41
+ benchmarks:
42
+ - changed-files:
43
+ - any-glob-to-any-file: 'benches/**/*'
44
+
45
+ tests:
46
+ - changed-files:
47
+ - any-glob-to-any-file: 'tests/**/*'
48
+
49
+ ci:
50
+ - changed-files:
51
+ - any-glob-to-any-file: '.github/**/*'
52
+
53
+ docs:
54
+ - changed-files:
55
+ - any-glob-to-any-file:
56
+ - '**/*.md'
57
+ - 'LICENSE*'
@@ -0,0 +1,302 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ env:
10
+ CARGO_TERM_COLOR: always
11
+ # Features exercised on runners without CUDA. The `gpu` feature links against CUDA via
12
+ # cudarc's dynamic-linking mode and can't build on hosts that don't have the NVIDIA
13
+ # toolkit installed, so CI enumerates features instead of using --all-features.
14
+ CI_FEATURES: parallel,serialization
15
+ CI_BENCH_FEATURES: parallel,bench-fast
16
+ REGRESSION_THRESHOLD: ${{ vars.REGRESSION_THRESHOLD || '5.0' }}
17
+
18
+ jobs:
19
+ check:
20
+ name: Lint & Test
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@v7
24
+ - uses: dtolnay/rust-toolchain@stable
25
+ with:
26
+ components: rustfmt, clippy
27
+ - uses: Swatinem/rust-cache@v2
28
+ with:
29
+ cache-bin: false
30
+ - uses: taiki-e/install-action@cargo-nextest
31
+
32
+ - name: Formatting
33
+ run: cargo fmt --all -- --check
34
+
35
+ - name: Clippy
36
+ run: cargo clippy --all-targets --features "$CI_FEATURES" -- -D warnings -D clippy::undocumented_unsafe_blocks
37
+
38
+ - name: Tests
39
+ run: cargo nextest run --features "$CI_FEATURES"
40
+
41
+ - name: Doc tests
42
+ run: cargo test --doc --features "$CI_FEATURES"
43
+
44
+ - name: Doc build
45
+ run: cargo doc --no-deps --features "$CI_FEATURES"
46
+ env:
47
+ RUSTDOCFLAGS: -D warnings
48
+
49
+ check-no-default-features:
50
+ name: Lint & Test (no default features)
51
+ runs-on: ubuntu-latest
52
+ steps:
53
+ - uses: actions/checkout@v7
54
+ - uses: dtolnay/rust-toolchain@stable
55
+ with:
56
+ components: clippy
57
+ - uses: Swatinem/rust-cache@v2
58
+ with:
59
+ cache-bin: false
60
+ - uses: taiki-e/install-action@cargo-nextest
61
+
62
+ - name: Clippy
63
+ run: cargo clippy --all-targets --no-default-features -- -D warnings -D clippy::undocumented_unsafe_blocks
64
+
65
+ - name: Tests
66
+ run: cargo nextest run --no-default-features
67
+
68
+ - name: Doc tests
69
+ run: cargo test --doc --no-default-features
70
+
71
+ benchmark-regression:
72
+ name: Benchmark Regression
73
+ runs-on: ubuntu-latest
74
+ needs: check
75
+ if: github.event_name == 'pull_request'
76
+ timeout-minutes: 45
77
+ permissions:
78
+ contents: read
79
+ steps:
80
+ - name: Checkout base
81
+ uses: actions/checkout@v7
82
+ with:
83
+ ref: ${{ github.event.pull_request.base.sha }}
84
+ path: base
85
+ fetch-depth: 1
86
+
87
+ - name: Checkout head
88
+ uses: actions/checkout@v7
89
+ with:
90
+ repository: ${{ github.event.pull_request.head.repo.full_name }}
91
+ ref: ${{ github.event.pull_request.head.sha }}
92
+ path: head
93
+ fetch-depth: 1
94
+
95
+ - uses: dtolnay/rust-toolchain@stable
96
+
97
+ - uses: Swatinem/rust-cache@v2
98
+ with:
99
+ cache-bin: false
100
+ workspaces: |
101
+ base -> target
102
+ head -> target
103
+
104
+ - name: Install benchmark tools
105
+ run: sudo apt-get update && sudo apt-get install -y bc jq
106
+
107
+ - name: Benchmark base
108
+ working-directory: base
109
+ run: bash ../head/scripts/bench_ci.sh
110
+ env:
111
+ PRISM_BENCH_PROJECT_DIR: ${{ github.workspace }}/base
112
+
113
+ - name: Save base baseline
114
+ working-directory: base
115
+ run: bash scripts/bench_check.sh save --name ci-base
116
+
117
+ - name: Copy base baseline
118
+ run: |
119
+ mkdir -p head/bench_results/baselines
120
+ cp base/bench_results/baselines/ci-base.json head/bench_results/baselines/ci-base.json
121
+
122
+ - name: Benchmark head
123
+ working-directory: head
124
+ run: bash scripts/bench_ci.sh
125
+
126
+ - name: Compare benchmark results
127
+ working-directory: head
128
+ run: |
129
+ set +e
130
+ bash scripts/bench_check.sh table --baseline ci-base | tee ../benchmark-summary.md
131
+ table_status=${PIPESTATUS[0]}
132
+ bash scripts/bench_check.sh compare --baseline ci-base | tee ../benchmark-compare.txt
133
+ compare_status=${PIPESTATUS[0]}
134
+
135
+ {
136
+ echo "## Benchmark Regression Gate"
137
+ echo ""
138
+ cat ../benchmark-summary.md
139
+ echo ""
140
+ echo '```text'
141
+ cat ../benchmark-compare.txt
142
+ echo '```'
143
+ } >> "$GITHUB_STEP_SUMMARY"
144
+
145
+ if [[ "$table_status" -ne 0 ]]; then
146
+ exit "$table_status"
147
+ fi
148
+ exit "$compare_status"
149
+
150
+ - name: Upload benchmark artifacts
151
+ if: always()
152
+ uses: actions/upload-artifact@v7
153
+ with:
154
+ name: benchmark-regression
155
+ if-no-files-found: ignore
156
+ path: |
157
+ benchmark-summary.md
158
+ benchmark-compare.txt
159
+ base/bench_results/baselines/ci-base.json
160
+ head/bench_results/baselines/ci-base.json
161
+ head/target/criterion/**/benchmark.json
162
+ head/target/criterion/**/new/estimates.json
163
+
164
+ coverage:
165
+ name: Coverage
166
+ runs-on: ubuntu-latest
167
+ steps:
168
+ - uses: actions/checkout@v7
169
+ - uses: dtolnay/rust-toolchain@stable
170
+ with:
171
+ components: llvm-tools-preview
172
+ - uses: Swatinem/rust-cache@v2
173
+ with:
174
+ cache-bin: false
175
+ - uses: taiki-e/install-action@cargo-llvm-cov
176
+ - name: Generate coverage
177
+ run: cargo llvm-cov --features "$CI_FEATURES" --lcov --output-path lcov.info
178
+ - name: Extract coverage percentage
179
+ id: cov
180
+ run: |
181
+ LF=$(grep '^LF:' lcov.info | awk -F: '{s+=$2} END {print s+0}')
182
+ LH=$(grep '^LH:' lcov.info | awk -F: '{s+=$2} END {print s+0}')
183
+ COVERAGE=$(awk "BEGIN {if ($LF>0) printf \"%.1f\", ($LH/$LF)*100; else print \"0\"}")
184
+ echo "percentage=$COVERAGE" >> "$GITHUB_OUTPUT"
185
+ echo "### Coverage: ${COVERAGE}%" >> "$GITHUB_STEP_SUMMARY"
186
+ - name: Update coverage badge
187
+ if: github.ref == 'refs/heads/main' && github.event_name == 'push'
188
+ uses: schneegans/dynamic-badges-action@v1.9.0
189
+ with:
190
+ auth: ${{ secrets.GIST_TOKEN }}
191
+ gistID: ${{ vars.COVERAGE_GIST_ID }}
192
+ filename: coverage.json
193
+ label: coverage
194
+ message: ${{ steps.cov.outputs.percentage }}%
195
+ valColorRange: ${{ steps.cov.outputs.percentage }}
196
+ minColorRange: 50
197
+ maxColorRange: 90
198
+
199
+ check-aarch64:
200
+ name: Cross-compile aarch64
201
+ runs-on: ubuntu-latest
202
+ steps:
203
+ - uses: actions/checkout@v7
204
+ - uses: dtolnay/rust-toolchain@stable
205
+ with:
206
+ targets: aarch64-unknown-linux-gnu
207
+ - uses: Swatinem/rust-cache@v2
208
+ with:
209
+ cache-bin: false
210
+ - name: Install cross-compilation toolchain
211
+ run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
212
+ - name: Check (no default features)
213
+ run: cargo check --target aarch64-unknown-linux-gnu --no-default-features
214
+ env:
215
+ CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
216
+ - name: Check (CI features)
217
+ run: cargo check --target aarch64-unknown-linux-gnu --features "$CI_FEATURES"
218
+ env:
219
+ CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
220
+
221
+ # Execute the NEON fallbacks under emulation. check-aarch64 above only compiles,
222
+ # so without this the NEON kernels are never run against their scalar reference on
223
+ # Linux. Scoped to the SIMD-relevant tests to bound QEMU wall-clock.
224
+ test-aarch64-qemu:
225
+ name: Test aarch64 (QEMU)
226
+ runs-on: ubuntu-latest
227
+ timeout-minutes: 40
228
+ steps:
229
+ - uses: actions/checkout@v7
230
+ - uses: dtolnay/rust-toolchain@stable
231
+ with:
232
+ targets: aarch64-unknown-linux-gnu
233
+ - uses: Swatinem/rust-cache@v2
234
+ with:
235
+ cache-bin: false
236
+ - uses: taiki-e/install-action@v2
237
+ with:
238
+ tool: cross
239
+ - name: SIMD kernel unit tests (NEON vs scalar)
240
+ run: cross test --target aarch64-unknown-linux-gnu --features "$CI_FEATURES" --lib backend::simd::tests
241
+ - name: word_ops unit tests (NEON vs scalar)
242
+ run: cross test --target aarch64-unknown-linux-gnu --features "$CI_FEATURES" --lib backend::word_ops::tests
243
+ - name: Batched diagonal phase reference (NEON path)
244
+ run: cross test --target aarch64-unknown-linux-gnu --features "$CI_FEATURES" --lib backend::statevector::tests::batch_phase_matches_independent_reference
245
+ - name: Cross-backend correctness matrix
246
+ run: cross test --target aarch64-unknown-linux-gnu --features "$CI_FEATURES" --test backend_matrix
247
+
248
+ # Compile-check the GPU paths with the CUDA toolkit but no device. The job only
249
+ # compiles and runs the device-free KERNEL_NAMES test (nothing opens a device),
250
+ # enforcing the exhaustive GPU dispatch matches and the golden_gpu registry at
251
+ # compile time. Pinned to ubuntu-22.04: CUDA 12.4 (matching cudarc's cuda-12040
252
+ # bindings) has no package for the ubuntu2404 repo on ubuntu-latest.
253
+ gpu-check:
254
+ name: GPU compile-check (no device)
255
+ runs-on: ubuntu-22.04
256
+ steps:
257
+ - uses: actions/checkout@v7
258
+ - uses: Jimver/cuda-toolkit@v0.2.35
259
+ with:
260
+ cuda: '12.4.0'
261
+ method: network
262
+ - uses: dtolnay/rust-toolchain@stable
263
+ with:
264
+ components: clippy
265
+ - uses: Swatinem/rust-cache@v2
266
+ with:
267
+ cache-bin: false
268
+ - uses: taiki-e/install-action@cargo-nextest
269
+ - name: Compile-check GPU dispatch + golden_gpu coverage
270
+ run: cargo check --all-targets --features "parallel gpu"
271
+ - name: Clippy GPU paths
272
+ run: cargo clippy --all-targets --features "parallel gpu" -- -D warnings -D clippy::undocumented_unsafe_blocks
273
+ - name: KERNEL_NAMES consistency (device-free)
274
+ run: cargo nextest run --features "parallel gpu" -E 'test(kernel_names_match_source_entry_points)'
275
+
276
+ test-macos-arm:
277
+ name: Test macOS ARM64
278
+ runs-on: macos-latest
279
+ steps:
280
+ - uses: actions/checkout@v7
281
+ - uses: dtolnay/rust-toolchain@stable
282
+ with:
283
+ components: clippy
284
+ - uses: Swatinem/rust-cache@v2
285
+ with:
286
+ cache-bin: false
287
+ - uses: taiki-e/install-action@cargo-nextest
288
+ - name: Clippy
289
+ run: cargo clippy --all-targets --features "$CI_FEATURES" -- -D warnings -D clippy::undocumented_unsafe_blocks
290
+ - name: Tests
291
+ run: cargo nextest run --features "$CI_FEATURES"
292
+ - name: Doc tests
293
+ run: cargo test --doc --features "$CI_FEATURES"
294
+
295
+ security:
296
+ name: Security & Licenses
297
+ runs-on: ubuntu-latest
298
+ steps:
299
+ - uses: actions/checkout@v7
300
+ - uses: EmbarkStudios/cargo-deny-action@v2
301
+ with:
302
+ command: check
@@ -0,0 +1,49 @@
1
+ name: Docs
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths:
7
+ - 'docs/**'
8
+ - '.github/workflows/docs.yml'
9
+ pull_request:
10
+ paths:
11
+ - 'docs/**'
12
+ - '.github/workflows/docs.yml'
13
+ workflow_dispatch:
14
+
15
+ permissions:
16
+ contents: read
17
+ pages: write
18
+ id-token: write
19
+
20
+ concurrency:
21
+ group: pages
22
+ cancel-in-progress: true
23
+
24
+ jobs:
25
+ build:
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v7
29
+ - uses: taiki-e/install-action@v2
30
+ with:
31
+ tool: mdbook@0.4.52
32
+ - name: Install mdBook preprocessors
33
+ run: cargo install --locked mdbook-admonish@1.20.0 mdbook-mermaid@0.14.0 mdbook-katex@0.9.4
34
+ - name: Build book
35
+ run: mdbook build docs
36
+ - uses: actions/upload-pages-artifact@v5
37
+ with:
38
+ path: docs/book
39
+
40
+ deploy:
41
+ needs: build
42
+ if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
43
+ runs-on: ubuntu-latest
44
+ environment:
45
+ name: github-pages
46
+ url: ${{ steps.deployment.outputs.page_url }}
47
+ steps:
48
+ - id: deployment
49
+ uses: actions/deploy-pages@v5
@@ -0,0 +1,12 @@
1
+ name: Labeler
2
+ on: [pull_request_target]
3
+
4
+ jobs:
5
+ label:
6
+ runs-on: ubuntu-latest
7
+ permissions:
8
+ contents: read
9
+ pull-requests: write
10
+
11
+ steps:
12
+ - uses: actions/labeler@v6