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
@irdl_op_definition
class HLSYieldOp(IRDLOperation):
    name = "hls.yield"
    arguments = var_operand_def()

    traits = traits_def(IsTerminator())

    @staticmethod
    def get(*operands: OperandArg) -> 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: OperandArg) -> HLSYieldOp staticmethod

Source code in xdsl/dialects/experimental/hls.py
@staticmethod
def get(*operands: OperandArg) -> HLSYieldOp:
    return HLSYieldOp.create(
        operands=[SSAValue.get(operand) for operand in operands]
    )

PragmaPipelineOp

Bases: IRDLOperation

Source code in xdsl/dialects/experimental/hls.py
@irdl_op_definition
class PragmaPipelineOp(IRDLOperation):
    name = "hls.pipeline"
    ii = operand_def(IntegerType)

    def __init__(self, ii: OperandArg):
        super().__init__(operands=[ii])

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

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

__init__(ii: OperandArg)

Source code in xdsl/dialects/experimental/hls.py
def __init__(self, ii: OperandArg):
    super().__init__(operands=[ii])

PragmaUnrollOp

Bases: IRDLOperation

Source code in xdsl/dialects/experimental/hls.py
@irdl_op_definition
class PragmaUnrollOp(IRDLOperation):
    name = "hls.unroll"
    factor = operand_def(IntegerType)

    def __init__(self, factor: OperandArg):
        super().__init__(operands=[factor])

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

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

__init__(factor: OperandArg)

Source code in xdsl/dialects/experimental/hls.py
def __init__(self, factor: OperandArg):
    super().__init__(operands=[factor])

PragmaDataflowOp

Bases: IRDLOperation

Source code in xdsl/dialects/experimental/hls.py
@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
def __init__(self, region: Region):
    super().__init__(regions=[region])

PragmaArrayPartitionOp

Bases: IRDLOperation

Source code in xdsl/dialects/experimental/hls.py
@irdl_op_definition
class PragmaArrayPartitionOp(IRDLOperation):
    name = "hls.array_partition"
    variable = opt_prop_def(StringAttr)
    array_type = opt_prop_def()  # look at memref.Global
    factor = operand_def()
    dim = operand_def()

    def __init__(
        self,
        variable: StringAttr,
        array_type: Attribute,
        factor: OperandArg,
        dim: OperandArg,
    ):
        super().__init__(
            operands=[factor, dim],
            properties={"variable": variable, "array_type": array_type},
        )

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

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

array_type = opt_prop_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: OperandArg, dim: OperandArg)

Source code in xdsl/dialects/experimental/hls.py
def __init__(
    self,
    variable: StringAttr,
    array_type: Attribute,
    factor: OperandArg,
    dim: OperandArg,
):
    super().__init__(
        operands=[factor, dim],
        properties={"variable": variable, "array_type": array_type},
    )

HLSStreamType dataclass

Bases: ParametrizedAttribute, TypeAttribute

Source code in xdsl/dialects/experimental/hls.py
@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
@irdl_op_definition
class HLSStreamOp(IRDLOperation):
    name = "hls.stream"
    elem_type = prop_def()
    result = result_def(HLSStreamType)  # This should be changed to HLSStreamType

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

        props["elem_type"] = elem_type

        stream_type = HLSStreamType(elem_type)
        return HLSStreamOp.build(result_types=[stream_type], properties=props)

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

elem_type = prop_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
@staticmethod
def get(elem_type: Attribute) -> HLSStreamOp:
    props: dict[str, Attribute] = {}

    props["elem_type"] = elem_type

    stream_type = HLSStreamType(elem_type)
    return HLSStreamOp.build(result_types=[stream_type], properties=props)

HLSStreamWriteOp

Bases: IRDLOperation

Source code in xdsl/dialects/experimental/hls.py
@irdl_op_definition
class HLSStreamWriteOp(IRDLOperation):
    name = "hls.write"
    element = operand_def()
    stream = operand_def(HLSStreamType)

    def __init__(self, element: OperandArg, stream: OperandArg):
        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: OperandArg, stream: OperandArg)

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

HLSStreamReadOp

Bases: IRDLOperation

Source code in xdsl/dialects/experimental/hls.py
@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
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
@irdl_op_definition
class HLSExtractStencilValueOp(IRDLOperation):
    name = "hls.extract_stencil_value"

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

    res = result_def(Attribute)

    def __init__(
        self,
        position: DenseArrayBase,
        container: OperandArg,
        result_type: Attribute,
    ):
        super().__init__(
            operands=[container],
            properties={
                "position": position,
            },
            result_types=[result_type],
        )

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

position = prop_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: OperandArg, result_type: Attribute)

Source code in xdsl/dialects/experimental/hls.py
def __init__(
    self,
    position: DenseArrayBase,
    container: OperandArg,
    result_type: Attribute,
):
    super().__init__(
        operands=[container],
        properties={
            "position": position,
        },
        result_types=[result_type],
    )