Skip to content

Hls

hls

HLS = Dialect('hls', [PragmaPipelineOp, PragmaUnrollOp, PragmaDataflowOp, PragmaArrayPartitionOp, HLSStreamOp, HLSStreamWriteOp, HLSStreamReadOp, HLSYieldOp, HLSExtractStencilValueOp], [HLSStreamType]) module-attribute

HLSYieldOp dataclass

Bases: IRDLOperation

Source code in xdsl/dialects/experimental/hls.py
27
28
29
30
31
32
33
34
35
36
37
38
@irdl_op_definition
class HLSYieldOp(IRDLOperation):
    name = "hls.yield"
    arguments = var_operand_def()

    traits = traits_def(IsTerminator())

    @staticmethod
    def get(*operands: SSAValue | Operation) -> HLSYieldOp:
        return HLSYieldOp.create(
            operands=[SSAValue.get(operand) for operand in operands]
        )

name = 'hls.yield' class-attribute instance-attribute

arguments = var_operand_def() class-attribute instance-attribute

traits = traits_def(IsTerminator()) class-attribute instance-attribute

get(*operands: SSAValue | Operation) -> HLSYieldOp staticmethod

Source code in xdsl/dialects/experimental/hls.py
34
35
36
37
38
@staticmethod
def get(*operands: SSAValue | Operation) -> HLSYieldOp:
    return HLSYieldOp.create(
        operands=[SSAValue.get(operand) for operand in operands]
    )

PragmaPipelineOp

Bases: IRDLOperation

Source code in xdsl/dialects/experimental/hls.py
41
42
43
44
45
46
47
@irdl_op_definition
class PragmaPipelineOp(IRDLOperation):
    name = "hls.pipeline"
    ii = operand_def(IntegerType)

    def __init__(self, ii: SSAValue | Operation):
        super().__init__(operands=[ii])

name = 'hls.pipeline' class-attribute instance-attribute

ii = operand_def(IntegerType) class-attribute instance-attribute

__init__(ii: SSAValue | Operation)

Source code in xdsl/dialects/experimental/hls.py
46
47
def __init__(self, ii: SSAValue | Operation):
    super().__init__(operands=[ii])

PragmaUnrollOp

Bases: IRDLOperation

Source code in xdsl/dialects/experimental/hls.py
50
51
52
53
54
55
56
@irdl_op_definition
class PragmaUnrollOp(IRDLOperation):
    name = "hls.unroll"
    factor = operand_def(IntegerType)

    def __init__(self, factor: SSAValue | Operation):
        super().__init__(operands=[factor])

name = 'hls.unroll' class-attribute instance-attribute

factor = operand_def(IntegerType) class-attribute instance-attribute

__init__(factor: SSAValue | Operation)

Source code in xdsl/dialects/experimental/hls.py
55
56
def __init__(self, factor: SSAValue | Operation):
    super().__init__(operands=[factor])

PragmaDataflowOp

Bases: IRDLOperation

Source code in xdsl/dialects/experimental/hls.py
59
60
61
62
63
64
65
66
@irdl_op_definition
class PragmaDataflowOp(IRDLOperation):
    name = "hls.dataflow"

    body = region_def()

    def __init__(self, region: Region):
        super().__init__(regions=[region])

name = 'hls.dataflow' class-attribute instance-attribute

body = region_def() class-attribute instance-attribute

__init__(region: Region)

Source code in xdsl/dialects/experimental/hls.py
65
66
def __init__(self, region: Region):
    super().__init__(regions=[region])

PragmaArrayPartitionOp

Bases: IRDLOperation

Source code in xdsl/dialects/experimental/hls.py
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
@irdl_op_definition
class PragmaArrayPartitionOp(IRDLOperation):
    name = "hls.array_partition"
    variable = opt_attr_def(StringAttr)
    array_type = opt_attr_def()  # look at memref.Global
    factor = operand_def()
    dim = operand_def()

    def __init__(
        self,
        variable: StringAttr,
        array_type: Attribute,
        factor: SSAValue | Operation,
        dim: SSAValue | Operation,
    ):
        super().__init__(
            operands=[factor, dim],
            attributes={"variable": variable, "array_type": array_type},
        )

name = 'hls.array_partition' class-attribute instance-attribute

variable = opt_attr_def(StringAttr) class-attribute instance-attribute

array_type = opt_attr_def() class-attribute instance-attribute

factor = operand_def() class-attribute instance-attribute

dim = operand_def() class-attribute instance-attribute

__init__(variable: StringAttr, array_type: Attribute, factor: SSAValue | Operation, dim: SSAValue | Operation)

Source code in xdsl/dialects/experimental/hls.py
77
78
79
80
81
82
83
84
85
86
87
def __init__(
    self,
    variable: StringAttr,
    array_type: Attribute,
    factor: SSAValue | Operation,
    dim: SSAValue | Operation,
):
    super().__init__(
        operands=[factor, dim],
        attributes={"variable": variable, "array_type": array_type},
    )

HLSStreamType dataclass

Bases: ParametrizedAttribute, TypeAttribute

Source code in xdsl/dialects/experimental/hls.py
90
91
92
93
94
@irdl_attr_definition
class HLSStreamType(ParametrizedAttribute, TypeAttribute):
    name = "hls.streamtype"

    element_type: Attribute

name = 'hls.streamtype' class-attribute instance-attribute

element_type: Attribute instance-attribute

HLSStreamOp dataclass

Bases: IRDLOperation

Source code in xdsl/dialects/experimental/hls.py
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
@irdl_op_definition
class HLSStreamOp(IRDLOperation):
    name = "hls.stream"
    elem_type = attr_def()
    result = result_def(HLSStreamType)  # This should be changed to HLSStreamType

    @staticmethod
    def get(elem_type: Attribute) -> HLSStreamOp:
        attrs: dict[str, Attribute] = {}

        attrs["elem_type"] = elem_type

        stream_type = HLSStreamType(elem_type)
        return HLSStreamOp.build(result_types=[stream_type], attributes=attrs)

name = 'hls.stream' class-attribute instance-attribute

elem_type = attr_def() class-attribute instance-attribute

result = result_def(HLSStreamType) class-attribute instance-attribute

get(elem_type: Attribute) -> HLSStreamOp staticmethod

Source code in xdsl/dialects/experimental/hls.py
103
104
105
106
107
108
109
110
@staticmethod
def get(elem_type: Attribute) -> HLSStreamOp:
    attrs: dict[str, Attribute] = {}

    attrs["elem_type"] = elem_type

    stream_type = HLSStreamType(elem_type)
    return HLSStreamOp.build(result_types=[stream_type], attributes=attrs)

HLSStreamWriteOp

Bases: IRDLOperation

Source code in xdsl/dialects/experimental/hls.py
113
114
115
116
117
118
119
120
@irdl_op_definition
class HLSStreamWriteOp(IRDLOperation):
    name = "hls.write"
    element = operand_def()
    stream = operand_def(HLSStreamType)

    def __init__(self, element: SSAValue | Operation, stream: SSAValue | Operation):
        super().__init__(operands=[element, stream])

name = 'hls.write' class-attribute instance-attribute

element = operand_def() class-attribute instance-attribute

stream = operand_def(HLSStreamType) class-attribute instance-attribute

__init__(element: SSAValue | Operation, stream: SSAValue | Operation)

Source code in xdsl/dialects/experimental/hls.py
119
120
def __init__(self, element: SSAValue | Operation, stream: SSAValue | Operation):
    super().__init__(operands=[element, stream])

HLSStreamReadOp

Bases: IRDLOperation

Source code in xdsl/dialects/experimental/hls.py
123
124
125
126
127
128
129
130
131
132
@irdl_op_definition
class HLSStreamReadOp(IRDLOperation):
    name = "hls.read"
    stream = operand_def(HLSStreamType)
    res = result_def()

    def __init__(self, stream: SSAValue):
        assert isinstance(stream.type, HLSStreamType)
        print("TYPE STREAM: ", type(stream.type))
        super().__init__(operands=[stream], result_types=[stream.type.element_type])

name = 'hls.read' class-attribute instance-attribute

stream = operand_def(HLSStreamType) class-attribute instance-attribute

res = result_def() class-attribute instance-attribute

__init__(stream: SSAValue)

Source code in xdsl/dialects/experimental/hls.py
129
130
131
132
def __init__(self, stream: SSAValue):
    assert isinstance(stream.type, HLSStreamType)
    print("TYPE STREAM: ", type(stream.type))
    super().__init__(operands=[stream], result_types=[stream.type.element_type])

HLSExtractStencilValueOp

Bases: IRDLOperation

Source code in xdsl/dialects/experimental/hls.py
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
@irdl_op_definition
class HLSExtractStencilValueOp(IRDLOperation):
    name = "hls.extract_stencil_value"

    position = attr_def(DenseArrayBase.constr(i64))
    container = operand_def(Attribute)

    res = result_def(Attribute)

    def __init__(
        self,
        position: DenseArrayBase,
        container: SSAValue | Operation,
        result_type: Attribute,
    ):
        super().__init__(
            operands=[container],
            attributes={
                "position": position,
            },
            result_types=[result_type],
        )

name = 'hls.extract_stencil_value' class-attribute instance-attribute

position = attr_def(DenseArrayBase.constr(i64)) class-attribute instance-attribute

container = operand_def(Attribute) class-attribute instance-attribute

res = result_def(Attribute) class-attribute instance-attribute

__init__(position: DenseArrayBase, container: SSAValue | Operation, result_type: Attribute)

Source code in xdsl/dialects/experimental/hls.py
144
145
146
147
148
149
150
151
152
153
154
155
156
def __init__(
    self,
    position: DenseArrayBase,
    container: SSAValue | Operation,
    result_type: Attribute,
):
    super().__init__(
        operands=[container],
        attributes={
            "position": position,
        },
        result_types=[result_type],
    )