Skip to content

Run the 386 lane without an emulator, because qemu-i386 loses float state - #26

Merged
tannevaled merged 1 commit into
mainfrom
native386
Sep 26, 2026
Merged

tannevaled merged 1 commit into
mainfrom
native386

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

What this changes

The 386 lane stops using qemu-i386 and runs the test binary directly on the
x86-64 runner. Every other lane is unchanged.

Why — measured, not assumed

The 386 lane panicked in go-gfx/gfx at a line the arithmetic makes impossible.
Two instrumented runs passed, which looked like the instrumentation mattering —
until the lane was sampled properly. Eight identical lanes on one commit,
repeated for each condition:

condition failures
under qemu-i386 5 of 8
under qemu-i386, GODEBUG=asyncpreemptoff=1 0 of 8
native on the same runner, preemption on 0 of 8
under qemu-arm 0 of 8

If the true rate under emulation were 5/8, seeing 0/8 has probability
0.375^8 ≈ 4e-4, so asynchronous preemption is the mechanism and the emulator is
the variable. Each failure landed on a different input although the seed is
fixed, and the wrong value was a sign flip rather than a rounding difference:
qemu-i386 loses the guest's floating-point state across the signal Go delivers
to preempt a goroutine.

The control for "did it really run without the emulator": qemu-user-static
registers binfmt_misc handlers, so the riscv64 lane ran under qemu in both
conditions and took 71 s in both. The 386 lane went from ~85 s to ~40 s. Same job
shape, one lane moved.

Why this is the right fix rather than a retry

A lane that goes red at random teaches people to ignore red. Emulating 386 buys
nothing here — a 386 ELF is a native binary on this runner — so the lane is
faster and it only fails for reasons that belong to us.

arm stays under qemu-arm: there is no native option, and it was clean in
8 of 8.

🤖 Generated with Claude Code

…tate

The 386 lane panicked in go-gfx/gfx at a line the arithmetic makes impossible,
and sampling eight identical lanes per condition on one commit said why:

  under qemu-i386                     5 failures out of 8
  under qemu-i386, asyncpreemptoff=1  0 out of 8
  native on the same runner           0 out of 8
  under qemu-arm                      0 out of 8

Each failure landed on a different input although the seed is fixed, and the
wrong value was a sign flip rather than a rounding difference. qemu-i386 loses
the guest's floating-point state across the signal Go delivers for asynchronous
preemption.

A 386 ELF runs natively on an x86-64 runner, so the emulator bought nothing.
Control that it really ran native: qemu-user-static registers binfmt handlers,
the riscv64 lane took 71 s under both conditions, and the 386 lane went from
~85 s to ~40 s.

arm keeps its emulator: there is no native option and it was clean 8 of 8.
@tannevaled
tannevaled merged commit d5b36b3 into main Sep 26, 2026
7 checks passed
@tannevaled
tannevaled deleted the native386 branch September 26, 2026 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant