Skip to content

Bug in pytimeloop/timeloopfe/v4/arch.py: 'StorageAttributes' object has no attribute 'name' #42

@JYLiAo32

Description

@JYLiAo32

Hi, I’m currently learning how to use the Timeloop tools.
Following the instructions in workspace/README.md from the Accelergy-Project/timeloop-accelergy-exercises repository, I tried running the script workspace/scripts/generate_timeloop_spec.py to generate the reference configuration file timeloop_spec.yaml.

However, I encountered the following error:

(tsmap) ljy@manager:.../timeloop-accelergy-exercises/workspace/scripts$ python generate_timeloop_spec.py 
Traceback (most recent call last):
  File ".../accelergy-timeloop-infrastructure/src/timeloop-python/pytimeloop/timeloopfe/common/nodes.py", line 134, in cast_check_type
    casted = self.cast(value)
  File ".../accelergy-timeloop-infrastructure/src/timeloop-python/pytimeloop/timeloopfe/common/nodes.py", line 182, in cast
    value = self.callfunc(value)
  File ".../accelergy-timeloop-infrastructure/src/timeloop-python/pytimeloop/timeloopfe/common/nodes.py", line 96, in callfunc
    return rt(x, __node_skip_parse=__node_skip_parse)
  File ".../accelergy-timeloop-infrastructure/src/timeloop-python/pytimeloop/timeloopfe/v4/arch.py", line 591, in __init__
    print(f'WARNING: "depth" is not set for storage element {self.name}')
  File ".../accelergy-timeloop-infrastructure/src/timeloop-python/pytimeloop/timeloopfe/common/nodes.py", line 1447, in __getattr__
    raise AttributeError(
AttributeError: Could not find attribute 'name' in <class 'pytimeloop.timeloopfe.v4.arch.StorageAttributes'>. Available keys: ['type', 'width', 'datawidth', 'has_power_gating', 'power_gated_at', 'technology', 'n_banks', 'block_size', 'cluster_size', 'depth', 'entries', 'sizeKB', 'reduction_supported', 'multiple_buffering', 'min_utilization', 'shared_bandwidth', 'read_bandwidth', 'write_bandwidth', 'network_fill_latency', 'network_drain_latency', 'per_dataspace_bandwidth_consumption_scale', 'allow_overbooking', 'metadata_block_size', 'metadata_datawidth', 'metadata_storage_width', 'metadata_storage_depth', 'concordant_compressed_tile_traversal', 'tile_partition_supported', 'decompression_supported', 'compression_supported']. Available attributes: ['parent_node', 'spec', '_init_args', '_Node__currently_parsing_index', 'logger', '_default_parse', 'from_data', '__module__', 'declare_attrs', '__init__', '__doc__', '__abstractmethods__', '_abc_impl', '_param_type_specifiers', 'Node_all_recognized', 'ignore', 'has_power_gating', 'power_gated_at', '', 'datawidth', 'technology', 'n_banks', 'block_size', 'cluster_size', 'width', 'depth', 'entries', 'sizeKB', 'reduction_supported', 'multiple_buffering', 'min_utilization', 'shared_bandwidth', 'read_bandwidth', 'write_bandwidth', 'network_fill_latency', 'network_drain_latency', 'per_dataspace_bandwidth_consumption_scale', 'allow_overbooking', 'metadata_block_size', 'metadata_datawidth', 'metadata_storage_width', 'metadata_storage_depth', 'concordant_compressed_tile_traversal', 'tile_partition_supported', 'decompression_supported', 'compression_supported', '_require_one_of', '_require_all_or_none_of', '_update_combine_pre_parse', 'require_one_of', 'require_all_or_none_of', 'combine', 'from_yaml_files', '_check_alias', '__getitem__', '__setitem__', 'get', 'setdefault', 'pop', 'check_unrecognized', '__getattr__', '__setattr__', '__dict__', '__weakref__', 'get_specifiers_from_processors', 'reset_specifiers_from_processors', 'reset_processor_elems', 'recognize_all', '_get_type_specifiers', '_get_all_recognized', '_get_tag', 'get_global_spec', 'set_global_spec', 'get_tag', '_get_index2checker', 'items', 'combine_index', '_parse_elem', '_parse_elems', '_parse_extra_elems', 'get_name', 'recursive_apply', 'clean_empties', 'isempty', 'isempty_recursive', 'add_attr', '_check_unrecognized', 'get_nodes_of_type', 'get_setter_lambda', 'get_combiner_lambda', 'get_setters_for_keytag', 'get_combiners_for_keytag', 'get_setters_for_type', 'get_combiners_for_type', '__str__', '__format__', 'try_combine', 'is_defined_non_default_non_empty', 'parse_expressions', '_parse_expression', 'unique_class_name', '__slots__', '__new__', '__repr__', '__hash__', '__getattribute__', '__delattr__', '__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__reduce_ex__', '__reduce__', '__subclasshook__', '__init_subclass__', '__sizeof__', '__dir__', '__class__', '__iter__', '__or__', '__ror__', '__ior__', '__len__', '__delitem__', '__contains__', 'popitem', 'keys', 'values', 'update', 'fromkeys', 'clear', 'copy', '__reversed__', '__class_getitem__']

The above exception was the direct cause of the following exception:
......

I found a related discussion here: NVlabs/timeloop#323
In the latest commit (91ae9e4), I noticed the following code modification:

# line 590-591 in pytimeloop/timeloopfe/v4/arch.py
if self.depth is None:
    print(f'WARNING: "depth" is not set for storage element {self.name}')

It seems that this change might have introduced a new issue: the class StorageAttributes (and its parent classes) does not define a name attribute, which leads to the error above.

In short, this might be a side effect of fixing the missing Depth attribute, but causing a new problem due to the missing name field.
So, we may need a more appropriate way to handle this case. Thanks! : )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions