Repository navigation
perf(platform): copy the initialised RAM 64 words a round - #15
Merged
Merged
Conversation
_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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
platform/entry.S:_startcopies 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:.rodatais aligned to 32, the largest alignment of its input sections, which lld warned about.Measured with Airbender CLI
7a147da, outputs unchanged:.data): -25,756 cycles on every block, e.g. opcodes 1,828,267 -> 1,802,511.Testing
build/ci.sh: all vectors, platform tests and ISA checks pass.Remarks
🤖 AI agent (Claude Code / Opus 5.5) on behalf of @LukaszRozmej