Configuration keys¶
Every key a campaign file accepts. Explanations and examples are in Campaign configuration.
Backends column: all = QEMU, gem5 and hardware; QEMU, gem5 = that backend only. Any key below may also be set in a file the campaign includes (include:); the campaign's own value wins. A key the list does not name is refused at load, a near-miss spelling with the key it was probably meant to be; a key that starts with x_ is a note and is kept as written. Boolean keys must be YAML true / false; a quoted 'false' is rejected.
Required¶
| Key | Type / values | Default | Backends | Meaning | Manual |
|---|---|---|---|---|---|
benchmark |
string | required | all | directory name under benchmarks/ |
Required keys |
seed |
integer >= 0 | required | all | seed of the campaign PRNG | Seed |
num_injections |
integer > 0 | required | all | number of faults, one run each | Seed |
sampling_with_replacement |
boolean | true |
all | false redraws a fault that repeats an earlier complete fault |
Seed |
fault |
see Target | required | all | target family | What to inject |
fault_model |
single_bit_flip, stuck_at_0, stuck_at_1 |
required | all | bit operation | Fault models |
timeout |
number > 0, or auto |
required | all | wall-clock limit per injection, seconds | Time limits |
Identification¶
| Key | Type / values | Default | Backends | Meaning | Manual |
|---|---|---|---|---|---|
campaign_name |
string | none | all | label recorded in provenance.json; not part of the directory name |
Output |
campaign_label |
string | none | all | added to the result directory name: <benchmark>_<label>_<timestamp> |
Output |
description |
string | none | all | free text |
Target¶
| Key | Type / values | Default | Backends | Meaning | Manual |
|---|---|---|---|---|---|
fault |
register, memory |
required | all | target family | Fault targets |
fault |
cache_l1d, cache_l1i, cache_l2, cache_tag, cache_tag_parity, ecc_parity_l1d, ecc_parity_l1i, ecc_parity_l2, dram, nvm_tags, branch_pred, tlb, phys_reg, rename_map, rob, lsq, coherence, ruby_directory, ruby_mshr, ruby_tbe, ruby_message_buffer |
gem5 | target family | gem5 backend | |
target_types |
list with one fault value |
required | all | list form of fault; fault wins if both are set |
Required keys |
fault_target |
a fault value |
all | internal name of fault; setting both to different values is rejected |
||
target_registers |
list of ABI or xN names |
required for register without auto_registers |
all | register pool | Registers |
auto_registers |
boolean | false |
QEMU, gem5 | pool = registers the ELF uses (objdump); a target_registers list is added to it |
Registers |
include_int |
boolean | true |
QEMU, gem5 | with auto_registers: include integer registers |
Registers |
include_floats |
boolean | false |
QEMU, gem5 | with auto_registers: include float registers |
Registers |
allow_zero_register |
boolean | false |
all | allow x0 in the pool |
Registers |
xlen |
32, 64 |
from the ELF | hardware, QEMU | register width; limits the bit draw | Bits that can flip |
target_variable (alias target_symbol) |
symbol name | none | all | memory window = the variable's storage | Memory, one variable |
section |
section name, .stack, .stack-live |
none | all | memory window = a whole section; fills memory_start and memory_end |
Memory, one section |
memory_start |
address or section name | required for memory without target_symbol / section |
all | start of the memory window | Memory, address range |
memory_end |
address or section name | required with memory_start |
all | end of the memory window; a section name means its end | Memory, address range |
memory_access_size |
1, 2, 4, 8 |
1 |
all | alignment of the drawn address, bytes | Memory |
memory_random_fallback |
boolean | false |
gem5 | draw a random byte of the whole DRAM instead of a window | Memory, random DRAM byte |
Fault model¶
| Key | Type / values | Default | Backends | Meaning | Manual |
|---|---|---|---|---|---|
multi_bit_count |
integer >= 1, at most the bit width | 1 |
all | distinct bits per injection | Multi-bit |
fault_persistence |
transient, permanent |
transient |
gem5, ovp | apply once, or after every committed instruction | Stuck-at, applied once or held |
ovp_permanent_model |
inverted_cell |
none | ovp | a permanent bit flip stored as V ^ mask on every program write (native, opt-in) | The OVP inverted cell |
stepi_reset_steps |
integer >= 0 | none | ovp | stepi: the steps of the reference reset before the ELF entry a count includes (0: from the entry); a count below it is refused |
|
stack_live_shared_reservation |
{bottom: <symbol>, top: <symbol>, harts: [0, ..]} |
none | ovp | declares the one stack reservation every hart shares, required by a generated .stack-live campaign with several harts; checked against the ELF and each stop's sp |
|
bit_width |
8, 16, 32, 64 |
registers 64, memory memory_access_size * 8 |
all | bits the draw may pick from | Bits that can flip |
fault_mask |
integer | none | gem5 | explicit bit mask, used by nvm_tags |
gem5 backend |
faultlist_csv |
path | none | all | inject the rows of this faultlist or injections.csv instead of drawing |
Replaying |
verify_injection |
boolean | false |
QEMU, hardware | read the target back after the write; a mismatch is an infrastructure failure |
gem5 targets¶
| Key | Type / values | Default | Backends | Meaning | Manual |
|---|---|---|---|---|---|
cache_set |
integer >= 0 | random | gem5 | restrict a cache fault to one set | gem5 backend |
cache_way |
integer >= 0 | random | gem5 | restrict a cache fault to one way | gem5 backend |
cache_lines |
valid, all |
valid |
gem5 | pick the line among those holding data at the injection, or draw set and way over the whole array | Cache data |
cache_level_sweep |
list of l1d, l1i, l2 |
none | gem5 | inject across these cache levels | gem5 backend |
cache_ecc_enabled |
boolean | false |
gem5 | model ECC on the caches; single-core only | gem5 backend |
cache_ecc_scope |
data, tag, both |
data |
gem5 | what the cache ECC covers; only data is modeled, so tag and both act as data |
gem5 backend |
cache_ecc_policy_l1d, cache_ecc_policy_l1i, cache_ecc_policy_l2 |
parity, secded, none |
inherit cache_ecc_enabled |
gem5 | ECC policy per cache level; needs cache_ecc_enabled: true |
gem5 backend |
dram_error_model |
none, single_bit, multi_bit, row, retention |
none |
gem5 | DRAM device error model | DRAM error models |
dram_multi_bit_count |
integer | 2 |
gem5 | bits for dram_error_model: multi_bit |
DRAM error models |
dram_row_size |
integer, bytes | 8192 |
gem5 | row size for dram_error_model: row |
DRAM error models |
dram_ecc_enabled |
boolean | false |
gem5 | SECDED over DRAM | DRAM ECC |
ruby_target_addr |
address | 0 |
gem5 | program (virtual) address whose line a ruby_* target faults; gem5 translates it to the physical line. 0 takes the address of ruby_target_symbol. Ruby runs only |
gem5 backend |
ruby_target_symbol |
symbol name | pingpong_var |
gem5 | symbol whose line is the coherence target | gem5 backend |
When to inject¶
| Key | Type / values | Default | Backends | Meaning | Manual |
|---|---|---|---|---|---|
injection_mode |
icount, breakpoint, timer, stepi |
icount |
QEMU, hardware (breakpoint) |
how the injection instant is named | When to inject |
inject_at_symbol |
symbol name | none | QEMU, hardware | breakpoint: stop at this symbol on every injection |
breakpoint |
inject_at_addr |
address | none | QEMU, hardware | breakpoint: stop at this address on every injection |
breakpoint |
inject_at_offset |
integer, bytes | 0 |
QEMU, hardware | offset added to inject_at_symbol / inject_at_addr |
breakpoint |
injection_pc_exclude |
list of "0xA-0xB" or {symbol, offset_start, offset_end} |
none | QEMU | PC ranges removed from the random breakpoint draw |
breakpoint |
breakpoint_kind |
soft, hardware |
soft |
QEMU | GDB breakpoint type; hardware is forced with checkpoint |
|
injection_icounts |
list of integers | none | QEMU | fixed instruction counts, used in order and cycled | icount |
precise_stop_margin |
integer >= 0 | unset | QEMU | has no reliable effect; leave unset | icount |
precise_stop_margin_i_know_it_is_broken |
boolean | false |
QEMU | apply precise_stop_margin anyway (it is ignored with a warning otherwise) |
|
timer_scale_factor |
number > 0 | 0.00001 |
QEMU | timer: seconds per instruction |
timer |
min_instructions |
integer >= 0 | 0 |
QEMU | timer, stepi: lower bound of the window |
timer |
max_instructions |
integer > min_instructions |
none | QEMU | timer, stepi: upper bound of the window |
timer |
inject_at_instruction |
integer | 0 |
gem5 | committed-instruction count to inject at when the faultlist gives none | gem5 backend |
warmup_instructions |
integer >= 0 | 0 |
gem5 | instructions simulated before the injection point is counted | gem5 backend |
Time limits and outcomes¶
| Key | Type / values | Default | Backends | Meaning | Manual |
|---|---|---|---|---|---|
timeout |
number > 0, or auto |
required | all | wall-clock limit per injection | Time limits |
timeout_factor |
number > 0 | 1.5 |
all | auto: multiple of the golden run time |
Time limits |
timeout_floor |
number > 0, seconds | 30 |
all | auto: minimum limit |
Time limits |
injection_timeout |
number > 0, seconds | none | all | exact limit; replaces timeout |
Time limits |
hang_icount_factor |
number > 0 | none | QEMU (icount only), gem5 |
stop a run past this multiple of the golden instruction count; outcome timeout |
Time limits |
crash_patterns |
list of strings | none | all | console text that ends the run as crash |
Fault classification |
completion_patterns |
list of strings | derived from observable_outputs |
all | console text that means the program has finished | |
detection_string |
string | none | all | console text that ends the run as detected |
Fault classification |
comparison_mode |
normalized, strict |
normalized whitespace | all | without observables: strict compares the console output byte for byte |
Fault classification |
Observables¶
| Key | Type / values | Default | Backends | Meaning | Manual |
|---|---|---|---|---|---|
observable_outputs |
mapping | none | all | what is compared with the golden run | What counts as correct |
observable_outputs.comparison |
exact, tolerance |
exact |
all | comparison mode | What counts as correct |
observable_outputs.variables[].name |
symbol name | required | all | file-scope volatile variable |
What counts as correct |
observable_outputs.variables[].type |
C type string, for example double[8] |
from the ELF | all | overrides the ELF type; no struct, union or bitfield | What counts as correct |
observable_outputs.variables[].tolerance |
number >= 0 | none | all | allowed difference under comparison: tolerance |
What counts as correct |
observable_outputs.variables[].compare |
boolean | true |
all | false: record only, do not compare |
What counts as correct |
observable_outputs.record_at_injection |
boolean | false |
all | read the variables at the injection instant into marker_readback.csv; also per variable |
What counts as correct |
observable_outputs.memory_regions[] |
{name, address, size} |
none | all | raw memory ranges compared with the golden run | |
state_capture_function |
symbol name | fim_exit |
all | where observables are read | What counts as correct |
Execution¶
| Key | Type / values | Default | Backends | Meaning | Manual |
|---|---|---|---|---|---|
num_workers |
integer >= 1 | 1 |
QEMU, gem5 | injections run at once; hfim run --workers N |
Workers |
continue_on_error |
boolean | true |
all | continue the campaign after an injection that fails to run | |
log_level |
DEBUG, INFO, WARNING, ERROR |
INFO |
all | campaign log verbosity |
Simulator¶
| Key | Type / values | Default | Backends | Meaning | Manual |
|---|---|---|---|---|---|
simulator |
name@version |
from the toolchain configuration | all | installed simulator package | Which simulator |
simulator_backend |
qemu, gem5, gem5-ruby, hardware |
qemu |
all | backend; hardware is in development |
Which simulator |
simulator_manifest |
path | none | all | manifest file to use instead of the installed one | |
runtime |
native, docker |
from the manifest | QEMU, gem5 | how the simulator package is run | |
qemu_path |
path | none | QEMU | QEMU binary, instead of a package; not with simulator. Without either, the toolchain profile for the ELF's architecture, then the machine default |
Which simulator |
gdb_path |
path | none | QEMU, hardware | GDB binary, instead of a package | Which simulator |
gdb_port |
1 to 65535 | 1234 |
QEMU | GDB stub port; differs from qmp_port |
|
qmp_port |
1 to 65535 | 4444 |
QEMU | QMP port | |
qemu_args |
list of strings | [] |
QEMU | appended last to every QEMU command line, golden run included | Firmware |
arch |
riscv64, riscv32, ... |
riscv64 |
all | architecture of the benchmark ELF | |
elf_path |
path | benchmarks/<benchmark>/build/<benchmark>_<arch>.elf |
all | benchmark ELF; with firmware, read for symbols only | Firmware |
cpu_model |
AtomicSimpleCPU, TimingSimpleCPU, MinorCPU, DerivO3CPU |
the board's cpu.model, else AtomicSimpleCPU; TimingSimpleCPU for a cache, coherence or Ruby target |
gem5 | CPU model; AtomicSimpleCPU is refused for a cache, coherence or Ruby target, pipeline targets need DerivO3CPU |
gem5 backend |
cpu_clock |
frequency, for example 1GHz |
the board's cpu.clock, else 1GHz |
gem5 | CPU clock | gem5 backend |
mem_backend |
gem5_builtin, dramsim3, nvmain |
gem5_builtin |
gem5 | memory model | gem5 backend |
cache_config |
mapping | the board's cache:, else built-in hierarchy |
gem5 | cache hierarchy: line_size, l1i_size, l1i_assoc, l1d_size, l1d_assoc, l2_enabled, l2_size, l2_assoc; a field it leaves out comes from the board |
gem5 backend |
checkpoint_dir |
path | none | gem5 | gem5 checkpoint to restore | |
gem5_binary |
path | FIM_GEM5_BINARY, else build/RISCV/gem5.opt |
gem5 | gem5 binary, instead of a package; not with simulator |
gem5 backend |
inject_config |
path | from the package | gem5 | gem5 configuration script of an injection run (fim_inject.py); a Ruby run uses fim_inject_ruby.py beside it |
gem5 backend |
gem5_platform |
se, or a platform the package ships scripts for (d1) |
se |
gem5 | the board the image runs on: d1 boots an Allwinner D1 bare-metal image in full system with the package scripts golden_d1 and inject_d1 |
gem5 backend |
gem5_args |
list of strings | [] |
gem5 | appended last to every gem5 golden and injection command; the D1 run controls go here | gem5 backend |
golden_config |
path | from the package | gem5 | gem5 configuration script of the golden run (fim_golden.py) |
gem5 backend |
memory_size |
size, for example 256MB |
the board's memory.size, else 256MB |
gem5 | simulated memory size | gem5 backend |
max_ticks |
integer >= 0 | 0 |
gem5 | stop the simulation after this many ticks; 0 means no limit |
gem5 backend |
dramsim3_ini |
path | none | gem5 | DRAMsim3 configuration for mem_backend: dramsim3 |
gem5 backend |
nvmain_config |
path | none | gem5 | NVMain configuration for mem_backend: nvmain |
gem5 backend |
check_bit_fault |
boolean | true for an ecc_parity_* target, else false |
gem5 | the flip lands on a check bit of the ECC or parity code, not on a data bit | gem5 backend |
mcpat |
boolean | false |
gem5 | estimate power with McPAT from the gem5 statistics of each run | |
mcpat_template |
path | none | gem5 | McPAT XML template the statistics are written into | |
mcpat_binary |
path or command | mcpat |
gem5 | McPAT executable | |
mcpat_translator |
path | scripts/gem5_to_mcpat.py |
gem5 | script that turns gem5 statistics into McPAT input |
Board and firmware¶
| Key | Type / values | Default | Backends | Meaning | Manual |
|---|---|---|---|---|---|
board_spec |
path | found through hfim.yaml |
all | the template's board.yaml |
Firmware |
qemu_machine |
QEMU machine | none | QEMU | -machine |
Firmware |
qemu_cpu |
QEMU CPU | none | QEMU | -cpu; rejected with firmware_path, where the machine defines its cores |
Firmware |
qemu_memory |
size, for example 2G |
none | QEMU | -m |
Firmware |
firmware_path |
path | none | QEMU | firmware every hart starts in | Firmware |
firmware_entry |
address | entry of the firmware ELF | QEMU | firmware start address; needs firmware_path |
Firmware |
sd_image_path |
path | none | QEMU | SD card image the firmware boots from; needs firmware_path |
Firmware |
guest_uart_serial |
path | none | QEMU | second UART written to a file; matched by crash_patterns; needs firmware_path |
Firmware |
Multicore¶
| Key | Type / values | Default | Backends | Meaning | Manual |
|---|---|---|---|---|---|
num_cores |
integer >= 1 | 1 |
QEMU, gem5-ruby | harts started; above 1 on QEMU needs breakpoint; rejected on classic gem5 |
Multicore |
target_core |
hart, list of harts, or random |
random with num_cores above 1 |
QEMU | hart whose registers take the fault | Multicore |
target_cluster |
integer >= 0, below the board's cpu.clusters |
0 |
QEMU | CPU cluster of target_core |
Multicore |
memory_per_core |
boolean | false |
QEMU | split the memory target into one slice per hart | Multicore |
Checkpoints, feeders and hooks¶
| Key | Type / values | Default | Backends | Meaning | Manual |
|---|---|---|---|---|---|
checkpoint.anchor |
fim_init, symbol, {symbol, offset}, or address |
required in checkpoint |
QEMU | where the snapshot is taken; needs breakpoint |
Running campaigns |
checkpoint.restore |
per_injection |
per_injection |
QEMU | restore before every injection | Running campaigns |
checkpoint.recycle_every |
integer >= 0 | 0 |
QEMU | completed injections after which the campaign coprocess (feeder) is restarted; 0 never restarts it. The snapshot is not retaken |
Running campaigns |
checkpoint_locations |
list with one anchor | none | QEMU | older form of checkpoint.anchor; not with checkpoint |
|
serial_pty |
boolean | false |
QEMU | connect the guest UART to a PTY | Writing a benchmark |
serial_feeder_cmd |
command; {pty} is replaced |
none | QEMU | process started per injection that talks to the PTY; older name of coprocess.injection |
Writing a benchmark |
coprocess.injection |
command, or {cmd, ready_timeout} |
none | QEMU | process started per injection | |
coprocess.campaign |
command, or {cmd, ready_timeout} |
none | QEMU | process started once per campaign; not with coprocess.injection |
|
hooks.campaign_start, hooks.injection_start, hooks.injection_end, hooks.campaign_end |
command | none | QEMU | command run at that point | |
hook_timeout |
integer > 0, seconds | none | QEMU | limit for each hook command |
Output¶
| Key | Type / values | Default | Backends | Meaning | Manual |
|---|---|---|---|---|---|
output_dir |
path | results |
all | parent of the result directory | Output |
results.save_per_injection |
boolean | true |
all | a directory per injection | Output |
results.save_uart_output |
boolean | true |
all | output.txt per injection |
Output |
results.save_register_dump |
boolean | false |
QEMU, hardware | registers.json per injection |
Output |
results.save_observable_state |
boolean | true |
all | state.json for sdc outcomes |
Output |
results.cleanup_injections |
boolean | false |
all | delete injections/ when the campaign ends |
Output |
results_store |
URI, for example ssh://user@host/path |
HFIM_RESULTS_STORE |
all | where the bulk of a campaign is stored | Output files |
golden_dir |
path | golden/<benchmark> |
all | golden run directory |
Build¶
The Build Settings. A campaign sets them, or a file it includes, like any other key. hfim run passes them to the SDK's build.sh as arguments, and the build record names that same command, so changing a setting rebuilds. A benchmark directory holds no Build Setting: build.sh run by hand builds with its defaults. With hfim-sdk 1.3 or later the build reads nothing else: build.sh gets every setting, the compiler and the startup code as arguments. OPTFLAG in the environment sets the optimisation level when no file does, and a run where it disagrees with a file is refused. RISCV_CC and AARCH64_CC choose the compiler, which the build record identifies by its content. A campaign setting needs hfim-sdk 1.2 or later; an older SDK refuses the build rather than ignore it. A template that builds with its own command (build: in hfim.yaml) refuses a campaign that sets one.
| Key | Type / values | Default | Backends | Meaning | Manual |
|---|---|---|---|---|---|
build_runtime |
nostdlib, newlib (riscv64 only), zephyr |
nostdlib |
all | runtime the benchmark is built against | Writing a benchmark |
build_toolchain |
name | first RISC-V GCC on PATH |
all | cross toolchain, a name in the SDK's toolchains/ folder or on PATH |
Writing a benchmark |
build_optflag |
O0, O1, O2, Og, ... (-O2 is the same as O2) |
O1 |
all | compiler optimisation level; no effect on a .s source |
Writing a benchmark |
Hardware¶
In development; see Hardware backend.
| Key | Type / values | Default | Backends | Meaning | Manual |
|---|---|---|---|---|---|
hardware |
mapping | from board.yaml |
hardware | debug link settings, merged over the board's | Hardware backend |
hardware_trigger |
none | hardware | |||
probe |
name@version |
none | hardware | debug probe package | |
probe_manifest |
path | none | hardware | probe manifest to use instead of the installed one |