Skip to content

Alpenglow, VM, Performance Enhancements and bug fixes - #293

Merged
NeerajGodiyal merged 194 commits into
alpenglow-devfrom
7layer/streaming-execution-overlap
Sep 25, 2026
Merged

NeerajGodiyal merged 194 commits into
alpenglow-devfrom
7layer/streaming-execution-overlap

Conversation

@smcio

@smcio smcio commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Various fixes and perf improvements to Alpenglow, the VM, SBPF, the runtime, and mithril generally.

Keep full-field independent coefficients and existing verification admission. Use sequential G1/G2 MultiExp with one arithmetic task for at least 16 members, retaining the scalar path where setup costs dominate. Preserve individual fallback and failed-batch subdivision.

Validate invalid members, wrong payloads and cancelling shares across both paths. Document local component and execution-contention measurements; native and live validation remain pending.
Native contention tests showed that MultiExp task handoffs can increase certificate wall time with GOMAXPROCS=1. Preserve the original scalar path there while retaining bounded MultiExp for larger batches on multi-thread runtimes.

Repeat combined native race tests, adversarial tests at one and two threads, vet and build. Record both fold gains and noisy execution samples; no live voting improvement is inferred.
7layermagik and others added 27 commits September 24, 2026 00:17
Preserve the exact c1f7134 source tree. The new prerequisite stack contains the earlier code plus upstream epoch fixes and execution review corrections already present here; this merge changes review ancestry only.
…en transfer)

Consensus-neutral performance changes to pkg/sbpf, validated against the
unmodified interpreter with a 100k-program differential corpus (identical
return values, errors/PCs, CU consumed, meter remaining, memory contents,
input-region state) plus the package's unit tests:

- meter instructions with a local due/budget pair synced around syscalls
  and on exit (Agave's due_insn_count scheme) instead of calling
  ComputeMeter.Consume per instruction
- move cold opcodes to executeCold so Run drops below the compiler's
  "big function" threshold and Consume/Read*/Push/Pop/fast paths inline
- zero only the dirty range of the pooled stack/heap in Finish (page
  bitmap on the fast path, byte range on the translate path) instead of
  256 KiB + HeapMax per execution
- per-window fast-path address translation table (Agave aligned mapping
  layout, branch-free v0 frame gaps, one-entry cache for VASA input regions)
- 16-wide register file (no bounds checks on r[dst]/r[src]), in-place
  call-frame Push/Pop, precomputed internal call targets per Program

pooling_test writes through the VM's translation layer now, since the pool
only re-zeroes memory the VM saw written (all production writes go through
translation).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ctTQDHudYoF3FhmgmvY2y
- perf_bench_test.go: synthetic ALU / load-store / call loops and
  interpreter setup+teardown
- loader/token_perf_bench_test.go: real SPL Token Transfer through the
  loader/verifier/interpreter with sealevel-equivalent syscalls, in the
  aligned and VASA input layouts
- perf_differential_test.go: deterministic random program corpus; run on
  two builds with SBPF_DIFF_OUT=<file> and diff the outputs;
  SBPF_CHECK_POOL_ZERO=1 asserts pooled buffers come back zeroed

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ctTQDHudYoF3FhmgmvY2y
…TowerSync)

Measured through ExecutionCtx.ProcessInstruction so instruction-context
push/pop, lamport-sum checks and timing metrics are included; each has a
NoTiming variant (SkipTimingMetrics) to quantify instrumentation cost, plus
a vote-state (de)serialization round trip. NOTE: written without a local
build of pkg/sealevel (sandbox cannot fetch its dependencies); expect to
fix compile errors on first run.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ctTQDHudYoF3FhmgmvY2y
…e loops

sol_memcpy_/sol_memmove_ read the source into a fresh heap buffer and wrote
it back; the copy now goes directly between the two translated slices with
Go's memmove-semantics copy (overlap handled, source translated first so
error precedence is unchanged, and a copy-on-write/growth of the
destination region still reads the pre-write bytes because the source slice
keeps the previous backing buffer alive). sol_memcmp_ uses bytes.Equal for
the common equal case and word-skips to the first differing byte otherwise;
sol_memset_ uses clear for zero and a doubling copy for other values. An
SPL Token transfer issues two memcpy and four memcmp calls, so this is a
small, allocation-free win rather than a large one.

Tests: memcmpResult against the previous byte loop on 100k random inputs,
memsetBytes over sizes and values, and VM-level memmove/memcpy overlap,
error-ordering, copy-on-write-region and memcmp/memset checks.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ctTQDHudYoF3FhmgmvY2y
LtHash.MixIn/MixOut are 1024-lane uint16 add/subtract loops that run twice
per modified account in the accounts delta hash (once for the old value,
once for the new). The scalar loop costs ~560 ns per call in the sandbox
and roughly 350 ns on Zen 5, so a block with ~10k modified accounts spends
several milliseconds of worker CPU on lane arithmetic alone.

On amd64 with AVX2 the lanes are now mixed with VPADDW/VPSUBW, 16 lanes per
instruction, four vectors per iteration, unaligned loads and stores
(28 ns per call here, 20x). Dispatch is a package variable set from
cpu.X86.HasAVX2 (golang.org/x/sys is already a direct dependency); other
architectures, CPUs without AVX2 and the purego build tag keep the
portable loops, which remain the reference. Equals now compares the two
arrays directly (runtime memequal) instead of a lane loop.

Tests compare the assembly and the dispatched functions against the
portable loops on random lanes including wrap-around values, check that
MixOut inverts MixIn, that aliased operands behave, and that the generic
fallback is selectable; go vet's asmdecl check passes and the package
builds under -tags purego and GOARCH=arm64.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ctTQDHudYoF3FhmgmvY2y
@smcio smcio changed the title Alpenglow, VM, and Performance Enhancements Alpenglow, VM, Performance Enhancements and bug fixes Sep 24, 2026
@NeerajGodiyal
NeerajGodiyal merged commit edd8851 into alpenglow-dev Sep 25, 2026
6 checks passed
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.

4 participants