Skip to content

Move generalized tableau interpreter and simulator over from bloqade-internal - #71

Merged
Roger-luo merged 9 commits into
mainfrom
david/generalized-tableau-interpreter
May 17, 2026
Merged

Roger-luo merged 9 commits into
mainfrom
david/generalized-tableau-interpreter

Conversation

@david-pl

Copy link
Copy Markdown
Collaborator

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.

Copilot AI review requested due to automatic review settings May 11, 2026 12:18
@github-actions

github-actions Bot commented May 11, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-05-17 18:06 UTC

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_interpreter package implementing Kirin method tables for squin qubits/gates/noise plus a GeneralizedTableauSimulator device/task wrapper.
  • Exported the simulator/task from ppvm’s top-level package and added bloqade-circuit + kirin runtime 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.

Comment thread ppvm-python/src/ppvm/squin_interpreter/impls/gate.py
Comment thread ppvm-python/src/ppvm/squin_interpreter/device.py
Comment thread ppvm-python/src/ppvm/squin_interpreter/device.py Outdated
Comment thread ppvm-python/src/ppvm/squin_interpreter/_interp.py Outdated
Comment thread ppvm-python/src/ppvm/squin_interpreter/qubit.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 11, 2026 12:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 11 changed files in this pull request and generated 4 comments.

self.current_qubit_addr = 0
return self

def allocate_qubit(self) -> int:
Comment thread ppvm-python/src/ppvm/squin_interpreter/device.py
Comment thread ppvm-python/src/ppvm/squin_interpreter/device.py Outdated
Comment thread ppvm-python/test/generalized_tableau/test_simulator_device.py Outdated
@david-pl
david-pl requested a review from Roger-luo May 11, 2026 12:56
Copilot AI review requested due to automatic review settings May 17, 2026 02:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 11 changed files in this pull request and generated no new comments.

@Roger-luo

Copy link
Copy Markdown
Collaborator

@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>
@Roger-luo

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts in this pull request

Copilot AI commented May 17, 2026

Copy link
Copy Markdown

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts and pushed merge commit 3a8779f. I merged the latest main, regenerated ppvm-python/uv.lock to resolve the conflict cleanly, and validated the merged state with uv run --project ppvm-python --group dev pytest ppvm-python/test/generalized_tableau/test_simulator_device.py ppvm-python/test/generalized_tableau/test_stim.py plus RUSTFLAGS='-C target-feature=+aes,+sse2' cargo test -p ppvm-stim.

Copilot AI review requested due to automatic review settings May 17, 2026 16:39
@david-pl
david-pl removed the request for review from Copilot May 17, 2026 16:39

Copilot AI commented May 17, 2026

Copy link
Copy Markdown

@copilot resolve the merge conflicts in this pull request

Resolved the latest merge conflicts and pushed 50226b5. This merged the current main, kept the new stim-parser proptest setup from upstream, regenerated Cargo.lock and ppvm-python/uv.lock, and validated with RUSTFLAGS='-C target-feature=+aes,+sse2' cargo test -p stim-parser plus uv run --project ppvm-python --group dev pytest ppvm-python/test/generalized_tableau/test_simulator_device.py.

Take main's versions of stim-parser, ppvm-stim, and lockfiles
(superseded by #73, #74, #75 landing on main).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 17, 2026 17:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.

Comment on lines +44 to +53
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
Comment on lines +17 to +25
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
Comment on lines +59 to +61
tab = GeneralizedTableau(n_qubits=n_qubits, **self.options)
interp = GeneralizedTableauInterpreter(
kernel.dialects, backend=tab, rng_seed=self.options.get("seed")
Comment thread ppvm-python/src/ppvm/__init__.py Outdated
Comment on lines +12 to +17

# 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>
@Roger-luo
Roger-luo merged commit 970bf01 into main May 17, 2026
7 checks passed
@Roger-luo
Roger-luo deleted the david/generalized-tableau-interpreter branch May 17, 2026 18:06
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.

4 participants