qat.experimental.dialect.q1.ir.attrs module

class DebugInfoAttr(*parameters)

Bases: ParametrizedAttribute, ABC

Abstract base for debug information carried on a lowered Q1 op.

Subclasses record structured debug metadata that the assembly printer uses to emit per-instruction inline comments. The attribute is stripped in production builds by passing emit_debug_info=False to emit_program().

Concrete implementations must provide format_comment().

abstract format_comment()

Return a human-readable comment string for this debug info.

Return type:

str

Returns:

Comment text to be appended to the assembly instruction.

class LabelAttr(data)

Bases: WithArgument, Data[str]

data: DataElement
name: ClassVar[str] = 'q1.label'

The attribute name should be a static field in the attribute classes.

classmethod parse_parameter(parser)

Parse the attribute parameter.

Return type:

str

print_arg()

Return the textual form of this value as a Q1 assembly argument.

Return type:

str

Returns:

Textual representation of this value for assembly emission.

print_parameter(printer)

Print the attribute parameter.

Return type:

None

class ProvenanceInfoAttr(source_op, port)

Bases: ProvenanceInfoAttr

Provenance information carried on a lowered Q1 op.

Records the originating pulse dialect operation and the physical channel port so that the assembly printer can emit per-instruction inline comments.

Parameters:
  • source_op (str) – The pulse dialect op name that this Q1 instruction was lowered from (e.g. "pulse.pulse", "pulse.acquire").

  • port (str) – The physical channel token from the enclosing q1_sequence.sequence symbol (e.g. "q0_drive").

  • source_op – Originating pulse op name.

  • port – Physical channel token from the enclosing sequence.

format_comment()

Return a human-readable comment string derived from the provenance info.

Return type:

str

Returns:

A comment of the form "from <source_op> on <port>".

classmethod get_irdl_definition()

Get the IRDL attribute definition.

name: ClassVar[str] = 'q1.provenance_info'

The attribute name should be a static field in the attribute classes.

port: StringAttr = <xdsl.irdl.attributes._ParameterDef object>
source_op: StringAttr = <xdsl.irdl.attributes._ParameterDef object>