Skip to content

QAlloc - (Measure/Q)Free #1267

@acl-cqc

Description

@acl-cqc

Several of the guppy_opt.rs tests currently fail to optimize down to the identity despite all quantum gates being removed. We are left with circuits of the form QAlloc - MeasureFree. (Neither of these are passed into pytket because of the order edges.)

There are two tasks to optimise these:

  • Elide the statically-predictable measurements. This could be done by
    • enhancing constant-folding (returning a bool for the measurement output), which would disconnect the bool outport; plus a pass to convert such disconnected MeasureFree's into simple QFrees (followed by the second task, below)
    • @mark-koch and @willsimmons1465 quantum relational analysis
    • possibly encoding the QAlloc(/Reset) + Measure(Free) so pytket can predict the measurement output?
  • elide QAlloc - QFree. Pytket decoding may remove these following pytket producing a circuit with an extra (ancilla) qubit input+output, and/or we may need a separate pass.
    • The assumption here is that optimizing programs that panic in qalloc to programs that don't, is desirable, rather than a semantic change to be avoided. I.e. that qalloc succeeds on a "best-effort basis" rather than according to some precisely specified (statically-predictable) semantics that should be preserved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions