gt4py.cartesian.gtc.passes.oir_optimizations package

Submodules

gt4py.cartesian.gtc.passes.oir_optimizations.caches module

class gt4py.cartesian.gtc.passes.oir_optimizations.caches.FillFlushToLocalKCaches[source]

Bases: gt4py.eve.visitors.NodeTranslator, gt4py.eve.traits.VisitorWithSymbolTableTrait

Converts fill and flush k-caches to local k-caches.

For each cached field, the following actions are performed: 1. A new locally-k-cached temporary is introduced. 2. All accesses to the original field are replaced by accesses to this temporary. 3. Loop sections are split where necessary to allow single-level loads whereever possible. 3. Fill statements from the original field to the temporary are introduced. 4. Flush statements from the temporary to the original field are introduced.

static _fill_limits(loop_order: gt4py.cartesian.gtc.common.LoopOrder, section: gt4py.cartesian.gtc.oir.VerticalLoopSection) Dict[str, Tuple[int, int]][source]

Direction-normalized min and max read accesses for each accessed field.

Parameters
  • loop_order – forward or backward order.

  • section – loop section to split.

Returns

A dict, mapping field names to min and max read offsets relative to loop order (i.e., positive means in the direction of the loop order).

classmethod _fill_stmts(loop_order: gt4py.cartesian.gtc.common.LoopOrder, section: gt4py.cartesian.gtc.oir.VerticalLoopSection, filling_fields: Dict[str, str], first_unfilled: Dict[str, int], symtable: Dict[str, Any]) Tuple[List[gt4py.cartesian.gtc.oir.AssignStmt], Dict[str, int]][source]

Generate fill statements for the given loop section.

Parameters
  • loop_order – forward or backward order.

  • section – loop section to split.

  • filling_fields – mapping from field names to cache names.

  • first_unfilled – direction-normalized offset of the first unfilled cache entry for each field.

Returns

A list of fill statements and an updated first_unfilled map.

classmethod _flush_stmts(loop_order: gt4py.cartesian.gtc.common.LoopOrder, section: gt4py.cartesian.gtc.oir.VerticalLoopSection, flushing_fields: Dict[str, str], symtable: Dict[str, Any]) List[gt4py.cartesian.gtc.oir.AssignStmt][source]

Generate flush statements for the given loop section.

Parameters
  • loop_order – forward or backward order.

  • section – loop section to split.

  • flushing_fields – mapping from field names to cache names.

Returns

A list of flush statements.

static _requires_splitting(interval: gt4py.cartesian.gtc.oir.Interval) bool[source]

Check if an interval is larger than one level and thus may require splitting.

static _split_entry_level(loop_order: gt4py.cartesian.gtc.common.LoopOrder, section: gt4py.cartesian.gtc.oir.VerticalLoopSection, new_symbol_name: Callable[[str], str]) Tuple[gt4py.cartesian.gtc.oir.VerticalLoopSection, gt4py.cartesian.gtc.oir.VerticalLoopSection][source]

Split the entry level of a loop section.

Parameters
  • loop_order – forward or backward order.

  • section – loop section to split.

Returns

Two loop sections.

classmethod _split_section_with_multiple_fills(loop_order: gt4py.cartesian.gtc.common.LoopOrder, section: gt4py.cartesian.gtc.oir.VerticalLoopSection, filling_fields: Iterable[str], first_unfilled: Dict[str, int], new_symbol_name: Callable[[str], str]) Tuple[Tuple[gt4py.cartesian.gtc.oir.VerticalLoopSection, ...], Dict[str, int]][source]

Split loop sections that require multiple fills.

Parameters
  • loop_order – forward or backward order.

  • section – loop section to split.

  • filling_fields – fields that are using fill caches.

  • first_unfilled – direction-normalized offset of the first unfilled cache entry for each field.

Returns

A list of sections and an updated first_unfilled map.

visit_FieldAccess(node: gt4py.cartesian.gtc.oir.FieldAccess, *, name_map: Dict[str, str], **kwargs: Any) gt4py.cartesian.gtc.oir.FieldAccess[source]
visit_HorizontalExecution(node: gt4py.cartesian.gtc.oir.HorizontalExecution, *, name_map: Dict[str, str], fills: List[gt4py.cartesian.gtc.oir.Stmt], flushes: List[gt4py.cartesian.gtc.oir.Stmt], **kwargs: Any) gt4py.cartesian.gtc.oir.HorizontalExecution[source]
visit_Stencil(node: gt4py.cartesian.gtc.oir.Stencil, **kwargs: Any) gt4py.cartesian.gtc.oir.Stencil[source]
visit_VerticalLoop(node: gt4py.cartesian.gtc.oir.VerticalLoop, *, new_tmps: List[gt4py.cartesian.gtc.oir.Temporary], symtable: Dict[str, Any], new_symbol_name: Callable[[str], str], **kwargs: Any) gt4py.cartesian.gtc.oir.VerticalLoop[source]
visit_VerticalLoopSection(node: gt4py.cartesian.gtc.oir.VerticalLoopSection, **kwargs: Any) gt4py.cartesian.gtc.oir.VerticalLoopSection[source]
class gt4py.cartesian.gtc.passes.oir_optimizations.caches.IJCacheDetection[source]

Bases: gt4py.eve.visitors.NodeTranslator

visit_Stencil(node: gt4py.cartesian.gtc.oir.Stencil, **kwargs: Any) gt4py.cartesian.gtc.oir.Stencil[source]
visit_VerticalLoop(node: gt4py.cartesian.gtc.oir.VerticalLoop, *, local_tmps: Set[str], **kwargs: Any) gt4py.cartesian.gtc.oir.VerticalLoop[source]
class gt4py.cartesian.gtc.passes.oir_optimizations.caches.KCacheDetection(max_cacheable_offset: int = 5)[source]

Bases: gt4py.eve.visitors.NodeTranslator

max_cacheable_offset: int = 5
visit_VerticalLoop(node: gt4py.cartesian.gtc.oir.VerticalLoop, **kwargs: Any) gt4py.cartesian.gtc.oir.VerticalLoop[source]
class gt4py.cartesian.gtc.passes.oir_optimizations.caches.PruneKCacheFills[source]

Bases: gt4py.eve.visitors.NodeTranslator

Prunes unneeded k-cache fills.

A fill is classified as required if at least one of the two following conditions holds in any of the loop sections: * There is a read with offset in the direction of looping. * The first centered access is a read access. If none of the conditions holds for any loop section, the fill is considered as unneeded.

visit_KCache(node: gt4py.cartesian.gtc.oir.KCache, *, pruneable: Set[str], **kwargs: Any) gt4py.cartesian.gtc.oir.KCache[source]
visit_VerticalLoop(node: gt4py.cartesian.gtc.oir.VerticalLoop, **kwargs: Any) gt4py.cartesian.gtc.oir.VerticalLoop[source]
class gt4py.cartesian.gtc.passes.oir_optimizations.caches.PruneKCacheFlushes[source]

Bases: gt4py.eve.visitors.NodeTranslator

Prunes unneeded k-cache flushes.

A flush is classified as unneeded under the following conditions: * All accesses to the field are read-only in the current vertical loop. * There are no read accesses to the field in a following loop.

visit_KCache(node: gt4py.cartesian.gtc.oir.KCache, *, pruneable: Set[str], **kwargs: Any) gt4py.cartesian.gtc.oir.KCache[source]
visit_Stencil(node: gt4py.cartesian.gtc.oir.Stencil, **kwargs: Any) gt4py.cartesian.gtc.oir.Stencil[source]

gt4py.cartesian.gtc.passes.oir_optimizations.horizontal_execution_merging module

class gt4py.cartesian.gtc.passes.oir_optimizations.horizontal_execution_merging.HorizontalExecutionMerging[source]

Bases: gt4py.eve.visitors.NodeTranslator

