gt4py.cartesian.gtc.dace package
Subpackages
Submodules
gt4py.cartesian.gtc.dace.expansion_specification module
- class gt4py.cartesian.gtc.dace.expansion_specification.Iteration(axis: gt4py.cartesian.gtc.daceir.Axis, kind: str, stride: Optional[int] = None)[source]
Bases:
object
- property iterations: List[gt4py.cartesian.gtc.dace.expansion_specification.Iteration]
- class gt4py.cartesian.gtc.dace.expansion_specification.Loop(axis: gt4py.cartesian.gtc.daceir.Axis, kind: str = 'contiguous', stride: Optional[int] = None, storage: dace.dtypes.StorageType = None)[source]
Bases:
gt4py.cartesian.gtc.dace.expansion_specification.Iteration
,gt4py.cartesian.gtc.dace.expansion_specification.ExpansionItem
- property iterations: List[gt4py.cartesian.gtc.dace.expansion_specification.Iteration]
- storage: dace.dtypes.StorageType = None
- class gt4py.cartesian.gtc.dace.expansion_specification.Map(iterations: List[gt4py.cartesian.gtc.dace.expansion_specification.Iteration], schedule: Optional[dace.dtypes.ScheduleType] = None)[source]
Bases:
gt4py.cartesian.gtc.dace.expansion_specification.ExpansionItem
- iterations: List[gt4py.cartesian.gtc.dace.expansion_specification.Iteration]
- schedule: Optional[dace.dtypes.ScheduleType] = None
- class gt4py.cartesian.gtc.dace.expansion_specification.Sections[source]
Bases:
gt4py.cartesian.gtc.dace.expansion_specification.ExpansionItem
- class gt4py.cartesian.gtc.dace.expansion_specification.Stages[source]
Bases:
gt4py.cartesian.gtc.dace.expansion_specification.ExpansionItem
- gt4py.cartesian.gtc.dace.expansion_specification._populate_strides(node, expansion_specification)[source]
Fill in stride attribute of Iteration and Loop dataclasses.
For loops, stride is set to either -1 or 1, based on iteration order. For tiling maps, the stride is chosen such that the resulting tile size is that of the tile_size attribute. Other maps get stride 1.
- gt4py.cartesian.gtc.dace.expansion_specification.get_expansion_order_index(expansion_order, axis)[source]
- gt4py.cartesian.gtc.dace.expansion_specification.is_expansion_order_valid(node: StencilComputation, expansion_order) bool [source]
Check if a given expansion specification valid.
That is, it is semantically valid for the StencilComputation node that is to be configured and currently implemented.
- gt4py.cartesian.gtc.dace.expansion_specification.make_expansion_order(node: StencilComputation, expansion_order: Union[List[str], List[gt4py.cartesian.gtc.dace.expansion_specification.ExpansionItem]]) List[gt4py.cartesian.gtc.dace.expansion_specification.ExpansionItem] [source]
gt4py.cartesian.gtc.dace.nodes module
- class gt4py.cartesian.gtc.dace.nodes.PickledDataclassProperty(getter=None, setter=None, dtype: typing.Optional[typing.Type[dace.properties.T]] = None, default=None, from_string=None, to_string=None, from_json=None, to_json=None, meta_to_json=None, choices=None, unmapped=False, allow_none=False, indirected=False, category='General', desc='', optional=False, optional_condition=<function Property.<lambda>>)[source]
Bases:
gt4py.cartesian.gtc.dace.nodes.PickledProperty
,dace.properties.DataclassProperty
- class gt4py.cartesian.gtc.dace.nodes.PickledDictProperty(key_type, value_type, *args, **kwargs)[source]
Bases:
gt4py.cartesian.gtc.dace.nodes.PickledProperty
,dace.properties.DictProperty
- class gt4py.cartesian.gtc.dace.nodes.PickledListProperty(element_type: dace.properties.T, *args, **kwargs)[source]
Bases:
gt4py.cartesian.gtc.dace.nodes.PickledProperty
,dace.properties.ListProperty
- class gt4py.cartesian.gtc.dace.nodes.StencilComputation(*args, **kwargs)[source]
Bases:
dace.sdfg.nodes.LibraryNode
- access_infos
Object property of type dict
- declarations
Object property of type dict
- default_implementation = 'default'
- device
Object property of type DeviceType
- expansion_specification
Object property of type list
- extents
Object property of type dict
- property field_decls: Dict[str, gt4py.cartesian.gtc.oir.FieldDecl]
- implementations: Dict[str, dace.transformation.transformation.ExpandTransformation] = {'default': <class 'gt4py.cartesian.gtc.dace.expansion.expansion.StencilComputationExpansion'>}
- oir_node
Object property of type VerticalLoop
- properties()
- symbol_mapping
Object property of type dict
- tile_sizes
Object property of type dict
- tile_sizes_interpretation
Object property of type str
- property tile_strides
gt4py.cartesian.gtc.dace.oir_to_dace module
- class gt4py.cartesian.gtc.dace.oir_to_dace.OirSDFGBuilder[source]
Bases:
gt4py.eve.visitors.NodeVisitor
- class SDFGContext(stencil: gt4py.cartesian.gtc.oir.Stencil)[source]
Bases:
object
- access_infos: Dict[str, gt4py.cartesian.gtc.daceir.FieldAccessInfo]
- block_extents: Dict[int, gt4py.cartesian.gtc.definitions.Extent]
- decls: Dict[str, gt4py.cartesian.gtc.oir.Decl]
- last_state: dace.sdfg.state.SDFGState
- sdfg: dace.sdfg.sdfg.SDFG
- visit_Stencil(node: gt4py.cartesian.gtc.oir.Stencil, **kwargs)[source]
- visit_VerticalLoop(node: gt4py.cartesian.gtc.oir.VerticalLoop, *, ctx: gt4py.cartesian.gtc.dace.oir_to_dace.OirSDFGBuilder.SDFGContext, **kwargs)[source]
gt4py.cartesian.gtc.dace.symbol_utils module
- gt4py.cartesian.gtc.dace.symbol_utils.get_axis_bound_dace_symbol(axis_bound: dcir.AxisBound)[source]
- gt4py.cartesian.gtc.dace.symbol_utils.get_axis_bound_diff_str(axis_bound1, axis_bound2, var_name: str)[source]
- gt4py.cartesian.gtc.dace.symbol_utils.get_dace_symbol(name: gt4py.eve.concepts.SymbolRef, dtype: gt4py.cartesian.gtc.common.DataType = DataType.INT32)[source]
gt4py.cartesian.gtc.dace.transformations module
- class gt4py.cartesian.gtc.dace.transformations.InlineThreadLocalTransients(*args, **kwargs)[source]
Bases:
dace.transformation.transformation.SingleStateTransformation
Inline and tile thread-local transients.
Inlines transients like dace.transformations.interstate.InlineTransients, however only applies to OpenMP map scopes but also makes the resulting local arrays persistent and thread-local. This reproduces cpu_kfirst-style transient tiling.
- apply(graph, sdfg)[source]
Applies this transformation instance on the matched pattern graph. :param sdfg: The SDFG to apply the transformation to. :return: A transformation-defined return value, which could be used
to pass analysis data out, or nothing.
- can_be_applied(graph, expr_index, sdfg, permissive=False)[source]
Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.- Parameters
expr_index – The list index from
PatternTransformation.expressions
that was matched.sdfg – The parent SDFG of the matched state.
permissive – Whether transformation should run in permissive mode.
- Returns
True if the transformation can be applied.
- classmethod expressions()[source]
Returns a list of SDFG state subgraphs that will be matched in the subgraph isomorphism phase. Used as a pre-pass before calling
can_be_applied
.
- map_entry
Static field wrapper of a node or an SDFG state that designates it as part of a subgraph pattern. These objects are used in subclasses of
PatternTransformation
to represent the subgraph patterns.Example use: ``` class MyTransformation(SingleStateTransformation):
some_map_node = PatternNode(nodes.MapEntry) array = PatternNode(nodes.AccessNode)
The two nodes can then be used in the transformation static methods (e.g.,
expressions
,can_be_applied
) to represent the nodes, and in the instance methods to point to the nodes in the parent SDFG.
- class gt4py.cartesian.gtc.dace.transformations.NoEmptyEdgeTrivialMapElimination(*args, **kwargs)[source]
Bases:
dace.transformation.dataflow.trivial_map_elimination.TrivialMapElimination
Eliminate trivial maps like TrivialMapElimination, with additional conditions in can_be_applied.
- can_be_applied(graph, expr_index, sdfg, permissive=False)[source]
Returns True if this transformation can be applied on the candidate matched subgraph. :param graph: SDFGState object in which the match was found. :param candidate: A mapping between node IDs returned from
PatternTransformation.expressions
and the nodes ingraph
.- Parameters
expr_index – The list index from
PatternTransformation.expressions
that was matched.sdfg – The parent SDFG of the matched state.
permissive – Whether transformation should run in permissive mode.
- Returns
True if the transformation can be applied.
- gt4py.cartesian.gtc.dace.transformations.nest_sequential_map_scopes(sdfg: dace.sdfg.sdfg.SDFG)[source]
Nest map scopes of sequential maps.
Nest scope subgraphs of sequential maps in NestedSDFG’s to force eagerly offsetting pointers on each iteration, to avoid more complex pointer arithmetic on each Tasklet’s invocation. This is performed in an inner-map-first order to avoid revisiting the graph after changes.
gt4py.cartesian.gtc.dace.utils module
- class gt4py.cartesian.gtc.dace.utils.AccessInfoCollector(collect_read: bool, collect_write: bool, include_full_domain: bool = False)[source]
Bases:
gt4py.eve.visitors.NodeVisitor
- class Context(axes: Dict[str, List[ForwardRef('dcir.Axis')]], access_infos: Dict[str, ForwardRef('dcir.FieldAccessInfo')] = <factory>)[source]
Bases:
object
- access_infos: Dict[str, gt4py.cartesian.gtc.daceir.FieldAccessInfo]
- axes: Dict[str, List[gt4py.cartesian.gtc.daceir.Axis]]
- visit_AssignStmt(node: gt4py.cartesian.gtc.oir.AssignStmt, **kwargs)[source]
- visit_FieldAccess(node: gt4py.cartesian.gtc.oir.FieldAccess, *, he_grid, grid_subset, is_write: bool = False, is_conditional: bool = False, region=None, ctx: gt4py.cartesian.gtc.dace.utils.AccessInfoCollector.Context, **kwargs)[source]
- visit_HorizontalExecution(node: gt4py.cartesian.gtc.oir.HorizontalExecution, *, block_extents, ctx: gt4py.cartesian.gtc.dace.utils.AccessInfoCollector.Context, k_interval, grid_subset=None, **kwargs) Dict[str, gt4py.cartesian.gtc.daceir.FieldAccessInfo] [source]
- visit_HorizontalRestriction(node: gt4py.cartesian.gtc.oir.HorizontalRestriction, *, is_conditional=False, **kwargs)[source]
- visit_MaskStmt(node: gt4py.cartesian.gtc.oir.MaskStmt, *, is_conditional=False, **kwargs)[source]
- visit_VerticalLoop(node: gt4py.cartesian.gtc.oir.VerticalLoop, *, block_extents, ctx, **kwargs: Any) Dict[str, gt4py.cartesian.gtc.daceir.FieldAccessInfo] [source]
- visit_VerticalLoopSection(node: gt4py.cartesian.gtc.oir.VerticalLoopSection, *, block_extents, ctx, grid_subset=None, **kwargs: Any) Dict[str, gt4py.cartesian.gtc.daceir.FieldAccessInfo] [source]
- visit_While(node: gt4py.cartesian.gtc.oir.While, *, is_conditional=False, **kwargs)[source]
- gt4py.cartesian.gtc.dace.utils.collect_toplevel_computation_nodes(list_or_node: Union[List[Any], gt4py.eve.concepts.Node]) List[gt4py.cartesian.gtc.daceir.ComputationNode] [source]
- gt4py.cartesian.gtc.dace.utils.collect_toplevel_iteration_nodes(list_or_node: Union[List[Any], gt4py.eve.concepts.Node]) List[gt4py.cartesian.gtc.daceir.IterationNode] [source]
- gt4py.cartesian.gtc.dace.utils.compute_dcir_access_infos(oir_node, *, oir_decls=None, block_extents=None, collect_read=True, collect_write=True, include_full_domain=False, **kwargs) dace.properties.DictProperty [source]
- gt4py.cartesian.gtc.dace.utils.flatten_list(list_or_node: Union[List[Any], gt4py.eve.concepts.Node])[source]
- gt4py.cartesian.gtc.dace.utils.make_dace_subset(context_info: gt4py.cartesian.gtc.daceir.FieldAccessInfo, access_info: gt4py.cartesian.gtc.daceir.FieldAccessInfo, data_dims: Tuple[int, ...]) dace.subsets.Range [source]
- gt4py.cartesian.gtc.dace.utils.union_inout_memlets(nodes: List[gt4py.eve.concepts.Node])[source]
- gt4py.cartesian.gtc.dace.utils.union_node_grid_subsets(nodes: List[gt4py.eve.concepts.Node])[source]
- gt4py.cartesian.gtc.dace.utils.untile_memlets(memlets: Sequence[gt4py.cartesian.gtc.daceir.Memlet], axes: Sequence[gt4py.cartesian.gtc.daceir.Axis]) List[gt4py.cartesian.gtc.daceir.Memlet] [source]