예제 #1
0
def testMultitileSizes():
    sequence = transform.SequenceOp()
    with InsertionPoint(sequence.body):
        structured.MultiTileSizesOp(sequence.bodyTarget,
                                    dimension=1,
                                    target_size=42)
        transform.YieldOp()
예제 #2
0
def testTileCompact():
    sequence = transform.SequenceOp()
    with InsertionPoint(sequence.body):
        structured.TileOp(sequence.bodyTarget,
                          sizes=[4, 8],
                          interchange=[0, 1])
        transform.YieldOp()
예제 #3
0
def testTileZero():
    sequence = transform.SequenceOp()
    with InsertionPoint(sequence.body):
        structured.TileOp(sequence.bodyTarget,
                          sizes=[4, 0, 2, 0],
                          interchange=[0, 1, 2, 3])
        transform.YieldOp()
예제 #4
0
def testPad():
    sequence = transform.SequenceOp()
    with InsertionPoint(sequence.body):
        structured.PadOp(sequence.bodyTarget,
                         padding_values=[FloatAttr.get_f32(42.0)],
                         padding_dimensions=[1],
                         transpose_paddings=[[1, 0]])
        transform.YieldOp()
예제 #5
0
def testInterchange():
    sequence = transform.SequenceOp()
    with InsertionPoint(sequence.body):
        structured.InterchangeOp(sequence.bodyTarget,
                                 iterator_interchange=[
                                     IntegerAttr.get(
                                         IntegerType.get_signless(64), 1), 0
                                 ])
        transform.YieldOp()
예제 #6
0
def testTileDynamic():
    with_pdl = transform.WithPDLPatternsOp()
    with InsertionPoint(with_pdl.body):
        sequence = transform.SequenceOp(with_pdl.bodyTarget)
        with InsertionPoint(sequence.body):
            m1 = transform.PDLMatchOp(sequence.bodyTarget, "first")
            m2 = transform.PDLMatchOp(sequence.bodyTarget, "second")
            structured.TileOp(sequence.bodyTarget, sizes=[m1, 3, m2, 0])
            transform.YieldOp()
예제 #7
0
def testTileAttributes():
    sequence = transform.SequenceOp()
    attr = ArrayAttr.get(
        [IntegerAttr.get(IntegerType.get_signless(64), x) for x in [4, 8]])
    ichange = ArrayAttr.get(
        [IntegerAttr.get(IntegerType.get_signless(64), x) for x in [0, 1]])
    with InsertionPoint(sequence.body):
        structured.TileOp(sequence.bodyTarget, sizes=attr, interchange=ichange)
        transform.YieldOp()
예제 #8
0
def testSplit():
    sequence = transform.SequenceOp()
    with InsertionPoint(sequence.body):
        split = structured.SplitOp(sequence.bodyTarget,
                                   dimension=1,
                                   split_point=42)
        structured.SplitOp(split.results[0],
                           dimension=3,
                           split_point=split.results[1])
        transform.YieldOp()
예제 #9
0
def testScalarize():
    sequence = transform.SequenceOp()
    with InsertionPoint(sequence.body):
        structured.ScalarizeOp(sequence.bodyTarget)
        transform.YieldOp()
예제 #10
0
def testDecompose():
    sequence = transform.SequenceOp()
    with InsertionPoint(sequence.body):
        structured.DecomposeOp(sequence.bodyTarget)
        transform.YieldOp()
예제 #11
0
def testVectorize():
    sequence = transform.SequenceOp()
    with InsertionPoint(sequence.body):
        structured.VectorizeOp(sequence.bodyTarget, vectorize_padding=True)
        transform.YieldOp()
예제 #12
0
def loopUnroll():
    sequence = transform.SequenceOp()
    with InsertionPoint(sequence.body):
        loop.LoopUnrollOp(sequence.bodyTarget, factor=42)
        transform.YieldOp()
예제 #13
0
def loopPipeline():
    sequence = transform.SequenceOp()
    with InsertionPoint(sequence.body):
        loop.LoopPipelineOp(sequence.bodyTarget, iteration_interval=3)
        transform.YieldOp()
예제 #14
0
def loopPeel():
    sequence = transform.SequenceOp()
    with InsertionPoint(sequence.body):
        loop.LoopPeelOp(sequence.bodyTarget)
        transform.YieldOp()
예제 #15
0
def loopOutline():
    sequence = transform.SequenceOp()
    with InsertionPoint(sequence.body):
        loop.LoopOutlineOp(sequence.bodyTarget, func_name="foo")
        transform.YieldOp()
예제 #16
0
def getParentLoop():
    sequence = transform.SequenceOp()
    with InsertionPoint(sequence.body):
        loop.GetParentForOp(sequence.bodyTarget, num_loops=2)
        transform.YieldOp()