Exemple #1
0
def test_computation_block(defir_to_gtir):
    block = (
        TComputationBlock(order=IterationOrder.FORWARD)
        .add_statements(TAssign("a", "b", (0, 0, 0)))
        .build()
    )
    vertical_loop = defir_to_gtir.visit_ComputationBlock(block)
    assert isinstance(vertical_loop, gtir.VerticalLoop)
Exemple #2
0
def test_stencil_definition(
        defir_to_gtir,
        ijk_domain  # noqa: F811 [redefinition, reason: fixture]
):
    stencil_definition = (TDefinition(
        name="definition", domain=ijk_domain, fields=["a", "b"]).add_blocks(
            TComputationBlock(order=IterationOrder.PARALLEL).add_statements(
                TAssign("a", "b", (0, 0, 0)), )).build())
    gtir1 = defir_to_gtir.apply(stencil_definition)
    gtir2 = defir_to_gtir.visit_StencilDefinition(stencil_definition)
    assert gtir1 is not gtir2
    assert isinstance(gtir1, gtir.Stencil)
    assert isinstance(gtir2, gtir.Stencil)
Exemple #3
0
def test_assign(defir_to_gtir):
    assign = TAssign("a", "b", (0, 0, 0)).build()
    assign_stmt = defir_to_gtir.visit_Assign(assign)
    assert isinstance(assign_stmt, gtir.ParAssignStmt)
Exemple #4
0
def test_block_stmt(defir_to_gtir):
    block_stmt = BlockStmt(stmts=[TAssign("a", "b", (0, 0, 0)).build()])
    statements = defir_to_gtir.visit_BlockStmt(block_stmt)
    assert isinstance(statements[0], gtir.Stmt)