Skip to content

BN254 Block Multiplier (Rust Version)#34

Merged
recmo merged 3 commits into
mainfrom
quarky93/block-multiplier
May 6, 2025
Merged

BN254 Block Multiplier (Rust Version)#34
recmo merged 3 commits into
mainfrom
quarky93/block-multiplier

Conversation

@Quarky93
Copy link
Copy Markdown
Collaborator

@Quarky93 Quarky93 commented May 2, 2025

This PR introduces a new crate called block-multiplier. The crate provides a primitive for efficient modular multiplication, designed to serve as a low-level building block for higher-level cryptographic operations such as the Number-Theoretic Transform (NTT) and the Skyscraper hash.

This is work done by the working group:
Yuval Domb --- @yuvalingo
Xander van der Goot --- @xrvdg
Koh Wei Jie --- @weijiekoh
Tony Wu --- @Quarky93

Motivation

The core idea behind block-multiplier is to maximize throughput of modular multiplications by exploiting the parallelism between the scalar integer and floating-point SIMD pipelines available on modern ARM CPUs. Specifically, this design targets:

3 modular multiplications per block:
    1 via the scalar integer pipeline
    2 via the floating-point SIMD pipeline
On optimized platforms (like the Cortex-A76 in the Raspberry Pi 5), the goal is for the latency of a block (3 multiplies) to match that of a single scalar multiplication.

Platform Notes

Raspberry Pi 5 (Cortex-A76): Block size of 3 seem to be optimal. Performance gain significant.
Apple Silicon (M1, M3): Slight tuning differences may still be required.

Algorithms
The techniques implemented draw from the following works:

Yuval Domb @yuvalingo --- [multi-precision modular reduction scheme with only n^2 + 1 digit multiplications](https://hackmd.io/@Ingonyama/Barret-Montgomery)
Niall Emmart @nemmart --- [Modular Exponentiation Using Double Precision Floating Point](https://ieeexplore.ieee.org/document/8464792)

These works were implemented by Xander van der Goot @xrvdg in the modmulzoo repo.

Further improvements planned, but will be a future PR.

@Quarky93 Quarky93 requested review from Dzejkop, recmo and xrvdg May 2, 2025 03:33
@xrvdg xrvdg changed the base branch from main to xr/rtz May 2, 2025 04:55
Copy link
Copy Markdown
Collaborator

@xrvdg xrvdg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed the base branch from main into xr/rtz (#28) for easier review.

@recmo
Copy link
Copy Markdown
Contributor

recmo commented May 6, 2025

Interesting. Apparently if I delete the target branch (which was merge into main), it auto-closes any outstanding PRs. Furthermore, the 'reopen' button is disabled and I can not change the target branch to main. 🤔

@recmo
Copy link
Copy Markdown
Contributor

recmo commented May 6, 2025

ok, re-created the target branch.

@recmo recmo reopened this May 6, 2025
@recmo recmo changed the base branch from xr/rtz to main May 6, 2025 18:11
@recmo recmo merged commit 98e787f into main May 6, 2025
0 of 2 checks passed
dcbuild3r pushed a commit that referenced this pull request May 16, 2026
BN254 Block Multiplier (Rust Version)
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.

3 participants