gt4py.cartesian.gtc package¶
Subpackages¶
- gt4py.cartesian.gtc.dace package
- Subpackages
- Submodules
- gt4py.cartesian.gtc.dace.oir_to_tasklet module
ContextOIRToTaskletOIRToTasklet._node_visitor_cache_OIRToTasklet.visit_AbsoluteKIndex()OIRToTasklet.visit_AssignStmt()OIRToTasklet.visit_BinaryOp()OIRToTasklet.visit_BuiltInLiteral()OIRToTasklet.visit_CacheDesc()OIRToTasklet.visit_CartesianOffset()OIRToTasklet.visit_Cast()OIRToTasklet.visit_CodeBlock()OIRToTasklet.visit_Decl()OIRToTasklet.visit_FieldAccess()OIRToTasklet.visit_FieldDecl()OIRToTasklet.visit_HorizontalExecution()OIRToTasklet.visit_HorizontalRestriction()OIRToTasklet.visit_IJCache()OIRToTasklet.visit_Interval()OIRToTasklet.visit_IteratorAccess()OIRToTasklet.visit_KCache()OIRToTasklet.visit_Literal()OIRToTasklet.visit_LocalScalar()OIRToTasklet.visit_MaskStmt()OIRToTasklet.visit_NativeFuncCall()OIRToTasklet.visit_NativeFunction()OIRToTasklet.visit_ScalarAccess()OIRToTasklet.visit_ScalarDecl()OIRToTasklet.visit_Stencil()OIRToTasklet.visit_Temporary()OIRToTasklet.visit_TernaryOp()OIRToTasklet.visit_UnaryOp()OIRToTasklet.visit_UnboundedInterval()OIRToTasklet.visit_VariableKOffset()OIRToTasklet.visit_VerticalLoop()OIRToTasklet.visit_VerticalLoopSection()OIRToTasklet.visit_While()
_field_offset_postfix()_memlet_subset()_memlet_subset_cartesian()_memlet_subset_variable_offset()_tasklet_name()
- gt4py.cartesian.gtc.dace.oir_to_treeir module
ControlFlowDEFAULT_STORAGE_TYPEOIRToTreeIROIRToTreeIR._group_statements()OIRToTreeIR._insert_evaluation_tasklet()OIRToTreeIR._node_visitor_cache_OIRToTreeIR.visit_AbsoluteKIndex()OIRToTreeIR.visit_AxisBound()OIRToTreeIR.visit_BinaryOp()OIRToTreeIR.visit_BuiltInLiteral()OIRToTreeIR.visit_CartesianOffset()OIRToTreeIR.visit_Cast()OIRToTreeIR.visit_CodeBlock()OIRToTreeIR.visit_Decl()OIRToTreeIR.visit_FieldAccess()OIRToTreeIR.visit_FieldDecl()OIRToTreeIR.visit_HorizontalExecution()OIRToTreeIR.visit_HorizontalMask()OIRToTreeIR.visit_HorizontalRestriction()OIRToTreeIR.visit_Interval()OIRToTreeIR.visit_IteratorAccess()OIRToTreeIR.visit_Literal()OIRToTreeIR.visit_LocalScalar()OIRToTreeIR.visit_MaskStmt()OIRToTreeIR.visit_RuntimeAxisBound()OIRToTreeIR.visit_ScalarAccess()OIRToTreeIR.visit_Stencil()OIRToTreeIR.visit_TernaryOp()OIRToTreeIR.visit_UnaryOp()OIRToTreeIR.visit_VariableKOffset()OIRToTreeIR.visit_VerticalLoop()OIRToTreeIR.visit_VerticalLoopSection()OIRToTreeIR.visit_While()
_is_boolean_scalar()_resolve_map_schedule()get_dace_shape()get_dace_strides()
- gt4py.cartesian.gtc.dace.treeir module
- gt4py.cartesian.gtc.dace.treeir_to_stree module
ContextContextPushPopTreeIRToScheduleTreeTreeIRToScheduleTree._node_visitor_cache_TreeIRToScheduleTree.visit_HorizontalLoop()TreeIRToScheduleTree.visit_IfElse()TreeIRToScheduleTree.visit_ParallelVerticalLoop()TreeIRToScheduleTree.visit_SequentialVerticalLoop()TreeIRToScheduleTree.visit_Tasklet()TreeIRToScheduleTree.visit_TreeRoot()TreeIRToScheduleTree.visit_While()
_loop_region_for()_loop_region_while()
- gt4py.cartesian.gtc.dace.utils module
- Module contents
- gt4py.cartesian.gtc.debug package
- Submodules
- gt4py.cartesian.gtc.debug.debug_codegen module
DebugCodeGenDebugCodeGen._node_visitor_cache_DebugCodeGen.create_k_loop_code()DebugCodeGen.generate_field_decls()DebugCodeGen.generate_ij_loop()DebugCodeGen.generate_imports()DebugCodeGen.generate_run_function()DebugCodeGen.generate_stencil_code()DebugCodeGen.generate_temp_decls()DebugCodeGen.initial_declarations()DebugCodeGen.visit_AbsoluteKIndex()DebugCodeGen.visit_AssignStmt()DebugCodeGen.visit_AxisBound()DebugCodeGen.visit_BinaryOp()DebugCodeGen.visit_CacheDesc()DebugCodeGen.visit_CartesianOffset()DebugCodeGen.visit_Cast()DebugCodeGen.visit_DataType()DebugCodeGen.visit_FieldAccess()DebugCodeGen.visit_FieldDecl()DebugCodeGen.visit_HorizontalExecution()DebugCodeGen.visit_HorizontalInterval()DebugCodeGen.visit_HorizontalMask()DebugCodeGen.visit_HorizontalRestriction()DebugCodeGen.visit_IJCache()DebugCodeGen.visit_Interval()DebugCodeGen.visit_IteratorAccess()DebugCodeGen.visit_KCache()DebugCodeGen.visit_Literal()DebugCodeGen.visit_LocalScalar()DebugCodeGen.visit_MaskStmt()DebugCodeGen.visit_NativeFuncCall()DebugCodeGen.visit_RuntimeAxisBound()DebugCodeGen.visit_ScalarAccess()DebugCodeGen.visit_ScalarDecl()DebugCodeGen.visit_Stencil()DebugCodeGen.visit_SymbolRef()DebugCodeGen.visit_Temporary()DebugCodeGen.visit_TernaryOp()DebugCodeGen.visit_UnaryOp()DebugCodeGen.visit_UnboundedInterval()DebugCodeGen.visit_VariableKOffset()DebugCodeGen.visit_VerticalLoop()DebugCodeGen.visit_VerticalLoopSection()DebugCodeGen.visit_While()
compute_extents()
- Module contents
- gt4py.cartesian.gtc.gtcpp package
- Submodules
- gt4py.cartesian.gtc.gtcpp.gtcpp module
AccessorRefApiParamDeclArgAssignStmtAxisLengthBinaryOpBlockStmtCacheCastComputationDeclExprFieldDeclGTAccessorGTApplyMethodGTComputationCallGTExtentGTFunctorGTIntervalGTLevelGTMultiStageGTParamListGTStageGlobalParamDeclIJCacheIfStmtIntentKCacheLiteralLocalAccessLocalVarDeclNativeFuncCallOffsetPositionalProgramStmtTemporaryTernaryOpUnaryOpVariableKOffsetWhile
- gt4py.cartesian.gtc.gtcpp.gtcpp_codegen module
GTCppCodegenGTCppCodegen.ApiParamDeclGTCppCodegen.ArgGTCppCodegen.AssignStmtGTCppCodegen.AxisLengthGTCppCodegen.BinaryOpGTCppCodegen.BlockStmtGTCppCodegen.CastGTCppCodegen.DATA_TYPE_TO_CODEGTCppCodegen.GTAccessorGTCppCodegen.GTApplyMethodGTCppCodegen.GTComputationCallGTCppCodegen.GTExtentGTCppCodegen.GTFunctorGTCppCodegen.GTIntervalGTCppCodegen.GTLevelGTCppCodegen.GTMultiStageGTCppCodegen.GTParamListGTCppCodegen.GTStageGTCppCodegen.IJCacheGTCppCodegen.IfStmtGTCppCodegen.KCacheGTCppCodegen.LocalAccessGTCppCodegen.LocalVarDeclGTCppCodegen.NativeFuncCallGTCppCodegen.PositionalGTCppCodegen.ProgramGTCppCodegen.TernaryOpGTCppCodegen.UNARY_OPERATOR_TO_CODEGTCppCodegen.UnaryOpGTCppCodegen.WhileGTCppCodegen._node_visitor_cache_GTCppCodegen.apply()GTCppCodegen.visit_AccessorRef()GTCppCodegen.visit_BuiltInLiteral()GTCppCodegen.visit_DataType()GTCppCodegen.visit_GTComputationCall()GTCppCodegen.visit_Literal()GTCppCodegen.visit_LoopOrder()GTCppCodegen.visit_NativeFunction()GTCppCodegen.visit_Program()GTCppCodegen.visit_Temporary()
_offset_limit()
- gt4py.cartesian.gtc.gtcpp.oir_to_gtcpp module
OIRToGTCppOIRToGTCpp.GTComputationContextOIRToGTCpp.ProgramContextOIRToGTCpp._mask_to_expr()OIRToGTCpp._node_visitor_cache_OIRToGTCpp.visit_AbsoluteKIndex()OIRToGTCpp.visit_AssignStmt()OIRToGTCpp.visit_AxisBound()OIRToGTCpp.visit_BinaryOp()OIRToGTCpp.visit_Cast()OIRToGTCpp.visit_FieldAccess()OIRToGTCpp.visit_FieldDecl()OIRToGTCpp.visit_HorizontalExecution()OIRToGTCpp.visit_HorizontalRestriction()OIRToGTCpp.visit_IJCache()OIRToGTCpp.visit_Interval()OIRToGTCpp.visit_IteratorAccess()OIRToGTCpp.visit_KCache()OIRToGTCpp.visit_Literal()OIRToGTCpp.visit_LocalScalar()OIRToGTCpp.visit_MaskStmt()OIRToGTCpp.visit_NativeFuncCall()OIRToGTCpp.visit_RuntimeAxisBound()OIRToGTCpp.visit_ScalarAccess()OIRToGTCpp.visit_ScalarDecl()OIRToGTCpp.visit_Stencil()OIRToGTCpp.visit_Temporary()OIRToGTCpp.visit_TernaryOp()OIRToGTCpp.visit_UnaryOp()OIRToGTCpp.visit_VariableKOffset()OIRToGTCpp.visit_VerticalLoop()OIRToGTCpp.visit_While()
SymbolNameCreator_extract_accessors()_make_axis_offset_expr()
- Module contents
- gt4py.cartesian.gtc.numpy package
- Submodules
- gt4py.cartesian.gtc.numpy.npir module
AxisNameBroadcastComputationDeclExprFieldDeclFieldSliceHorizontalBlockHorizontalMaskKMaskFieldAccessLocalScalarAccessLocalScalarDeclNativeFuncCallParamAccessScalarCastScalarDeclScalarLiteralStmtTemporaryDeclVarKOffsetVectorArithmeticVectorAssignVectorCastVectorLValueVectorLogicVectorTernaryOpVectorUnaryOpVerticalPassWhile
- gt4py.cartesian.gtc.numpy.npir_codegen module
NpirCodegenNpirCodegen.AxisBoundNpirCodegen.BlockContextNpirCodegen.BroadcastNpirCodegen.ComputationNpirCodegen.FieldDeclNpirCodegen.HorizontalBlockNpirCodegen.LocalScalarDeclNpirCodegen.NativeFuncCallNpirCodegen.ParamAccessNpirCodegen.ScalarCastNpirCodegen.VarKOffsetNpirCodegen.VectorArithmeticNpirCodegen.VectorCastNpirCodegen.VectorLogicNpirCodegen.VectorTernaryOpNpirCodegen.VectorUnaryOpNpirCodegen.VerticalPassNpirCodegen.WhileNpirCodegen._node_visitor_cache_NpirCodegen.visit_AxisBound()NpirCodegen.visit_BuiltInLiteral()NpirCodegen.visit_Computation()NpirCodegen.visit_DataType()NpirCodegen.visit_FieldSlice()NpirCodegen.visit_HorizontalBlock()NpirCodegen.visit_KMaskFieldAccess()NpirCodegen.visit_LevelMarker()NpirCodegen.visit_LocalScalarAccess()NpirCodegen.visit_LoopOrder()NpirCodegen.visit_NativeFuncCall()NpirCodegen.visit_NativeFunction()NpirCodegen.visit_ScalarLiteral()NpirCodegen.visit_TemporaryDecl()NpirCodegen.visit_UnaryOperator()NpirCodegen.visit_VectorAssign()NpirCodegen.visit_VerticalPass()NpirCodegen.visit_While()
- gt4py.cartesian.gtc.numpy.oir_to_npir module
OirToNpirOirToNpir._node_visitor_cache_OirToNpir.visit_AbsoluteKIndex()OirToNpir.visit_AssignStmt()OirToNpir.visit_AxisBound()OirToNpir.visit_BinaryOp()OirToNpir.visit_CartesianOffset()OirToNpir.visit_Cast()OirToNpir.visit_FieldAccess()OirToNpir.visit_FieldDecl()OirToNpir.visit_HorizontalExecution()OirToNpir.visit_HorizontalRestriction()OirToNpir.visit_IteratorAccess()OirToNpir.visit_Literal()OirToNpir.visit_LocalScalar()OirToNpir.visit_MaskStmt()OirToNpir.visit_NativeFuncCall()OirToNpir.visit_RuntimeAxisBound()OirToNpir.visit_ScalarAccess()OirToNpir.visit_ScalarDecl()OirToNpir.visit_Stencil()OirToNpir.visit_Temporary()OirToNpir.visit_TernaryOp()OirToNpir.visit_UnaryOp()OirToNpir.visit_VariableKOffset()OirToNpir.visit_VerticalLoop()OirToNpir.visit_VerticalLoopSection()OirToNpir.visit_While()
- gt4py.cartesian.gtc.numpy.scalars_to_temps module
- Module contents
NpirCodegenNpirCodegen.AxisBoundNpirCodegen.BlockContextNpirCodegen.BroadcastNpirCodegen.ComputationNpirCodegen.FieldDeclNpirCodegen.HorizontalBlockNpirCodegen.LocalScalarDeclNpirCodegen.NativeFuncCallNpirCodegen.ParamAccessNpirCodegen.ScalarCastNpirCodegen.VarKOffsetNpirCodegen.VectorArithmeticNpirCodegen.VectorCastNpirCodegen.VectorLogicNpirCodegen.VectorTernaryOpNpirCodegen.VectorUnaryOpNpirCodegen.VerticalPassNpirCodegen.WhileNpirCodegen._node_visitor_cache_NpirCodegen.visit_AxisBound()NpirCodegen.visit_BuiltInLiteral()NpirCodegen.visit_Computation()NpirCodegen.visit_DataType()NpirCodegen.visit_FieldSlice()NpirCodegen.visit_HorizontalBlock()NpirCodegen.visit_KMaskFieldAccess()NpirCodegen.visit_LevelMarker()NpirCodegen.visit_LocalScalarAccess()NpirCodegen.visit_LoopOrder()NpirCodegen.visit_NativeFuncCall()NpirCodegen.visit_NativeFunction()NpirCodegen.visit_ScalarLiteral()NpirCodegen.visit_TemporaryDecl()NpirCodegen.visit_UnaryOperator()NpirCodegen.visit_VectorAssign()NpirCodegen.visit_VerticalPass()NpirCodegen.visit_While()
OirToNpirOirToNpir._node_visitor_cache_OirToNpir.visit_AbsoluteKIndex()OirToNpir.visit_AssignStmt()OirToNpir.visit_AxisBound()OirToNpir.visit_BinaryOp()OirToNpir.visit_CartesianOffset()OirToNpir.visit_Cast()OirToNpir.visit_FieldAccess()OirToNpir.visit_FieldDecl()OirToNpir.visit_HorizontalExecution()OirToNpir.visit_HorizontalRestriction()OirToNpir.visit_IteratorAccess()OirToNpir.visit_Literal()OirToNpir.visit_LocalScalar()OirToNpir.visit_MaskStmt()OirToNpir.visit_NativeFuncCall()OirToNpir.visit_RuntimeAxisBound()OirToNpir.visit_ScalarAccess()OirToNpir.visit_ScalarDecl()OirToNpir.visit_Stencil()OirToNpir.visit_Temporary()OirToNpir.visit_TernaryOp()OirToNpir.visit_UnaryOp()OirToNpir.visit_VariableKOffset()OirToNpir.visit_VerticalLoop()OirToNpir.visit_VerticalLoopSection()OirToNpir.visit_While()
ScalarsToTemporaries
- gt4py.cartesian.gtc.passes package
- Subpackages
- gt4py.cartesian.gtc.passes.oir_optimizations package
- Submodules
- gt4py.cartesian.gtc.passes.oir_optimizations.caches module
- gt4py.cartesian.gtc.passes.oir_optimizations.horizontal_execution_merging module
- gt4py.cartesian.gtc.passes.oir_optimizations.inlining module
- gt4py.cartesian.gtc.passes.oir_optimizations.mask_stmt_merging module
- gt4py.cartesian.gtc.passes.oir_optimizations.pruning module
- gt4py.cartesian.gtc.passes.oir_optimizations.temporaries module
- gt4py.cartesian.gtc.passes.oir_optimizations.utils module
- gt4py.cartesian.gtc.passes.oir_optimizations.vertical_loop_merging module
- Module contents
- gt4py.cartesian.gtc.passes.oir_optimizations package
- Submodules
- gt4py.cartesian.gtc.passes.gtir_definitive_assignment_analysis module
- gt4py.cartesian.gtc.passes.gtir_dtype_resolver module
- gt4py.cartesian.gtc.passes.gtir_k_boundary module
- gt4py.cartesian.gtc.passes.gtir_pipeline module
- gt4py.cartesian.gtc.passes.gtir_prune_unused_parameters module
- gt4py.cartesian.gtc.passes.gtir_upcaster module
- gt4py.cartesian.gtc.passes.horizontal_masks module
- gt4py.cartesian.gtc.passes.oir_access_kinds module
AccessKindComputerAccessKindComputer._node_visitor_cache_AccessKindComputer._visit_Access()AccessKindComputer.visit_AssignStmt()AccessKindComputer.visit_FieldAccess()AccessKindComputer.visit_HorizontalExecution()AccessKindComputer.visit_HorizontalRestriction()AccessKindComputer.visit_MaskStmt()AccessKindComputer.visit_RuntimeAxisBound()AccessKindComputer.visit_ScalarAccess()AccessKindComputer.visit_Stencil()AccessKindComputer.visit_While()
compute_access_kinds()
- gt4py.cartesian.gtc.passes.oir_pipeline module
- Module contents
- Subpackages
Submodules¶
gt4py.cartesian.gtc.common module¶
- class gt4py.cartesian.gtc.common.AbsoluteKIndex(*, k: int | ExprT)[source]¶
Bases:
GenericNode,Generic[ExprT]Access a field with absolute K
Restrictions: - Centered I/J - No data dimensions - Read-only
- 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.common.AbsoluteKIndex__Expr(*, k: int | Expr)¶
Bases:
AbsoluteKIndex- 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.common.ArithmeticOperator(*values)[source]¶
Bases:
StrEnumArithmetic operators.
- ADD = '+'¶
- DIV = '/'¶
- MATMULT = '@'¶
- MUL = '*'¶
- SUB = '-'¶
- class gt4py.cartesian.gtc.common.AssignStmt(*, left: TargetT, right: ExprT)[source]¶
Bases:
GenericNode,Generic[TargetT,ExprT]- left: TargetT¶
- right: ExprT¶
- 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.common.AssignStmt__FieldAccess_Expr(*, left: FieldAccess, right: Expr)¶
Bases:
AssignStmt- left: FieldAccess¶
- 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.common.AssignStmt__VectorLValue_Expr(*, left: VectorLValue, right: Expr)¶
Bases:
AssignStmt- left: VectorLValue¶
- 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.common.AssignStmt__gt4py_cartesian_gtc_gtcpp_gtcpp_localaccess_gt4py_cartesian_gtc_gtcpp_gtcpp_accessorref_Expr(*, left: LocalAccess | AccessorRef, right: Expr)¶
Bases:
AssignStmt- left: LocalAccess | AccessorRef¶
- 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.common.AssignStmt__gt4py_cartesian_gtc_oir_scalaraccess_gt4py_cartesian_gtc_oir_fieldaccess_Expr(*, left: ScalarAccess | FieldAccess, right: Expr)¶
Bases:
AssignStmt- left: ScalarAccess | FieldAccess¶
- 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.common.AssignmentKind(*values)[source]¶
Bases:
StrEnumKind of assignment: plain or combined with operations.
- ADD = '+='¶
- DIV = '/='¶
- MUL = '*='¶
- PLAIN = '='¶
- SUB = '-='¶
- class gt4py.cartesian.gtc.common.AxisBound(*, level: LevelMarker, offset: int = 0)[source]¶
Bases:
BaseAxisBound- _abc_impl = <_abc._abc_data object>¶
- level: LevelMarker¶
- 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.common.BaseAxisBound(*, level: LevelMarker, offset: ScalarAccess | FieldAccess | int)[source]¶
Bases:
Node,ABC- _abc_impl = <_abc._abc_data object>¶
- level: LevelMarker¶
- offset: ScalarAccess | FieldAccess | int¶
- 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.common.BinaryOp(*, op: ArithmeticOperator | ComparisonOperator | LogicalOperator, left: ExprT, right: ExprT)[source]¶
Bases:
GenericNode,Generic[ExprT]Generic binary operation with type propagation.
The generic BinaryOp already contains logic for - strict type checking if the dtype for left and right is set. - type propagation (taking operator type into account).
- left: ExprT¶
- right: ExprT¶
- 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.common.BinaryOp__Expr(*, op: ArithmeticOperator | ComparisonOperator | LogicalOperator, left: Expr, right: Expr)¶
Bases:
BinaryOp- 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.common.BlockStmt(*, body: List[StmtT])[source]¶
Bases:
GenericNode,SymbolTableTrait,Generic[StmtT]- 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.common.BlockStmt__Stmt(*, body: List[Stmt])¶
Bases:
BlockStmt- 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.common.BuiltInLiteral(*values)[source]¶
Bases:
StrEnum- FALSE = 'false'¶
- MAX_VALUE = 'max'¶
- MIN_VALUE = 'min'¶
- ONE = 'one'¶
- TRUE = 'true'¶
- ZERO = 'zero'¶
- class gt4py.cartesian.gtc.common.CartesianOffset(*, i: int, j: int, k: int)[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).
- classmethod zero() CartesianOffset[source]¶
- class gt4py.cartesian.gtc.common.Cast(*, dtype: DataType, expr: ExprT)[source]¶
Bases:
GenericNode,Generic[ExprT]- expr: ExprT¶
- 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.common.Cast__Expr(*, dtype: DataType, expr: Expr)¶
Bases:
Cast- 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.common.ComparisonOperator(*values)[source]¶
Bases:
StrEnumComparison operators.
- EQ = '=='¶
- GE = '>='¶
- GT = '>'¶
- LE = '<='¶
- LT = '<'¶
- NE = '!='¶
- class gt4py.cartesian.gtc.common.DataType(*values)[source]¶
Bases:
IntEnumData type identifier.
- AUTO = 0¶
- BOOL = 10¶
- DEFAULT = 1¶
- FLOAT32 = 104¶
- FLOAT64 = 108¶
- INT16 = 12¶
- INT32 = 14¶
- INT64 = 18¶
- INT8 = 11¶
- INVALID = -1¶
- class gt4py.cartesian.gtc.common.Expr(*args: Any, **kwargs: Any)[source]¶
Bases:
LocNodeExpression base class.
All expressions have - an optional dtype - an expression kind (scalar or field)
- 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.common.FieldAccess(data_index: List[ExprT] = NOTHING, *, name: Any, offset: CartesianOffset | VariableKOffsetT | AbsoluteKIndex, kind: ExprKind = ExprKind.FIELD)[source]¶
Bases:
GenericNode,Generic[ExprT,VariableKOffsetT]- classmethod centered(*, name: str, loc: SourceLocation | None = None) FieldAccess[source]¶
- name: SymbolRef¶
- offset: CartesianOffset | VariableKOffsetT | AbsoluteKIndex¶
- 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.common.FieldAccess__Expr_VariableKOffset(data_index: List[Expr] = NOTHING, *, name: Any, kind: ExprKind = ExprKind.FIELD, offset: CartesianOffset | VariableKOffset | AbsoluteKIndex)¶
Bases:
FieldAccess- offset: CartesianOffset | VariableKOffset | AbsoluteKIndex¶
- 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).
- exception gt4py.cartesian.gtc.common.GTCPostconditionError(*, expected: str, **kwargs: Any)[source]¶
Bases:
EveError,RuntimeError- message_template = 'GTC pass postcondition error: [{info}]'¶
- exception gt4py.cartesian.gtc.common.GTCPreconditionError(*, expected: str, **kwargs: Any)[source]¶
Bases:
EveError,RuntimeError- message_template = 'GTC pass precondition error: [{info}]'¶
- class gt4py.cartesian.gtc.common.HorizontalInterval(*, start: AxisBound | None, end: AxisBound | None)[source]¶
Bases:
NodeRepresents an interval of the index space in the horizontal.
This is separate from gtir.Interval because the endpoints may be outside the compute domain.
- classmethod at_endpt(level: LevelMarker, start_offset: int, end_offset: int | None = None) HorizontalInterval[source]¶
- classmethod check_start_before_end(instance: HorizontalInterval) None[source]¶
- classmethod compute_domain(start_offset: int = 0, end_offset: int = 0) HorizontalInterval[source]¶
- classmethod full() HorizontalInterval[source]¶
- overlaps(other: HorizontalInterval) bool[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.common.HorizontalMask(*, loc: SourceLocation | None = None, i: HorizontalInterval, j: HorizontalInterval)[source]¶
Bases:
LocNodeExpr to represent a convex portion of the horizontal iteration space.
- property intervals: Tuple[HorizontalInterval, HorizontalInterval]¶
- 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.common.HorizontalRestriction(*, mask: HorizontalMask, body: List[StmtT])[source]¶
Bases:
GenericNode,Generic[StmtT]A specialization of the horizontal space.
- mask: HorizontalMask¶
- 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.common.HorizontalRestriction__Stmt(*, mask: HorizontalMask, body: List[Stmt])¶
Bases:
HorizontalRestriction- 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.common.IfStmt(*, cond: ExprT, true_branch: StmtT, false_branch: StmtT | None = None)[source]¶
Bases:
GenericNode,Generic[StmtT,ExprT]Generic if statement.
Verifies that cond is a boolean expr (if dtype is set).
- cond: ExprT¶
- true_branch: StmtT¶
- 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.common.IfStmt__BlockStmt_Expr(*, cond: Expr, true_branch: BlockStmt, false_branch: BlockStmt | None = None)¶
Bases:
IfStmt- 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.common.LevelMarker(*values)[source]¶
Bases:
StrEnum- END = 'end'¶
- START = 'start'¶
- class gt4py.cartesian.gtc.common.Literal(*, value: BuiltInLiteral | str, dtype: DataType, kind: ExprKind = ExprKind.SCALAR)[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).
- value: BuiltInLiteral | str¶
- class gt4py.cartesian.gtc.common.LocNode(*, loc: SourceLocation | None = None)[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.common.LogicalOperator(*values)[source]¶
Bases:
StrEnumLogical operators.
- AND = 'and'¶
- OR = 'or'¶
- class gt4py.cartesian.gtc.common.LoopOrder(*values)[source]¶
Bases:
StrEnumLoop order identifier.
- BACKWARD = 'backward'¶
- FORWARD = 'forward'¶
- PARALLEL = 'parallel'¶
- class gt4py.cartesian.gtc.common.NativeFuncCall(*, func: NativeFunction, args: List[ExprT])[source]¶
Bases:
GenericNode,Generic[ExprT]- classmethod arity_check(instance: NativeFuncCall) None[source]¶
- func: NativeFunction¶
- classmethod kind_propagation(instance: NativeFuncCall) None[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.common.NativeFuncCall__Expr(*, func: NativeFunction, args: List[Expr])¶
Bases:
NativeFuncCall- 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.common.NativeFunction(*values)[source]¶
Bases:
StrEnum- ABS = 'abs'¶
- ARCCOS = 'arccos'¶
- ARCCOSH = 'arccosh'¶
- ARCSIN = 'arcsin'¶
- ARCSINH = 'arcsinh'¶
- ARCTAN = 'arctan'¶
- ARCTANH = 'arctanh'¶
- CBRT = 'cbrt'¶
- CEIL = 'ceil'¶
- COS = 'cos'¶
- COSH = 'cosh'¶
- ERF = 'erf'¶
- ERFC = 'erfc'¶
- EXP = 'exp'¶
- FLOAT32 = 'float32'¶
- FLOAT64 = 'float64'¶
- FLOOR = 'floor'¶
- GAMMA = 'gamma'¶
- INT32 = 'int32'¶
- INT64 = 'int64'¶
- IR_OP_TO_NUM_ARGS: ClassVar[Dict[NativeFunction, int]] = {NativeFunction.ABS: 1, NativeFunction.ARCCOS: 1, NativeFunction.ARCCOSH: 1, NativeFunction.ARCSIN: 1, NativeFunction.ARCSINH: 1, NativeFunction.ARCTAN: 1, NativeFunction.ARCTANH: 1, NativeFunction.CBRT: 1, NativeFunction.CEIL: 1, NativeFunction.COS: 1, NativeFunction.COSH: 1, NativeFunction.ERF: 1, NativeFunction.ERFC: 1, NativeFunction.EXP: 1, NativeFunction.FLOAT32: 1, NativeFunction.FLOAT64: 1, NativeFunction.FLOOR: 1, NativeFunction.GAMMA: 1, NativeFunction.INT32: 1, NativeFunction.INT64: 1, NativeFunction.ISFINITE: 1, NativeFunction.ISINF: 1, NativeFunction.ISNAN: 1, NativeFunction.LOG: 1, NativeFunction.LOG10: 1, NativeFunction.MAX: 2, NativeFunction.MIN: 2, NativeFunction.MOD: 2, NativeFunction.POW: 2, NativeFunction.ROUND: 1, NativeFunction.ROUND_AWAY_FROM_ZERO: 1, NativeFunction.SIN: 1, NativeFunction.SINH: 1, NativeFunction.SQRT: 1, NativeFunction.TAN: 1, NativeFunction.TANH: 1, NativeFunction.TRUNC: 1}¶
- ISFINITE = 'isfinite'¶
- ISINF = 'isinf'¶
- ISNAN = 'isnan'¶
- LOG = 'log'¶
- LOG10 = 'log10'¶
- MAX = 'max'¶
- MIN = 'min'¶
- MOD = 'mod'¶
- POW = 'pow'¶
- ROUND = 'round'¶
- ROUND_AWAY_FROM_ZERO = 'round_away_from_zero'¶
- SIN = 'sin'¶
- SINH = 'sinh'¶
- SQRT = 'sqrt'¶
- TAN = 'tan'¶
- TANH = 'tanh'¶
- TRUNC = 'trunc'¶
- class gt4py.cartesian.gtc.common.RuntimeAxisBound(*, level: LevelMarker, offset: ScalarAccess | FieldAccess)[source]¶
Bases:
BaseAxisBound- _abc_impl = <_abc._abc_data object>¶
- level: LevelMarker¶
- offset: ScalarAccess | FieldAccess¶
- 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.common.ScalarAccess(*, loc: SourceLocation | None = None, name: Any, kind: ExprKind = ExprKind.SCALAR)[source]¶
Bases:
LocNode- 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.common.Stmt(*args: Any, **kwargs: Any)[source]¶
Bases:
LocNode- 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.common.TernaryOp(*, cond: ExprT, true_expr: ExprT, false_expr: ExprT)[source]¶
Bases:
GenericNode,Generic[ExprT]Generic ternary operation with type propagation.
The generic TernaryOp already contains logic for - strict type checking if the dtype for true_expr and false_expr is set. - type checking for cond - type propagation.
- cond: ExprT¶
- false_expr: ExprT¶
- true_expr: ExprT¶
- 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.common.TernaryOp__Expr(*, cond: Expr, true_expr: Expr, false_expr: Expr)¶
Bases:
TernaryOp- 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.common.UnaryOp(*, op: UnaryOperator, expr: ExprT)[source]¶
Bases:
GenericNode,Generic[ExprT]Generic unary operation with type propagation.
The generic UnaryOp already contains logic for type propagation.
- expr: ExprT¶
- op: UnaryOperator¶
- 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.common.UnaryOp__Expr(*, op: UnaryOperator, expr: Expr)¶
Bases:
UnaryOp- 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.common.UnaryOperator(*values)[source]¶
Bases:
StrEnumUnary operator identifier.
- NEG = '-'¶
- NOT = 'not'¶
- POS = '+'¶
- class gt4py.cartesian.gtc.common.VariableKOffset(*, k: ExprT)[source]¶
Bases:
GenericNode,Generic[ExprT]- k: ExprT¶
- 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.common.VariableKOffset__Expr(*, k: Expr)¶
Bases:
VariableKOffset- 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.common.While(*, cond: ExprT, body: List[StmtT])[source]¶
Bases:
GenericNode,Generic[StmtT,ExprT]Generic while loop.
Verifies that cond is a boolean expr (if dtype is set).
- cond: ExprT¶
- 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.common.While__Stmt_Expr(*, cond: Expr, body: List[Stmt])¶
Bases:
While- 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.common._LvalueDimsValidator(vertical_loop_type: Type[Node], decl_type: Type[Node])[source]¶
Bases:
VisitorWithSymbolTableTrait- _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.
- gt4py.cartesian.gtc.common._make_root_validator(impl: Callable[[type[_DM], _DM], None]) Callable[[type[_DM], _DM], None][source]¶
- gt4py.cartesian.gtc.common.assign_stmt_dtype_validation(*, strict: bool) Callable[[type[_DM], _DM], None][source]¶
- gt4py.cartesian.gtc.common.binary_op_dtype_propagation(*, strict: bool) Callable[[type[_DM], _DM], None][source]¶
- gt4py.cartesian.gtc.common.native_func_call_dtype_propagation(*, strict: bool = True) Callable[[type[_DM], _DM], None][source]¶
- gt4py.cartesian.gtc.common.op_to_ufunc(op: UnaryOperator | ArithmeticOperator | ComparisonOperator | LogicalOperator | NativeFunction) ufunc[source]¶
- gt4py.cartesian.gtc.common.ternary_op_dtype_propagation(*, strict: bool) Callable[[type[_DM], _DM], None][source]¶
- gt4py.cartesian.gtc.common.validate_lvalue_dims(vertical_loop_type: Type[Node], decl_type: Type[Node]) Callable[[type[_DM], _DM], None][source]¶
Validate lvalue dimensions using the root node symbol table.
The following tree structure is expected:
Root(`SymTableTrait`) |- * |- `vertical_loop_type` |- loop_order: `LoopOrder` |- * |- AssignStmt(`AssignStmt`) |- left: `Node`, validated only if reference to `decl_type` in symtable |- symtable_: Symtable[name, Union[`decl_type`, *]] DeclType |- dimensions: `Tuple[bool, bool, bool]`- Parameters:
vertical_loop_type – A node type with an LoopOrder attribute named loop_order
decl_type – A declaration type with field dimension information in the format Tuple[bool, bool, bool] in an attribute named dimensions.
gt4py.cartesian.gtc.definitions module¶
- class gt4py.cartesian.gtc.definitions.Boundary(ranges, *args, ndims=None)[source]¶
Bases:
FrameTupleFrame size around one central origin (pairs of integers).
Negative numbers represent a boundary region subtracting from the wrapped area.
- property frame_size¶
Sizes of the boundary area, i.e., excluding the central element of the frame.
- property shape¶
Total shape of the frame area.
- class gt4py.cartesian.gtc.definitions.CenteredExtent(ranges, *args, ndims=None)[source]¶
Bases:
ExtentRegion defined by the largest negative offset (or zero) and the largest positive offset (or zero).
Size of boundary regions are expressed as minimum and maximum relative offsets related to the computation position. For example the frame for a stencil accessing 3 elements at the left of computation point and two at the right in the X axis would be: (-3, 2). If the stencil only has accesses with negative indices, the upper boundary would be 0.
- class gt4py.cartesian.gtc.definitions.Extent(ranges, *args, ndims=None)[source]¶
Bases:
FrameTupleRegion defined by the smallest and the largest offsets.
Size of boundary regions are expressed as minimum and maximum relative offsets related to the computation position. For example the frame for a stencil accessing 3 elements at the left of computation point and two at the right in the X axis would be: (-3, 2). If the stencil only has accesses with negative indices, the upper boundary would be then a negative value.
- property frame_size¶
Sizes of the boundary area, i.e., excluding the central element of the frame.
- property shape¶
Total shape of the frame area.
- class gt4py.cartesian.gtc.definitions.FrameTuple(ranges, *args, ndims=None)[source]¶
Bases:
tupleN-dimensional list of pairs of numbers representing offsets around one central origin.
- property is_symmetric¶
- property is_zero¶
- property lower_indices¶
- property ndims¶
- property upper_indices¶
- class gt4py.cartesian.gtc.definitions.Index(sizes, *args, ndims=None)[source]¶
Bases:
NumericTupleIndex in a grid (all elements are ints).
gt4py.cartesian.gtc.gtir module¶
GridTools Intermediate Representation.
GTIR represents a computation with the semantics of the GTScript parallel model <https://github.com/GridTools/concepts/wiki/GTScript-Parallel-model>.
Type constraints and validators narrow the IR as much as reasonable to valid (executable) IR.
Analysis is required to generate valid code (complying with the parallel model) - extent analysis to define the extended compute domain - FieldIfStmt expansion to comply with the parallel model
- class gt4py.cartesian.gtc.gtir.AbsoluteKIndex(*, k: int | Expr)[source]¶
Bases:
AbsoluteKIndex__ExprSee gtc.common.AbsoluteKIndex
- 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.gtir.Argument(*, name: str, is_keyword: bool, default: str)[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.gtir.BinaryOp(*, loc: SourceLocation | None = None, kind: ExprKind = ExprKind.FIELD, dtype: DataType = DataType.AUTO, op: ArithmeticOperator | ComparisonOperator | LogicalOperator, left: Expr, right: Expr)[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.gtir.BlockStmt(*, loc: SourceLocation | None = None, body: List[Stmt])[source]¶
Bases:
BlockStmt__Stmt,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.gtir.Cast(*, 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.gtir.Decl(*args: Any, **kwargs: Any)[source]¶
Bases:
LocNode- 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.gtir.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.gtir.FieldAccess(data_index: List[Expr] = NOTHING, *, loc: SourceLocation | None = None, dtype: DataType = DataType.AUTO, name: Any, kind: ExprKind = ExprKind.FIELD, offset: CartesianOffset | VariableKOffset | AbsoluteKIndex)[source]¶
Bases:
FieldAccess__Expr_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.gtir.FieldDecl(data_dims: Tuple[Integral, ...] = NOTHING, *, loc: SourceLocation | None = None, name: Any, dtype: DataType, dimensions: Tuple[bool, bool, bool])[source]¶
Bases:
Decl- 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.gtir.FieldIfStmt(*, loc: SourceLocation | None = None, true_branch: BlockStmt, false_branch: BlockStmt | None = None, cond: Expr)[source]¶
Bases:
IfStmt__BlockStmt_Expr,StmtIf statement with a field expression as condition.
The condition is evaluated for all gridpoints and stored in a mask.
Each statement inside the if and else branches is executed according to the same rules as statements outside of branches.
The following restriction applies:
Inside the if and else blocks the same field cannot be written to and read with an offset in the parallel axes (order does not matter).
See parallel model <https://github.com/GridTools/concepts/wiki/GTScript-Parallel-model#conditionals-on-field-expressions>
- 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.gtir.HorizontalRestriction(*, loc: SourceLocation | None = None, mask: HorizontalMask, body: List[Stmt])[source]¶
Bases:
HorizontalRestriction__Stmt,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.gtir.Interval(*, loc: SourceLocation | None = None, start: BaseAxisBound, end: BaseAxisBound)[source]¶
Bases:
LocNode- end: BaseAxisBound¶
- start: BaseAxisBound¶
- 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.gtir.IteratorAccess(*, loc: SourceLocation | None = None, dtype: DataType = DataType.AUTO, name: AxisName, kind: ExprKind = ExprKind.SCALAR)[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.gtir.Literal(*, loc: SourceLocation | None = None, value: BuiltInLiteral | str, dtype: DataType, kind: ExprKind = ExprKind.SCALAR)[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.gtir.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.gtir.ParAssignStmt(*, loc: SourceLocation | None = None, right: Expr, left: FieldAccess)[source]¶
Bases:
AssignStmt__FieldAccess_Expr,StmtParallel assignment.
R.h.s. is evaluated for all points and the resulting field is assigned (GTScript parallel model). Scalar variables on the l.h.s. are not allowed, as the only scalar variables are read-only stencil parameters.
- left: FieldAccess¶
- no_horizontal_offset_in_assignment(attribute: Attribute, value: FieldAccess) None[source]¶
- classmethod no_write_and_read_with_offset_of_same_field(instance: ParAssignStmt) None[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.gtir.ScalarAccess(*, loc: SourceLocation | None = None, dtype: DataType = DataType.AUTO, name: Any, kind: ExprKind = ExprKind.SCALAR)[source]¶
Bases:
ScalarAccess,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.gtir.ScalarDecl(*, loc: SourceLocation | None = None, name: Any, dtype: DataType)[source]¶
Bases:
Decl- 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.gtir.ScalarIfStmt(*, loc: SourceLocation | None = None, true_branch: BlockStmt, false_branch: BlockStmt | None = None, cond: Expr)[source]¶
Bases:
IfStmt__BlockStmt_Expr,StmtIf statement with a scalar expression as condition.
No special rules apply.
- 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.gtir.Stencil(*, loc: SourceLocation | None = None, name: str, api_signature: List[Argument], params: List[Decl], vertical_loops: List[VerticalLoop], externals: Dict[str, Literal], sources: Dict[str, str], docstring: str)[source]¶
Bases:
LocNode,ValidatedSymbolTableTrait- 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_loops: List[VerticalLoop]¶
- class gt4py.cartesian.gtc.gtir.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.gtir.TernaryOp(*, 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.gtir.UnaryOp(*, 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.gtir.VariableKOffset(*, 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.gtir.VerticalLoop(*, loc: SourceLocation | None = None, interval: Interval, loop_order: LoopOrder, temporaries: List[FieldDecl], body: List[Stmt])[source]¶
Bases:
LocNode- classmethod _no_write_and_read_with_horizontal_offset(instance: VerticalLoop) None[source]¶
In the same VerticalLoop a field must not be written and read with a horizontal offset.
Temporaries don’t have this constraint. Backends are required to implement them using block-private halos.
- classmethod _vertical_offset_in_parallel(instance: VerticalLoop) None[source]¶
In a parallel vertical loop we disallow writing and reading the same field with a non-zero offset.
To write and read with non-zero offset creates a race condition in parallel. There’s an exception for vertical loops with size one, e.g. interval(0, 1).
- 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.gtir.While(*, loc: SourceLocation | None = None, cond: Expr, body: List[Stmt])[source]¶
Bases:
While__Stmt_Expr,StmtWhile loop with a field or scalar expression as condition.
- _no_write_and_read_with_horizontal_offset_all(attribute: Attribute, value: List[Stmt]) None[source]¶
In a while loop all variables must not be written and read with a horizontal offset.
- 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.gtir_to_oir module¶
- class gt4py.cartesian.gtc.gtir_to_oir.GTIRToOIR[source]¶
Bases:
NodeTranslator- class Context(local_scalars: List[gt4py.cartesian.gtc.oir.ScalarDecl] = <factory>, temp_fields: List[gt4py.cartesian.gtc.oir.FieldDecl] = <factory>)[source]¶
Bases:
object- local_scalars: List[ScalarDecl]¶
- _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) AbsoluteKIndex[source]¶
- visit_FieldAccess(node: FieldAccess) FieldAccess[source]¶
- visit_FieldIfStmt(node: FieldIfStmt, *, ctx: Context, **kwargs: Any) List[AssignStmt | MaskStmt][source]¶
- visit_HorizontalRestriction(node: HorizontalRestriction, **kwargs: Any) HorizontalRestriction[source]¶
- visit_IteratorAccess(iterator_access: IteratorAccess) IteratorAccess[source]¶
- visit_NativeFuncCall(node: NativeFuncCall) NativeFuncCall[source]¶
- visit_ParAssignStmt(node: ParAssignStmt, **kwargs: Any) AssignStmt[source]¶
- visit_ScalarAccess(node: ScalarAccess) ScalarAccess[source]¶
- visit_ScalarDecl(node: ScalarDecl) ScalarDecl[source]¶
- visit_VariableKOffset(node: VariableKOffset) VariableKOffset[source]¶
- visit_VerticalLoop(node: VerticalLoop, *, ctx: Context) VerticalLoop[source]¶
- gt4py.cartesian.gtc.gtir_to_oir.validate_stencil_memory_accesses(node: Stencil) Stencil[source]¶
Check that no memory races occur in GridTools backends.
Since this is required for GridTools backends, it’s imposed on all backends at the OIR level. This is similar to the check at the gtir level for read-with-offset and writes, but more complete because it involves extent analysis, so it catches indirect read-with-offset through temporaries.
gt4py.cartesian.gtc.oir module¶
Optimizable Intermediate Representation (working title).
OIR represents a computation at the level of GridTools stages and multistages, e.g. stage merging, staged computations to compute-on-the-fly, cache annotations, etc.
- class gt4py.cartesian.gtc.oir.AbsoluteKIndex(*, k: int | Expr)[source]¶
Bases:
AbsoluteKIndex__ExprSee gtc.common.AbsoluteKIndex
- 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.oir.AssignStmt(*, loc: SourceLocation | None = None, right: Expr, left: ScalarAccess | FieldAccess)[source]¶
Bases:
AssignStmt__gt4py_cartesian_gtc_oir_scalaraccess_gt4py_cartesian_gtc_oir_fieldaccess_Expr,Stmt- left: ScalarAccess | FieldAccess¶
- no_horizontal_offset_in_assignment(attribute: Attribute, value: ScalarAccess | FieldAccess) None[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.oir.BinaryOp(*, loc: SourceLocation | None = None, kind: ExprKind = ExprKind.FIELD, dtype: DataType = DataType.AUTO, op: ArithmeticOperator | ComparisonOperator | LogicalOperator, left: Expr, right: Expr)[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.oir.CacheDesc(*, loc: SourceLocation | None = None, name: Any)[source]¶
Bases:
LocNode- 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.oir.Cast(*, 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.oir.CodeBlock(*, loc: SourceLocation | None = None, body: List[Stmt], label: str)[source]¶
Bases:
BlockStmt__Stmt,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.oir.Decl(*args: Any, **kwargs: Any)[source]¶
Bases:
LocNode- 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.oir.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.oir.FieldAccess(data_index: List[Expr] = NOTHING, *, loc: SourceLocation | None = None, dtype: DataType = DataType.AUTO, name: Any, kind: ExprKind = ExprKind.FIELD, offset: CartesianOffset | VariableKOffset | AbsoluteKIndex)[source]¶
Bases:
FieldAccess__Expr_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.oir.FieldDecl(data_dims: Tuple[Integral, ...] = NOTHING, *, loc: SourceLocation | None = None, name: Any, dtype: DataType, dimensions: Tuple[bool, bool, bool])[source]¶
Bases:
Decl- 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.oir.HorizontalExecution(*, loc: SourceLocation | None = None, body: List[Stmt], declarations: List[LocalScalar])[source]¶
Bases:
LocNode,SymbolTableTrait- declarations: List[LocalScalar]¶
- 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.oir.HorizontalRestriction(*, loc: SourceLocation | None = None, mask: HorizontalMask, body: List[Stmt])[source]¶
Bases:
HorizontalRestriction__Stmt,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.oir.IJCache(*, loc: SourceLocation | None = None, name: Any)[source]¶
Bases:
CacheDesc- 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.oir.Interval(*, loc: SourceLocation | None = None, start: BaseAxisBound, end: BaseAxisBound)[source]¶
Bases:
LocNode- end: BaseAxisBound¶
- has_runtime_access() bool[source]¶
Check if the interval contains runtime-accesses.
- Returns:
True if there are runtime bounds to the interval.
- Return type:
- start: BaseAxisBound¶
- 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.oir.IteratorAccess(*, loc: SourceLocation | None = None, kind: ExprKind = ExprKind.FIELD, dtype: DataType = DataType.AUTO, name: AxisName)[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.oir.KCache(*, loc: SourceLocation | None = None, name: Any, fill: bool, flush: bool)[source]¶
Bases:
CacheDesc- 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.oir.Literal(*, loc: SourceLocation | None = None, value: BuiltInLiteral | str, dtype: DataType, kind: ExprKind = ExprKind.SCALAR)[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.oir.LocalScalar(*, loc: SourceLocation | None = None, name: Any, dtype: DataType)[source]¶
Bases:
Decl- 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.oir.MaskStmt(*, loc: SourceLocation | None = None, mask: Expr, body: List[Stmt])[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.oir.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.oir.ScalarAccess(*, loc: SourceLocation | None = None, dtype: DataType = DataType.AUTO, name: Any, kind: ExprKind = ExprKind.SCALAR)[source]¶
Bases:
ScalarAccess,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.oir.ScalarDecl(*, loc: SourceLocation | None = None, name: Any, dtype: DataType)[source]¶
Bases:
Decl- 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.oir.Stencil(*, loc: SourceLocation | None = None, name: str, params: List[Decl], vertical_loops: List[VerticalLoop], declarations: List[Temporary])[source]¶
Bases:
LocNode,ValidatedSymbolTableTrait- 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_loops: List[VerticalLoop]¶
- class gt4py.cartesian.gtc.oir.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.oir.Temporary(data_dims: Tuple[Integral, ...] = NOTHING, *, loc: SourceLocation | None = None, name: Any, dtype: DataType, dimensions: Tuple[bool, bool, bool])[source]¶
Bases:
FieldDecl- 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.oir.TernaryOp(*, 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.oir.UnaryOp(*, 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.oir.UnboundedInterval[source]¶
Bases:
object- classmethod check(instance: UnboundedInterval) None[source]¶
- covers(other: Interval | UnboundedInterval) bool[source]¶
- intersects(other: Interval | UnboundedInterval) bool[source]¶
- shifted(offset: int | None) UnboundedInterval[source]¶
- class gt4py.cartesian.gtc.oir.VariableKOffset(*, 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.oir.VerticalLoop(caches: List[CacheDesc] = NOTHING, *, loc: SourceLocation | None = None, loop_order: LoopOrder, sections: List[VerticalLoopSection])[source]¶
Bases:
LocNode- sections: List[VerticalLoopSection]¶
- 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).
- classmethod valid_section_intervals(instance: VerticalLoop) None[source]¶
- class gt4py.cartesian.gtc.oir.VerticalLoopSection(*, loc: SourceLocation | None = None, interval: Interval, horizontal_executions: List[HorizontalExecution])[source]¶
Bases:
LocNode- horizontal_executions: List[HorizontalExecution]¶
- 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.oir.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.oir._check_interval(instance: Interval | UnboundedInterval) None[source]¶
gt4py.cartesian.gtc.ufuncs module¶
- gt4py.cartesian.gtc.ufuncs._round_away_from_zero(num)[source]¶
Computes the nearest integer value to num, rounding halfway cases away from zero.
- gt4py.cartesian.gtc.ufuncs.round_away_from_zero(num)¶
Computes the nearest integer value to num, rounding halfway cases away from zero.
- gt4py.cartesian.gtc.ufuncs.round_away_from_zero_(num)¶
Computes the nearest integer value to num, rounding halfway cases away from zero.
gt4py.cartesian.gtc.utils module¶
- gt4py.cartesian.gtc.utils.filter_mask(seq: Sequence[Any], mask: Sequence[bool]) Tuple[Any, ...][source]¶
Return a reduced-size tuple, with indices where mask[i]=False removed.
Example: >>> a = (1, 2, 3) >>> mask = (False, True, False) >>> filter_mask(a, mask) (2,)
- gt4py.cartesian.gtc.utils.interpolate_mask(seq: Sequence[Any], mask: Sequence[bool], default) Tuple[Any, ...][source]¶
Replace True values by those from the seq in the mask, else default.
Example: >>> default = 0 >>> a = (1, 2) >>> mask = (False, True, False, True) >>> interpolate_mask(a, mask, 0) (0, 1, 0, 2)