Accelergy-Project / accelergy-plug-in-template

An skeleton template as a starting point for constructing an Accelergy plug-in
3 stars 1 forks source link

A Problem while adding new plug-ins to Accelergy #1

Closed kmchiti closed 7 months ago

kmchiti commented 3 years ago

Hi

I used your plug-in template and install it on my system. To Test this new plug-in I try to add a component of my plug-in class to the 00-model-conv1d-1level exercise. When I add my new component to the architecture and run timeloop-mapper (or timeloop-model), Accelergy identified my plug-in. The ART, ERT, and flattened_architecture are generated without any problem. This is the part of the ERT that deals with the new component.

ERT_summary: version: 0.3 table_summary: - name: PE.test_component actions:

  • name: access energy: 0.18 primitive_estimation(s):
  • name: PE.test_component estimator: Test_table

But the total energy (or total area) didn't change. In fact, I cannot find my new component in model.stats!

Summary Stats ------------- Utilization: 1.00 Cycles: 48 Energy: 0.00 uJ Area: 0.00 mm^2

MACCs = 48 pJ/MACC MACC = 0.56 Buffer = 1.54 Buffer <==> MACC = 0.00 Total = 2.10

It seems timeloop didn't identify my new component and didn't compute the action count for that. Do you have any idea about this issue? Thanks!

nellie-wu commented 3 years ago

Would you please share the architecture specification that has your new component for us the better understand the issue?

kmchiti commented 3 years ago

Thanks for your reply. You can find the files of plug-in template and model that I used attached.

accelergy-plug-in-template-master.zip 00-model-LDPC-test.zip

nellie-wu commented 3 years ago

The reason that timeloop does not recognize your class is because it does not know that decoder is. At a high level, timeloop only cares whether a component in an architecture is a storage or a compute. Accelergy cares about your exact class because it needs to generate precise energy consumption number.

Is your decoder part of the Buffer or is it part of the compute unit or is it by itself a storage or compute? If it is part of the existing storage level, you can make a larger compound component and merge the decoder into it. If it is by itself another level in the architecture, try to specify it:

   - name: test_component
       class: storage 
       subclass: decoder
       attributes:
        width: 8
        depth: 10
        clockrate: 10ns
        datawidth: 8

Where the class keyword tells timeloop it is a storage unit and the subclass keyword tells accelergy the exact hardware class accelergy should use to generate energy estimation.

kmchiti commented 3 years ago

Thank you so much for your help. The decoder component is another level in my architecture. When I use storage class for my component and specify the exact hardware class by subclass, there are two major problems:

1- The vector access energy is computed correctly by Accelergy, but surprisingly Energy (per-scalar-access) is equal to zero in the model.stats for my component:

level 1

=== test_component ===

SPECS
-----
    Technology           : SRAM
    Size                 : 1
    Word bits            : 8
    Block size           : 1
    Cluster size         : 4
    Instances            : 1 (1*1)
    Read bandwidth       : -
    Write bandwidth      : -
    Multiple buffering   : 1.00
    Effective size       : 1
    Min utilization      : 0.00
    Vector access energy : 0.08 pJ
    Area                 : 0.00 um^2

MAPPING
-------
Loop nest:
  for R in [0:3)

STATS
-----
Cycles               : 48
Bandwidth throttling : 1.00
Outputs:
    Partition size                           : 16
    Utilized capacity                        : 1
    Utilized instances (max)                 : 1
    Utilized clusters (max)                  : 0
    Scalar reads (per-instance)              : 32
    Scalar updates (per-instance)            : 48
    Scalar fills (per-instance)              : 16
    Temporal reductions (per-instance)       : 32
    Address generations (per-cluster)        : 64
    Energy (per-scalar-access)               : 0.00 pJ
    Energy (per-instance)                    : 0.00 pJ
    Energy (total)                           : 0.00 pJ
    Temporal Reduction Energy (per-instance) : 0.00 pJ
    Temporal Reduction Energy (total)        : 0.00 pJ
    Address Generation Energy (per-cluster)  : 0.00 pJ
    Address Generation Energy (total)        : 0.00 pJ
    Read Bandwidth (per-instance)            : 0.67 words/cycle
    Read Bandwidth (total)                   : 0.67 words/cycle
    Write Bandwidth (per-instance)           : 1.33 words/cycle
    Write Bandwidth (total)                  : 1.33 words/cycle

2- I think by using storage class for the component, in fact, Timeloop uses the component as memory so we are adding another memory hierarchy and thus the total energy will decrease (which is not something that I want). Is there another way that Timeloop can recognize my new component?

nellie-wu commented 3 years ago

Timeloop will only recognize the energy consumption if you have your action names as read, write, compute etc. So if your action name is different timeloop will not recognize it.

Timeloop only cares about two types of components: storage or compute, because these are the only two types of components that matters for data reuse and computation analysis. What does your component do? If it does not introduce data reuse, or it does not create more "MACs", then you can just merge it to a compute or storage component in the architecture to account for its energy cost.