Skip to content

rotation_kind in the PPRotationOp operation is missing a constraint on its legal values #2343

@mehrdad2m

Description

@mehrdad2m

The rotation_kind in the PPRotationOp is defined as a I16Attr but there is no limitation on the values. Since only 2, 4, and 8 are the only relevant values, We should add a verifier or a constraint (preferred) so any invalid IR raises an error.
Currently, merge rotation pass is already implicitly assuming these values to be powers of 2, so if someone tries a goofy value, merge rotation would incorrectly change it to a valid IR and continue without raising an error. e.g.

%0 = qec.ppr ["Y"](9) %q1: !quantum.bit
%1 = qec.ppr ["Y"](9) %0: !quantum.bit

would turn into

%0 = qec.ppr ["Y"](4) %arg0 : !quantum.bit 

After merge-rotation pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions