Skip to content

perf(platform): copy the initialised RAM 64 words a round - #15

Merged
maximmenshikov merged 2 commits into
mainfrom
perf/start-copy-64-words
Nov 28, 2026
Merged

maximmenshikov merged 2 commits into
mainfrom
perf/start-copy-64-words

Conversation

@LukaszRozmej

Copy link
Copy Markdown
Member

Changes

  • platform/entry.S: _start copies the initialised RAM block (the guest's .data) from ROM 64 words a round instead of 8. The delegations cannot read ROM, so the copy stays loads and stores. With eight words a round the pointer steps and the branch took 3 of every 19 instructions; with 64 words they take 3 of 131, about 2.05 instructions a word instead of 2.38. The rounds load and store through one register, as Airbender runs one instruction a cycle with no load delay.
  • platform/airbender.ld: .rodata is aligned to 32, the largest alignment of its input sections, which lld warned about.

Measured with Airbender CLI 7a147da, outputs unchanged:

  • Nethermind ZKsync OS guest (about 310 KiB of .data): -25,756 cycles on every block, e.g. opcodes 1,828,267 -> 1,802,511.
  • Nethermind Ethereum trusted-input guest: about -34k cycles per block on 3 mainnet blocks (26507065, 26507101, 26507131).

Testing

  • build/ci.sh: all vectors, platform tests and ISA checks pass.
  • Guest outputs are the same with and without the change on the blocks above.

Remarks

🤖 AI agent (Claude Code / Opus 5.5) on behalf of @LukaszRozmej

_start copies the RAM block (the guest's .data, about 310 KiB for the ZKsync OS guest) from ROM with loads and
stores, as the delegations cannot read ROM. With eight words a round the pointer steps and the branch took 3 of
every 19 instructions; with 64 words a round they take 3 of 131, about 2.05 instructions a word instead of 2.38.
The rounds load and store through one register, as Airbender runs one instruction a cycle with no load delay.

.rodata is aligned to 32, the largest alignment of its input sections, which lld warned about.

ZKsync OS guest (airbender-runner 7a147da, family sum): -25,756 cycles on every block, e.g. opcodes
1,828,267 -> 1,802,511 and storage-second-block 1,600,285 -> 1,574,529; outputs unchanged.
@maximmenshikov
maximmenshikov merged commit 595a1a8 into main Nov 28, 2026
5 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.

2 participants