gt4py.cartesian.gtc.numpy package¶
Submodules¶
gt4py.cartesian.gtc.numpy.npir module¶
- class gt4py.cartesian.gtc.numpy.npir.AxisName(*values)[source]¶
Bases:
StrEnum- I = 'I'¶
- J = 'J'¶
- K = 'K'¶
- class gt4py.cartesian.gtc.numpy.npir.Broadcast(*, loc: SourceLocation | None = None, dtype: DataType = DataType.AUTO, expr: Expr, kind: ExprKind = ExprKind.FIELD)[source]¶
Bases:
Expr- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.Computation(*, loc: SourceLocation | None = None, arguments: List[str], api_field_decls: List[FieldDecl], param_decls: List[ScalarDecl], temp_decls: List[TemporaryDecl], vertical_passes: List[VerticalPass])[source]¶
Bases:
LocNode,SymbolTableTrait- param_decls: List[ScalarDecl]¶
- temp_decls: List[TemporaryDecl]¶
- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- vertical_passes: List[VerticalPass]¶
- class gt4py.cartesian.gtc.numpy.npir.Decl(*args: Any, **kwargs: Any)[source]¶
Bases:
Node- name: SymbolName¶
- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.Expr(*args: Any, **kwargs: Any)[source]¶
Bases:
Expr- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.FieldDecl(data_dims: Tuple[Integral, ...] = NOTHING, *, name: Any, dtype: DataType, dimensions: Tuple[bool, bool, bool], extent: Extent)[source]¶
Bases:
DeclGeneral field shared across HorizontalBlocks.
- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.FieldSlice(data_index: List[Expr] = NOTHING, *, loc: SourceLocation | None = None, dtype: DataType = DataType.AUTO, name: Any, i_offset: int, j_offset: int, k_offset: int | VarKOffset, kind: ExprKind = ExprKind.FIELD)[source]¶
Bases:
VectorLValue- k_offset: int | VarKOffset¶
- name: SymbolRef¶
- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.HorizontalBlock(*, loc: SourceLocation | None = None, body: List[Stmt], extent: Extent, declarations: List[LocalScalarDecl])[source]¶
Bases:
LocNode,SymbolTableTrait- declarations: List[LocalScalarDecl]¶
- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.HorizontalMask(*, i: Tuple[AxisBound, AxisBound], j: Tuple[AxisBound, AxisBound])[source]¶
Bases:
Node- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.KMaskFieldAccess(*, loc: SourceLocation | None = None, kind: ExprKind = ExprKind.FIELD, dtype: DataType = DataType.AUTO)[source]¶
Bases:
Expr- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.LocalScalarAccess(*, loc: SourceLocation | None = None, dtype: DataType = DataType.AUTO, name: Any, kind: ExprKind = ExprKind.FIELD)[source]¶
Bases:
VectorLValue- name: SymbolRef¶
- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.LocalScalarDecl(*, name: Any, dtype: DataType)[source]¶
Bases:
DeclScalar per grid point.
Used for API scalar parameters. Local scalars never have data_dims.
- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.NativeFuncCall(*, loc: SourceLocation | None = None, kind: ExprKind = ExprKind.FIELD, dtype: DataType = DataType.AUTO, func: NativeFunction, args: List[Expr])[source]¶
Bases:
NativeFuncCall__Expr,Expr- classmethod _dtype_propagation(instance: NativeFuncCall) None¶
- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.ParamAccess(*, loc: SourceLocation | None = None, dtype: DataType = DataType.AUTO, name: Any, kind: ExprKind = ExprKind.SCALAR)[source]¶
Bases:
Expr- name: SymbolRef¶
- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.ScalarCast(*, loc: SourceLocation | None = None, kind: ExprKind = ExprKind.FIELD, dtype: DataType, expr: Expr)[source]¶
Bases:
Cast__Expr,Expr- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.ScalarDecl(*, name: Any, dtype: DataType)[source]¶
Bases:
DeclScalar per grid point.
Used for API scalar parameters. Local scalars never have data_dims.
- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.ScalarLiteral(*, loc: SourceLocation | None = None, value: BuiltInLiteral | str, kind: ExprKind = ExprKind.SCALAR, dtype: DataType)[source]¶
-
- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.Stmt(*args: Any, **kwargs: Any)[source]¶
Bases:
Stmt- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.TemporaryDecl(data_dims: Tuple[Integral, ...] = NOTHING, *, name: Any, dtype: DataType, dimensions: Tuple[bool, bool, bool], offset: Tuple[int, int], padding: Tuple[int, int])[source]¶
Bases:
DeclTemporary field shared across HorizontalBlocks.
- Parameters:
data_dims (Data dimensions sizes (static))
dimensions (Mask which cartesian dimensions are present)
offset (Origin of the temporary field.)
padding (Buffer added to compute domain as field size.)
- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.VarKOffset(*, k: Expr)[source]¶
Bases:
VariableKOffset__Expr- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.VectorArithmetic(*, loc: SourceLocation | None = None, kind: ExprKind = ExprKind.FIELD, dtype: DataType = DataType.AUTO, left: Expr, right: Expr, op: ArithmeticOperator | ComparisonOperator)[source]¶
Bases:
BinaryOp__Expr,Expr- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.VectorAssign(*, loc: SourceLocation | None = None, left: VectorLValue, horizontal_mask: HorizontalMask | None = None, right: Expr)[source]¶
Bases:
AssignStmt__VectorLValue_Expr,Stmt- horizontal_mask: HorizontalMask | None¶
- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.VectorCast(*, loc: SourceLocation | None = None, kind: ExprKind = ExprKind.FIELD, dtype: DataType, expr: Expr)[source]¶
Bases:
Cast__Expr,Expr- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.VectorLValue(*args: Any, **kwargs: Any)[source]¶
Bases:
Expr- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.VectorLogic(*, loc: SourceLocation | None = None, kind: ExprKind = ExprKind.FIELD, dtype: DataType = DataType.AUTO, left: Expr, right: Expr, op: LogicalOperator)[source]¶
Bases:
BinaryOp__Expr,Expr- op: LogicalOperator¶
- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.VectorTernaryOp(*, loc: SourceLocation | None = None, kind: ExprKind = ExprKind.FIELD, dtype: DataType = DataType.AUTO, cond: Expr, true_expr: Expr, false_expr: Expr)[source]¶
Bases:
TernaryOp__Expr,Expr- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.VectorUnaryOp(*, loc: SourceLocation | None = None, kind: ExprKind = ExprKind.FIELD, dtype: DataType = DataType.AUTO, op: UnaryOperator, expr: Expr)[source]¶
Bases:
UnaryOp__Expr,Expr- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.VerticalPass(*, loc: SourceLocation | None = None, body: List[HorizontalBlock], lower: AxisBound, upper: AxisBound, direction: LoopOrder)[source]¶
Bases:
LocNode- body: List[HorizontalBlock]¶
- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
- class gt4py.cartesian.gtc.numpy.npir.While(*, loc: SourceLocation | None = None, cond: Expr, body: List[Stmt])[source]¶
Bases:
While__Stmt_Expr,Stmt- classmethod update_forward_refs(localns: dict[str, Any] | None = None) type[_DataModelT]¶
Update Data Model class meta-information replacing forwarded type annotations with actual types.
- Parameters:
localns – locals
dictused in the evaluation of the annotations (globals are automatically taken frommodel.__module__).- Returns:
The provided class (so it can be used as a decorator too).
gt4py.cartesian.gtc.numpy.npir_codegen module¶
- class gt4py.cartesian.gtc.numpy.npir_codegen.NpirCodegen[source]¶
Bases:
TemplatedGenerator,VisitorWithSymbolTableTrait- AxisBound = <gt4py.eve.codegen.FormatTemplate object>¶
- Broadcast = <gt4py.eve.codegen.FormatTemplate object>¶
- Computation = <gt4py.eve.codegen.JinjaTemplate object>¶
- FieldDecl = <gt4py.eve.codegen.FormatTemplate object>¶
- HorizontalBlock = <gt4py.eve.codegen.JinjaTemplate object>¶
- LocalScalarDecl = <gt4py.eve.codegen.FormatTemplate object>¶
- NativeFuncCall = <gt4py.eve.codegen.FormatTemplate object>¶
- ParamAccess = <gt4py.eve.codegen.FormatTemplate object>¶
- ScalarCast = <gt4py.eve.codegen.FormatTemplate object>¶
- VarKOffset = <gt4py.eve.codegen.FormatTemplate object>¶
- VectorArithmetic = <gt4py.eve.codegen.FormatTemplate object>¶
- VectorCast = <gt4py.eve.codegen.FormatTemplate object>¶
- VectorLogic = <gt4py.eve.codegen.FormatTemplate object>¶
- VectorTernaryOp = <gt4py.eve.codegen.FormatTemplate object>¶
- VectorUnaryOp = <gt4py.eve.codegen.FormatTemplate object>¶
- VerticalPass = <gt4py.eve.codegen.JinjaTemplate object>¶
- While = <gt4py.eve.codegen.JinjaTemplate object>¶
- _node_visitor_cache_: ClassVar[dict[type, str] | None] = {}¶
Cache for visitor method names per node class to speed up dispatching. Note that we cache the visitor method name, not the bound method itself, to avoid implicitly caching the visitor state, which could lead to unexpected behavior.
- visit_BuiltInLiteral(node: BuiltInLiteral, **kwargs) str | Collection[str][source]¶
- visit_Computation(node: Computation, *, ignore_np_errstate: bool = True, **kwargs: Any) str | Collection[str][source]¶
- visit_FieldSlice(node: FieldSlice, **kwargs: Any) str | Collection[str][source]¶
- visit_HorizontalBlock(node: HorizontalBlock, **kwargs: Any) str | Collection[str][source]¶
- visit_KMaskFieldAccess(node: KMaskFieldAccess, **kwargs: Any) str[source]¶
- visit_LevelMarker(node: LevelMarker, **kwargs: Any) str | Collection[str][source]¶
- visit_LocalScalarAccess(node: LocalScalarAccess, *, is_serial: bool, horizontal_mask: HorizontalMask | None = None, **kwargs: Any) str | Collection[str][source]¶
- visit_NativeFunction(node: NativeFunction, **kwargs: Any) str | Collection[str][source]¶
- visit_ScalarLiteral(node: ScalarLiteral, *, inside_slice: bool = False, **kwargs: Any) str | Collection[str][source]¶
- visit_TemporaryDecl(node: TemporaryDecl, **kwargs) str | Collection[str][source]¶
- visit_UnaryOperator(node: UnaryOperator, **kwargs: Any) str | Collection[str][source]¶
- visit_VectorAssign(node: npir.VectorAssign, *, ctx: BlockContext, **kwargs: Any) str | Collection[str][source]¶
- visit_VerticalPass(node: VerticalPass, **kwargs)[source]¶
gt4py.cartesian.gtc.numpy.oir_to_npir module¶
- class gt4py.cartesian.gtc.numpy.oir_to_npir.OirToNpir[source]¶
Bases:
NodeTranslator,VisitorWithSymbolTableTraitLower from optimizable IR (OIR) to numpy IR (NPIR).
- _node_visitor_cache_: ClassVar[dict[type, str] | None] = {}¶
Cache for visitor method names per node class to speed up dispatching. Note that we cache the visitor method name, not the bound method itself, to avoid implicitly caching the visitor state, which could lead to unexpected behavior.
- visit_AbsoluteKIndex(node: AbsoluteKIndex, **kwargs: Any) None[source]¶
- visit_AssignStmt(node: AssignStmt, *, mask: Expr | None = None, horizontal_mask: HorizontalMask | None = None, **kwargs: Any) VectorAssign[source]¶
- visit_BinaryOp(node: BinaryOp, **kwargs: Any) VectorArithmetic | VectorLogic[source]¶
- visit_Cast(node: Cast, **kwargs: Any) VectorCast | ScalarCast[source]¶
- visit_FieldAccess(node: FieldAccess, **kwargs: Any) FieldSlice[source]¶
- visit_FieldDecl(node: FieldDecl, *, field_extents: Dict[str, Extent], **kwargs: Any) FieldDecl[source]¶
- visit_HorizontalExecution(node: HorizontalExecution, *, block_extents: Dict[int, Extent] | None = None, **kwargs: Any) HorizontalBlock[source]¶
- visit_HorizontalRestriction(node: HorizontalRestriction, *, extent: Extent, **kwargs: Any) Any[source]¶
- visit_IteratorAccess(node: IteratorAccess, **kwargs: Any) KMaskFieldAccess[source]¶
- visit_Literal(node: Literal, **kwargs: Any) ScalarLiteral[source]¶
- visit_LocalScalar(node: LocalScalar, **kwargs: Any) LocalScalarDecl[source]¶
- visit_NativeFuncCall(node: NativeFuncCall, **kwargs: Any) NativeFuncCall[source]¶
- visit_RuntimeAxisBound(node: RuntimeAxisBound, **kwargs: Any) None[source]¶
- visit_ScalarAccess(node: ScalarAccess, *, symtable: Dict[str, Decl], **kwargs: Any) ParamAccess | LocalScalarAccess[source]¶
- visit_ScalarDecl(node: ScalarDecl, **kwargs: Any) ScalarDecl[source]¶
- visit_Stencil(node: Stencil, **kwargs: Any) Computation[source]¶
- visit_Temporary(node: Temporary, *, field_extents: Dict[str, Extent], **kwargs: Any) TemporaryDecl[source]¶
- visit_TernaryOp(node: TernaryOp, **kwargs: Any) VectorTernaryOp[source]¶
- visit_UnaryOp(node: UnaryOp, **kwargs: Any) VectorUnaryOp[source]¶
- visit_VerticalLoop(node: VerticalLoop, **kwargs: Any) List[VerticalPass][source]¶
- visit_VerticalLoopSection(node: VerticalLoopSection, *, loop_order: LoopOrder, **kwargs: Any) VerticalPass[source]¶
gt4py.cartesian.gtc.numpy.scalars_to_temps module¶
An optimization to convert npir.LocalScalarDecl to npir.TemporaryDecl.
- class gt4py.cartesian.gtc.numpy.scalars_to_temps.ScalarsToTemporaries[source]¶
Bases:
NodeTranslator- _node_visitor_cache_: ClassVar[dict[type, str] | None] = {}¶
Cache for visitor method names per node class to speed up dispatching. Note that we cache the visitor method name, not the bound method itself, to avoid implicitly caching the visitor state, which could lead to unexpected behavior.
- visit_Computation(node: Computation) Computation[source]¶
- visit_HorizontalBlock(node: HorizontalBlock, *, temps_from_scalars: Dict[str, Temporary]) HorizontalBlock[source]¶
- visit_LocalScalarAccess(node: LocalScalarAccess, *, temps_from_scalars: Dict[str, Temporary]) FieldSlice[source]¶
- class gt4py.cartesian.gtc.numpy.scalars_to_temps.Temporary(name: str, dtype: gt4py.cartesian.gtc.common.DataType, extent: gt4py.cartesian.gtc.definitions.Extent, dimensions: tuple[bool, bool, bool])[source]¶
Bases:
object
- gt4py.cartesian.gtc.numpy.scalars_to_temps._all_local_scalars_are_unique_type(stencil: Computation) bool[source]¶
Module contents¶
- class gt4py.cartesian.gtc.numpy.NpirCodegen[source]¶
Bases:
TemplatedGenerator,VisitorWithSymbolTableTrait- AxisBound = <gt4py.eve.codegen.FormatTemplate object>¶
- Broadcast = <gt4py.eve.codegen.FormatTemplate object>¶
- Computation = <gt4py.eve.codegen.JinjaTemplate object>¶
- FieldDecl = <gt4py.eve.codegen.FormatTemplate object>¶
- HorizontalBlock = <gt4py.eve.codegen.JinjaTemplate object>¶
- LocalScalarDecl = <gt4py.eve.codegen.FormatTemplate object>¶
- NativeFuncCall = <gt4py.eve.codegen.FormatTemplate object>¶
- ParamAccess = <gt4py.eve.codegen.FormatTemplate object>¶
- ScalarCast = <gt4py.eve.codegen.FormatTemplate object>¶
- VarKOffset = <gt4py.eve.codegen.FormatTemplate object>¶
- VectorArithmetic = <gt4py.eve.codegen.FormatTemplate object>¶
- VectorCast = <gt4py.eve.codegen.FormatTemplate object>¶
- VectorLogic = <gt4py.eve.codegen.FormatTemplate object>¶
- VectorTernaryOp = <gt4py.eve.codegen.FormatTemplate object>¶
- VectorUnaryOp = <gt4py.eve.codegen.FormatTemplate object>¶
- VerticalPass = <gt4py.eve.codegen.JinjaTemplate object>¶
- While = <gt4py.eve.codegen.JinjaTemplate object>¶
- _node_visitor_cache_: ClassVar[dict[type, str] | None] = {}¶
Cache for visitor method names per node class to speed up dispatching. Note that we cache the visitor method name, not the bound method itself, to avoid implicitly caching the visitor state, which could lead to unexpected behavior.
- visit_BuiltInLiteral(node: BuiltInLiteral, **kwargs) str | Collection[str][source]¶
- visit_Computation(node: Computation, *, ignore_np_errstate: bool = True, **kwargs: Any) str | Collection[str][source]¶
- visit_FieldSlice(node: FieldSlice, **kwargs: Any) str | Collection[str][source]¶
- visit_HorizontalBlock(node: HorizontalBlock, **kwargs: Any) str | Collection[str][source]¶
- visit_KMaskFieldAccess(node: KMaskFieldAccess, **kwargs: Any) str[source]¶
- visit_LevelMarker(node: LevelMarker, **kwargs: Any) str | Collection[str][source]¶
- visit_LocalScalarAccess(node: LocalScalarAccess, *, is_serial: bool, horizontal_mask: HorizontalMask | None = None, **kwargs: Any) str | Collection[str][source]¶
- visit_NativeFunction(node: NativeFunction, **kwargs: Any) str | Collection[str][source]¶
- visit_ScalarLiteral(node: ScalarLiteral, *, inside_slice: bool = False, **kwargs: Any) str | Collection[str][source]¶
- visit_TemporaryDecl(node: TemporaryDecl, **kwargs) str | Collection[str][source]¶
- visit_UnaryOperator(node: UnaryOperator, **kwargs: Any) str | Collection[str][source]¶
- visit_VectorAssign(node: npir.VectorAssign, *, ctx: BlockContext, **kwargs: Any) str | Collection[str][source]¶
- visit_VerticalPass(node: VerticalPass, **kwargs)[source]¶
- class gt4py.cartesian.gtc.numpy.OirToNpir[source]¶
Bases:
NodeTranslator,VisitorWithSymbolTableTraitLower from optimizable IR (OIR) to numpy IR (NPIR).
- _node_visitor_cache_: ClassVar[dict[type, str] | None] = {}¶
Cache for visitor method names per node class to speed up dispatching. Note that we cache the visitor method name, not the bound method itself, to avoid implicitly caching the visitor state, which could lead to unexpected behavior.
- visit_AbsoluteKIndex(node: AbsoluteKIndex, **kwargs: Any) None[source]¶
- visit_AssignStmt(node: AssignStmt, *, mask: Expr | None = None, horizontal_mask: HorizontalMask | None = None, **kwargs: Any) VectorAssign[source]¶
- visit_BinaryOp(node: BinaryOp, **kwargs: Any) VectorArithmetic | VectorLogic[source]¶
- visit_Cast(node: Cast, **kwargs: Any) VectorCast | ScalarCast[source]¶
- visit_FieldAccess(node: FieldAccess, **kwargs: Any) FieldSlice[source]¶
- visit_FieldDecl(node: FieldDecl, *, field_extents: Dict[str, Extent], **kwargs: Any) FieldDecl[source]¶
- visit_HorizontalExecution(node: HorizontalExecution, *, block_extents: Dict[int, Extent] | None = None, **kwargs: Any) HorizontalBlock[source]¶
- visit_HorizontalRestriction(node: HorizontalRestriction, *, extent: Extent, **kwargs: Any) Any[source]¶
- visit_IteratorAccess(node: IteratorAccess, **kwargs: Any) KMaskFieldAccess[source]¶
- visit_Literal(node: Literal, **kwargs: Any) ScalarLiteral[source]¶
- visit_LocalScalar(node: LocalScalar, **kwargs: Any) LocalScalarDecl[source]¶
- visit_NativeFuncCall(node: NativeFuncCall, **kwargs: Any) NativeFuncCall[source]¶
- visit_RuntimeAxisBound(node: RuntimeAxisBound, **kwargs: Any) None[source]¶
- visit_ScalarAccess(node: ScalarAccess, *, symtable: Dict[str, Decl], **kwargs: Any) ParamAccess | LocalScalarAccess[source]¶
- visit_ScalarDecl(node: ScalarDecl, **kwargs: Any) ScalarDecl[source]¶
- visit_Stencil(node: Stencil, **kwargs: Any) Computation[source]¶
- visit_Temporary(node: Temporary, *, field_extents: Dict[str, Extent], **kwargs: Any) TemporaryDecl[source]¶
- visit_TernaryOp(node: TernaryOp, **kwargs: Any) VectorTernaryOp[source]¶
- visit_UnaryOp(node: UnaryOp, **kwargs: Any) VectorUnaryOp[source]¶
- visit_VerticalLoop(node: VerticalLoop, **kwargs: Any) List[VerticalPass][source]¶
- visit_VerticalLoopSection(node: VerticalLoopSection, *, loop_order: LoopOrder, **kwargs: Any) VerticalPass[source]¶
- class gt4py.cartesian.gtc.numpy.ScalarsToTemporaries[source]¶
Bases:
NodeTranslator- _node_visitor_cache_: ClassVar[dict[type, str] | None] = {}¶
Cache for visitor method names per node class to speed up dispatching. Note that we cache the visitor method name, not the bound method itself, to avoid implicitly caching the visitor state, which could lead to unexpected behavior.
- visit_Computation(node: Computation) Computation[source]¶
- visit_HorizontalBlock(node: HorizontalBlock, *, temps_from_scalars: Dict[str, Temporary]) HorizontalBlock[source]¶
- visit_LocalScalarAccess(node: LocalScalarAccess, *, temps_from_scalars: Dict[str, Temporary]) FieldSlice[source]¶