NVM tag store and endurance¶
gem5 only, on Ruby with NVMain main memory. Fault models: none; fault_model is required but has no effect. fault: nvm_tags, with simulator_backend: gem5-ruby and mem_backend: nvmain. Endurance outcomes (stuck_after_wear) need mem_backend: nvmain and an endurance model in the NVMain configuration file.
An HFIM campaign runs your benchmark many times, with one fault per run, and compares each run with a fault-free golden run. This page covers the two things HFIM measures in non-volatile memory (NVM): a fault in the tag store that sits in front of NVM main memory, and cells that wear out because they were written too often.
NVMain is a main-memory simulator that models NVM technologies such as phase-change memory (PCM), spin-transfer-torque magnetic RAM (STT-MRAM) and resistive RAM (RRAM). Ruby is gem5's detailed cache-coherence memory system. With mem_backend: nvmain, NVMain replaces gem5's DRAM model, and Ruby's directory reads and writes main memory through it.
NVMain keeps a tag store: a record of the 64-byte lines that main memory has served, with one state per line. A line is S (clean) when it arrived by a read, and M (modified, dirty) when it was written. The nvm_tags target corrupts that record. In its main mode, one write to main memory is lost, so main memory keeps the old bytes of that line.
How HFIM applies the fault¶
At the instruction count drawn from the seed, gem5 calls the tag store injector. The low bit of fault_mask selects one of two modes. A fault_mask of 0, or no fault_mask at all, counts as 1, so the mode that changes program data needs an even value such as 2.
fault_mask |
Mode | What changes | Effect on the program |
|---|---|---|---|
even, not 0 (for example 2) |
drop a writeback | the next write that reaches NVMain is treated as clean and lost: the write completes, then NVMain restores the old bytes | main memory keeps the old value; a later read of that line returns stale data |
odd, 0, or unset |
toggle a state | one resident line flips between S and M | none: the tag store's counters change, memory contents do not |
Drop mode is single-shot. Exactly one writeback is lost per injection, the first write to main memory after the injection instant.
In toggle mode, the injector picks the line by hashing the instruction count, the mask and the number of resident lines, then indexing a sorted list of the resident lines. The same faultlist row picks the same line on a replay.
The tag store holds 65536 lines. When it is full, the line that has gone unused the longest leaves to make room. A campaign cannot change this size.
A campaign¶
The nezha-c906-gem5 template ships this campaign as campaigns/pingpong/nvm_tags.yaml. Its benchmark, pingpong, runs two harts that pass one variable back and forth. Then one hart writes a 512 KiB sweep, more than the caches hold, and reads it back. A dropped writeback in that sweep is read back stale and changes checksum.
include: [pingpong.yaml, ../nvmain.yaml]
campaign_name: pingpong-nvm_tags
simulator_backend: gem5-ruby
seed: 7
num_injections: 10
num_workers: 1
target_types: [nvm_tags]
fault_model: single_bit_flip
fault_mask: 2 # even: drop the next writeback
timeout: 600
output_dir: results
The included ../nvmain.yaml holds the memory model, with the device file kept at the root of the campaign repository:
mem_backend: nvmain
nvmain_config: nvmain/PCM_ISSCC_2012_4GB.config
pingpong.yaml sets benchmark: pingpong, num_cores: 2 and the observed variables checksum and pingpong_var. Run the campaign from the repository root:
hfim run campaigns/pingpong/nvm_tags.yaml
NVMain models every main-memory access cycle by cycle on top of Ruby, so each injection is slow. The template sets timeout: 600 (seconds per injection) for that reason.
What you see in the results¶
Each injection directory holds injection_report.json, written by gem5 when the fault fires. These lines come from a real drop-mode run:
"fault_type": "nvm_tags",
"target": "nvm_tags[line=000000000000;S->M]",
"original_value": "0x0000000000000001",
"faulty_value": "0x0000000000000002"
The target field names the line, as a 12-digit hexadecimal line number (the address divided by 64), and the change of state. The original_value and faulty_value fields, also copied to the injections.csv columns of the same names, encode the line and its state as (line << 2) | state, where state 1 is S and 2 is M. In drop mode no line is known yet when the fault fires, so every drop-mode row shows line 0, S to M, and the values 0x1 and 0x2 in injections.csv. In toggle mode the target names the line that changed and its change, S->M or M->S.
Next to it, tagstore_stats.json holds the tag store's counters for that run, under a tag_store key: among them hits, misses, evictions, dirty_evictions, resident_lines, tag_faults_injected and tag_lost_writebacks. Every injection shows tag_faults_injected: 1. A drop-mode run that lost its writeback also shows tag_lost_writebacks: 1. A toggle-mode run shows tag_lost_writebacks: 0; the toggle changes only counters such as dirty_evictions.
The outcome column follows the usual rules. masked means the observed variables match the golden run. sdc (silent data corruption) means they differ and the benchmark did not report it. In drop mode, sdc appears when the lost line is read back before the run ends, and masked when it is not. Toggle mode leaves memory untouched, so its rows are masked. Every outcome and the order HFIM decides them in: Fault classification.
NVM endurance¶
NVM cells survive a limited number of writes. With mem_backend: nvmain and an endurance model in the NVMain configuration file, NVMain counts writes per cell and records the worst cell's remaining life. This works with any fault target, on classic gem5 and on Ruby.
After each injection, HFIM reads NVMainStats.log from the gem5 output. When the worst cell has no life left, or NVMain reports an endurance failure, HFIM sets endurance_failed to True and the row's outcome to stuck_after_wear. This outcome replaces whatever the program did, because the memory itself has failed. stuck_after_wear rows count in the outcome rates.
Three injections.csv columns record wear. They are empty when mem_backend is not nvmain, or when NVMain wrote no NVMainStats.log.
| Column | Meaning |
|---|---|
dram_writes_per_cell_max |
writes the worst cell has used: EnduranceDistMean from the configuration file minus that cell's remaining life; 0 when HFIM cannot read EnduranceDistMean from the file |
endurance_failed |
True when a cell reached its write limit |
ecp_corrected_count |
corrections made by error-correcting pointers (ECP), summed over the memory; empty when the configuration has no ECP fault model |
The limit of each cell comes from a normal distribution set in the configuration file by EnduranceDistMean and EnduranceDistVariance. HFIM ships NVMain configuration files in fim/configs/nvmain/. The ones with an endurance model set a mean of 100 writes, low enough for a short benchmark to wear cells out:
| File | Technology | Endurance model |
|---|---|---|
PCM_ISSCC_2012_4GB_BitModel.config |
PCM | per bit |
PCM_ISSCC_2012_4GB_ByteModel.config |
PCM | per byte |
PCM_ISSCC_2012_4GB_WordModel.config |
PCM | per word (one 64-byte burst in this file) |
PCM_ISSCC_2012_4GB_RowModel.config |
PCM | per row |
PCM_ISSCC_2012_4GB_BitModel_ECP.config |
PCM with ECP | per bit |
PCM_MLC_example_BitModel.config |
multi-level-cell PCM | per bit |
STTRAM_Everspin_4GB_BitModel.config |
STT-MRAM | per bit |
PCM_ISSCC_2012_4GB.config, RRAM_ISSCC_2012_4GB.config |
PCM, RRAM | none (NullModel) |
The template's nvm_tags campaign uses PCM_ISSCC_2012_4GB.config, which has no endurance model, so it never produces stuck_after_wear. To study wear, copy one of the endurance files into your campaign repository and point nvmain_config at it.
Keys¶
| Key | Values | Default |
|---|---|---|
fault or target_types |
nvm_tags |
required |
simulator_backend |
gem5-ruby for nvm_tags; gem5 or gem5-ruby for endurance |
qemu |
mem_backend |
nvmain |
gem5_builtin |
nvmain_config |
path to an NVMain .config file, relative to the repository root or absolute; required with nvmain |
none |
fault_mask |
even and not 0: drop a writeback; odd, 0 or unset: toggle a state |
unset |
Every key: Configuration keys.
Limits¶
nvm_tagsruns only on Ruby. On classic gem5 (simulator_backend: gem5), the gem5 configuration script does not accept the target and the run stops with an argument error.- On Ruby without NVMain main memory, the run stops with
nvm_tags requires an NVMainMemory instance in system.mem_ctrls. fault_modelhas no effect onnvm_tags. The injector always toggles S and M or drops one writeback, and the faultlist'sbit_positiondoes not choose anything.- If no line is resident when the fault fires, gem5 prints
nvm_tags injection found no resident lines (empty tag store)and the run goes on without a fault. It writes noinjection_report.json, so HFIM records the row asinfrastructure_failure, which does not count in the outcome rates. - The tag store tracks state per 64-byte line only. It stores no data, so a toggle-mode fault cannot corrupt a value.
- Drop mode loses the next write to main memory, whichever line it belongs to. It cannot aim at a chosen variable.
- Endurance outcomes need an endurance model in the configuration file. A
NullModelfile counts no wear, andendurance_failedis neverTrue.
See also: gem5 backend · DRAM · Ruby controllers · Configuration keys