visit_ScalarAccess(node: gt4py.cartesian.gtc.oir.ScalarAccess, *, scalar_map: Dict[str, str], **kwargs: Any) gt4py.cartesian.gtc.oir.ScalarAccess[source]
visit_Stencil(node: gt4py.cartesian.gtc.oir.Stencil, **kwargs: Any) gt4py.cartesian.gtc.oir.Stencil[source]
visit_VerticalLoopSection(node: gt4py.cartesian.gtc.oir.VerticalLoopSection, *, block_extents: Dict[int, gt4py.cartesian.gtc.definitions.Extent], new_symbol_name: Callable[[str], str], **kwargs: Any) gt4py.cartesian.gtc.oir.VerticalLoopSection[source]
class gt4py.cartesian.gtc.passes.oir_optimizations.horizontal_execution_merging.OnTheFlyMerging(max_horizontal_execution_body_size: int = 100, allow_expensive_function_duplication: bool = False)[source]

Bases: gt4py.eve.visitors.NodeTranslator, gt4py.eve.traits.VisitorWithSymbolTableTrait

Merges consecutive horizontal executions inside parallel vertical loops by introducing redundant computations.

Limitations: * Works on the level of whole horizontal executions, no full dependency analysis is performed (common subexpression and dead code eliminitation at a later stage can work around this limitation). * The chosen default merge limits are totally arbitrary.

_merge(horizontal_executions: List[gt4py.cartesian.gtc.oir.HorizontalExecution], symtable: Dict[str, Any], new_symbol_name: Callable[[str], str], protected_fields: Set[str]) List[gt4py.cartesian.gtc.oir.HorizontalExecution][source]

Recursively merge horizontal executions.

Uses the following algorithm: 1. Get output fields of the first horizontal execution. 2. Check in which following h. execs. the outputs are read. 3. Duplicate the body of the first h. exec. for each read access (with corresponding offset) and prepend it to the depending h. execs. 4. Recurse on the resulting h. execs.

allow_expensive_function_duplication: bool = False
max_horizontal_execution_body_size: int = 100
visit_CartesianOffset(node: gt4py.cartesian.gtc.common.CartesianOffset, *, shift: Optional[Tuple[int, int, int]] = None, **kwargs: Any) gt4py.cartesian.gtc.common.CartesianOffset[source]
visit_FieldAccess(node: gt4py.cartesian.gtc.oir.FieldAccess, *, offset_symbol_map: Optional[Dict[Tuple[str, Tuple[int, int, int]], str]] = None, **kwargs: Any) Union[gt4py.cartesian.gtc.oir.FieldAccess, gt4py.cartesian.gtc.oir.ScalarAccess][source]
visit_ScalarAccess(node: gt4py.cartesian.gtc.oir.ScalarAccess, *, scalar_map: Dict[str, str], **kwargs: Any) gt4py.cartesian.gtc.oir.ScalarAccess[source]
visit_Stencil(node: gt4py.cartesian.gtc.oir.Stencil, **kwargs: Any) gt4py.cartesian.gtc.oir.Stencil[source]
visit_VerticalLoop(node: gt4py.cartesian.gtc.oir.VerticalLoop, **kwargs: Any) gt4py.cartesian.gtc.oir.VerticalLoop[source]
visit_VerticalLoopSection(node: gt4py.cartesian.gtc.oir.VerticalLoopSection, **kwargs: Any) gt4py.cartesian.gtc.oir.VerticalLoopSection[source]

gt4py.cartesian.gtc.passes.oir_optimizations.inlining module

class gt4py.cartesian.gtc.passes.oir_optimizations.inlining.MaskCollector[source]

Bases: gt4py.eve.visitors.NodeVisitor

Collects the boolean expressions defining mask statements that are boolean fields.

visit_AssignStmt(node: gt4py.cartesian.gtc.oir.AssignStmt, *, masks_to_inline: Dict[str, gt4py.cartesian.gtc.oir.Expr]) None[source]
visit_MaskStmt(node: gt4py.cartesian.gtc.oir.MaskStmt, *, masks_to_inline: Dict[str, gt4py.cartesian.gtc.oir.Expr], **kwargs: Any) None[source]
visit_Stencil(node: gt4py.cartesian.gtc.oir.Stencil, **kwargs: Any) Dict[str, gt4py.cartesian.gtc.oir.Expr][source]
class gt4py.cartesian.gtc.passes.oir_optimizations.inlining.MaskInlining[source]

Bases: gt4py.eve.visitors.NodeTranslator

Inlines mask statements that are boolean mask fields with the expression that generates the field.

Preconditions: Mask statements exist as boolean temporary field accesses. Postcondition: Mask statements exist as boolean expressions.

visit_AssignStmt(node: gt4py.cartesian.gtc.oir.AssignStmt, *, masks_to_inline: Dict[str, gt4py.cartesian.gtc.oir.Expr], **kwargs: Any) Union[gt4py.cartesian.gtc.oir.AssignStmt, typing.Type[<class 'gt4py.eve.type_definitions.NOTHING'>]][source]
visit_CacheDesc(node: gt4py.cartesian.gtc.oir.CacheDesc, *, masks_to_inline, **kwargs)[source]
visit_FieldAccess(node: gt4py.cartesian.gtc.oir.FieldAccess, *, masks_to_inline: Dict[str, gt4py.cartesian.gtc.oir.Expr], **kwargs: Any) gt4py.cartesian.gtc.oir.Expr[source]
visit_Stencil(node: gt4py.cartesian.gtc.oir.Stencil, **kwargs)[source]
visit_Temporary(node: gt4py.cartesian.gtc.oir.Temporary, *, masks_to_inline, **kwargs)[source]

gt4py.cartesian.gtc.passes.oir_optimizations.mask_stmt_merging module

class gt4py.cartesian.gtc.passes.oir_optimizations.mask_stmt_merging.MaskStmtMerging[source]

Bases: gt4py.eve.visitors.NodeTranslator

visit_HorizontalExecution(node: gt4py.cartesian.gtc.oir.HorizontalExecution) gt4py.cartesian.gtc.oir.HorizontalExecution[source]
visit_MaskStmt(node: gt4py.cartesian.gtc.oir.MaskStmt) gt4py.cartesian.gtc.oir.MaskStmt[source]
visit_While(node: gt4py.cartesian.gtc.oir.While) gt4py.cartesian.gtc.oir.While[source]

gt4py.cartesian.gtc.passes.oir_optimizations.pruning module

class gt4py.cartesian.gtc.passes.oir_optimizations.pruning.NoFieldAccessPruning[source]

Bases: gt4py.eve.visitors.NodeTranslator

visit_HorizontalExecution(node: gt4py.cartesian.gtc.oir.HorizontalExecution) Any[source]
visit_Stencil(node: gt4py.cartesian.gtc.oir.Stencil, **kwargs)[source]
visit_VerticalLoop(node: gt4py.cartesian.gtc.oir.VerticalLoop) Any[source]
visit_VerticalLoopSection(node: gt4py.cartesian.gtc.oir.VerticalLoopSection) Any[source]
class gt4py.cartesian.gtc.passes.oir_optimizations.pruning.UnreachableStmtPruning[source]

Bases: gt4py.eve.visitors.NodeTranslator

visit_HorizontalExecution(node: gt4py.cartesian.gtc.oir.HorizontalExecution, *, block_extents: Dict[int, gt4py.cartesian.gtc.definitions.Extent]) gt4py.cartesian.gtc.oir.HorizontalExecution[source]
visit_HorizontalRestriction(node: gt4py.cartesian.gtc.oir.HorizontalRestriction, *, block_extent: gt4py.cartesian.gtc.definitions.Extent, **kwargs: Any) Any[source]
visit_Stencil(node: gt4py.cartesian.gtc.oir.Stencil) gt4py.cartesian.gtc.oir.Stencil[source]

gt4py.cartesian.gtc.passes.oir_optimizations.temporaries module

class gt4py.cartesian.gtc.passes.oir_optimizations.temporaries.LocalTemporariesToScalars[source]

Bases: gt4py.cartesian.gtc.passes.oir_optimizations.temporaries.TemporariesToScalarsBase

Replaces temporary fields accessed only within a single horizontal execution by scalars.

  1. Finds temporaries that are only accessed within a single HorizontalExecution.

  2. Replaces corresponding FieldAccess nodes by ScalarAccess nodes.

  3. Removes matching temporaries from VerticalLoop declarations.

  4. Add matching temporaries to HorizontalExecution declarations.

