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 Integer Rings in RNS Representation #787

Merged
merged 39 commits into from
Mar 3, 2025
Merged

Conversation

yshekel
Copy link
Collaborator

@yshekel yshekel commented Feb 23, 2025

This PR introduces a template class for integer rings in the Residue Number System (RNS) representation. Instead of storing an integer modulo a composite modulus q = p1 * p2 * ... * pn, this implementation represents the integer as a tuple (x mod p1, x mod p2, ..., x mod pn), where each component resides in a different field.

  • Implement ZqRns type - RNS representation of ring elements
  • Instantiate vecops, ntt dispatchers for rns type
  • register vecops CPU (and CUDA and backend PR)
  • register ntt CPU (and CUDA and backend PR)
  • rns <--> direct conversions, including vector API and test

Future PRs:

  • Large ring (geryhound)
  • Rust bindings
  • Additional APIs

cuda-backend-branch: yshekel/ring_rns

@yshekel yshekel changed the title initial integer RNS, labrador RNS and test Implement Integer Rings in RNS Representation Feb 24, 2025
@yshekel yshekel marked this pull request as ready for review February 24, 2025 17:25
@yshekel yshekel force-pushed the yshekel/ring_rns branch from 547c8b8 to c3e66ee Compare March 2, 2025 16:54
@yshekel yshekel requested a review from mickeyasa March 2, 2025 17:10
@yshekel yshekel force-pushed the yshekel/ring_rns branch from c309b1e to cb20581 Compare March 3, 2025 08:56
Copy link
Contributor

@mickeyasa mickeyasa left a comment

Choose a reason for hiding this comment

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

some comments inside

}

// Arithmetic Operators
friend HOST_DEVICE_INLINE IntegerRingRns operator+(const IntegerRingRns& a, const IntegerRingRns& b)
Copy link
Contributor

Choose a reason for hiding this comment

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

a general comment: do we need to add compound assignments. we also don't have it for Fields

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could, I am not sure it's more efficient but we could when we need it

@yshekel yshekel merged commit 959d249 into main Mar 3, 2025
16 checks passed
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.

9 participants