Esempio n. 1
0
    tag_index: List[SsaUse]
    src_type: ast.MemRefType
    dst_type: ast.MemRefType
    tag_type: ast.MemRefType
    stride: Optional[SsaUse] = None
    transfer_per_stride: Optional[SsaUse] = None

    _syntax_ = [
        'affine.dma_start {src.ssa_use} [ {src_index.multi_dim_affine_expr_no_parens} ] , {dst.ssa_use} [ {dst_index.multi_dim_affine_expr_no_parens} ] , {tag.ssa_use} [ {tag_index.multi_dim_affine_expr_no_parens} ] , {size.ssa_use} : {src_type.memref_type} , {dst_type.memref_type} , {tag_type.memref_type}',
        'affine.dma_start {src.ssa_use} [ {src_index.multi_dim_affine_expr_no_parens} ] , {dst.ssa_use} [ {dst_index.multi_dim_affine_expr_no_parens} ] , {tag.ssa_use} [ {tag_index.multi_dim_affine_expr_no_parens} ] , {size.ssa_use} , {stride.ssa_use} , {transfer_per_stride.ssa_use} : {src_type.memref_type} , {dst_type.memref_type} , {tag_type.memref_type}'
    ]


@dataclass
class AffineDmaWaitOperation(DialectOp):
    tag: SsaUse
    tag_index: ast.MultiDimAffineExpr
    size: SsaUse
    type: ast.MemRefType

    _syntax_ = 'affine.dma_wait {tag.ssa_use} [ {tag_index.multi_dim_affine_expr_no_parens} ] , {size.ssa_use} : {type.memref_type}'


# Inspect current module to get all classes defined above
affine = Dialect(
    'affine',
    ops=[
        m[1] for m in inspect.getmembers(sys.modules[__name__],
                                         lambda obj: is_op(obj, __name__))
    ])
Esempio n. 2
0
    end: ast.SsaId
    body: ast.Region
    step: Optional[ast.SsaId] = None
    _syntax_ = [
        'scf.for {index.ssa_id} = {begin.ssa_id} to {end.ssa_id} {body.region}',
        'scf.for {index.ssa_id} = {begin.ssa_id} to {end.ssa_id} step {step.ssa_id} {body.region}'
    ]


@dataclass
class SCFIfOp(DialectOp):
    cond: ast.SsaId
    body: ast.Region
    elsebody: Optional[ast.Region] = None
    _syntax_ = [
        'scf.if {cond.ssa_id} {body.region}',
        'scf.if {cond.ssa_id} {body.region} else {elsebody.region}'
    ]


class SCFYield(UnaryOperation):
    _opname_ = 'scf.yield'


# Inspect current module to get all classes defined above
scf = Dialect('scf',
              ops=[
                  m[1] for m in inspect.getmembers(
                      sys.modules[__name__], lambda obj: is_op(obj, __name__))
              ])