Note that temporaries used in horizontal regions in a single horizontal execution may not be scalarized.

visit_Stencil(node: gt4py.cartesian.gtc.oir.Stencil, **kwargs: Any) gt4py.cartesian.gtc.oir.Stencil[source]
class gt4py.cartesian.gtc.passes.oir_optimizations.temporaries.TemporariesToScalarsBase[source]

Bases: gt4py.eve.visitors.NodeTranslator, gt4py.eve.traits.VisitorWithSymbolTableTrait

visit_FieldAccess(node: gt4py.cartesian.gtc.oir.FieldAccess, *, tmps_name_map: Dict[str, str], **kwargs: Any) Union[gt4py.cartesian.gtc.oir.FieldAccess, gt4py.cartesian.gtc.oir.ScalarAccess][source]
visit_HorizontalExecution(node: gt4py.cartesian.gtc.oir.HorizontalExecution, tmps_to_replace: Set[str], symtable: Dict[str, Any], new_symbol_name: Callable[[str], str], **kwargs: Any) gt4py.cartesian.gtc.oir.HorizontalExecution[source]
visit_Stencil(node: gt4py.cartesian.gtc.oir.Stencil, **kwargs: Any) gt4py.cartesian.gtc.oir.Stencil[source]
visit_VerticalLoop(node: gt4py.cartesian.gtc.oir.VerticalLoop, tmps_to_replace: Set[str], **kwargs: Any) gt4py.cartesian.gtc.oir.VerticalLoop[source]
class gt4py.cartesian.gtc.passes.oir_optimizations.temporaries.WriteBeforeReadTemporariesToScalars[source]

Bases: gt4py.cartesian.gtc.passes.oir_optimizations.temporaries.TemporariesToScalarsBase

Replaces temporay fields that are always written before read by scalars.

Note that temporaries used in horizontal regions in a single horizontal execution may not be scalarized.

visit_Stencil(node: gt4py.cartesian.gtc.oir.Stencil, **kwargs: Any) gt4py.cartesian.gtc.oir.Stencil[source]

gt4py.cartesian.gtc.passes.oir_optimizations.utils module

class gt4py.cartesian.gtc.passes.oir_optimizations.utils.AccessCollector[source]

Bases: gt4py.eve.visitors.NodeVisitor

Collects all field accesses and corresponding offsets.

class CartesianAccessCollection(_ordered_accesses: List[gt4py.cartesian.gtc.passes.oir_optimizations.utils.AccessT])[source]

Bases: gt4py.cartesian.gtc.passes.oir_optimizations.utils.AccessCollector.GenericAccessCollection[gt4py.cartesian.gtc.passes.oir_optimizations.utils.CartesianAccess, Tuple[int, int, int]]

class GeneralAccessCollection(_ordered_accesses: List[gt4py.cartesian.gtc.passes.oir_optimizations.utils.AccessT])[source]

Bases: gt4py.cartesian.gtc.passes.oir_optimizations.utils.AccessCollector.GenericAccessCollection[gt4py.cartesian.gtc.passes.oir_optimizations.utils.GeneralAccess, Tuple[int, int, Optional[int]]]

cartesian_accesses() gt4py.cartesian.gtc.passes.oir_optimizations.utils.AccessCollector.CartesianAccessCollection[source]
has_variable_access() bool[source]
class GenericAccessCollection(_ordered_accesses: List[AccessT])[source]

Bases: Generic[gt4py.cartesian.gtc.passes.oir_optimizations.utils.AccessT, gt4py.cartesian.gtc.passes.oir_optimizations.utils.OffsetT]

fields() Set[str][source]

Get a set of all accessed fields’ names.

offsets() Dict[str, Set[gt4py.cartesian.gtc.passes.oir_optimizations.utils.OffsetT]][source]

Get a dictionary, mapping all accessed fields’ names to sets of offset tuples.

ordered_accesses() List[gt4py.cartesian.gtc.passes.oir_optimizations.utils.AccessT][source]

