示例#1
0
def test_inst_construct_2():
    block = BlockRV()
    inst = Instruction(
        kind=InstructionKind.get("ComputeInline"),
        inputs=[block],
        attrs=[],
        outputs=[],
    )
    assert str(inst) == "sch.compute_inline(block=_)"
    assert len(inst.inputs) == 1
    assert len(inst.attrs) == 0
    assert len(inst.outputs) == 0
    assert inst.kind.same_as(InstructionKind.get("ComputeInline"))
    assert inst.inputs[0].same_as(block)
def _make_enter_postproc():
    return Instruction(
        kind=InstructionKind.get("EnterPostproc"),
        inputs=[],
        attrs=[],
        outputs=[],
    )
def _make_compute_inline(input):  # pylint: disable=redefined-builtin
    return Instruction(
        kind=InstructionKind.get("ComputeInline"),
        inputs=[input],
        attrs=[],
        outputs=[],
    )
def _make_get_loops(input, outputs):  # pylint: disable=redefined-builtin
    return Instruction(
        kind=InstructionKind.get("GetLoops"),
        inputs=[input],
        attrs=[],
        outputs=outputs,
    )
def _make_get_block(name, output):
    return Instruction(
        kind=InstructionKind.get("GetBlock"),
        inputs=[],
        attrs=[name, "main"],
        outputs=[output],
    )
示例#6
0
def _make_split(inputs, outputs):  # pylint: disable=redefined-builtin
    return Instruction(
        kind=InstructionKind.get("Split"),
        inputs=inputs,
        attrs=[],
        outputs=outputs,
    )
示例#7
0
def test_inst_construct_1():
    block = BlockRV()
    loop0 = LoopRV()
    loop1 = LoopRV()
    inst = Instruction(
        kind=InstructionKind.get("GetLoops"),
        inputs=[block],
        attrs=[],
        outputs=[loop0, loop1],
    )
    assert str(inst) == "_, _ = sch.get_loops(block=_)"
    assert len(inst.inputs) == 1
    assert len(inst.attrs) == 0
    assert len(inst.outputs) == 2
    assert inst.kind.same_as(InstructionKind.get("GetLoops"))
    assert inst.inputs[0].same_as(block)
    assert inst.outputs[0].same_as(loop0)
    assert inst.outputs[1].same_as(loop1)
示例#8
0
def test_inst_kind_get():
    kind = InstructionKind.get("EnterPostproc")
    assert not kind.is_pure
    assert kind.name == "EnterPostproc"