Skip to content

BN254 block multiplier (assembly version)#30

Merged
recmo merged 10 commits into
xr/rtzfrom
xr/block-multiplier-sys
May 6, 2025
Merged

BN254 block multiplier (assembly version)#30
recmo merged 10 commits into
xr/rtzfrom
xr/block-multiplier-sys

Conversation

@xrvdg
Copy link
Copy Markdown
Collaborator

@xrvdg xrvdg commented May 1, 2025

This PR adds inline assembly for bn254 block multipliers. This is a partial replacement for the Rust version as this PR doesn’t include an optimised squaring routine. Even with this the Rust version is useful as a fallback option on non-NEON architectures and as a reference implementation for testing.

Motivation
The motivation for an assembly version is to have predictable performance. With the Rust version we’ve seen that small changes to the source can have big performance differences. Which makes it likely to be susceptible to changes in Rust/LLVM as well.

Concurrent multiplications
Three concurrent multiplication has been the best performing on Raspberry Pi 5 (130ns for 3 multiplication vs 97ns for a single multiplication. On Apple Silicon (M3) we saw an improvement of ~6% running four concurrent multiplication compared to a single multiplication.

Depends on #28
Tracking: #35

@xrvdg xrvdg marked this pull request as draft May 1, 2025 03:37
@xrvdg xrvdg mentioned this pull request May 2, 2025
@xrvdg xrvdg changed the title Assembly for montgomery multipliers of size 3 and 4 BN254 block multiplier (assembly version) May 2, 2025
@xrvdg xrvdg marked this pull request as ready for review May 2, 2025 06:53
@xrvdg xrvdg requested review from Dzejkop, Quarky93 and recmo May 2, 2025 06:53
@recmo recmo merged commit 6db5c0e into xr/rtz May 6, 2025
0 of 2 checks passed
@recmo recmo deleted the xr/block-multiplier-sys branch May 6, 2025 18:04
@recmo recmo restored the xr/block-multiplier-sys branch May 6, 2025 18:17
@recmo recmo deleted the xr/block-multiplier-sys branch May 6, 2025 18:18
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