Skip to content

Add type inference for LWE/CKKS ops#2412

Merged
copybara-service[bot] merged 1 commit intogoogle:mainfrom
j2kun:lwe-result-type-inference
Nov 17, 2025
Merged

Add type inference for LWE/CKKS ops#2412
copybara-service[bot] merged 1 commit intogoogle:mainfrom
j2kun:lwe-result-type-inference

Conversation

@j2kun
Copy link
Collaborator

@j2kun j2kun commented Nov 14, 2025

This came up in the conversion from Orion to CKKS (#2326). That line of work requires me to reimplement chebyshev evaluation and the halevi-shoup kernel, but at the level of CKKS with parameters pre-selected.

#2338 is addressing the finer points of that conversion, but in the mean time it has proven helpful to extend the result type inference capabilities of the LWE/CKKS dialects, because when I insert ciphertext mgmt ops at the CKKS level, I need to re-walk the IR and re-infer result types for all ops.

Yes, I know this is what @ZenithalHourlyRate warned against and why we have mgmt at the higher level. Normally I wouldn't want to do this either, but for comparing against another compiler that handles ciphertext management and parameter selection itself, I don't see another way :)

@j2kun j2kun changed the title Add type inference for LWE/CKKS ops. Add type inference for LWE/CKKS ops Nov 14, 2025
@j2kun
Copy link
Collaborator Author

j2kun commented Nov 14, 2025

For the reviewer: I'm looking for some extra scrutiny on the logic of the type inference, to make sure I'm not incorrectly dropping limbs or dividing by the wrong moduli.

Copy link
Collaborator

@ZenithalHourlyRate ZenithalHourlyRate left a comment

Choose a reason for hiding this comment

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

LGTM!

@j2kun j2kun added the pull_ready Indicates whether a PR is ready to pull. The copybara worker will import for internal testing label Nov 16, 2025
@copybara-service copybara-service bot merged commit 58a861c into google:main Nov 17, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pull_ready Indicates whether a PR is ready to pull. The copybara worker will import for internal testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants