Skip to content

[TOGSim] Report off-chip DRAM energy in the end-of-run stats - #311

Open
YWHyuk wants to merge 1 commit into
developfrom
feature/dram-energy
Open

[TOGSim] Report off-chip DRAM energy in the end-of-run stats#311
YWHyuk wants to merge 1 commit into
developfrom
feature/dram-energy

Conversation

@YWHyuk

@YWHyuk YWHyuk commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Adds an off-chip DRAM energy/power figure to the end-of-run TOGSim stats.

E = n_ACT x row_activation_pj + bits x sum(transfer_pj_per_bit)

Where the counters come from

n_ACT — Ramulator2 has no ACT command counter, so activations are derived from the per-controller row stats that already exist: a row hit needs no ACT, a miss (closed bank) and a conflict (another row open) each need one, so n_ACT = row_misses + row_conflicts, summed over channels.

bits — served transactions times the DRAM model's own get_tx_bytes() (internal_prefetch_size * channel_width / 8, 32 B for the HBM2 config), times 8. A DRAM column command moves one full burst in bytes, never a partial one, so the byte granularity follows the ramulator config instead of a hardcoded size and is only converted to bits at the last step. The report prints the transaction count and burst size so the conversion is auditable.

Output

A separate section at the end of a run, aggregated over all channels. Periodic interval logs are untouched.

=== Energy statistics ===
[Energy] Energy cost table "HBM2" loaded from "configs/energy_tables/hbm2.yml"
[Energy] OffChip DRAM channels 0..15 combined | 11.085 W avg power, 3.358 mJ over 302.879 us | 555.087 uJ activation, 2.802 mJ transfer
[Energy] OffChip DRAM channels 0..15 combined | 610657 activations x 909.00 pJ | 3145728 transactions x 32 B x 3.48 pJ/bit (dram 1.51 + io 1.17 + phy 0.80)

Configuration

energy_cost_table_path: ../configs/energy_tables/hbm2.yml

Omit the key and no energy section is printed, so every existing config behaves exactly as before. The constants live in a swappable table (configs/energy_tables/hbm2.yml) with the per-bit terms kept separate so the report can show the breakdown. Activation energy needs row state, so the report requires dram_type: ramulator2; with simple it prints a one-line note instead.

Verification

  • 2048-cube matmul: the reported 610657 activations match the sum of row_misses and row_conflicts across the 16 per-channel ramulator dumps exactly. row_hits + row_misses + row_conflicts equals the transaction count, so both terms are counted over the same event population.
  • Arithmetic checks out by hand: 610657 x 909 pJ = 555.087 uJ; 3145728 x 32 B x 8 x 3.48 pJ = 2.802 mJ; 284706 cycles at 940 MHz = 302.879 us, giving 11.085 W.
  • Regression: a config without energy_cost_table_path produces byte-identical stats output to before, and tests/ops/elementwise/test_add.py and tests/ops/gemm/test_matmul.py pass.

Scope

Dynamic, activity-proportional energy only. Refresh and background/standby power are not modelled, so the figure is a floor on real device power. Effective energy works out to 3.93 pJ/bit at 512-cube and 4.17 pJ/bit at 2048-cube, and 16 channels is about two HBM2 stacks, so roughly 5.5 W per stack at 69% bandwidth utilisation.

Depends on

PSAL-POSTECH/ramulator2#1, which adds the row_activations() accessor. The submodule pointer in this PR references that branch and needs re-pointing at the merged commit once it lands.

Add an energy model that turns DRAM activity into energy using constants
from a swappable cost table:

  E = n_ACT x row_activation_pj + bits x sum(transfer_pj_per_bit)

n_ACT comes from the ramulator2 controllers (row_misses + row_conflicts,
summed over channels). bits comes from served transactions times the DRAM
model's own get_tx_bytes(), so the burst granularity follows the ramulator
config instead of a hardcoded size; a command moves one full burst, never
a partial one.

The report is a separate "=== Energy statistics ===" section printed once
at the end of a run, aggregated over all channels. The periodic interval
logs are unchanged.

Select the constants with energy_cost_table_path in the simulation config.
Omit the key and no energy section is printed, so existing configs behave
as before. configs/energy_tables/hbm2.yml holds the HBM2 values. Activation
energy needs row state, so the report requires dram_type: ramulator2.

Verified on a 2048 cube matmul: the reported 610657 activations match the
sum of row_misses and row_conflicts across the 16 per-channel ramulator
dumps, and 3.358 mJ over 302.879 us gives 11.085 W.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant