[TOGSim] Report off-chip DRAM energy in the end-of-run stats - #311
Open
YWHyuk wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an off-chip DRAM energy/power figure to the end-of-run TOGSim stats.
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.
Configuration
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 requiresdram_type: ramulator2; withsimpleit prints a one-line note instead.Verification
row_missesandrow_conflictsacross the 16 per-channel ramulator dumps exactly.row_hits + row_misses + row_conflictsequals the transaction count, so both terms are counted over the same event population.energy_cost_table_pathproduces byte-identical stats output to before, andtests/ops/elementwise/test_add.pyandtests/ops/gemm/test_matmul.pypass.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.