Skip to content

feat: added bloqade.gemini namespace from bloqade-lanes - #392

Open
jasonhan3 wants to merge 8 commits into
mainfrom
jasonh/refactor-bloqade-gemini-lanes-988
Open

jasonhan3 wants to merge 8 commits into
mainfrom
jasonh/refactor-bloqade-gemini-lanes-988

Conversation

@jasonhan3

@jasonhan3 jasonhan3 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Adds bloqade.gemini under src/bloqade/gemini, completing the frontend side of QuEraComputing/bloqade-lanes#988.

  • Host Gemini kernel decorators, devices, simulation, decoding, and frontend/integration tests in this repository.
  • Import compiler dialects, rewrites, analyses, validation passes, and their method tables from lanes. Compiler table registration is handled by lanes; importing Gemini does not replace those registrations.
  • Keep Cirq emission and device-only extension-validation tables in Gemini.
  • Preserve public frontend APIs such as @logical.kernel, logical.terminal_measure, logical.star_rz, gemini.new_at, and gemini.arrange.permute. Relocated compiler internals use their canonical lanes paths; deprecated internal compatibility modules are removed.
  • Use shared core, circuit, and decoder implementations where available.

Release coordination

Depends on QuEraComputing/bloqade-lanes#1157, which restores compiler-owned method tables and moves their direct validation tests to lanes. This PR removes the duplicate Gemini registrations and keeps decorator/device-policy tests here.

Requires bloqade-lanes>=0.12.2,<0.13. Backport the lanes fix to release-0-12 and publish 0.12.2 before releasing this package. As agreed, uv.lock regeneration remains deferred until that release; installation from published dependencies is not yet validated.

Saved pre-lowering IR must be regenerated because canonical statement paths and dialect names change.

Validation of the method-table migration

Tested against the local lanes fix with Python 3.12:

  • Gemini validation, analysis, and compiler suite: 348 passed, 3 skipped.
  • Gemini validation and package-boundary tests against the actual 0.12 backport: 99 passed.
  • Broader Gemini suite excluding decoding: 851 passed, 3 skipped, 1 XPASS; two existing JSON round-trip equality failures in test_compiled_move_program_roundtrip[True/False]. Both failures also reproduce on the original PR commit 96622cc84 with unmodified lanes 0.12.1 (899 passed with the tests that have now moved).
  • All configured bloqade pre-commit hooks passed.

The companion lanes change passes its full Python suite (1,923 passed) and Pyright.

@weinbe58

Copy link
Copy Markdown
Member

Follow-up from QuEraComputing/bloqade-lanes#1156: with bloqade-lanes 0.12.x, LogicalPipeline cannot compile unless bloqade.gemini has been imported, because the method tables its validation passes and analyses dispatch on are registered here and not in lanes. The proposal in that issue is to register them in lanes. If that goes ahead, this PR needs the following.

Drop the tables that move to lanes (at 96622cc84):

  • src/bloqade/gemini/common/impl/: const_address.py, duplicate_address.py, move_to.py, new_at.py, qubit_address.py, terminal_measure.py
  • src/bloqade/gemini/logical/impl/: measure_id.py, measurement.py, typeinfer.py
  • src/bloqade/gemini/logical/validation/clifford/impls.py

These register lanes.validate.logical, lanes.validate.terminal_measurement, lanes.validate.physical.terminal_measure, lanes.arch.const_address, lanes.arch.duplicates, move.address.validation, qubit.address, measure_id and typeinfer. Keeping them here once lanes registers them would register each table twice.

Update what imports them: common/impl/__init__.py and logical/impl/__init__.py (which also pulls in validation.clifford.impls).

Keep here: the emit.cirq tables in common/cirq_conversion.py and logical/cirq_conversion.py, and the device-only lanes.validate.no_extensions table in logical/validation/extensions/impls.py.

Raise the lanes pin: bloqade-lanes>=0.12.0.dev0,<0.13 admits 0.12.0 and 0.12.1, which do not have the tables. The lower bound should be the lanes release that restores them, and that release has to be published before this one.

Tests: the ones under test/gemini/validation/ and test/gemini/analysis/test_logical_validation.py that exercise these tables directly probably belong with the tables in lanes; the ones that test the frontend's kernel decorators and policies stay.

For reference, loading just the files listed above (plus extensions/impls.py) on top of bloqade-lanes==0.12.1, with nothing else from bloqade.gemini, is enough to make the reproduction in the lanes issue compile, so they have no dependency on the rest of the frontend.

jasonhan3 added a commit to QuEraComputing/bloqade-circuit that referenced this pull request Nov 12, 2026
Allow `bloqade-decoders>=0.4.0,<0.8.0` so circuit can be installed
alongside packages requiring decoders 0.7, including
QuEraComputing/bloqade#392. Refresh `uv.lock` to select decoders 0.7.0;
no other package versions change.

This targets the existing 0.16 development line. With decoders 0.7, the
publicly re-exported `bloqade.pyqrack.MeasurementResultValue` uses
loss-aware XOR: `Lost ^ Lost` returns `Lost`, XOR with integers raises
`TypeError`, and XOR between measurement values returns an enum rather
than an integer.

Validation on Python 3.12:
- Full suite: 1,812 passed, 5 skipped, 6 xfailed, 1 xpassed.
- `uv lock --check` with CI's uv 0.13.5.
- Pre-commit checks for `pyproject.toml` and `uv.lock`.
- Smoke check of annotation imports and measurement-value XOR with
installed decoders 0.7.0.

This permits decoders 0.7 on circuit main; a circuit release and a
corresponding dependency update in bloqade are still needed for
published-package resolution.
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.2

QR code for preview link

🚀 View preview at
https://QuEraComputing.github.io/bloqade/pr-preview/pr-392/

Built to branch gh-pages at 2026-11-12 21:43 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@jasonhan3
jasonhan3 marked this pull request as ready for review November 12, 2026 21:12

This branch has not been deployed

No deployments
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.

2 participants