Skip to Content
marmot

This page shows the state of marmot in three groups. "Works" is on by default. "Opt-in" is off by default and needs a switch. "Planned" is not built yet. Experiments has the measurements for each item, and Support has the platforms and the test results.

Works

AreaState
Native buildsmacOS on Apple Silicon and Linux on x86-64. Linux on arm64 builds.
Build modesdev (tier0, the fast code generator), -O 0 to -O 3, -O s, -O z, and -release (whole program optimization).
cgoPackages that import "C" build. Cross builds for Linux use a sysroot from marmot sysroot add.
Static Linux executablesmarmot build -static links with musl.
WebAssembly-target wasip1/wasm works. It is in progress. /play runs programs with it in the browser.
Run in the browser/play builds and runs an edited program in the page. Browsers with JSPI use the JSPI runtime.
Line-only source locationsOn in optimized builds. MARMOT_LOC_COLS=1 keeps the columns.
Park clearOn. A parked goroutine does not keep dead pointers alive. MARMOT_PARKCLEAR=0 turns it off.
Pointer-free data sectionsOn. Package variables without pointers go to sections that the collector does not scan. MARMOT_NOPTR=0 turns it off.
Scan records for package dataOn. The collector scans each package variable with pointers precisely. LLVM builds only. MARMOT_GCVARS=0 turns it off.
Constant literal imagesOn. Constant composite literals and map literals come from static data. MARMOT_LITCOPY=0 turns them off.
tier0 on x86-64Uses the same middle as arm64.
MIR in dev buildsOn. MIR is a new function IR and register allocator for tier0. In the perfcmp gate, dev programs ran in 0.778 of the earlier wall time. MARMOT_TIER0_MIR=0 turns it off.
tier0 code qualityOn. Address folding, dominating checks, range checks and two-address registers (x86-64). MARMOT_TIER0_ADDR=0, MARMOT_TIER0_DOMCHECKS=0, MARMOT_TIER0_RANGES=0 and MARMOT_TIER0_TIE=0 turn each one off.
tier0 loopsOn. Range loops drop the bounds check that the loop test decides. Loop counters and their increments share a register. On x86-64, 32-bit integer arithmetic uses 32-bit instructions. In the gate, dev programs ran in 0.989 of the earlier wall time. MARMOT_TIER0_RANGELOOP=0, MARMOT_TIER0_TIEPARAM=0 and MARMOT_TIER0_ALU32=0 turn each one off.
tier0 coverage and registersOn. MIR converts floats to 8, 16 and 32-bit integers, takes aggregates of up to 64 pieces and inlines small leaf functions of the same module. On x86-64, a value that lives across calls stays in a register. MARMOT_TIER0_SATNARROW=0, MARMOT_TIER0_PIECES64=0, MARMOT_TIER0_INLINE=0 and MARMOT_TIER0_CALLSAVE=0 turn each one off.
Stable tier0 namesOn. Local symbols of dev builds take their names from the names that the module defines. MARMOT_TIER0_STABLENAMES=0 turns it off.
Memory reuse on macOSOn. Memory that the runtime gave back is counted again in the footprint when it is used again. MARMOT_MADV_REUSE=0 turns it off.
Split reachOn. Each split group of a large module copies only the definitions that it reaches. MARMOT_SPLIT_REACH=0 turns it off.
No huge pages for heap metadataOn, on Linux. The card table, the page map and the heap bits do not use transparent huge pages. Small programs use about 2 MB less memory. MARMOT_NOHUGE=0 turns it off.
Split by program sizeOn in -release. Large builds split by program size, and functions are grouped by call graph. MARMOT_SPLIT_ADAPT=0 turns it off.
Branch alignment on x86-64On in builds other than dev. Each branch stays inside a 32-byte boundary, which avoids the JCC erratum of some Intel CPUs. MARMOT_BRANCH_ALIGN=0 turns it off.
Escape setOn. Escape summaries, escape analysis across packages and the extended escape rules. MARMOT_ESCAPE_SUMMARY=0, MARMOT_XPKG_ESCAPE=0 and MARMOT_ESCAPE_EXT=0 turn each part off.
Race detectorOpt-in with -race for marmot build, marmot run and marmot test. Native linux/amd64 only, not with -static. It finds the race in 348 of the 362 race tests of gc that run, with no false reports.
Init sectionsOn for ELF and macOS targets. Package init code goes to its own text section. MARMOT_INITSECT=0 turns it off. On iOS, MARMOT_INITSECT=1 turns it on.
Build infoOn. go version -m and runtime/debug.ReadBuildInfo show the module versions, build settings and git state of a binary. -buildvcs sets whether the git state is recorded. MARMOT_BUILDINFO=0 turns it off. Wasm builds and test binaries do not carry it yet.
Fixed-address Linux executablesOn. The default Linux executable is position dependent, as go build makes it. tuios in -release starts in 5.5 ms instead of 8.1 ms and uses 25.8 MB of memory instead of 33.6 MB. MARMOT_NOPIE=0 gives a PIE by default. A -pie or -no-pie in #cgo LDFLAGS or MARMOT_LDFLAGS wins.
PIE builds-buildmode=pie builds a position independent executable on Linux, with address randomization (ASLR). It packs relative relocations only where the C library supports DT_RELR. Other links get a plain PIE.
Defer record elisionOn. A function that cannot panic does not keep a defer record. MARMOT_DEFERELIDE=0 turns it off.
Memory statisticsruntime.MemStats reports NumForcedGC, HeapIdle and HeapReleased. debug.FreeOSMemory returns every free page to the OS.
File and line in dev tracebacksOn. Dev builds on Linux that reuse tier 1 objects name the file and line in tracebacks. MARMOT_PCLN_SYMFUNCS=0 turns it off.
Stable split namesOn. Split modules get names from their content, not from the cache key. A switch that changes only the key leaves -O 2 binaries the same. MARMOT_SPLIT_NAMEHASH=0 turns it off.
Part orderOn. Module parts link in package and part order. MARMOT_PART_ORDER=0 turns it off.
marmot verifyReports panics that can happen, with code M0120. marmot check -verify runs it with the other checks.
Reproducible paths-trimpath records no directory of the build machine.
Reproducible objectsThe backend gives the same object in every run and for every input path. On macOS, two links of the same objects give one binary.
Build cacheEvery switch that changes objects is part of the cache key. The key also holds the build of the backend and the LLVM version. Package keys hold the content of the backend and of the runtime bitcode. A -nocache build gives the same binary as a cold cached build.