Get a list of ordered accesses.

read_accesses() List[gt4py.cartesian.gtc.passes.oir_optimizations.utils.AccessT][source]

Get the sub-list of read accesses.

read_fields() Set[str][source]

Get a set of all read fields’ names.

read_offsets() Dict[str, Set[gt4py.cartesian.gtc.passes.oir_optimizations.utils.OffsetT]][source]

Get a dictionary, mapping read fields’ names to sets of offset tuples.

write_accesses() List[gt4py.cartesian.gtc.passes.oir_optimizations.utils.AccessT][source]

Get the sub-list of write accesses.

write_fields() Set[str][source]

Get a set of all written fields’ names.

write_offsets() Dict[str, Set[gt4py.cartesian.gtc.passes.oir_optimizations.utils.OffsetT]][source]

Get a dictionary, mapping written fields’ names to sets of offset tuples.

classmethod apply(node: Union[gt4py.eve.concepts.NodeT, list[Union[NodeT, bool, bytes, int, float, str, enum.IntEnum, gt4py.eve.type_definitions.StrEnum]], dict[typing_extensions.Any, Union[NodeT, bool, bytes, int, float, str, enum.IntEnum, gt4py.eve.type_definitions.StrEnum]], set[Union[NodeT, bool, bytes, int, float, str, enum.IntEnum, gt4py.eve.type_definitions.StrEnum]]], **kwargs: Any) gt4py.cartesian.gtc.passes.oir_optimizations.utils.AccessCollector.GeneralAccessCollection[source]
visit_AssignStmt(node: gt4py.cartesian.gtc.oir.AssignStmt, **kwargs: Any) None[source]
visit_FieldAccess(node: gt4py.cartesian.gtc.oir.FieldAccess, *, accesses: List[gt4py.cartesian.gtc.passes.oir_optimizations.utils.GeneralAccess], is_write: bool, horizontal_mask: Optional[gt4py.cartesian.gtc.common.HorizontalMask] = None, **kwargs: Any) None[source]
visit_HorizontalRestriction(node: gt4py.cartesian.gtc.oir.HorizontalRestriction, **kwargs: Any) None[source]
visit_MaskStmt(node: gt4py.cartesian.gtc.oir.MaskStmt, **kwargs: Any) None[source]
visit_While(node: gt4py.cartesian.gtc.oir.While, **kwargs: Any) None[source]
class gt4py.cartesian.gtc.passes.oir_optimizations.utils.CartesianAccess(field: str, offset: gt4py.cartesian.gtc.passes.oir_optimizations.utils.OffsetT, is_write: bool, data_index: typing.List[gt4py.cartesian.gtc.oir.Expr] = <factory>, horizontal_mask: typing.Optional[gt4py.cartesian.gtc.common.HorizontalMask] = None)[source]

Bases: gt4py.cartesian.gtc.passes.oir_optimizations.utils.GenericAccess[Tuple[int, int, int]]

data_index: List[gt4py.cartesian.gtc.oir.Expr]
field: str
is_write: bool
offset: gt4py.cartesian.gtc.passes.oir_optimizations.utils.OffsetT
class gt4py.cartesian.gtc.passes.oir_optimizations.utils.GeneralAccess(field: str, offset: gt4py.cartesian.gtc.passes.oir_optimizations.utils.OffsetT, is_write: bool, data_index: typing.List[gt4py.cartesian.gtc.oir.Expr] = <factory>, horizontal_mask: typing.Optional[gt4py.cartesian.gtc.common.HorizontalMask] = None)[source]

Bases: gt4py.cartesian.gtc.passes.oir_optimizations.utils.GenericAccess[Tuple[int, int, Optional[int]]]

data_index: List[gt4py.cartesian.gtc.oir.Expr]
field: str
is_write: bool
offset: gt4py.cartesian.gtc.passes.oir_optimizations.utils.OffsetT
class gt4py.cartesian.gtc.passes.oir_optimizations.utils.GenericAccess(field: str, offset: ~OffsetT, is_write: bool, data_index: List[gt4py.cartesian.gtc.oir.Expr] = <factory>, horizontal_mask: Optional[gt4py.cartesian.gtc.common.HorizontalMask] = None)[source]

