Skip to content

Optimised Montgomery squaring#108

Merged
Dzejkop merged 14 commits into
mainfrom
xr/squaring
May 30, 2025
Merged

Optimised Montgomery squaring#108
Dzejkop merged 14 commits into
mainfrom
xr/squaring

Conversation

@xrvdg
Copy link
Copy Markdown
Collaborator

@xrvdg xrvdg commented May 29, 2025

This PR introduces optimised Montgomery squaring for both scalar and SIMD.

Additionally:

  • the block multipliers in Skyscraper are replaced by the squaring operations.
  • code generators and assembly for blocks of size 3 and 4. Due to a small reordering the code of the block multipliers also changed.
  • HLA now has support for lazy evaluation for use in code generators. This made it easier to write the squaring algorithm in the scalar case.
  • test_utils to share code between tests.
  • comparison test between the block squarer and ark_ff.

Note: the reducer hasn't been taken out yet. That will be done in a follow-up PR.

@xrvdg xrvdg requested a review from recmo May 29, 2025 08:16
@xrvdg xrvdg self-assigned this May 29, 2025
@Dzejkop
Copy link
Copy Markdown
Collaborator

Dzejkop commented May 29, 2025

Can you rebase this branch against main? There are no conflicts but main now has a passing CI pipeline

@Dzejkop Dzejkop merged commit 997434a into main May 30, 2025
2 of 4 checks passed
dcbuild3r pushed a commit that referenced this pull request May 16, 2026
* HLA: add support for lazy evaluation

* lazy u256 multiplier

* widening_mul_u256: split outer product from accumulator

* codegen: single step montgomery squaring

* codegen: squaring SIMD

* block-multiplier: add block squaring

* block-multiplier: add test

* skyscraper: replace multiplier by squaring

* block-multiplier: refactor tests

* block-multiplier: compare montgomery_square_interleaved to ark-ff

* clippy improvements

* hla: safer interface for Lazy

* fixup rebase

* refactor
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