Opt-in and being measured

Each switch below is off by default. It becomes the default only when perfcmp exits 0 in dev, -O 2 and -release. Experiments says how this gate works.

SwitchWhat it doesState
MARMOT_NILDOM=1No nil check of a value that an earlier check of the same value dominates.Opt-in. The perfcmp gate is in the queue.
MARMOT_HOME_INSTANCES=1Home instances: a large generic instance or wrapper is emitted once, in an instances module. Whole program -release builds only.Opt-in. The perfcmp gate is in the queue.
MARMOT_ROCONV=1A []byte(s) conversion uses the memory of the string, with no copy, when the callee does not write or keep the slice.Opt-in. It waits for its gate.
MARMOT_DEVIRT1=1Escape analysis follows an interface call when the receiver has only one possible type.Opt-in. It waits for its gate.
MARMOT_APPENDMAKE=1append(s, make([]T, n)...) grows the slice in one step.Opt-in. It waits for its gate.

Other opt-in switches:

SwitchWhat it does
MARMOT_BOXSCALAR=1In -release, small integers, floats and bools go into interfaces without an allocation.
MARMOT_APPENDSTACK=1An append to a nil slice that stays in its function uses a 32-byte buffer in the frame.
MARMOT_SYSMON_EAGER=1The system monitor sleeps as soon as every processor is idle, as in go. A program that wakes now and then has fewer idle wakeups.
MARMOT_TRACE_V2=1Set it when you build the program. runtime/trace then writes Go execution traces that go tool trace and golang.org/x/exp/trace read. Native builds only, not with -race or -static. It needs make -C runtime/core tracev2. GC, heap and CPU sample events are not written yet.
MARMOT_DWARF=1ELF binaries keep DWARF line tables and function symbols. gdb, lldb and perf then show files and lines.
MARMOT_LOOPS_VERSION=1Bounds check versioning of loops in builds without -par. The guard of a versioned loop drops conditions that other conditions imply. The backend option -loops-version-short also versions short nested loops. The backend option -loops-rtsign adds run-time sign checks for strides and coefficients of unknown sign.
MARMOT_WB=cardsCard marking write barriers for a concurrent collector.
MARMOT_VERIFY_SMT=onEngine B of marmot verify, which uses z3 for what engine A leaves open.
MARMOT_TEST_SLOW=1When you build marmot from source, its tests include the slow driver tests.
LLVM_RELEASE=1Builds marmot against the official LLVM release, when you build marmot from source. Works on Linux and on macOS on Apple Silicon.

Accelerators

The research is done. Go on accelerators has the research note. Stage 1 started on 2026-11-19. In stage 1, marmot compiles Go loops to CUDA kernels, with a CPU fallback. marmot build -gpu builds kernels for NVIDIA GPUs from sm_75 on. A -gpu binary runs parallel loops on the GPU by default. MARMOT_GPU=0 keeps them on the CPU. Without a CUDA driver, the loops run on the CPU with the same output. Builds without -gpu do not change. A matrix multiply written as nested Go loops runs on the GPU, with results equal to Go on the CPU. On an RTX 3070, a 2048 x 2048 float32 multiply takes 169 ms on the GPU and 8.9 s on 8 CPU cores. Progress has the numbers. The first milestone is inference of GPT-2 small on a GPU. Early numbers: a tiled float32 kernel reaches 0.77x to 0.88x of cuBLAS on the RTX 3070. Before, it was 70x to 82x slower. Stage 2 started. In step 1, a GPT-2 small forward pass in pure Go, built with marmot, gives the same outputs as Hugging Face. The test uses 3 prompts. This work is not on main yet.

Planned

These items are next steps in the experiment notes. None is built yet.

  • Flip each opt-in switch above when its perfcmp gate exits 0.
  • The release LLVM as the default.
  • Engine B of marmot verify on by default, after the soundness fuzzer runs a full day clean.
  • Growable goroutine stacks on wasm.
  • Direct goroutine handoff in the JSPI runtime.
  • A precise scan of package data with dirty-page tracking, on Linux and macOS.
  • Precompressed play tools, about 8 MB smaller, if the static host accepts them.

On this page

Was this page helpful?

Report an issueOpen issues