DRAM error models¶
gem5 only, with the classic memory system. Target: fault: dram. Key: dram_error_model, one of none, single_bit, multi_bit, row or retention.
DRAM (dynamic random-access memory) is the main memory behind the caches. Its errors come in shapes that one flipped bit does not cover: a particle upsets one cell, or several neighboring cells at once, or activity on a row disturbs cells along it, or a cell leaks its charge and loses a stored 1. A fault: dram campaign picks one of these shapes with the key dram_error_model, and gem5's fault injector applies it to main memory.
An HFIM campaign runs your program many times, with one fault per run, and compares each run with a fault-free golden run of the same program. For a dram fault, the injector picks the location itself: one byte drawn uniformly from the whole main memory, not a variable you name. Each section below says what one model does to that byte, and the figure shows all four side by side.
What every model shares¶
At the injection instant, the injector draws one byte address from the whole address range of main memory. The injector draws the address, the bits and the row count from gem5's random number generator, which it seeds for each injection from the campaign seed and the injection's number. Each injection of a campaign therefore draws its own address, and the same campaign run again draws the same ones. It reads that byte straight from the memory's storage, changes it as the model says, and writes it back, below the caches. The program sees the change the next time it fetches that byte from main memory.
The dram_error_model decides the bits. fault_model is still required in the campaign, but the dram target does not use it, nor the faultlist's bit_position. Every DRAM fault is applied once; fault_persistence: permanent has no effect on it.
dram_error_model |
Operation on the drawn byte | Bits counted |
|---|---|---|
none (default) |
the same as single_bit |
1 |
single_bit |
value XOR (1 << b), b drawn from 0 to 7 |
1 |
multi_bit |
XOR with dram_multi_bit_count adjacent bits |
dram_multi_bit_count |
row |
one XOR (1 << b) in each of 1 to 8 bytes of the row |
one per byte changed |
retention |
value AND NOT (1 << b), b drawn from 0 to 7 |
1, or 0 if the bit was already 0 |
The bits counted go into the injection report and decide the DRAM ECC (error-correcting code) verdict, described further down.
none¶
none is the default, so a fault: dram campaign without the key gets it. HFIM then passes no DRAM model to gem5, and the injector treats none exactly as single_bit. The report names the model it applied, so these runs read model=single_bit. none refuses dram_ecc_enabled: true. To combine one flipped bit with ECC, set single_bit instead.
single_bit¶
One random bit of the drawn byte inverts. This is the classic single event upset (SEU): a particle strike changes one cell, and the cell works normally afterwards. In the figure the byte holds 0x2a, the injector draws bit 6, and 0x2a XOR 0x40 = 0x6a. A flip always changes the byte, so the report always counts 1 bit.
multi_bit¶
dram_multi_bit_count neighboring bits of the drawn byte invert together, as when one strike upsets a cluster of adjacent cells. The injector draws the lowest bit so that the whole burst fits inside the byte, then flips that bit and the ones above it. In the figure the count is 2 (the default) and the lowest bit is 4: 0x2a XOR 0x30 = 0x1a.
dram_error_model: multi_bit
dram_multi_bit_count: 3
The bits are adjacent by construction. That differs from the multi-bit fault model of the other targets, set with multi_bit_count, which draws each bit position independently. dram_multi_bit_count must be between 1 and 8, because the burst stays in one byte. HFIM does not check the range: with 0, nothing changes and the report counts 0 bits.
row¶
Several bytes of one DRAM row change. The row is the block of dram_row_size bytes (default 8192), aligned to that size, that holds the drawn byte. The injector draws a count from 1 to 8, then that many byte addresses inside the row, and inverts one random bit in each. Rows above and below are not touched.
dram_error_model: row
dram_row_size: 8192
The draws are independent, so the same byte can be drawn twice, and when the same bit is drawn again the second flip undoes the first. The report still counts every flip. A draw outside main memory, possible only in a row that runs past either end of it, is skipped and not counted. The report gives the address of the drawn byte, not the bytes that changed in its row.
retention¶
One random bit of the drawn byte is cleared to 0, as when a cell leaks its charge before the next refresh. In the figure, bit 3 of 0x2a is 1, so the byte becomes 0x22. If the drawn bit already holds 0, nothing changes and the report counts 0 bits. Memory then matches the golden run, so the run behaves like the fault-free one. The retention run under What you see in the results drew such a bit.
DRAM ECC on top of a model¶
With dram_ecc_enabled: true, HFIM labels each injection with the verdict that SECDED ECC (single error correct, double error detect) would give for the bits counted:
| Bits counted | Verdict | target in injection_report.json |
|---|---|---|
| 0 | no check | dram[0x<address>,model=<model>,bits=0] |
| 1 | corrected | dram_ecc_corrected[0x<address>] |
| 2 | detected | dram[0x<address>,model=<model>,bits=2] |
| 3 or more | not detected | dram[0x<address>,model=<model>,bits=<n>] |
The verdict is only a label. The changed bits stay in memory in every case: a corrected error is not undone, and a detected one raises no trap, so ECC never produces the detected outcome. A detected and an undetected error write the same form of target; only the bit count tells them apart. For row, the count is the total over the whole injection, while a real SECDED code checks each memory word on its own.
A campaign¶
The nezha-c906-gem5 template ships no DRAM campaign. This one sits next to its Fibonacci memory campaign as campaigns/fibonacci/dram.yaml and differs from it only in the target and the DRAM keys. The included fibonacci.yaml names the benchmark, which fills result with the first 64 Fibonacci numbers, and compares result with the golden run:
# campaigns/fibonacci/dram.yaml
include: fibonacci.yaml
campaign_name: fibonacci-dram
simulator_backend: gem5
seed: 7
num_injections: 10
num_workers: 1
fault: dram
fault_model: single_bit_flip # required, not used by the dram target
dram_error_model: row # or single_bit, multi_bit, retention
dram_row_size: 8192
timeout: 120
output_dir: results
Run it with hfim run campaigns/fibonacci/dram.yaml. To try another model, change dram_error_model and keep only its own key: dram_multi_bit_count with multi_bit, dram_row_size with row. A key set for another model stops the campaign before it runs:
dram_multi_bit_count acts only with dram_error_model: multi_bit; this campaign uses row, so gem5 would ignore it.
What you see in the results¶
The record of a DRAM fault is the target field of injection_report.json, in each injection_NNNN/ directory. It holds the drawn address, the model and the bits counted. These are the target fields of five gem5 runs of the injector on the mmult benchmark, all injecting at instruction 500000. The second is multi_bit with a count of 3, and the last is single_bit with ECC on:
dram[0x00000000032c5143,model=single_bit,bits=1]
dram[0x00000000032c5143,model=multi_bit,bits=3]
dram[0x00000000032c5143,model=row,bits=6]
dram[0x00000000032c5143,model=retention,bits=0]
dram_ecc_corrected[0x00000000032c5143]
The five runs started from the same generator state, so they share one address; the injections of one campaign each draw their own.
In injections.csv, a DRAM row has target_type and target_name both dram. original_value is 0x0 and faulty_value is the number of bits counted, copied from the report (0x0 for an ECC-corrected row). bit_position is the campaign's own draw and does not describe the fault, so read the address and the bits from the report. The outcome column is decided as for any other target, in this order: timeout, crash, detected when the program reports the error itself, then sdc (silent data corruption) when result differs from the golden run and masked when it matches. Details: Fault classification.
Keys¶
| Key | Values | Default |
|---|---|---|
dram_error_model |
none, single_bit, multi_bit, row, retention |
none |
dram_multi_bit_count |
bits in the multi_bit burst; only with multi_bit |
2 |
dram_row_size |
row size in bytes for row; only with row |
8192 |
dram_ecc_enabled |
true adds the SECDED verdict; not with none |
false |
These keys are gem5 only; another backend refuses them at load. Any other value of dram_error_model is refused too, with the list of valid ones.
Limits¶
- No aiming. A DRAM fault cannot target a variable or a section. To corrupt bytes your program uses, use a memory fault.
- Only with
fault: dram.dram_error_modelon another target, such asmemory, is accepted and has no effect. - The caches hide it. While the line sits in a cache, the program reads the cached copy, and a dirty line written back later overwrites the changed byte.
- A row is an address block.
rowuses aligned physical addresses, not the device's real row, bank and column mapping, and never reaches neighboring rows. - Ruby and full system. On the Ruby memory system, HFIM's DRAM keys do not reach the injector, so every DRAM fault there is a
single_bitflip without ECC. The full-system board script accepts onlyregisterandcachefaults.
See also: gem5 backend · DRAM target · Single-bit flip · Configuration keys