Skip to content

feat: Refactor to support custom gates#186

Draft
jake-arkinstall wants to merge 2 commits into
0.3-seriesfrom
feat/custom-gatesets
Draft

feat: Refactor to support custom gates#186
jake-arkinstall wants to merge 2 commits into
0.3-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.

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.

1 participant