Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Cache

Built: every step is cached by itself in a per-user cache, with GC roots, collection by age and size, and pinning. A cache unit is cached as a whole, and a debug run stores debug outputs. A key holds the version each tool’s probe reports, the host variables the tool names as its key_env, the hash of each plugin, and a key protocol for doris’s own part, bumped by hand, in place of doris’s version. See The cache, Cleaning the cache and Cache and results.

Host environment in the key

key_env is built, and Verilator as a simulator uses it for UVM_HOME (see What is in a key). No other tool names a variable yet. A plugin adds one as soon as it is found to matter.

Tool identity

  • A patched install that keeps its version string has the patch level added to the version its plugin reports. A plugin can only name a command whose output is the version, so this needs a way for a plugin to read the output; none does it yet.
  • A probe that fails gives the version unknown today, which is keyed like any other.

Include files

Include files are not in a filelist, only the include directories. By default, doris will hash the header-like files (.svh, .vh, .sv; the list is set per tool) under each +incdir. Where a tool writes a dependency file, such as Verilator --MMD, it uses that instead, which narrows the key to the files actually included.

FuseSoC resolution

Today the filelist step is keyed on every file under the cores roots, because it also copies the sources.

For FuseSoC generators, the generator’s script and declared inputs become part of the key, so generated IP never goes stale. With the file index below, checking the cores roots is a metadata scan, not a re-hash.

External inputs

Tool modules declare large libraries, such as foundry libraries, as external inputs, keyed by name and a version tag from site settings rather than by path or content. A cheap guard (the directory’s modification time, or the hash of a version file) turns a library replaced in place into a cache miss.

Hashing cost

Today inputs are re-hashed on every run.

A local index maps path, size, modification time, change time and inode to a content hash, as Cargo, Ninja and git do. Only files whose metadata changed are re-hashed. A file modified within the timestamp resolution of the last index write is always re-hashed, so a quick edit is never missed.

Forcing a rerun of part of a run

--rerun alone reruns everything selected, and --rerun=STEP,... the steps of those names. It will take the same -i/-x filter syntax as job selection too, such as --rerun='design=aes*', to rerun the steps of some jobs only.

Blobs

Entries store their outputs as content-addressed blobs, so identical outputs are stored once. Marking walks from roots to entries, from entries to their upstream entries, and from entries to blobs. Collecting by size keeps a reference count per entry, so removing one root at a time is cheap rather than re-marking the whole cache.

Today each entry holds its own copy of each output.

Cache units

Cache units are built: a unit has one entry, which stores only what it exports. Exports are not yet normalised, so a rerun of a unit can still change the keys downstream (see Normalised exports).

A shared cache

A shared or remote cache comes with remote launchers. Keys already hold nothing tied to one machine, so the format carries over.

Garbage collection

  • Limits on gc.*. The gc.* values come from the settings layers, but a site can’t cap them in limits (see Limits on more keys).
  • Protected roots under size pressure. Today collecting by size never drops a root keep_latest protects, and stops with a warning. The design has them go last, after all other roots.
  • Shorter locking. Today a run holds the shared lock from start to end, so doris gc waits for running runs. The design has collection lock only for the sweep.
  • Upgrading the cache’s files. Until the first release a schema change is a clean break: a root with another schema is removed by the next sweep, and an entry with another schema is not used, so its step runs again. From the first release, a change to doris/gc-root or doris/cache-entry comes with a transform that reads the older schema and converts it, so a newer doris keeps what an older one stored.