Skip to content

feat: Refactor to support custom gates#186

Merged
jake-arkinstall merged 19 commits into
1.0-seriesfrom
feat/custom-gatesets
Jul 6, 2026
Merged

feat: Refactor to support custom gates#186
jake-arkinstall merged 19 commits into
1.0-seriesfrom
feat/custom-gatesets

Conversation

@jake-arkinstall

Copy link
Copy Markdown
Collaborator

Currently, supported gates are encoded as function calls within plugin structs. This means adding new gates into Selene is a breaking change at the plugin API level, and users cannot provide their own gatesets. Though the present gatesets are useful for hardware emulation, there are times that users may benefit from being able to simulate other gatesets, either for experimentation, or because simulation is more efficient in another gateset (e.g. CX can be more straightforward than a sequence of rotations).

This PR Introduces a new library (GateWire) to selene-core, which handles the registration, handshaking, and serialisation of gates and gatesets. A gateset is registered on program startup, and a handshake propagates through the runtime, error model and simulator so ensure support before the user program shot loop runs. The API is usable in rust and C - to evidence this, an example project is provided that demonstrates a user being able to configure clifford+T simulations in a mix of C and Rust and use them interactively or through the build/run_shots process.

This PR also takes the opportunity to correct a historical painpoint of inconsistent gate names. We now use the naming convention used in TKET and TKET2, ditching rxy for PhasedX. Docs are provided for this new extensibility API, and a migration doc is provided for updating from the existing hardcoded convention.

As this work required large sweeping changes, much of the work was done with Codex.

@jake-arkinstall jake-arkinstall changed the base branch from 0.3-series to 1.0-series July 2, 2026 16:11
@jake-arkinstall jake-arkinstall marked this pull request as ready for review July 6, 2026 08:58
Copilot AI review requested due to automatic review settings July 6, 2026 08:58
@jake-arkinstall jake-arkinstall merged commit 1c3c26e into 1.0-series Jul 6, 2026
11 checks passed
@jake-arkinstall jake-arkinstall deleted the feat/custom-gatesets branch July 6, 2026 08:59

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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

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