Skip to content

RFC: getting rid of the squin noise rewrite and StochasticUnitaryChannel #476

@david-pl

Description

@david-pl

Whenever you run a squin kernel through the PyQrack simulator, statements of the noise dialect are rewritten to a single StochasticUnitaryChannel statement with different arguments. The advantage here is that you only need to implement a single method in the corresponding method table.

We had this implementation for a while now, but I honestly don't see the benefit. This has been causing a lot of issues, e.g. for nested kernels (see also #469) and similar things. It's also easy to just forget to run the rewrite even when it is required and the error message is not very user friendly.

Also, I'd argue that the rewrite actually just shifts the complexity from the method table implementations to the rewrite itself. It's also not a great pattern, IMO, to have successful interpretation depend on a rewrite that is only used for this specific purpose and only internally.

Instead, I'd suggest we just do what we do elsewhere. That is, implement the methods for the corresponding statements in the method table (it's really not that many statements).

If any rewrites further downstream rely on having this rewrite pass, we can still keep it for that purpose.

Metadata

Metadata

Assignees

Labels

rfcRequest for Commentssquinsquin related issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions