Skip to Content
marmot

Area: the LLVM pipeline, linking, code size and build time. Data: perfcmp and MARMOT_IRSTATS runs on linux/amd64 (8 CPUs per build) from 15 to 17 November, and the LLVM build profile of 15 November. Also the front end's per-function SSA counts of a tuios -release build.

1. Gaps

GapMeasurementSPEC 3c goalDistance
Cold -release build timetuios: go 28.6 s wall and 133 s CPU, marmot 223 s wall and 1086 s CPU (15 Nov), with tonight's static backend and split reach, 245 s wall and 1040 s CPU at a busier timeat most 0.8x of goabout 8x away
Parallel use of the build machinetuios -release: 1040 s CPU in 245.6 s wall on 8 CPUs, so 4.2 busy cores on average (53%), -O 2: 1423 s CPU in 315 s, 4.5 cores (56%)(part of build time)up to 1.9x of wall time is idle cores
Binary sizetuios dev 92.9 MB against go 70.1 MB (1.33x), -release text 21.2 MBat most 0.8x1.66x short in dev

| Peak memory from stale stack roots | bench jsondec peak RSS 2.16x go (68 against 31 MB). After a forced GC go keeps 713 objects, marmot 272,851: main's frame keeps dead locals and the previous result reachable for the conservative scan (the runtime's measurement). With the runtime register fix and a noinline split: 148,849 objects, 42 MB | at most 0.7x | 3x short on this row |

Run time is in good shape for my area (perfcmp geomeans within noise of 1.0 between backend changes). The run time gaps are allocation bound library code, which is the front end's and the runtime's.

2. Evidence

Build time and parallelism

Size

3. Candidates for marmot

CandidateGapExpected gainCostRisk
A. Build schedule: measure the -release timeline (frontend, each unit's start and end), then largest units first, cut the critical path (finer split of the last large units, start LLVM units while the frontend still emits)build wall timefrom 53% toward 80% use of 8 cores: up to 1.5x less wall time, CPU unchanged2 to 4 dayslow: output unchanged if units are the same, scheduling only
B. Less work per unit: module passes (GlobalOpt, GlobalDCE, IPSCCP, the CGSCC walk) cost about 20% of optimizer time and scale with the whole module, including the runtime bitcode and declarations each unit carriesbuild CPU5 to 10% of optimizer CPU2 daysmedium: pass changes change output, needs perfcmp
C. Dedup of optimizer input (split reach, home instances): measured -6% (O2) and -19% (release) input with split reach, -7% more with home instancesbuild CPU5% to 14% optimizer time, measureddone, gates runninglow
D. Identical code folding at link for -release (Go functions only, safe mode first)size2% to 6% text by the Chromium numbers, more for generic instances that differ only in type descriptors they do not use1 to 2 daysmedium: traceback names of folded functions, needs an address significance table
E. MachineOutliner on cold code (panic paths, init) at -release, arm64 firstsize2% to 4% text1 day to tryrun time if it touches hot code

| F. strconcat's hot loop (total += int(t[i]) & 3) is vectorized with SSE2 at 2 bytes per iteration, zero-extended to 64-bit lanes | run time | narrower lanes (sum in 32 or 16 bits with a widening reduce at the end) or AVX2 for -release when the target allows: 2x to 8x more bytes per iteration in the loop | 1 to 2 days (loop vectorizer cost model, or a reduction width pass before it) | low with a gate, AVX2 needs a target feature decision |

| G. Precise stack maps for pointer locals (statepoints, the parked aggregate design) or, cheaper, zeroing dead pointer spill slots before allocation slow paths as park clear does before park calls | memory | jsondec peak RSS 68 MB toward about 36 MB (the runtime's estimate) | statepoints: 1 to 2 weeks with the frontend ABI part, slot zeroing: 2 days | statepoints change every object, MARMOT_GCPTR=1 fails to build -release today (ptr against ptr addrspace(1) at go.nil_check) |

4. Pick

  1. A, the build schedule. It is the largest lever on the 3c build time gap that does not change output: the machine is half idle during a -release build. The first step is a measurement (a per-unit timeline). The cause of the idle cores decides the fix: a serial front end phase, a long last unit, or an admission limit.
  2. D, identical code folding, for size, after A.

C is already measured and in its perfcmp gates.

On this page

Was this page helpful?

Report an issueOpen issues