Beispiel #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)
Beispiel #2
0
class ParameterAccessor(Accessor):
    symbol = attribute(of=str)
Beispiel #3
0
class StencilID:
    qualified_name = attribute(of=str)
    version = attribute(of=str)

    def __iter__(self):
        return iter([self.qualified_name, self.version])
Beispiel #4
0
class While(Statement):
    condition = attribute(of=Expr)
    body = attribute(of=BlockStmt)
    loc = attribute(of=Location, optional=True)
Beispiel #5
0
class ComputationBlock(Node):
    interval = attribute(of=AxisInterval)
    iteration_order = attribute(of=IterationOrder)
    body = attribute(of=BlockStmt)
    loc = attribute(of=Location, optional=True)
Beispiel #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)
Beispiel #7
0
class Assign(Statement):
    target = attribute(of=Ref)
    value = attribute(of=Expr)
    loc = attribute(of=Location, optional=True)
Beispiel #8
0
class StageGroup(IIRNode):
    stages = attribute(of=ListOf[Stage])
Beispiel #9
0
class MultiStage(IIRNode):
    name = attribute(of=str)
    iteration_order = attribute(of=IterationOrder)
    # caches = attribute(of=ListOf[Cache])
    groups = attribute(of=ListOf[StageGroup])
Beispiel #10
0
class ApplyBlock(Node):
    interval = attribute(of=AxisInterval)
    local_symbols = attribute(of=DictOf[str, VarDecl])
    body = attribute(of=BlockStmt)
Beispiel #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)
Beispiel #12
0
class FieldRef(Ref):
    name = attribute(of=str)
    offset = attribute(of=DictOf[str, int])
    loc = attribute(of=Location, optional=True)
Beispiel #13
0
class ShapedExpr(gt_ir.Expr):
    axes = attribute(of=SetOf[str])
    expr = attribute(of=gt_ir.Expr)
Beispiel #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
Beispiel #15
0
class UnaryOpExpr(CompositeExpr):
    op = attribute(of=UnaryOperator)
    arg = attribute(of=Expr)
    loc = attribute(of=Location, optional=True)
Beispiel #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
Beispiel #17
0
class BinOpExpr(CompositeExpr):
    op = attribute(of=BinaryOperator)
    lhs = attribute(of=Expr)
    rhs = attribute(of=Expr)
    loc = attribute(of=Location, optional=True)
Beispiel #18
0
class Axis(Node):
    name = attribute(of=str)
Beispiel #19
0
class BlockStmt(Statement):
    stmts = attribute(of=ListOf[Statement])
    loc = attribute(of=Location, optional=True)
Beispiel #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)
Beispiel #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)
Beispiel #22
0
class BuiltinLiteral(Literal):
    value = attribute(of=Builtin)
    loc = attribute(of=Location, optional=True)
Beispiel #23
0
class AxisBound(Node):
    level = attribute(of=UnionOf[LevelMarker, VarRef])
    offset = attribute(of=int, default=0)
    loc = attribute(of=Location, optional=True)
Beispiel #24
0
class VarRef(Ref):
    name = attribute(of=str)
    index = attribute(of=int, optional=True)
    loc = attribute(of=Location, optional=True)
Beispiel #25
0
class ArgumentInfo(Node):
    name = attribute(of=str)
    is_keyword = attribute(of=bool, default=False)
    default = attribute(of=Any, default=Empty)
Beispiel #26
0
class Cast(Expr):
    data_type = attribute(of=DataType)
    expr = attribute(of=Expr)
    loc = attribute(of=Location, optional=True)
Beispiel #27
0
class FieldAccessor(Accessor):
    symbol = attribute(of=str)
    intent = attribute(of=AccessKind)
    extent = attribute(of=Extent, default=Extent.zeros())
Beispiel #28
0
class AugAssign(Statement):
    target = attribute(of=Ref)
    value = attribute(of=Expr)
    op = attribute(of=BinaryOperator)
    loc = attribute(of=Location, optional=True)