Repository navigation
Move generalized tableau interpreter and simulator over from bloqade-internal - #71
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR vendors the Bloqade “squin” generalized-tableau interpreter and simulator device into ppvm to avoid depending on the non–open source internal repository, and wires it into the Python package with new dependencies and tests.
Changes:
- Added a
ppvm.squin_interpreterpackage implementing Kirin method tables for squin qubits/gates/noise plus aGeneralizedTableauSimulatordevice/task wrapper. - Exported the simulator/task from
ppvm’s top-level package and addedbloqade-circuit+kirinruntime dependencies. - Added pytest coverage for executing squin kernels against the simulator and validating expected measurement outcomes.
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| ppvm-python/test/generalized_tableau/test_simulator_device.py | New tests exercising squin kernels via GeneralizedTableauSimulator. |
| ppvm-python/src/ppvm/squin_interpreter/qubit.py | Qubit allocation/measure/reset method table and result conversion to Bloqade measurement enums. |
| ppvm-python/src/ppvm/squin_interpreter/impls/noise.py | Noise channel method table mapping squin noise statements to GeneralizedTableau backend calls. |
| ppvm-python/src/ppvm/squin_interpreter/impls/gate.py | Gate method table mapping squin gate statements to GeneralizedTableau backend calls. |
| ppvm-python/src/ppvm/squin_interpreter/device.py | Simulator device/task wrapper that runs Kirin IR kernels and exposes backend state. |
| ppvm-python/src/ppvm/squin_interpreter/_interp.py | Kirin interpreter subclass providing backend lifecycle + qubit address allocation. |
| ppvm-python/src/ppvm/squin_interpreter/init.py | Package init importing impls/device/interpreter. |
| ppvm-python/src/ppvm/init.py | Re-exports simulator/task from the top-level ppvm package. |
| ppvm-python/pyproject.toml | Adds runtime deps on bloqade-circuit and kirin. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| self.current_qubit_addr = 0 | ||
| return self | ||
|
|
||
| def allocate_qubit(self) -> int: |
|
@copilot resolve the merge conflicts in this pull request |
Agent-Logs-Url: https://github.com/QuEraComputing/ppvm/sessions/ede0210c-ea81-46ad-aaf7-329275575a86 Co-authored-by: Roger-luo <8445510+Roger-luo@users.noreply.github.com>
|
@copilot resolve the merge conflicts in this pull request |
Resolved the merge conflicts and pushed merge commit |
Agent-Logs-Url: https://github.com/QuEraComputing/ppvm/sessions/37548f7c-0a7c-44a0-a7e1-4627b6c4c12d Co-authored-by: Roger-luo <8445510+Roger-luo@users.noreply.github.com>
Resolved the latest merge conflicts and pushed |
| options = {"min_abs_coeff": 1e-8} | ||
| sim = GeneralizedTableauSimulator(85, options=options) | ||
| task = sim.task(main) | ||
|
|
||
| start = time.time() | ||
| result = task.run() | ||
| print(result) | ||
| print(f"Runtime: {(time.time() - start) * 1e3} ms") | ||
|
|
||
| assert result[81] == ZERO |
| def initialize(self) -> Self: | ||
| super().initialize() | ||
| self.backend = GeneralizedTableau( | ||
| n_qubits=self.backend.n_qubits, | ||
| min_abs_coeff=self.backend.min_abs_coeff, | ||
| seed=self.rng_seed, | ||
| ) | ||
| self.current_qubit_addr = 0 | ||
| return self |
| tab = GeneralizedTableau(n_qubits=n_qubits, **self.options) | ||
| interp = GeneralizedTableauInterpreter( | ||
| kernel.dialects, backend=tab, rng_seed=self.options.get("seed") |
|
|
||
| # NOTE: just to register methods | ||
| from .squin_interpreter.impls import ( | ||
| gate as _gate, | ||
| noise as _noise | ||
| ) |
- Validate n_qubits is positive and bounds-check qubit allocation - Pop "seed" from options before splatting into GeneralizedTableau to avoid double-passing it - Assign super().initialize() return value for proper Self chaining - Drop redundant dialect-registration imports in ppvm/__init__.py; squin_interpreter/__init__.py already triggers them - Tighten test_basic_execution: drop timing instrumentation and assert the deterministic GHZ correlation across seeds - Use math.pi instead of float literals in tests Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Instead of https://github.com/QuEraComputing/bloqade-internal/pull/191, we are moving the squin interpreter and simulator device here for now. This solves the dependency issues while things are still not open source.