qat.experimental.dialect.results.ir.attributes module

Models the attributes in the results dialect.

This includes attributes that model post-selection predicates.

class IntegerStatePredicateAttr(key, disallowed_values)

Bases: IntegerStatePredicateAttr

Models a predicate for post selecting results based on an integer state.

This attribute is used to filter results based on a specific integer state value. It is described by a key and a list of disallowed integer values. The key refers to the entry in a record.

Variables:
  • key – The key of the entry in the record that post-selection is performed on.

  • disallowed_values – The list of values that are disallowed and will result in the record being post-selected out of the results collection.

Initializes the IntegerStatePredicateAttr with the given key and disallowed values.

Parameters:
  • key (str | StringAttr) – The key of the entry in the record that post-selection is performed on.

  • disallowed_values (Iterable[int | IntAttr] | ArrayAttr[IntAttr]) – The list of values that are disallowed and will result in the record being post-selected out of the results collection.

disallowed_values: ArrayAttr[IntAttr]
classmethod get_irdl_definition()

Get the IRDL attribute definition.

key: StringAttr
name: ClassVar[str] = 'results.integer_state_predicate'

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

class PostSelectPredicateAttr(*parameters)

Bases: ParametrizedAttribute, ABC

Models a predicate for post selecting results.

Eventually, this class could be extended to provide a lowering hook.

name: ClassVar[str] = 'results.post_select_predicate'

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

class RecordFieldAttr(key, type_)

Bases: RecordFieldAttr

Models a field in a record in the results dialect, to be used by records and collections of records.

Contains a key and a type.

Variables:
  • key – The key of the entry in the record.

  • type – The type of the entry in the record.

Initializes the RecordFieldAttr with the given key and type.

Parameters:
  • key (str | StringAttr) – The key of the entry in the record.

  • type_ – The type of the entry in the record.

classmethod get_irdl_definition()

Get the IRDL attribute definition.

key: StringAttr
name: ClassVar[str] = 'results.record_field'

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

type: Attribute = <xdsl.irdl.attributes._ParameterDef object>
class RecordSchemaAttr(fields)

Bases: RecordSchemaAttr

Models the schema of a record in the results dialect, to be used by records and collections of records.

Variables:

fields – An array of record field attributes, which individually define the key and type of each field in the record.

Initializes the RecordSchemaAttr with the given fields.

Parameters:

fields (ArrayAttr[RecordFieldAttr] | Sequence[RecordFieldAttr]) – An array of record field attributes, which individually define the key and type of each field in the record.

as_dict()

Return the schema as a dictionary mapping keys to types.

Return type:

dict[str, TypeAttribute]

fields: ArrayAttr[RecordFieldAttr]
classmethod get_irdl_definition()

Get the IRDL attribute definition.

name: ClassVar[str] = 'results.record_schema'

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

verify()

Verify that there are no duplicate keys in the schema.