Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Optimized Montgomery Multiplication for Metal #6

Closed
moven0831 opened this issue Oct 25, 2024 · 1 comment · Fixed by #23
Closed

Implement Optimized Montgomery Multiplication for Metal #6

moven0831 opened this issue Oct 25, 2024 · 1 comment · Fixed by #23
Assignees

Comments

@moven0831
Copy link
Collaborator

moven0831 commented Oct 25, 2024

Problem

Montgomery multiplication is a critical operation in multi-scalar multiplication (MSM) that significantly impacts performance. The current implementation lacks an optimized Montgomery multiplication tailored for Metal, leading to slower field arithmetic operations on iOS devices.

Details

Implement an optimized version of Montgomery multiplication specifically designed for Metal to enhance the efficiency of field operations within the MSM process. This optimization should leverage Metal's capabilities to perform modular arithmetic more efficiently, thereby reducing the overall MSM runtime.

Acceptance criteria

  • Develop a Metal shader that performs Montgomery multiplication optimized for Metal’s uint data types.
  • Benchmark various limb sizes (e.g., 12 to 16 bits) to identify the optimal configuration for Metal on iOS devices.
  • Adapt Gregor Mitscha-Baude's approach for limb sizes suitable for Metal.
  • Integrate the optimized Montgomery multiplication into the existing MSM pipeline.
  • Compare performance against the baseline implementation to demonstrate improvement.
  • Create unit tests to verify the correctness of the optimized Montgomery multiplication.

Reference (optional)

@FoodChain1028 FoodChain1028 self-assigned this Nov 1, 2024
@moven0831 moven0831 assigned moven0831 and unassigned FoodChain1028 Nov 4, 2024
@moven0831
Copy link
Collaborator Author

update: the mont_mul backend has been imported from https://github.com/geometryxyz/msl-secp256k1. Noted the source in each imported file. For details please check development branch

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 a pull request may close this issue.

2 participants