Skip to content

lwe: add (optional) level and scale attributes to lwe.rlwe_encode - #3305

Merged
copybara-service[bot] merged 1 commit into
mainfrom
alex/encode-level-attr
Aug 11, 2026
Merged

lwe: add (optional) level and scale attributes to lwe.rlwe_encode#3305
copybara-service[bot] merged 1 commit into
mainfrom
alex/encode-level-attr

Conversation

@AlexanderViand

@AlexanderViand AlexanderViand commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Preliminary for Cheddar work (where encoding a plaintext effectively requires knowing what level to encode it to, since the canonical scale is different for each level).

@AlexanderViand
AlexanderViand requested a review from j2kun August 5, 2026 15:10
@j2kun

j2kun commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

The CI failure looks legit to me.

@AlexanderViand

Copy link
Copy Markdown
Collaborator Author

The CI failure looks legit to me.

Yep, looks like something broke when I cherry-picked it :(

@AlexanderViand
AlexanderViand marked this pull request as draft August 5, 2026 16:03
@AlexanderViand
AlexanderViand force-pushed the alex/encode-level-attr branch from e508373 to 34a5d61 Compare August 11, 2026 09:26
@AlexanderViand
AlexanderViand force-pushed the alex/encode-level-attr branch from 34a5d61 to d13bf8e Compare August 11, 2026 10:52
@AlexanderViand
AlexanderViand changed the base branch from main to alex/affine-fix August 11, 2026 10:52
@AlexanderViand
AlexanderViand marked this pull request as ready for review August 11, 2026 11:12
@AlexanderViand
AlexanderViand requested a review from mdgrs August 11, 2026 11:22

@j2kun j2kun left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can't the level be inferred from the result type of the encode op?

@AlexanderViand

AlexanderViand commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

Can't the level be inferred from the result type of the encode op?

@j2kun Nope, unfortunately the info on the ptxt type isn't sufficient. In #3305 @ZenithalHourlyRate suggested also adding a ctxt space to the op as a solution, I instead picked this approach with an optional Attr when I needed it "just to make cheddar work" since its a lot lower-impact.

In the meantime, @mdgrs is looking into actually doing smart encoding-target-level selection in general, so maybe it is now actually worth doing a "real" solution rather than the optional attr workaround?

@AlexanderViand
AlexanderViand force-pushed the alex/encode-level-attr branch from d13bf8e to 0b568d3 Compare August 11, 2026 15:54
@j2kun

j2kun commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

I'm fine with this approach, though I suspect we will also want a scale attribute so that plaintext encoding can target a specific scale. Can you add that as another optional attribute, then we can get this in.

Base automatically changed from alex/affine-fix to main August 11, 2026 17:58
@AlexanderViand
AlexanderViand force-pushed the alex/encode-level-attr branch from 0b568d3 to 1c65637 Compare August 11, 2026 18:23
@AlexanderViand AlexanderViand changed the title lwe: add (optional) level attribute to lwe.rlwe_encode lwe: add (optional) level and scale attributes to lwe.rlwe_encode Aug 11, 2026
@AlexanderViand

Copy link
Copy Markdown
Collaborator Author

I'm fine with this approach, though I suspect we will also want a scale attribute so that plaintext encoding can target a specific scale. Can you add that as another optional attribute, then we can get this in.

@j2kun done :)

@j2kun j2kun added the pull_ready Indicates whether a PR is ready to pull. The copybara worker will import for internal testing label Aug 11, 2026
@copybara-service
copybara-service Bot merged commit 1e549c2 into main Aug 11, 2026
20 checks passed
@copybara-service
copybara-service Bot deleted the alex/encode-level-attr branch August 11, 2026 20:27
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.

3 participants