Bases: Generic[gt4py.cartesian.gtc.passes.oir_optimizations.utils.OffsetT]

data_index: List[gt4py.cartesian.gtc.oir.Expr]
field: str
horizontal_mask: Optional[gt4py.cartesian.gtc.common.HorizontalMask] = None
property is_read: bool
is_write: bool
offset: gt4py.cartesian.gtc.passes.oir_optimizations.utils.OffsetT
to_extent(horizontal_extent: gt4py.cartesian.gtc.definitions.Extent) Optional[gt4py.cartesian.gtc.definitions.Extent][source]

Convert the access to an extent provided a horizontal extent for the access.

This returns None if no overlap exists between the horizontal mask and interval.

class gt4py.cartesian.gtc.passes.oir_optimizations.utils.StencilExtentComputer(add_k: bool = False)[source]

Bases: gt4py.eve.visitors.NodeVisitor

class Context(fields: Dict[str, gt4py.cartesian.gtc.definitions.Extent] = <factory>, blocks: Dict[int, gt4py.cartesian.gtc.definitions.Extent] = <factory>)[source]

Bases: object

blocks: Dict[int, gt4py.cartesian.gtc.definitions.Extent]
fields: Dict[str, gt4py.cartesian.gtc.definitions.Extent]
visit_HorizontalExecution(node: gt4py.cartesian.gtc.oir.HorizontalExecution, *, ctx: gt4py.cartesian.gtc.passes.oir_optimizations.utils.StencilExtentComputer.Context) None[source]
visit_Stencil(node: gt4py.cartesian.gtc.oir.Stencil) Context[source]
visit_VerticalLoopSection(node: gt4py.cartesian.gtc.oir.VerticalLoopSection, **kwargs: Any) None[source]
gt4py.cartesian.gtc.passes.oir_optimizations.utils.collect_symbol_names(node: Union[gt4py.eve.concepts.NodeT, list[Union[NodeT, bool, bytes, int, float, str, enum.IntEnum, gt4py.eve.type_definitions.StrEnum]], dict[typing_extensions.Any, Union[NodeT, bool, bytes, int, float, str, enum.IntEnum, gt4py.eve.type_definitions.StrEnum]], set[Union[NodeT, bool, bytes, int, float, str, enum.IntEnum, gt4py.eve.type_definitions.StrEnum]]]) Set[str][source]
gt4py.cartesian.gtc.passes.oir_optimizations.utils.compute_extents(node: gt4py.cartesian.gtc.oir.Stencil, **kwargs: Any) Tuple[Dict[str, gt4py.cartesian.gtc.definitions.Extent], Dict[int, gt4py.cartesian.gtc.definitions.Extent]][source]
gt4py.cartesian.gtc.passes.oir_optimizations.utils.compute_fields_extents(node: gt4py.cartesian.gtc.oir.Stencil, **kwargs: Any) Dict[str, gt4py.cartesian.gtc.definitions.Extent][source]
gt4py.cartesian.gtc.passes.oir_optimizations.utils.compute_horizontal_block_extents(node: gt4py.cartesian.gtc.oir.Stencil, **kwargs: Any) Dict[int, gt4py.cartesian.gtc.definitions.Extent][source]
gt4py.cartesian.gtc.passes.oir_optimizations.utils.symbol_name_creator(used_names: Set[str]) Callable[[str], str][source]

Create a function that generates symbol names that are not already in use.

Parameters

used_names – Symbol names that are already in use and thus should not be generated. NOTE: used_names will be modified to contain all generated symbols.

Returns

A callable to generate new unique symbol names.

gt4py.cartesian.gtc.passes.oir_optimizations.vertical_loop_merging module

class gt4py.cartesian.gtc.passes.oir_optimizations.vertical_loop_merging.AdjacentLoopMerging[source]

Bases: gt4py.eve.visitors.NodeTranslator

visit_Stencil(node: gt4py.cartesian.gtc.oir.Stencil, **kwargs: Any) gt4py.cartesian.gtc.oir.Stencil[source]

Module contents