Skip to content

Update docstring for DelegateMappingBuilder #504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions exir/backend/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ def replace_quantized_partition_with_op(
# TODO - style: use templated types
class DelegateMappingBuilder:
"""
Profiling helper class for building Delegate Maps.
Delegate Maps are a mapping from log entry identifiers to node
Profiling helper class for building Delegate Mappings.
Delegate Mappings are mappings from delegate debug identifiers to node
debug handles. Specifically this is used to log within backend delegates

Args:
generated_identifiers (bool, optional): Whether delegate map keys are
generated_identifiers (bool, optional): Whether identifier keys are
generated automatically. Defaults to False.
"""

Expand Down Expand Up @@ -206,27 +206,23 @@ def insert_delegate_mapping_entry(
identifier: Optional[Union[int, str]] = None,
) -> Union[int, str]:
"""
Add or append to an existing delegate mapping entry
Add a new delegate mapping entry

If self._generated_identifiers = False:
- An identifier must be provided, else this is no-op
- A new identifier must be provided, else an exception is thrown

If self._generated_identifiers = True:
- NEW identifiers cannot be manually provided. Existing identifier
can be provided
- New identifiers are generated incrementally, 0 indexed

If a provided identifier already exists, node entries are appended
- Identifiers cannot be manually provided, else an exception is thrown

Args:
nodes (Union[Node, List[Node]]): A (list of) Node(s)
identifier (Optional[Union[int, str]]):
Debug identifier corresponding to the Node(s)

Returns:
Optional[Union[int, str]]:
Delegate debug identifier corresponding to the node group
None is returned, if no identifier is associated
Union[int, str]:
Delegate debug identifier inserted
"""

# Check for manual addition of identifier (with generated identifiers enabled)
Expand Down