accelforge.frontend.mapping package#
Submodules#
accelforge.frontend.mapping.mapping module#
A module containing the visualization and types needed to run mapspace exploratioon in AccelForge.
- class accelforge.frontend.mapping.mapping.Compute[source]#
Bases:
MappingNodeA node that represents a compute operation. These nodes are the leaves of the LoopTree.
- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- class accelforge.frontend.mapping.mapping.Loop[source]#
Bases:
MappingNodeA bounded loop over a rank variable with a given shape and/or pattern.
Do not instantiate directly; inherited by
TemporalandSpatial.- __init__(*args, **kwargs)#
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- initial_tile_shape: EvalsTo[Symbol | Expr | int | str | None] = None#
The shape of the first tile shape. This attribute is optional. If not specified, all tiles have the same shape.
If specified, the initial tile shape may differ. For example, an initial tile shape of 3 and tile shape of 2 creates the following tiles in the iteration space: [0, 1, 2], [3, 4], [5, 6], …
Similarly to tile shape, this value should be an integer when writing a YAML input.
For those developing the mapper, this attribute can be a string. See tile_shape for details.
- rank_variable: set[str] | str#
The rank variable(s) iterated over in this loop. This may be a single rank variable, or a set of rank variables if the loop is shared between multiple Einsums.
NOTE FOR DEVELOPERS: If the rank variable is a set DURING PMAPPIN GENERATION, then it means that the loop is a placeholder for multiple loops in the given Einsum. They will be split into multiple loops later. If the rank variable
- property tile_pattern: TilePattern#
- tile_shape: EvalsTo[Symbol | Expr | int | str] = 'symbol'#
The (common) tile shape of the iteration. For example, if the iteration space is range(6) and the tile shape is 3, then we create and iterate over two tiles [0, 1, 2] and [3, 4, 5].
This attribute specifies the common tile shape because initial_tile_shape may be specified.
For users writing YAML, the value should be an integer.
For those developing the mapper, the literal string “symbol” is often used to tell the model to create a sympy symbol to use as the tile shape. Any other string may be specified to explicitly request a variable name (later converted to a sympy variable).
- class accelforge.frontend.mapping.mapping.Mapping[source]#
Bases:
NestedA Mapping of a workload onto a hardware architecture.
- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- class accelforge.frontend.mapping.mapping.MappingNode[source]#
Bases:
EvalableModelRepresents a Node in the Mapping, which can be a loop, a storage node, a compute node, etc.
- __init__(*args, **kwargs)#
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- accelforge.frontend.mapping.mapping.MappingNodeTypes#
The types of MappingNodes possible.
- Type:
TypeAlias MappingNodeTypes
alias of
Temporal|Spatial|Storage|Pipeline|Sequential|Compute|Reservation|TensorHolder
- class accelforge.frontend.mapping.mapping.MappingNodeWithChildren[source]#
Bases:
MappingNodeA
MappingNodethat also has child nodes.- clear_nodes_of_type(types)[source]#
Clears all child nodes that match the given type(s).
- Return type:
- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- nodes: EvalableList[Annotated[Annotated[Split, Tag(tag=Split)] | Annotated[Compute, Tag(tag=Compute)] | Annotated[Storage, Tag(tag=Storage)] | Annotated[Temporal, Tag(tag=Temporal)] | Annotated[Spatial, Tag(tag=Spatial)] | Annotated[Sequential, Tag(tag=Sequential)] | Annotated[Pipeline, Tag(tag=Pipeline)] | Annotated[Nested, Tag(tag=Nested)] | Annotated[Reservation, Tag(tag=Reservation)] | Annotated[Mapping, Tag(tag=Mapping)] | Annotated[Toll, Tag(tag=Toll)], Discriminator(discriminator=_get_tag, custom_error_type=None, custom_error_message=None, custom_error_context=None)]] = []#
The child nodes.
- class accelforge.frontend.mapping.mapping.Nested[source]#
Bases:
MappingNodeWithChildrenA
MappingNodeWithChildrenthat represents a nested set of nodes. Each node is the parent of the next node.- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- accelforge.frontend.mapping.mapping.NodeList#
EvalableList that can contain and discriminate between MappingNodes of different types.
- Type:
TypeAlias NodeList
alias of
EvalableList[Annotated[Annotated[Split,Tag(tag=Split)] |Annotated[Compute,Tag(tag=Compute)] |Annotated[Storage,Tag(tag=Storage)] |Annotated[Temporal,Tag(tag=Temporal)] |Annotated[Spatial,Tag(tag=Spatial)] |Annotated[Sequential,Tag(tag=Sequential)] |Annotated[Pipeline,Tag(tag=Pipeline)] |Annotated[Nested,Tag(tag=Nested)] |Annotated[Reservation,Tag(tag=Reservation)] |Annotated[Mapping,Tag(tag=Mapping)] |Annotated[Toll,Tag(tag=Toll)],Discriminator(discriminator=_get_tag, custom_error_type=None, custom_error_message=None, custom_error_context=None)]]
- class accelforge.frontend.mapping.mapping.Pipeline[source]#
Bases:
SplitA
Splitwhere each branch operates at the same time in different spatially-organized hardware.- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- class accelforge.frontend.mapping.mapping.Reservation[source]#
Bases:
MappingNodeA node that reserves a hardware resource for a specific task.
- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- class accelforge.frontend.mapping.mapping.Sequential[source]#
Bases:
SplitA
Splitwhere branches are processed one-after-another.- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- class accelforge.frontend.mapping.mapping.Spatial[source]#
Bases:
LoopA spatial
Loop.- component_object: NoParse[ArchNode] = None#
The component object across which different spatial iterations occur.
- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- property tile_pattern: TilePattern#
- class accelforge.frontend.mapping.mapping.Split[source]#
Bases:
MappingNodeWithChildrenA
MappingNodeWithChildrenthat splits the tree into multiple branches, each applying to different Einsums.- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- class accelforge.frontend.mapping.mapping.Storage[source]#
Bases:
TensorHolderA Storage
TensorHolderthat can hold tensors for reuse.- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- class accelforge.frontend.mapping.mapping.T#
TypeVar T: Restricts the allowable types to types of MappingNodes.
alias of TypeVar(‘T’, bound=
MappingNode)
- class accelforge.frontend.mapping.mapping.Temporal[source]#
Bases:
LoopA Temporal
Loop.- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- property tile_pattern: TilePattern#
- class accelforge.frontend.mapping.mapping.TensorHolder[source]#
Bases:
MappingNodeA node that represents a hardware Component holding a set of tensors.
- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- persistent: bool = False#
Whether this tensor holder is persistent. Persistent tensors can’t be tiled and must be kept in backing storage for the full duration of the workload’s execution.
- class accelforge.frontend.mapping.mapping.TilePattern[source]#
Bases:
objectTilePattern(tile_shape: accelforge.util._basetypes.EvalsTo[typing.Union[typing.Literal[‘symbol’], sympy.core.symbol.Symbol, int, str, NoneType, sympy.core.expr.Expr]] = ‘symbol’, initial_tile_shape: accelforge.util._basetypes.EvalsTo[typing.Union[typing.Literal[‘symbol’], sympy.core.symbol.Symbol, int, str, NoneType, sympy.core.expr.Expr]] = ‘symbol’, calculated_n_iterations: Union[Literal[‘symbol’], sympy.core.symbol.Symbol, int, str, NoneType, sympy.core.expr.Expr] = None)
- __init__(tile_shape='symbol', initial_tile_shape='symbol', calculated_n_iterations=None)#
- calculated_n_iterations: Literal['symbol'] | Symbol | int | str | None | Expr = None#
The number of iterations in the pattern. Do not set this! Used internally by the mapper.
- initial_tile_shape: EvalsTo[Literal['symbol'] | Symbol | int | str | None | Expr] = 'symbol'#
The initial tile shape. This is the shape of the tile at the first iteration. Subsequent iterations may be smaller if they overlap previous iterations.
- tile_shape: EvalsTo[Literal['symbol'] | Symbol | int | str | None | Expr] = 'symbol'#
The common tile shape of the pattern. This is the number of indices by which the tile moves each iteration.
- class accelforge.frontend.mapping.mapping.Toll[source]#
Bases:
TensorHolderA Toll
TensorHolderthat acts as a pass-through, where data is not reused but incurs accesses into this Toll.- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
Module contents#
- class accelforge.frontend.mapping.Compute[source]#
Bases:
MappingNodeA node that represents a compute operation. These nodes are the leaves of the LoopTree.
- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- class accelforge.frontend.mapping.Loop[source]#
Bases:
MappingNodeA bounded loop over a rank variable with a given shape and/or pattern.
Do not instantiate directly; inherited by
TemporalandSpatial.- __init__(*args, **kwargs)#
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- initial_tile_shape: EvalsTo[Symbol | Expr | int | str | None] = None#
The shape of the first tile shape. This attribute is optional. If not specified, all tiles have the same shape.
If specified, the initial tile shape may differ. For example, an initial tile shape of 3 and tile shape of 2 creates the following tiles in the iteration space: [0, 1, 2], [3, 4], [5, 6], …
Similarly to tile shape, this value should be an integer when writing a YAML input.
For those developing the mapper, this attribute can be a string. See tile_shape for details.
- rank_variable: set[str] | str#
The rank variable(s) iterated over in this loop. This may be a single rank variable, or a set of rank variables if the loop is shared between multiple Einsums.
NOTE FOR DEVELOPERS: If the rank variable is a set DURING PMAPPIN GENERATION, then it means that the loop is a placeholder for multiple loops in the given Einsum. They will be split into multiple loops later. If the rank variable
- property tile_pattern: TilePattern#
- tile_shape: EvalsTo[Symbol | Expr | int | str] = 'symbol'#
The (common) tile shape of the iteration. For example, if the iteration space is range(6) and the tile shape is 3, then we create and iterate over two tiles [0, 1, 2] and [3, 4, 5].
This attribute specifies the common tile shape because initial_tile_shape may be specified.
For users writing YAML, the value should be an integer.
For those developing the mapper, the literal string “symbol” is often used to tell the model to create a sympy symbol to use as the tile shape. Any other string may be specified to explicitly request a variable name (later converted to a sympy variable).
- class accelforge.frontend.mapping.Mapping[source]#
Bases:
NestedA Mapping of a workload onto a hardware architecture.
- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- class accelforge.frontend.mapping.MappingNode[source]#
Bases:
EvalableModelRepresents a Node in the Mapping, which can be a loop, a storage node, a compute node, etc.
- __init__(*args, **kwargs)#
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- class accelforge.frontend.mapping.MappingNodeWithChildren[source]#
Bases:
MappingNodeA
MappingNodethat also has child nodes.- clear_nodes_of_type(types)[source]#
Clears all child nodes that match the given type(s).
- Return type:
- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- nodes: EvalableList[Annotated[Annotated[Split, Tag(tag=Split)] | Annotated[Compute, Tag(tag=Compute)] | Annotated[Storage, Tag(tag=Storage)] | Annotated[Temporal, Tag(tag=Temporal)] | Annotated[Spatial, Tag(tag=Spatial)] | Annotated[Sequential, Tag(tag=Sequential)] | Annotated[Pipeline, Tag(tag=Pipeline)] | Annotated[Nested, Tag(tag=Nested)] | Annotated[Reservation, Tag(tag=Reservation)] | Annotated[Mapping, Tag(tag=Mapping)] | Annotated[Toll, Tag(tag=Toll)], Discriminator(discriminator=_get_tag, custom_error_type=None, custom_error_message=None, custom_error_context=None)]] = []#
The child nodes.
- class accelforge.frontend.mapping.Nested[source]#
Bases:
MappingNodeWithChildrenA
MappingNodeWithChildrenthat represents a nested set of nodes. Each node is the parent of the next node.- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- class accelforge.frontend.mapping.Pipeline[source]#
Bases:
SplitA
Splitwhere each branch operates at the same time in different spatially-organized hardware.- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- class accelforge.frontend.mapping.Reservation[source]#
Bases:
MappingNodeA node that reserves a hardware resource for a specific task.
- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- class accelforge.frontend.mapping.Sequential[source]#
Bases:
SplitA
Splitwhere branches are processed one-after-another.- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- class accelforge.frontend.mapping.Spatial[source]#
Bases:
LoopA spatial
Loop.- component_object: NoParse[ArchNode] = None#
The component object across which different spatial iterations occur.
- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- initial_tile_shape: EvalsTo[sympy.Symbol | sympy.Expr | int | str | None] = None#
The shape of the first tile shape. This attribute is optional. If not specified, all tiles have the same shape.
If specified, the initial tile shape may differ. For example, an initial tile shape of 3 and tile shape of 2 creates the following tiles in the iteration space: [0, 1, 2], [3, 4], [5, 6], …
Similarly to tile shape, this value should be an integer when writing a YAML input.
For those developing the mapper, this attribute can be a string. See tile_shape for details.
- rank_variable: set[RankVariable] | RankVariable#
The rank variable(s) iterated over in this loop. This may be a single rank variable, or a set of rank variables if the loop is shared between multiple Einsums.
NOTE FOR DEVELOPERS: If the rank variable is a set DURING PMAPPIN GENERATION, then it means that the loop is a placeholder for multiple loops in the given Einsum. They will be split into multiple loops later. If the rank variable
- property tile_pattern: TilePattern#
- tile_shape: EvalsTo[sympy.Symbol | sympy.Expr | int | str] = 'symbol'#
The (common) tile shape of the iteration. For example, if the iteration space is range(6) and the tile shape is 3, then we create and iterate over two tiles [0, 1, 2] and [3, 4, 5].
This attribute specifies the common tile shape because initial_tile_shape may be specified.
For users writing YAML, the value should be an integer.
For those developing the mapper, the literal string “symbol” is often used to tell the model to create a sympy symbol to use as the tile shape. Any other string may be specified to explicitly request a variable name (later converted to a sympy variable).
- class accelforge.frontend.mapping.Split[source]#
Bases:
MappingNodeWithChildrenA
MappingNodeWithChildrenthat splits the tree into multiple branches, each applying to different Einsums.- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- class accelforge.frontend.mapping.Storage[source]#
Bases:
TensorHolderA Storage
TensorHolderthat can hold tensors for reuse.- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- class accelforge.frontend.mapping.Temporal[source]#
Bases:
LoopA Temporal
Loop.- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- property tile_pattern: TilePattern#
- class accelforge.frontend.mapping.TensorHolder[source]#
Bases:
MappingNodeA node that represents a hardware Component holding a set of tensors.
- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.
- persistent: bool = False#
Whether this tensor holder is persistent. Persistent tensors can’t be tiled and must be kept in backing storage for the full duration of the workload’s execution.
- class accelforge.frontend.mapping.TilePattern[source]#
Bases:
objectTilePattern(tile_shape: accelforge.util._basetypes.EvalsTo[typing.Union[typing.Literal[‘symbol’], sympy.core.symbol.Symbol, int, str, NoneType, sympy.core.expr.Expr]] = ‘symbol’, initial_tile_shape: accelforge.util._basetypes.EvalsTo[typing.Union[typing.Literal[‘symbol’], sympy.core.symbol.Symbol, int, str, NoneType, sympy.core.expr.Expr]] = ‘symbol’, calculated_n_iterations: Union[Literal[‘symbol’], sympy.core.symbol.Symbol, int, str, NoneType, sympy.core.expr.Expr] = None)
- __init__(tile_shape='symbol', initial_tile_shape='symbol', calculated_n_iterations=None)#
- calculated_n_iterations: Literal['symbol'] | Symbol | int | str | None | Expr = None#
The number of iterations in the pattern. Do not set this! Used internally by the mapper.
- initial_tile_shape: EvalsTo[Literal['symbol'] | Symbol | int | str | None | Expr] = 'symbol'#
The initial tile shape. This is the shape of the tile at the first iteration. Subsequent iterations may be smaller if they overlap previous iterations.
- tile_shape: EvalsTo[Literal['symbol'] | Symbol | int | str | None | Expr] = 'symbol'#
The common tile shape of the pattern. This is the number of indices by which the tile moves each iteration.
- class accelforge.frontend.mapping.Toll[source]#
Bases:
TensorHolderA Toll
TensorHolderthat acts as a pass-through, where data is not reused but incurs accesses into this Toll.- classmethod from_yaml(*files, jinja_parse_data=None, top_key=None, **kwargs)#
Loads a dictionary from one more more yaml files.
Each yaml file should contain a dictionary. Dictionaries are combined in the order they are given.
Keyword arguments are also added to the dictionary.
- Parameters:
files (
str|list[str] |Path|list[Path]) – A list of yaml files to load.jinja_parse_data (
dict[str,Any] |None) – Optional[Dict[str, Any]] A dictionary of Jinja2 data to use when parsing the yaml files.top_key (
str|None) – Optional[str] The top key to use when parsing the yaml files.kwargs – Extra keyword arguments to be passed to the Jinja2 parser.
- Return type:
TypeVar(T)- Returns:
A dict containing the combined dictionaries.
- get_nodes_of_type(types)#
Returns all sub-nodes, including this one, that match the given types.