Exemplo n.º 1
0
class NativeFuncCall(Expr):
    func = attribute(of=NativeFunction)
    args = attribute(of=ListOf[Expr])
    data_type = attribute(of=DataType)
    loc = attribute(of=Location, optional=True)
Exemplo n.º 2
0
class ParameterAccessor(Accessor):
    symbol = attribute(of=str)
Exemplo n.º 3
0
class StencilID:
    qualified_name = attribute(of=str)
    version = attribute(of=str)

    def __iter__(self):
        return iter([self.qualified_name, self.version])
Exemplo n.º 4
0
class While(Statement):
    condition = attribute(of=Expr)
    body = attribute(of=BlockStmt)
    loc = attribute(of=Location, optional=True)
Exemplo n.º 5
0
class ComputationBlock(Node):
    interval = attribute(of=AxisInterval)
    iteration_order = attribute(of=IterationOrder)
    body = attribute(of=BlockStmt)
    loc = attribute(of=Location, optional=True)
Exemplo n.º 6
0
class TernaryOpExpr(CompositeExpr):
    condition = attribute(of=Expr)
    then_expr = attribute(of=Expr)
    else_expr = attribute(of=Expr)
    loc = attribute(of=Location, optional=True)
Exemplo n.º 7
0
class Assign(Statement):
    target = attribute(of=Ref)
    value = attribute(of=Expr)
    loc = attribute(of=Location, optional=True)
Exemplo n.º 8
0
class StageGroup(IIRNode):
    stages = attribute(of=ListOf[Stage])
Exemplo n.º 9
0
class MultiStage(IIRNode):
    name = attribute(of=str)
    iteration_order = attribute(of=IterationOrder)
    # caches = attribute(of=ListOf[Cache])
    groups = attribute(of=ListOf[StageGroup])
Exemplo n.º 10
0
class ApplyBlock(Node):
    interval = attribute(of=AxisInterval)
    local_symbols = attribute(of=DictOf[str, VarDecl])
    body = attribute(of=BlockStmt)
Exemplo n.º 11
0
class Stage(IIRNode):
    name = attribute(of=str)
    accessors = attribute(of=ListOf[Accessor])
    apply_blocks = attribute(of=ListOf[ApplyBlock])
    compute_extent = attribute(of=Extent)
Exemplo n.º 12
0
class FieldRef(Ref):
    name = attribute(of=str)
    offset = attribute(of=DictOf[str, int])
    loc = attribute(of=Location, optional=True)
Exemplo n.º 13
0
class ShapedExpr(gt_ir.Expr):
    axes = attribute(of=SetOf[str])
    expr = attribute(of=gt_ir.Expr)
Exemplo n.º 14
0
class StencilImplementation(IIRNode):
    name = attribute(of=str)
    api_signature = attribute(of=ListOf[ArgumentInfo])
    domain = attribute(of=Domain)
    fields = attribute(of=DictOf[str, FieldDecl])  # All fields, including temporaries
    parameters = attribute(of=DictOf[str, VarDecl])
    multi_stages = attribute(of=ListOf[MultiStage])
    fields_extents = attribute(of=DictOf[str, Extent])
    unreferenced = attribute(of=ListOf[str], factory=list)
    axis_splitters_var = attribute(of=str, optional=True)
    externals = attribute(of=DictOf[str, Any], optional=True)
    sources = attribute(of=DictOf[str, str], optional=True)
    docstring = attribute(of=str)

    @property
    def has_effect(self):
        """
        Determine whether the stencil modifies any of its arguments.

        Note that the only guarantee of this function is that the stencil has no effect if it returns ``false``. It
        might however return true in cases where the optimization passes were not able to deduce this.
        """
        return self.multi_stages and not all(
            arg_field in self.unreferenced for arg_field in self.arg_fields
        )

    @property
    def arg_fields(self):
        result = [f.name for f in self.fields.values() if f.is_api]
        return result

    @property
    def temporary_fields(self):
        result = [f.name for f in self.fields.values() if not f.is_api]
        return result
Exemplo n.º 15
0
class UnaryOpExpr(CompositeExpr):
    op = attribute(of=UnaryOperator)
    arg = attribute(of=Expr)
    loc = attribute(of=Location, optional=True)
Exemplo n.º 16
0
class StencilImplementation(IIRNode):
    name = attribute(of=str)
    api_signature = attribute(of=ListOf[ArgumentInfo])
    domain = attribute(of=Domain)
    fields = attribute(
        of=DictOf[str, FieldDecl])  # All fields, including temporaries
    parameters = attribute(of=DictOf[str, VarDecl])
    multi_stages = attribute(of=ListOf[MultiStage])
    fields_extents = attribute(of=DictOf[str, Extent])
    unreferenced = attribute(of=ListOf[str], factory=list)
    axis_splitters_var = attribute(of=str, optional=True)
    externals = attribute(of=DictOf[str, Any], optional=True)
    sources = attribute(of=DictOf[str, str], optional=True)

    @property
    def arg_fields(self):
        result = [f.name for f in self.fields.values() if f.is_api]
        return result

    @property
    def temporary_fields(self):
        result = [f.name for f in self.fields.values() if not f.is_api]
        return result
Exemplo n.º 17
0
class BinOpExpr(CompositeExpr):
    op = attribute(of=BinaryOperator)
    lhs = attribute(of=Expr)
    rhs = attribute(of=Expr)
    loc = attribute(of=Location, optional=True)
Exemplo n.º 18
0
class Axis(Node):
    name = attribute(of=str)
Exemplo n.º 19
0
class BlockStmt(Statement):
    stmts = attribute(of=ListOf[Statement])
    loc = attribute(of=Location, optional=True)
Exemplo n.º 20
0
class ScalarLiteral(Literal):
    value = attribute(of=Any)  # Potentially an array of numeric structs
    data_type = attribute(of=DataType)
    loc = attribute(of=Location, optional=True)
Exemplo n.º 21
0
class If(Statement):
    condition = attribute(of=Expr)
    main_body = attribute(of=BlockStmt)
    else_body = attribute(of=BlockStmt, optional=True)
    loc = attribute(of=Location, optional=True)
Exemplo n.º 22
0
class BuiltinLiteral(Literal):
    value = attribute(of=Builtin)
    loc = attribute(of=Location, optional=True)
Exemplo n.º 23
0
class AxisBound(Node):
    level = attribute(of=UnionOf[LevelMarker, VarRef])
    offset = attribute(of=int, default=0)
    loc = attribute(of=Location, optional=True)
Exemplo n.º 24
0
class VarRef(Ref):
    name = attribute(of=str)
    index = attribute(of=int, optional=True)
    loc = attribute(of=Location, optional=True)
Exemplo n.º 25
0
class ArgumentInfo(Node):
    name = attribute(of=str)
    is_keyword = attribute(of=bool, default=False)
    default = attribute(of=Any, default=Empty)
Exemplo n.º 26
0
class Cast(Expr):
    data_type = attribute(of=DataType)
    expr = attribute(of=Expr)
    loc = attribute(of=Location, optional=True)
Exemplo n.º 27
0
class FieldAccessor(Accessor):
    symbol = attribute(of=str)
    intent = attribute(of=AccessKind)
    extent = attribute(of=Extent, default=Extent.zeros())
Exemplo n.º 28
0
class AugAssign(Statement):
    target = attribute(of=Ref)
    value = attribute(of=Expr)
    op = attribute(of=BinaryOperator)
    loc = attribute(of=Location, optional=True)