Regressions and Triage
Run a suite again and again with seeds, and keep the first failure of each run. Then sort a night of failures into buckets by signature, so one person debugs one run per bug.
You Will Be Able To
- Describe a regression: a suite, its seeds, its modes and its control runs.
- Explain why only the first failure of a run is kept.
- Build a signature that masks what changes from run to run and keeps what names the check.
- Sort a set of failures into buckets, give each an owner, and spot a bucket split across modes.
- Lesson
- V12.4
- Time
- 28 min
- Runs on
- Your browser
- Check
- 5 questions
Monday morning, the regression report shows 40 failures. Forty separate bugs would mean forty debug sessions. One bug seen forty times would mean one. The first job is to find out which.
- Test
- Result
- Report
- Data
- Analysis
- The night's runs
Every reference test ran on the seat with 9 seeds and once on the processor, on five chips. 40 runs failed, all on candidate builds.
- First lines
Each failing run keeps its first error. There are 17 different lines, because the seeds move the cycle numbers.
- Signatures
Masking cycles and data words leaves 6 signatures: 6 buckets.
- Bugs
Two firmware fail codes name the same register reads as two seat messages. Joined, the buckets are four: one per bug.
Read the diagram as text
- 600 runs: 12 tests, two modes, 9 seeds
- 40 failures: the first error of each
- 17 distinct lines: cycles differ by seed
- 6 signatures: cycles and data masked
- 4 bugs: one per candidate build
- 600 runs → 40 failures: keep failures
- 40 failures → 17 distinct lines: first line
- 17 distinct lines → 6 signatures: mask
- 6 signatures → 4 bugs: join modes
Recorded on ap_soc v1.5 by tools/probes/socv/record-v12-labs.mjs (section regression). The four candidate builds each carry one seeded bug.
Before You Start
Read Ending a Test Honestly and One Bench, Two Modes first. The words regression and seed are defined in the Design Verification Fundamentals track; Random Instruction Streams uses seeds on the core.
| Question | |
|---|---|
| 1 | What makes a set of tests a regression? |
| 2 | Why keep only the first failure of a run? |
| 3 | What is a signature, and what should it mask? |
| 4 | How can one bug make two buckets, or one bucket hide two bugs? |
| 5 | What does a control run on the good build prove? |
The Idea: Many Failures, Few Causes
A regression runs the same suite of tests after every change to the design, the bench or the tests. Random tests run with many seeds, so each night tries new stimulus. When something breaks, many runs fail at once, because many tests pass through the broken part.
Most of those failures are the same bug seen again. Debugging each one would waste days. So you sort them first, by a short fingerprint of how each run failed: its signature. Runs with one signature go into one bucket. One person debugs one run of each bucket.
The sort is only as good as the signature. Keep too much of the message and every seed makes its own bucket. Keep too little and two different bugs share one. The lab below shows both errors on the real chip.
New Words
| Word | Meaning |
|---|---|
| Regression | Running the whole suite again after a change, to catch what the change broke. |
| Suite | The set of tests a regression runs. |
| Seed | The start value of a run's random numbers. The same seed replays the same run exactly. |
| First failure | The first error a run reports. Later errors are often its consequences. |
| Signature | A fingerprint of a failure: its first error message with the parts that vary from run to run masked. |
| Bucket | The failures that share one signature. |
| Triage | Sorting failures into buckets and choosing one run of each to debug. |
| Candidate build | A version of the design under test in the regression, before it is accepted. |
The Smallest Example: One Bug, Eight Seeds
A small register block loses a write that comes in the cycle right after another write. A test writes four registers with random gaps of zero or one cycle, then reads them back. It runs with seeds 1 to 8. Its signature is the register whose read failed first.
| Seeds | First failure | Bucket |
|---|---|---|
| 1, 2, 6, 7, 8 | reg1 read back 00 | read reg1: data |
| 4 | reg2 read back 00 | read reg2: data |
| 5 | reg3 read back 00 | read reg3: data |
| 3 | none: every gap was 1 | pass |
From the runnable example below. The cycle of each failure differs; the signature leaves it out.
Seven failures, three buckets, one bug. The signature named the register, and the register depends on where the seed put the first gap of zero. A better signature for this bench would name the kind of failure: a lost write. Seed 3 passed because no write followed another directly: a seed can miss a bug.
The Rules
Rule 1: Keep the first failure of each run.
Once something breaks, later checks fail because of it. The chip bench stops at its first checker error for this reason.
Rule 2: Mask what varies, keep what names the check.
Cycle numbers and data words change with the seed. The checker, the row and the register address do not.
Rule 3: Give each bucket one owner, who debugs one run.
The owner is the person nearest the failing check, often the block's designer. Pick the shortest failing run, with its seed, and replay it exactly.
Rule 4: Look for one bug in two buckets, and two bugs in one.
The same check in two modes can print two messages; one message can come from two causes. Check across modes and builds.
Rule 5: Record the seed and the build of every run.
A failure you cannot replay cannot be debugged.
Rule 6: Run a control on the good build.
If the control fails, the bug is in the bench or the test, not in the candidate.
| Step | What you do | Rule |
|---|---|---|
| 1. Control | Read the good build's runs first. If any failed, stop: fix the bench or the test. | 6 |
| 2. First failure | From each failing run keep only its first error line. | 1 |
| 3. Signature | Mask cycles and data; keep the check, the row and the address. | 2 |
| 4. Bucket | Group runs with equal signatures and count each bucket. | 2 |
| 5. Fold | Join buckets that name the same check in two modes; split one that mixes builds. | 4 |
| 6. Owner | One owner per bucket replays its shortest run, with seed and build. | 3, 5 |
The method this lesson teaches; the lab below runs it on the chip.
Sources for These Rules
Regressions combine directed and constrained-random tests on many machines, in random order. Failures go back to the designers: MEHTA-DV 15.5.5 (PDF p319-320). Speeding regressions up with acceleration, emulation or prototypes: MEHTA-DV 16.11 (PDF p328-329) and module V13.
The end of a test and the first checker error: tools/soc/ap_soc/bench/soc_tb/README.md, "The end of a test". The row interpreter's fail code is the entry number counted from 1: soc-rows.mjs.
Signature, bucket and triage are common practice; the masking used here is this lab's choice, defined in tools/probes/socv/record-v12-labs.mjs.
The Lab: A Night of Regression on the Chip
First the toy, on the site's Icarus:
seed 1: cycle 9: reg1 = 00, expected 11
seed 2: cycle 18: reg1 = 00, expected 11
seed 3: pass
seed 4: cycle 38: reg2 = 00, expected 12
seed 5: cycle 48: reg3 = 00, expected 13
seed 6: cycle 56: reg1 = 00, expected 11
seed 7: cycle 63: reg1 = 00, expected 11
seed 8: cycle 71: reg1 = 00, expected 11
7 of 8 runs failed
bucket "read reg1: data": 5 run(s)
bucket "read reg2: data": 1 run(s)
bucket "read reg3: data": 1 run(s)Now the chip. The suite is the reference tests of the chip's seeded-fault catalogue: 12 tests across the blocks. Each ran on the bus-manager seat with 9 seeds of random gaps between rows, and once on the processor. That is 120 runs per chip. They ran on the good chip and on four candidate builds, A to D, each with one seeded bug.
Rule 6 first: all 120 control runs on the good chip passed. So every failure below is a bug of a candidate build, not of the bench. There were 40 failures, with 17 different first lines. Masked into signatures they fell into 6 buckets:
| Runs | Signature | Where |
|---|---|---|
| 9 | bench: seat: read 02000000 = DATA, expected DATA (mask 00000003) | A msip seat |
| 1 | firmware: fail code 0003 | A msip cpu |
| 10 | MONITOR spi: frame 0: 32 clocks | B spi seat; B spi cpu |
| 10 | MONITOR dma: the byte written is not the byte read | C dma seat; C dma cpu |
| 9 | bench: seat: read 1000000c = DATA, expected DATA (mask 000000ff) | D uart seat |
| 1 | firmware: fail code 0007 | D uart cpu |
record-v12-labs.mjs, section regression. Build, test and mode are shown here for the lesson; the triage used the signature alone.
Rule 4 at work. Build A's bug breaks the readback of CLINT MSIP. On the seat it prints a bench message naming the address 0x0200_0000. On the processor, the row interpreter writes fail code 3: its third entry is that same read. Two signatures, one bug. Build D shows the same split. The SPI and DMA bugs were caught by block monitors, which print one message in both modes: one bucket each.
So six buckets fold into four, one per bug, and four owners can start at once. Each bug failed on all nine seeds and on the processor, which tells you something too. For these four bugs the random gaps did not matter.
The chip has older regressions of its own. Stage E7 ran the core in lockstep with its model on 2,000 random programs, each to its pass word. It compared 1,128,404 records in 24 fields over 2,537,139 cycles, with 0 mismatches. And every problem of this track runs again whenever the site is built. Each reference answer must pass, and each known wrong answer must fail. That is a regression of the course itself.
Why It Is Built This Way
Why run a directed test with many seeds? Because seeds change timing. The gaps between seat rows move every access to a different cycle against the clocks of the other blocks. A bug that needs one exact alignment shows on some seeds only. Here none did, and the regression proved that too.
Why one bug per candidate build? The chip's bench can seed one bug at a time. A real candidate may carry several, and then rule 4 matters more. One test can hit two bugs, and its first failure shows only the earlier one.
Traps
The first trap is the raw message as signature. The cycle number is part of the text, so every seed makes its own bucket. The report shows forty problems, and the team splits forty ways to debug one bug.
The second trap is the signature that masks too much. Strip every number and address, and the MSIP readback and the UART receive check both read "seat: read DATA expected DATA". Two bugs share one bucket. The first is fixed, the bucket shrinks, and the second bug looks like a flaky test.
The third trap is the missing control. A bench change breaks a pad model on the same night as a design change. Without a control run on the good build, the team debugs the design for a day before anyone looks at the bench.
At Scale
This section looks ahead. This regression was 600 short runs on one laptop.
Server farms
Chip regressions run thousands of tests a night on hundreds of machines, scheduled by a regression manager.
Automatic triage
Tools compute signatures, file one ticket per bucket and close it when the bucket empties.
Night against night
Each night's buckets are compared with the last. A new bucket after a change is narrowed to the commit that caused it by rerunning older builds.
Faster engines
When a suite outgrows the night, teams move parts of it to acceleration or emulation; module V13 covers these platforms.
Try It
Run it: eight seeds, the first failure of each, and the buckets.
Run only seeds 3 and 4 (the predict question below). How many runs fail?
Change the signature to "lost write" for every failure. How many buckets are left?
seed 1: cycle 9: reg1 = 00, expected 11 seed 2: cycle 18: reg1 = 00, expected 11 seed 3: pass seed 4: cycle 38: reg2 = 00, expected 12 seed 5: cycle 48: reg3 = 00, expected 13 seed 6: cycle 56: reg1 = 00, expected 11 seed 7: cycle 63: reg1 = 00, expected 11 seed 8: cycle 71: reg1 = 00, expected 11 7 of 8 runs failed bucket "read reg1: data": 5 run(s) bucket "read reg2: data": 1 run(s) bucket "read reg3: data": 1 run(s)Check Yourself
Common Mistakes
Wrong Use the raw error message as the signature.
Cycle numbers and data change with the seed, so every run makes its own bucket.
Fix Mask what varies and keep what names the check.
Wrong Debug the last error of a failing run.
Later errors are usually consequences of the first.
Fix Keep and debug the first failure.
Wrong Skip the control runs on the good build.
A bench or test bug then looks like a design bug.
Fix Run the suite on the good build too, every night.
Remember
- A regression reruns the suite after every change, with seeds and in both modes.
- Keep the first failure; mask what varies; bucket by signature; debug one run per bucket.
- One bug can make two buckets, and two bugs can share one.
- A control run on the good build tells chip bugs from bench bugs.