Experiments
How marmot tests a change before it becomes the default, and the notes of each area.
marmot changes a default only after a measurement shows that the change is safe and not slower. The pages in this section record the experiments of each area of the compiler. Each experiment gives what changed, why, the measurement, the verdict and the next step. An area can also have research notes, designs and reviews of designs. A design is a plan. It is not built until its own experiment lands.
How a change becomes the default
Land it behind a switch
A change that can alter what a program does, or how fast it runs, lands behind an environment variable.
The switch is off by default, so default output does not change.
An example is MARMOT_PART_ORDER=1.
Pass conformance
tests/conform builds and runs each test program with the switch on.
It compares the output, the exit status and the panic message with goldens from the stock Go toolchain.
Changes to code generation also run generated programs and compare their output with gc.
Compare A against B with perfcmp
tests/perfcmp builds the same programs twice: side A without the switch and side B with it (-b-env).
The programs are hello, ten bench programs, sketch and tuios.
perfcmp builds them in dev, -O 2 and -release.
The two sides run in turn, seven runs each, so a change in machine load hits both sides.
perfcmp compares the median wall time, CPU time, peak memory and size.
Flip only on a clean result
The default changes only when perfcmp exits 0 in dev, -O 2 and -release.
The commit that flips the default gives the perfcmp numbers.
The old behavior stays available: set the switch to 0, for example MARMOT_PARKCLEAR=0.
The perfcmp verdicts
| Verdict | Exit status | Meaning |
|---|---|---|
| ok | 0 | B is not slower than A by more than 2% and uses at most 3% more memory. |
| WORSE | 1 | B is more than 2% slower in wall or CPU time, or uses more than 3% more memory. |
| INCONCLUSIVE | 4 | The noise of a mode is above 2%, or the load went above half the CPUs. |
| FAILED | 5 | A build or a run failed on one side, or a ratio is not a number. |
The noise line compares each side with itself: its odd runs against its even runs. A verdict needs noise below 2%, because a 2% change must be visible.
The goals
The research notes measure the gaps against marmot's goals, which the notes call SPEC 3c.
For dev builds, the tier0 research note gives these goals against go build:
| Measure | Goal |
|---|---|
| Run time | at least 1.2x faster |
| Binary size | at most 0.8x |
| Memory | at most 0.7x |
| Build time | at most 0.8x |
Examples
- Line-only source locations passed perfcmp at -O 2 and -release and became the default (commit 08db8598).
- Park clear passed perfcmp in all three modes and became the default (commit 19aaa2c0).
- MIR for tier0 became the default, then a bug showed and the default went back (commits 14d3417b and 77acef69). The fix is in, and MIR is opt-in again until its gates pass.
The Status page lists the switches that are opt-in now.
Areas
Tier0 code generator
The fast code generator of dev builds and MIR.
Front end and code generator
Switches in the driver and the code generator.
Backend
LLVM, build time and the release LLVM.
Runtime
The collector, the scheduler and memory.
Verify
Proofs, budgets and the soundness fuzzer.
Playground and measurement tools
Run in the browser and the benchmark tools.
Modern toolchain features
What a modern toolchain has, and where marmot stands.
Self-hosting
marmot builds itself: stages, times and sizes.
Go on accelerators
Research on deep learning in Go on GPUs and other accelerators.