Skip to content

Commit a02c7d0

Browse files
Latency modeling
1 parent dc23d9b commit a02c7d0

21 files changed

Lines changed: 742 additions & 419 deletions

README.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# HWComponents
22
The HWComponents (Hardware Components) package, part of the
33
[CiMLoop](https://github.com/mit-emze/cimloop) project, provides an interface for the
4-
estimation of energy, area, and leakage power of hardware components in hardware
4+
estimation of area, energy, latency, and leak power of hardware components in hardware
55
architectures. Key features in HWComponents include:
66

77
[Information about the package is available on the hwcomponents website](https://accelergy-project.github.io/hwcomponents/).
@@ -11,7 +11,7 @@ architectures. Key features in HWComponents include:
1111
If you use this package in your work, please cite the CiMLoop project:
1212

1313
```bibtex
14-
@INPROCEEDINGS{10590023,
14+
@INPROCEEDINGS{cimloop,
1515
author={Andrulis, Tanner and Emer, Joel S. and Sze, Vivienne},
1616
booktitle={2024 IEEE International Symposium on Performance Analysis of Systems and Software (ISPASS)},
1717
title={CiMLoop: A Flexible, Accurate, and Fast Compute-In-Memory Modeling Tool},
@@ -22,15 +22,4 @@ If you use this package in your work, please cite the CiMLoop project:
2222
keywords={Performance evaluation;Accuracy;Computational modeling;Computer architecture;Artificial neural networks;In-memory computing;Data models;Compute-In-Memory;Processing-In-Memory;Analog;Deep Neural Networks;Systems;Hardware;Modeling;Open-Source},
2323
doi={10.1109/ISPASS61541.2024.00012}
2424
}
25-
@INPROCEEDINGS{8942149,
26-
author={Wu, Yannan Nellie and Emer, Joel S. and Sze, Vivienne},
27-
booktitle={2019 IEEE/ACM International Conference on Computer-Aided Design (ICCAD)},
28-
title={Accelergy: An Architecture-Level Energy Estimation Methodology for Accelerator Designs},
29-
year={2019},
30-
volume={},
31-
number={},
32-
pages={1-8},
33-
keywords={Program processors;Electric breakdown;Neural networks;Estimation;Hardware;Energy efficiency;Compounds},
34-
doi={10.1109/ICCAD45719.2019.8942149}
35-
}
3625
```

docs/source/index.rst

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ CiMLoop HWComponents
33

44
The HWComponents (Hardware Components) package, part of the `CiMLoop
55
<https://github.com/mit-emze/cimloop>`_ project, provides an interface for the
6-
estimation of energy, area, and leakage power of hardware components in hardware
7-
architectures. Key features in HWComponents include:
6+
estimation of area, energy, latency, and leak power of hardware components in
7+
hardware architectures. Key features in HWComponents include:
88

9-
- A simple Python API for writing energy, area, and leakage power models. New
9+
- A simple Python API for writing area, energy, latency, and leak power models. New
1010
models can be written in minutes.
1111
- Automatic scaling of parameters to different configurations, including scaling to
1212
different technology nodes.
@@ -15,9 +15,6 @@ architectures. Key features in HWComponents include:
1515
- Automatic gathering of components from available Python packages. This includes
1616
support for different models in virtual environments.
1717

18-
Components are also compatible with
19-
`Accelergy <https://github.com/accelergy-project/accelergy>`_.
20-
2118

2219
Installation
2320
------------
@@ -83,7 +80,7 @@ If you use this package in your work, please cite the CiMLoop project:
8380

8481
.. code-block:: bibtex
8582
86-
@INPROCEEDINGS{10590023,
83+
@INPROCEEDINGS{cimloop,
8784
author={Andrulis, Tanner and Emer, Joel S. and Sze, Vivienne},
8885
booktitle={2024 IEEE International Symposium on Performance Analysis of Systems and Software (ISPASS)},
8986
title={CiMLoop: A Flexible, Accurate, and Fast Compute-In-Memory Modeling Tool},
@@ -94,14 +91,3 @@ If you use this package in your work, please cite the CiMLoop project:
9491
keywords={Performance evaluation;Accuracy;Computational modeling;Computer architecture;Artificial neural networks;In-memory computing;Data models;Compute-In-Memory;Processing-In-Memory;Analog;Deep Neural Networks;Systems;Hardware;Modeling;Open-Source},
9592
doi={10.1109/ISPASS61541.2024.00012}
9693
}
97-
@INPROCEEDINGS{8942149,
98-
author={Wu, Yannan Nellie and Emer, Joel S. and Sze, Vivienne},
99-
booktitle={2019 IEEE/ACM International Conference on Computer-Aided Design (ICCAD)},
100-
title={Accelergy: An Architecture-Level Energy Estimation Methodology for Accelerator Designs},
101-
year={2019},
102-
volume={},
103-
number={},
104-
pages={1-8},
105-
keywords={Program processors;Electric breakdown;Neural networks;Estimation;Hardware;Energy efficiency;Compounds},
106-
doi={10.1109/ICCAD45719.2019.8942149}
107-
}

docs/source/notes/finding_and_using_models.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This document follows the ``1_finding_and_using_models.ipynb`` tutorial.
55

66
``hwcomponents`` supports many different component models. We can list available
77
component models with the :py:func:`~hwcomponents.find_models.get_models` function. This
8-
function returns a list of :py:class:`~hwcomponents.model.EnergyAreaModel` subclasses.
8+
function returns a list of :py:class:`~hwcomponents.model.ComponentModel` subclasses.
99

1010
You may also use the ``hwcomponents --list`` command from the shell.
1111

@@ -40,7 +40,8 @@ invoke a model. There are three ways to find a component model:
4040
select the best model for a given component name and attributes, and raise an error
4141
if no model can be instantiated with the given attributes.
4242
3. Ask for specific properties from hwcomponents. This is similar to the second method,
43-
but you can ask for the energy, area, or leakage power of a component directly.
43+
but you can ask for the area, energy, latency, or leak power of an action of a
44+
component directly.
4445

4546
.. include-notebook:: ../../notebooks/1_finding_and_using_models.ipynb
4647
:name: ways_to_find_components

docs/source/notes/making_models.rst

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,21 @@ This document follows the ``2_making_models.ipynb`` tutorial.
66
Basic Components
77
----------------
88

9-
Models can be created by subclassing the :py:class:`~hwcomponents.model.EnergyAreaModel`
9+
Models can be created by subclassing the :py:class:`~hwcomponents.model.ComponentModel`
1010
class. Models estimate the energy, area, and leakage power of a component. Each model
1111
requires the following:
1212

1313
- ``component_name``: The name of the component. This may also be a list of components if
1414
multiple aliases are used.
15-
- ``priority_0_to_100``: The percent accuracy of the model. This is used to
16-
break ties if multiple models support a given query.
15+
- ``priority``: This is used to break ties if multiple models support a given query.
1716
- A call to ``super().__init__(area, leak_power, subcomponents)``. This is used to
1817
initialize the model and set the area and leakage power.
1918

20-
Models can also have actions. Actions are functions that return an energy of a specific
21-
action. For the TernaryMAC model, we have an action called ``mac`` that returns the
22-
energy of a ternary MAC operation. The
23-
:py:func:`~hwcomponents.model.actionDynamicEnergy` decorator makes this function visible
24-
as an action. The function should return an energy in Joules.
19+
Models can also have actions. Actions are functions that return a tuple of ``(energy,
20+
latency)`` for a specific action. For the TernaryMAC model, we have an action called
21+
``mac`` that returns the energy and latency of a ternary MAC operation. The
22+
:py:func:`~hwcomponents.model.action` decorator makes this function visible as an
23+
action. The function should return ``(energy_in_Joules, latency_in_seconds)``.
2524

2625
Models can also be scaled to support a range of different parameters. For example,
2726
the TernaryMAC model can be scaled to support a range of different technology nodes.
@@ -35,9 +34,14 @@ model. The ``self.scale`` function takes the following arguments:
3534
scaling should be done.
3635
- ``energy_scaling_function``: The scaling function to use for dynamic energy. Use
3736
``None`` if no scaling should be done.
37+
- ``latency_scaling_function``: The scaling function to use for latency. Use ``None`` if
38+
no scaling should be done.
3839
- ``leak_scaling_function``: The scaling function to use for leakage power. Use ``None``
3940
if no scaling should be done.
4041

42+
**Note: Area, Energy, Latency, and Leak Power are always in alphabetical order in the
43+
function arguments.**
44+
4145
Many different scaling functions are defined and available in
4246
:py:mod:`hwcomponents.scaling`.
4347

@@ -49,12 +53,12 @@ Scaling by Number of Bits
4953
-------------------------
5054

5155
Some actions may depend on the number of bits being accessesed. For example, you may
52-
want to charge for the energy per bit of a DRAM read. To do this, you can use the
53-
``bits_per_action`` argument of the :py:func:`~hwcomponents.model.actionDynamicEnergy`
56+
want to charge for the energy and latency per bit of a DRAM read. To do this, you can
57+
use the ``bits_per_action`` argument of the :py:func:`~hwcomponents.model.action`
5458
decorator. This decorator takes a string that is the name of the parameter to scale by.
55-
For example, we can scale the energy of a DRAM read by the number of bits being read. In
56-
this example, the DRAM yields ``width`` bits per read, so energy is scaled by
57-
``bits_per_action / width``.
59+
For example, we can scale the energy and latency of a DRAM read by the number of bits
60+
being read. In this example, the DRAM yields ``width`` bits per read, so energy and
61+
latency are scaled by ``bits_per_action / width``.
5862

5963
.. include-notebook:: ../../notebooks/2_making_models.ipynb
6064
:name: scaling_by_number_of_bits
@@ -75,18 +79,24 @@ We'll use the following components:
7579
- An adder that adds the increment value to the current address
7680

7781
One new functionality is used here. The ``subcomponents`` argument to the
78-
:py:class:`~hwcomponents.model.EnergyAreaModel` constructor is used to register
82+
:py:class:`~hwcomponents.model.ComponentModel` constructor is used to register
7983
subcomponents.
8084

81-
The area, energy, and leak power of subcomponents will NOT be scaled by the component's
82-
``energy_scale``, ``area_scale``, or ``leak_scale``; if you want to scale the
83-
subcomponents, multiply their ``energy_scale``, ``area_scale``, or ``leak_scale`` by the
84-
desired scale factor.
85+
The area, energy, latency, and leak power of subcomponents will NOT be scaled by the
86+
component's ``area_scale``, ``energy_scale``, ``latency_scale``, and ``leak_scale``; if
87+
you want to scale the subcomponents, multiply the subcomponents' ``area_scale``,
88+
``energy_scale``, ``latency_scale``, and ``leak_scale`` by the desired scale factor.
8589

8690
.. include-notebook:: ../../notebooks/2_making_models.ipynb
8791
:name: smartbuffer_sram
8892
:language: python
8993

94+
The latency of subcomponents is generally summed. However, if the subcomponents are
95+
pipelined for a given action, then the ``pipelined_subcomponents`` argument to the
96+
:py:func:`~hwcomponents.model.action` decorator should be set to True. This will cause
97+
the latency of the action to be the max of the latency returned and all subcomponent
98+
latencies.
99+
90100
Installing Models and Making them Globally Visible
91101
--------------------------------------------------
92102

hwcomponents/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
from hwcomponents.model import EnergyAreaModel, actionDynamicEnergy
1+
from hwcomponents.model import ComponentModel, action
22
from hwcomponents.find_models import get_models
3-
from hwcomponents.select_models import get_energy, get_area
43
import hwcomponents.scaling as scaling
54
from hwcomponents.select_models import (
65
get_area,
76
get_energy,
8-
get_model,
7+
get_latency,
98
get_leak_power,
9+
get_model,
1010
)

0 commit comments

Comments
 (0)