Running flows
This page explains what happens when doris runs a flow: how a run is split into jobs and steps, how one step runs, and what its outcome means. A job’s outcome is only as strong as the checks behind it, so this page also says what doris does not check.
doris plan FLOW [DESIGN...] # what would run; runs no step, only the tools' version commands
doris run FLOW [DESIGN...] # run it
FLOW is testrig or lint. A DESIGN is a design’s name, as its design.hjson gives it. With no design, the run covers every design that configures the flow. Command line lists every command and option.
Jobs, steps and directories
A run is made of jobs. A job is one design in one flow with one tool bound to each of the flow’s roles, named FLOW/DESIGN@TOOL after the tool in the flow’s main role: testrig/my_core@xcelium, or lint/top_chip_system@verilator. TestRIG has one job per simulator bound for the design. Lint has one per linter bound for the design, in each context the design has: lint/top_chip_system/uart@verilator is uart linted with that top’s mappings.
Several tools for any role give a job for each combination. A role other than the main one adds its tool to the name, after a +, when it has several, as in testrig/my_core@xcelium+imc. A role with one tool is not in the name. No role but a main one has two tools that work in the same job today, so these longer names don’t come up yet.
A job is a graph of steps. Each step runs one command and has its own directory:
scratch/doris/<flow>/<job>/
result.json the job's result
report.html the job's report, made from the result
<step>/
stdout.log the step command's stdout
stderr.log the step command's stderr
<service>.log stdout and stderr of a service the step started
... whatever the command wrote
<job> is the job’s name without the flow: <design>@<simulator> for TestRIG and <design>@<linter> for lint. A TOP/NAME is written TOP.NAME there, so job directories are never nested. Everything a run writes goes under scratch/doris/ in the repo root, and nowhere else in the repo.
A step that passed keeps only its declared outputs. Its logs and everything else it wrote are deleted when it ends, unless they are outputs. A step that failed or did not complete keeps its whole directory, and doris run --debug keeps every step’s. See Working directories.
The flow pages say which steps each flow has. The step pages say what each one runs and checks.
Planning a run
doris plan FLOW DESIGN prints the jobs as a tree of their IDs, with each job’s steps under it: a step sits under the step it runs after, and is marked cached or will run. A step that runs after several is put under the last and its note names the others. doris plan -v FLOW DESIGN prints the whole graph without running it: each step’s directory, the steps it runs after, its inputs, exact command, services and outputs, and whether it would run or come from the cache. The plan is what doris will do. Compare it with the flow and step pages when reviewing a run.
doris plan runs no step, but it does run each tool’s version command, such as verilator --version, once per tool. A tool’s version is part of each step’s cache key, and the plan needs the keys to say what is cached.
--until STEP keeps only STEP and the steps it depends on, for plan and run alike. It is the way to work on one part of a flow, such as doris run testrig my_core --until build.
Checking the environment
doris runs tools from PATH and never installs one. Each step says what it needs of the machine, as prechecks, and doris check runs them all without running a step:
doris check # every configured flow
doris check testrig my_core # one run
testrig
ok program `make` on PATH /usr/bin/make
failed program `sail` on PATH not on PATH; needed by testrig/my_core@xcelium: model; testrig/my_core@verilator: model
ok program `xrun` on PATH /tools/cadence/bin/xrun
failed environment variable `UVM_HOME` set not set; needed by testrig/my_core@verilator: build
error: 2 of 5 prechecks failed; is the project's dev shell active?
Each flow has a line for each precheck its jobs make, in the order the steps first need them. A check that holds is ok, with how it is met, such as where the program was found. One that does not is failed, with why, and the steps of each job that need it. doris check exits 1 if any failed.
| Precheck | Made for |
|---|---|
A program on PATH | Every program a step runs by name, and those a command runs itself, such as the compiler a Makefile calls |
| An environment variable set | UVM_HOME, for a Verilator build with dut.uvm |
| A file or directory that exists | The replay trace directory, for a TestRIG run with --replay |
| A cgroup doris may write to | Every step that starts a process, with resources.enforce = cgroup |
doris run makes the same checks for its own jobs before any step starts. If any fails it prints each as a setup error: line and exits 2, CANNOT_RUN. So a missing tool or variable fails in seconds, not after an hour of upstream steps.
doris checkreads the same settings asdoris run, files,--settingsand--setalike, so it checks with the pool sizes and tool directories the run would have.- Resource pools are not prechecks. They are the scheduler’s: a step starts only when every pool it holds has enough left. Before any step starts,
doris checkanddoris runboth check that no step needs more of a pool than the pool’s size, since such a step could never start. - With enforcement on, every step that starts a process needs what the setting needs: with
systemd,systemd-run,systemctl,busctland a user systemd manager that answers; withcgroup, a cgroup doris may write to with thememoryandcpucontrollers. - A program a step is given by path is not checked. It is usually built by an earlier step, such as the QCVEngine binary.
- A check says that a tool is there, not that it works. A licence server that can’t be reached is found when the step runs.
Tools not on PATH
The setting tools.NAME.path says where a tool that is not on PATH is. NAME is a tool config can bind, such as xcelium or verilator, and the value must be a directory. A site sets it once in its settings file, or a command gives it with --set:
doris run testrig my_core --set tools.xcelium.path=/tools/cadence/XCELIUM2409/bin
The directory is in front of PATH only for that tool: for the commands and services whose invocations use it, the programs they start, their prechecks and the tool’s version probe. Every other step’s command sees PATH as it is, so a program of the same name in that directory is not found by another tool. It is not part of any cache key.
How a step runs
flowchart TD
key[Compute the cache key] --> hit{Key stored?}
hit -- yes --> restore[Restore outputs and verdict] --> done([Done, cached])
hit -- no --> empty[Empty the step directory]
empty --> ports[Allocate a free port per service]
ports --> services[Start services, wait until each port is listening]
services --> cmd[Run the command]
cmd --> stop[Stop the services]
stop --> checks[Completion checks]
checks --> verdict[Verdict: passed or failed]
verdict --> store[Store verdict and outputs in the cache]
store --> clean[Clean the step directory] --> done2([Done])
Before the first step of a run starts, the prechecks of every step are run. Then, for each step:
- Cache key. A hash of everything that can change the result (see The cache). If the key is stored, the step’s outputs and verdict are restored and nothing runs.
- Empty the directory. The step’s directory is deleted and recreated, so nothing from an earlier run is left in it. This only happens when the step runs. A step taken from the cache keeps or restores its outputs.
- Staging. Just before a process starts, doris prepares what it needs: a directory, a symlink, or a copy of a source tree in the step’s directory. A copied tree holds the files git would track, plus untracked files that aren’t ignored. Build products lying in the repo are not copied.
- Services. Some steps need programs running beside the command, such as the simulator in TestRIG’s run step. Each service gets a free TCP port. doris starts every service, then waits for each to be ready. Both of TestRIG’s are ready when their port is listening, read from
/proc/net/tcp. doris does not connect, because an RVFI-DII server accepts only one connection. A service that is not ready within its start-up timeout is a setup error. - Command. One program and its arguments, run without a shell, in its own process group, with stdin closed. It inherits the whole environment doris was started in. A few steps are functions inside doris and run no command.
- Stop services. Each service has a rule: terminate it with SIGTERM, or wait a given time for it to exit by itself. A service that then has to be killed is a step error.
- Completion checks, in this order. Failing any of them is a step error, not a failure:
- no service died or had to be killed against its stop rule;
- the command was not killed by a signal;
- the exit code is one the step accepts (0 unless the step says otherwise);
- every declared output exists;
- every pass pattern matches in the output it names, such as
stdout.log.
- Verdict. A step with a parse function has its results parsed first, in-process, into one of its outputs. A step that completed fails if its judge says so, from the exit code, the step’s directory and the parsed results, if one of its fail patterns matches in the output it names, or if it exited with a code other than 0 and is failed by that, as TestRIG’s
runstep is. Otherwise it has passed. A pattern is a regular expression, matched line by line. Only TestRIG’srunstep has a pass pattern, and no step has a fail pattern yet. - Store. A passed or failed step’s verdict and outputs go to the cache.
- Clean up. A step that passed has its directory deleted, except its outputs. A step that failed or did not complete keeps it whole. See Working directories.
Order and parallelism. A step runs after the steps whose outputs it reads. doris plan shows them as a tree, and doris plan -v as after .... Steps with no dependency between them run in parallel, up to -j N at once (default: the number of CPUs). The jobs of a run are scheduled together, so -j limits the steps of all of them, and steps of different jobs run at the same time. Each job’s result is written as soon as its last step ends.
A step two jobs share runs once. When two jobs have a step with the same cache key, such as the reference model in a design’s Xcelium and Verilator TestRIG jobs, one job runs it. The other waits, and takes it from the cache.
Progress. doris run prints a line when each step starts and ends, with the local time of day, and a line for each thing a running step does: a service starting and listening, the command starting and ending, a service being stopped, the result being cached. A [ wait ] line says that a step is ready but held back, by a resource pool or by another job running the same step. A step’s own output is not printed. It goes to the log files in its directory, which the progress line names. Those files are there while the step runs, and afterwards only if the step keeps them.
Status. On a terminal, doris run keeps a table below the progress lines and redraws it as steps move on. It has a row for each step name, counting the steps of that name over every job by where they are, and a row for all of them when there is more than one name:
STEP PROGRESS QUEUE WAIT RUN PASS FAIL ERR SKIP TOTAL RUNNING, 00:00:11 in
filelist █████████▒▒▒▒▒░░░░░░ 48% 0 15 13 26 0 0 0 54 lint/top_chip_system/spi_host@slang, …
flatten █████████░░░░░░░░░░░ 48% 28 0 0 26 0 0 0 54
lint █████████░░░░░░░░░░░ 46% 28 0 1 23 2 0 0 54 lint/top_chip_system/spi_device@verilator
all █████████▒▒░░░░░░░░░ 47% 56 15 14 75 2 0 0 162
| Column | Steps that |
|---|---|
QUEUE | Depend on steps that have not ended |
WAIT | Are ready, and held back by -j, a resource pool or another job running the same step |
RUN | Are being looked up in the cache or run. Their jobs are listed at the end of the row |
PASS | Passed, run or taken from the cache |
FAIL | Failed |
ERR | Ended in a step error or a setup error |
SKIP | Were skipped |
The bar is the share of steps that have ended, and the percentage beside it the same. When the output is not a terminal there is no table: a [status ] line gives a step name’s counts when the last step of that name ends, such as lint: 54 steps: 47 passed, 7 failed.
Resource pools
A step holds resources for as long as it runs: CPU threads, memory, disk space, licences. Each kind is a resource pool with a name and a size, and the steps running at once never hold more of a pool than its size. A step that needs more than is left waits.
| Pool | Counts | Size unless set | Held by |
|---|---|---|---|
threads | CPU threads | The machine’s CPU threads | Every step: one for each of its processes, or every thread for a parallel build |
memory | Bytes of memory | The machine’s memory | Steps the flow’s config gives a memory |
disk | Bytes of disk in the scratch directory | The space free there when a step asks | Steps the flow’s config gives a disk |
xcelium | Xcelium licences | The CPU threads, at most 16 | One by each xrun: TestRIG’s build and run steps with Xcelium |
imc | IMC licences | The CPU threads, at most 16 | One by each imc: TestRIG’s coverage step for an Xcelium job |
ascentlint | AscentLint licences | The CPU threads, at most 16 | One by each ascentlint: the Lint flow’s lint step with AscentLint |
doris plan -v shows what each step holds.
What a step holds comes from two places. The tool’s plugin says what its commands hold that is the same for every design: a licence, and how many threads. A parallel build, such as Verilator’s or cabal’s, takes every thread of the pool and is told how many that is, so it runs with no other step beside it. How much memory or disk a step needs depends on the design, so the flow’s config says, under resources and the step’s name:
// testrig.hjson
resources: {
build: { threads: 8, memory: "24G", disk: "10G" }
run: { memory: "8G" }
}
threads here replaces what the tool asks for, for the step’s command: the build above takes 8 threads and is told to use 8, where it would have taken them all. A name that is not a step of the flow is an error.
A tool can have values of its own, under STEP@TOOL, where the tool is the one the step’s command runs: doris plan -v shows it after runs. Different linters and simulators need different amounts, so the same step can too:
// lint.hjson
resources: {
lint: { memory: "128M" } // every linter
"lint@slang": { threads: 3 } // slang alone
"lint@verilator": { memory: "256M" } // Verilator alone, in place of 128M
}
Each of threads, memory and disk is taken from STEP@TOOL if it sets it, and from STEP if not. A tool no plugin has is an error, as a step no job has is.
A service has values of its own, under STEP.SERVICE, and STEP.SERVICE@TOOL for one tool. TestRIG’s run step runs QuickCheckVEngine as its command, and the reference model and the simulator as its services, reference and dut, each with its own needs:
// testrig.hjson
resources: {
run: { memory: "1G", disk: "2G" } // QuickCheckVEngine, and the step's disk
"run.dut": { memory: "4G" } // the simulator
"run.dut@xcelium": { threads: 2 } // Xcelium alone
"run.reference@sail": { memory: "512M" }
}
STEP is then the command’s share. What the step holds is the sum of its parts: the command’s threads and memory, and each service’s. The step is scheduled as a whole, with that sum, as a service only ever runs for its step’s command. Disk is the step’s alone, since its parts share its directory, so a service’s key can’t set it. doris plan -v shows what each part holds under the step, and the step’s total beside its name.
A pool’s size is the setting pools.NAME: in a settings file, or for one command with --set pools.NAME=SIZE. memory and disk take sizes such as 64G, the others a count, and unlimited takes the limit away. The system and user settings files can also put a limit on a pool that no later layer can raise.
doris run testrig --set pools.xcelium=2 # at most two xruns at once
doris run lint --set pools.threads=8 --set pools.memory=32G
- A step that needs more of a pool than is left waits. Steps that need nothing from that pool go ahead of it. Steps after it in the plan that do need the pool wait behind it, so a step that needs a lot is not kept waiting by a stream of small ones.
- A step holds its resources only while it runs: from when its services and command start until they have ended. A step taken from the cache holds nothing.
- A step that needs more than a pool’s size could never start, so
doris runexits 2,CANNOT_RUN, before any step starts, naming the step. - Resources are reserved, and enforced only if the settings say so. By default a step that uses more memory or threads than it holds is not stopped. The run’s metrics show what each step used, which is what to set its
memoryfrom. See Enforcing what a step holds. diskcounts free space, less what running steps hold. A step starts only if the scratch directory’s filesystem has that much free beyond what the steps already running have reserved. Without enforcement it is a check that there is room, not a quota. With it, a step that writes more to its working directory than it holds is stopped. Either way, what a step has written stays written after it ends.- Neither sizes nor what a step holds change a result, so they are not part of any cache key. The thread count a tool is told isn’t either.
-j still limits the steps running at once, whatever they hold. With the defaults it and threads are both the number of CPU threads, so threads is the one that holds a run back.
A commercial tool’s pool defaults to one licence per CPU thread, and to 16 on a machine with more, so a large machine does not take every licence a site has. Set it to what the site allows. With unlimited a pool limits nothing. Xcelium and IMC are run with -licqueue, and then wait in the licence server’s queue. AscentLint waits for a licence if its options give -wait_license, as those of lowrisc:lint:common do.
Enforcing what a step holds
With the setting resources.enforce, what a step holds is a limit, not only a reservation. Each step that starts a process gets a cgroup of its own for as long as it runs:
- Its memory limit is the memory it holds, with no swap. A step that holds no memory has no memory limit.
- Its CPU quota is its threads: one CPU’s worth of time for each thread it holds. A step that uses more threads is slowed down, not stopped.
- Every process of the step is in the cgroup: its command and its services, and what they start. A step with services has a cgroup below its own for each part, its command and each service, so each is measured on its own, but the limits are the step’s: one part may use what another leaves. A cache unit’s children share the unit’s cgroup.
- A step the kernel stops for going over its memory is a
step error:used more than the 8.0G of memory it holds, and was killed. For a step with services it says which part was killed, such as(its servicedut). That is the part whose process the kernel chose, its largest, which is not always in the part that grew. Give it more with the flow config’sresources. - A step that writes more to its working directory than the disk it holds is stopped, and is a
step error:wrote 3.1G to scratch/doris/..., more than the 2.0G of disk it holds. doris measures the directory while the step runs, every 2 seconds or less often if measuring it is slow, and again when it ends, so a step that writes a lot quickly can go over before it is stopped. Sources copied into the directory count. What it writes elsewhere does not. - The cgroup is removed when the step ends, after anything left in it is killed.
There are two ways to get the cgroups:
resources.enforce | Each step’s cgroup is | Needs |
|---|---|---|
systemd | A transient slice of the user’s systemd manager, with MemoryMax and CPUQuota. Each process is started with systemd-run --user --scope | systemd-run, systemctl, busctl and a user systemd manager that answers: a desktop session has one, and a CI container may not |
cgroup | A directory doris makes itself in a cgroup v2 hierarchy, with memory.max and cpu.max. Each process moves itself into it before it starts the program | A cgroup with the memory and cpu controllers that this user may write to: resources.cgroup, or the cgroup doris was started in |
# ~/.config/doris/settings.toml
[resources]
enforce = "systemd"
cgroup is for a machine with no systemd user manager, such as a container. A container with a cgroup namespace of its own, which Docker and Podman give by default on a cgroup v2 host, has its own cgroup at /sys/fs/cgroup. If it may write there, as a rootless Podman container or one run with --privileged may, resources.enforce = cgroup needs nothing else. Otherwise, give doris a cgroup delegated to its user with resources.cgroup, or start it in one, such as with systemd-run --user --scope -p Delegate=yes doris run ....
A cgroup that hands its controllers to cgroups below it can’t have processes of its own. So on the first step, doris moves every process in that cgroup, itself among them, to a new cgroup below it, doris_leaf, and makes each step’s cgroup beside it. Give doris a cgroup of its own, not one that other programs are in.
doris check and doris run check what the setting needs: for systemd, that systemd-run, systemctl and busctl are on PATH and that systemctl --user answers; for cgroup, that the cgroup has the controllers and is writable.
Pinning steps to CPUs
The CPU quota limits a step to its threads’ worth of CPU time, spread over every CPU. With resources.pin = true, each step is instead run on as many CPUs as it holds threads, and no other step runs on those CPUs while it does. A step’s processes are started with their CPU affinity set to its CPUs, so a tool that sizes itself by the CPUs it may use, such as make -j$(nproc), sees only those. It needs no enforcement, and works with either.
- The
threadspool must be no larger than the CPUs doris may run on, ordoris runexits 2,CANNOT_RUN, before any step starts. It is that size by default. - A cache unit’s children share the unit’s CPUs.
- A process can set its own affinity, so a tool that does is not held to its CPUs.
- A progress line says which CPUs each step runs on:
pinned to CPUs 4-7.
Metrics
doris measures every step, and doris run ends with a summary of what it measured:
metrics: 18 steps in 6 jobs: 18 ran, 0 cached, 0 skipped; 4.1 s wall, 12.9 s of steps, 12.1 s CPU; at most 4 steps at once (-j 4)
STEP TIME KEY WAITED CPU BUSY MEMORY HELD
lint/top_chip_system/uart@slang: filelist 1.5 s 0.32 s - 1.3 s 0.9 40.4M threads=1
lint/top_chip_system/i2c@verible: filelist 1.4 s - 2.2 s 1.2 s 0.9 40.9M threads=1
lint/top_chip_system/i2c@verilator: lint 1.0 s - - 0.92 s 0.9 67.7M threads=1
lint/top_chip_system/i2c@slang: lint 0.37 s - - 1.1 s 2.9 55.3M threads=1
...
and 8 steps that took less
POOL SIZE PEAK STEPS WAITED
threads 14 4 18 0.00 s
steps waited 4.5 s in all for the step limit (-j 4)
metrics: scratch/doris/lint/metrics.json
The first line has the totals: the time the run took, the time of the steps that ran added together, key included, and their CPU time. The table lists the ten steps that took longest to run, of those that ran.
| Column | Meaning |
|---|---|
TIME | How long the step took to run and store its outputs |
KEY | How long it took before that to work out its cache key and look for it in the cache: asking its tools for their versions and hashing its inputs. Each tool is asked once a run, so the first steps to need one take longest |
WAITED | How long it was ready but held back: by -j, by a resource pool, or by another job running the same step |
CPU | User and system CPU time of its command and services, and of the processes they started |
BUSY | How many CPUs it kept busy: its CPU time over its time. A second number is its busiest seconds, the 95th percentile, when that is higher by half a CPU or more |
MEMORY | The most memory the step had at once, every process together, page cache included. What was used, not what the step held. Marked * if the step was not measured: then it is the largest process alone |
HELD | What it held from the resource pools |
A second table has a row for each pool a step held some of: its size, the most held at once, how many steps held some of it, and how long steps waited for it in all. The last line is the same total for -j. Long waits for a pool, with a peak at its size, mean the pool is what limits the run.
Measuring steps
The kernel’s account of a process, when it is waited for, gives its CPU time and its own peak memory, not the peak of all the processes a step runs at once. A build that runs eight compilers at once uses about eight times its largest. So each step that starts a process is measured in a cgroup of its own, as enforcement uses, but with no limits: every process it starts, together. A step with services is measured for each part too, its command and each service, in a cgroup of its own below the step’s. While it runs, doris reads the cgroups each second and measures the step’s working directory as often as is cheap.
| Measured | From |
|---|---|
| Peak memory | memory.peak, or the most memory.current was |
| CPU time | cpu.stat, which counts processes no one waited for too |
| CPUs kept busy, on average | CPU time over the step’s time |
| CPUs kept busy, at its most | The 95th percentile of each second’s |
| Peak disk | The working directory’s size, at its largest |
The setting resources.measure says how steps get the cgroup when nothing is enforced:
| Value | Steps are measured |
|---|---|
auto | With systemd if systemd-run is there and the user manager answers, and not otherwise |
systemd | With a systemd slice, as resources.enforce = systemd makes |
cgroup | With a cgroup doris makes, as resources.enforce = cgroup does, in resources.cgroup |
off | Not: only each process’s own account |
With enforcement on, its cgroups are measured, whatever resources.measure says. A step that can’t be given a cgroup to be measured in runs without, and the run warns once. Starting a step in a systemd slice and stopping the slice takes a few hundredths of a second, on the step’s own thread.
The same numbers, for every step, are in the run’s metrics file. Each job’s result file and report page have its own steps’ numbers.
The metrics page shows them as interactive charts and tables. doris run and doris report FLOW write it to scratch/doris/<flow>/metrics.html from the metrics file, the flow’s index links to it, and doris report view serves it for the latest run and for every past run whose metrics the cache keeps. It has five tabs, and opens on the first:
| Tab | Shows |
|---|---|
| Summary | The run on one screen: the headline numbers, the steps running over time, the five longest steps, the time by step name, and the resource pools |
| Timeline | Every step that ran as a bar from its start to its end, in a band of rows for its step name, and below it how many steps were running, by step name, against -j |
| Longest steps | Every step with its time, start, time waited, CPU time, threads used and held, memory used and held |
| Time breakdown | Step time, CPU time, the longest step and the most memory, added up by step name, by tool and by job |
| Resources | Each pool’s size, peak and wait, how much of it was held over the run, and the steps by the memory they used. A step that used more threads or memory than it held is marked |
- Charts zoom. Drag over a chart to zoom into that part, scroll to zoom at the pointer, and double-click to see the whole run again. Hovering over a step gives its numbers, and clicking it opens its job’s page. Clicking a name in a chart’s legend hides it.
- The filter above the tabs applies to every chart and table: text that the job or step name must contain, and a box for each step name and tool. The headline numbers and the pools table are always of the whole run.
- Tables sort by the column whose heading is clicked. They show the first 100 rows, with a button for the rest.
- The address keeps the tab and the filter, so a link opens the page as it was, such as
metrics.html#tab=timeline&q=uart.
Threads used is CPU time over run time: the threads the step kept busy on average. Steps taken from the cache or skipped ran nothing, and are counted on the summary only.
The page is drawn by a script, with Plotly for the charts. Plotly is carried in doris and written to scratch/doris/<flow>/assets/plotly.min.js, beside the page, so the page needs no network. To move the page elsewhere, take the assets directory with it.
- CPU and memory come from the kernel, when doris waits for each process it started. They cover a process a tool started and waited for itself, which is the usual case. A process that outlives its parent is not counted.
- A step that started no process has neither: one taken from the cache, or one a plugin runs itself, such as
flatten. - A step measured in a cgroup has more: every process together, whether or not it was waited for, sampled each second while it runs (see Measuring steps).
Suggested resources
A repo can start with no resources in its flow configs, and get them as runs show what each step needs. Each run keeps what its steps used in the measurement store, and doris resources says from the store what each step should hold.
$ doris resources lint i2c
CONFIG STEP POOL NOW SUGGESTED RECORDS FROM
hw/ip/i2c/lint/lint.hjson filelist memory - 56M 15 p95 41.9M + 25%
disk - 2.5M 15 p95 1.8M + 25%
threads - 1 15 p95 0.9 CPUs busy, from runs: no sweep
lint disk - 1M 15 3 tools agree; the largest: p95 8.0K + 25%
lint@slang memory - 80M 5 p95 58.2M + 25%
threads - 5 5 p95 4.8 CPUs busy, from runs: no sweep
lint@verible memory - 12M 5 p95 8.8M + 25%
threads - 1 5 p95 0.8 CPUs busy, from runs: no sweep
lint@verilator memory - 112M 5 p95 77.5M + 25%
threads - 1 5 p95 1.0 CPUs busy, from runs: no sweep
10 values to change, from 30 records of 5 runs in ~/.cache/doris/measurements
A value is suggested for each part of a step and each tool it runs: slang, verible and Verilator lint at different speeds and sizes, as simulators run at different speeds. Where every tool’s value for a pool agrees, within resources.min_change, and exactly for threads, it is one value for the step, under STEP, the largest of them. Where they don’t, each tool has its own, under STEP@TOOL. A part that only ever runs one tool, such as filelist, which is FuseSoC in every job, has only STEP. Every job of the flow config counts, in every context. NOW is what the config gives the step, or the tool, and - if nothing.
A step with services has a row for each part: TestRIG’s run step has run, for QuickCheckVEngine, run.dut for the simulator and run.reference for the reference model, each from what that part used, and run.dut@xcelium where the simulators differ. Disk is suggested for the step, under run, as it is the step’s alone. Then run in all says what the step holds, the sum of its parts, now and with every suggestion taken. That is what the scheduler has to find room for. Jobs whose totals differ, as an Xcelium job’s and a Verilator job’s do, each have their own:
run memory - 384M 5 p95 286.1M + 25%
disk - 1.25G 5 p95 858.3M + 25%
threads - 1 5 p95 0.5 CPUs busy, from runs: no sweep
run.dut@verilator memory - 1.25G 5 p95 953.7M + 25%
threads - 4 5 p95 3.6 CPUs busy, from runs: no sweep
run.dut@xcelium memory - 3.5G 5 p95 2.8G + 25%
threads - 2 5 p95 1.8 CPUs busy, from runs: no sweep
run.reference memory - 256M 5 p95 190.7M + 25%
threads - 1 5 p95 0.9 CPUs busy, from runs: no sweep
run in all memory - 4.12G the sum of its parts, for xcelium
threads 3 4 the sum of its parts
memory - 1.88G the sum of its parts, for verilator
threads 3 6 the sum of its parts
A part with no value either way, set or suggested, is named after nothing for, and the total leaves it out.
- Memory and disk are the 95th percentile of the step’s peaks, plus 25%, rounded up to a round size. A step the kernel killed for its memory is given at least half as much again as it held then, whatever the other records say.
- Threads are the 95th percentile of how many CPUs the step kept busy in its busiest seconds, rounded up. They show what a step used while it ran beside others, not what more threads would be worth: a step that uses 4 CPUs may be as fast on 1.
from runs: no sweepsays so. - A value needs enough records,
resources.min_samples, 5 by default. With fewer, nothing is suggested, and the step stays as it is. - A part killed for its memory may not be the one that grew. The limit is the step’s, and the kernel kills its largest process, wherever that is. The part that held it has a record that says it was killed, and the next suggestion for that part is at least half as much again as it held.
- A value only changes by enough to matter: by more than
resources.min_change, 20% by default, unless it was too low. Small drifts are not worth a change to the config. - Only the newest 50 records of a step count. Older ones are of the design as it was.
- Only records of this repo count: those with the same
originremote URL, or, outside git, the same root.
doris resources suggests and changes nothing. The values go into the flow config by hand, for review like any other change.
The measurement store
The store is a directory of files, one per run, each a list of records in JSON: ~/.cache/doris/measurements, or the setting measurements.dir, or off to keep none. A run that ran a step adds a file and says where:
measurements: ~/.cache/doris/measurements/1796068732-buildhost-2103851.json
A record is one step that started a process in one run, or for a step with services, one part of it: its command, with the step’s disk, or one service. A step taken from the cache, skipped, or run by doris itself has none. It holds:
- the flow config file, relative to the repo root, the flow, design, job, step and service names, the tool the part runs, and the step’s cache key;
- the outcome, whether the kernel killed it for its memory, and what it held;
- how long it ran, and what it was measured to use: CPU time, peak memory, CPUs kept busy and peak disk. A step not measured in a cgroup has only its CPU time and largest process, and counts for nothing but its outcome;
- once per file: the repo’s
originURL, root, commit and whether it was dirty, the host’s name, CPU model, CPUs and memory, the time and the doris version.
A file per run means many machines can write to one directory on a shared filesystem with no locking. A CI job can instead keep its run’s file as an artefact, and it can be imported:
doris measurements import ci-artefacts/ # every file in the directory
doris measurements import run-1234.json # one file
Every file is checked before any is copied, and a file the store already has is not copied twice. doris gc removes the files of runs older than measurements.max_age, 365 days by default, or never.
Outcomes
Every step ends with exactly one outcome, so a problem with the environment is never reported as a failure of the design.
| Outcome | Meaning | Cached |
|---|---|---|
passed | The step completed and its verdict is pass | Yes |
failed | The step completed and its verdict is fail. This says something about the design | Yes |
step error | The step did not complete: a crash, a timeout, a dead service, a missing output. This says nothing about the design | No |
setup error | The step could not start: a tool or input is missing, a service was never ready, a port could not be allocated | No |
skipped | A step it depends on did not pass, or the run was interrupted | No |
A job’s outcome is the worst of its steps. From worst to best: setup error, step error, failed, skipped, passed. So a job with a failed step and the steps skipped after it is failed.
A step can be made to run after a failure. TestRIG’s coverage step is: it runs when the run step failed, because a run with a failing test still collected coverage. Such a step is still skipped when a step it depends on ended in a step error or a setup error, or was skipped itself. No other step runs after a failure.
doris run exits 0, OK, if every job passed; 1, FAILED, if the worst outcome is failed; 3, ERROR, for an error or a skip; and 2, CANNOT_RUN, if the run could not start. See Exit codes, and Interrupting a run for what Ctrl-C does.
Working directories
What is left in a step’s directory after a run depends on how the step ended:
| The step | Its directory after the run |
|---|---|
| Passed | Only its declared outputs |
| Failed | Everything, unless dirs.keep_failed is false |
| Did not complete: a step error, a setup error or an interrupt | Everything |
Ran in a run with --debug | Everything |
| Was taken from the cache | Its declared outputs, and whatever an earlier run kept there |
| Was skipped | Whatever an earlier run left |
After a normal run, a step that passed has no stdout.log or stderr.log, no service log and no scratch files, unless the step declares them as outputs. The step pages say what each step’s outputs are. Lint’s logs are outputs, and so are the engine’s and the simulator’s logs of TestRIG’s run step. The logs of the build steps are not. To read the log of a step that passed, run it with --debug:
doris run testrig my_core --until build --debug
--debugkeeps every step’s directory whole, and keeps each step’s debug outputs in the cache with its other outputs. A debug output is a file that is only of use for looking into a step, such as Xcelium’sbuild.log.- A debug run runs a step again if its cache entry was stored by a plain run, because that entry has no debug outputs. So the first
--debugrun after a plain one runs every selected step. Its entries then serve debug runs and plain runs alike: the cache keys are the same. - A step a debug run takes from the cache has its outputs and debug outputs, not its logs, unless its directory is still there from the run that stored it.
--debug --rerunruns every step and so always leaves the logs. - A failed step’s directory is kept so the failure can be looked into without running the step again. The setting
dirs.keep_failed = falsecleans a failure like a pass, which CI may prefer. - The job’s
result.jsonand reports are not affected. They are made from step outcomes and declared outputs.
A directory that was kept whole has a file .doris-kept in it, holding failed, interrupted or debug. debug is a step that passed in a debug run: one that failed in it is failed. Kept directories are removed in two ways:
- By age. At its start, every
doris runremoves the kept directories in the scratch directory that are older thandirs.work_max_age, of every flow. The default is 14 days. The setting changes it, such asdirs.work_max_age = "7d"in a settings file, andneverturns it off. - By
doris clean.
doris clean --dry-run # list every kept directory, with its kind and size
doris clean # remove them all
doris clean lint # only one flow's
doris clean testrig my_core # only one design's jobs
doris clean lint --tool verible # only the jobs that use one tool
doris clean --failed --debug # only those of failed steps, and of steps that passed in a debug run
failed 1.2M scratch/doris/lint/top_chip_system.uart@verilator/lint
interrupted 340.0M scratch/doris/testrig/my_core@xcelium/build
would remove 2 working directories, 341.2M
--failed, --interrupted and --debug pick the kinds. With none of them, every kind goes. doris clean removes a kept directory whole, outputs included. A step whose directory is gone is put back from the cache by the next run, if it has an entry. It never touches the directory of a step that passed in a plain run, a result file or a report, and it does not touch the cache. Neither it nor removal by age touches a job that a run is running: doris clean lists such a directory as in use and leaves it.
Runs at the same time
You can start several doris run commands at once in one checkout, in different terminals, from a script, or from CI jobs that share a workspace. Each run holds the jobs it runs, so two runs never work in the same job’s directory at once. Runs of different jobs go side by side, and a run that wants a job another run holds waits for it. Runs at the same time in the architecture explains how.
What that means in practice:
| You run, while another run is going | What happens |
|---|---|
Other jobs: doris run lint uart beside lint aes | Both run now. Each takes from the cache what the other has stored |
Another flow: doris run testrig beside doris run lint | Both run now. Every job of one flow is a different job from every job of the other |
The same job: doris run lint aes twice | The second waits until the first ends, then takes from the cache what the first ran, so it is quick |
Some of the same jobs: doris run lint beside lint aes | The second waits until the first ends, then runs. It runs none of its jobs until it holds all of them |
doris clean, or a run’s removal of old kept directories | Directories of jobs a run holds are left. doris clean lists them as in use |
doris report FLOW, or doris report view | Works as usual. A job still running shows its last result |
doris gc | Waits for the runs to end, as it always has (see Collecting while runs are going) |
A run that waits says so before it starts any step, naming the job:
waiting for another doris run of scratch/doris/lint/aes@verilator to finish
- A waiting run has done nothing yet. It has planned and checked, but run no step and written nothing. Ctrl-C stops it at once.
- To run one job twice at once, use two checkouts. Each checkout has its own scratch directory, so it has its own jobs. Two runs of one job in one checkout would undo each other’s working files, which is what the wait prevents.
- Each run uses its own
-jand resource pools, as if it were alone. Two runs at once can together start twice the threads, memory and licences either is allowed. When that matters, give each a share, such as-j 8 --set pools.xcelium=2for each of two runs on a 16-thread machine with four Xcelium licences. - The flow’s report index and
metrics.jsonare those of the run that ended last. The index lists every job with a result file, whichever run wrote it.metrics.jsonand the metrics page are the last run’s alone. Each run’s own metrics stay with its GC root, anddoris report viewshows each past run. - Two runs can run a step that both need, once each. Within one run, a step that two jobs share runs once. Between two runs, each runs it if neither has stored it yet. Both results are correct, and the cache keeps one.
- Nothing to clean up after a crash. The wait is a
flocklock on the file.doris-lockin each job’s directory, which the system lets go when the run’s process ends, however it ends. The file itself stays and is harmless. - The scratch directory must be on a filesystem with
flock, as the cache must. On one without it, a run stops with an error before its first step.
What passed covers
A passed step means only what its checks cover. Most steps have no judge and no pass pattern, so passed means “exited 0 and wrote its outputs”. A build step that exits 0 without doing any work passes. Each step’s page says what passed means for it and what to check by hand.
These hold for every step, and matter when judging a run:
- Logs are not scanned for error lines. A tool warning or error that doesn’t change the exit code is not seen, unless the step’s page says its output is parsed.
- Commands get the whole host environment, not a filtered one. Only what a plugin declares is part of the cache key.
- Resources are what steps declare, not what they use. A step with no
memoryin the config holds none, however much it uses, and a tool that starts more threads than it holds is not stopped. See Resource pools. - A passed step’s logs are gone after the run, unless they are outputs of the step. Checking one by hand needs a run with
--debug(see Working directories). - Steps don’t use the network. doris never fetches sources or packages. Sources already in the repo are built as ordinary steps.
The roadmap covers what is planned here.