layout: relax layout conditions to lower halevi-shoup kernel#2313
Merged
copybara-service[bot] merged 1 commit intomainfrom Oct 16, 2025
Merged
layout: relax layout conditions to lower halevi-shoup kernel#2313copybara-service[bot] merged 1 commit intomainfrom
copybara-service[bot] merged 1 commit intomainfrom
Conversation
a9a25c7 to
9759079
Compare
Before, we restricted convert-to-ciphertext-semantics to only lowering to the halevi-shoup kernel if the layouts on the matrix were exactly the diagonalized layout for the matrix and the row major layout for the vector. however, layout optimization may tweak the layouts of the matrix and vector and still preserve functionality of the kernel (e.g. by simultaneously swapping columns of the matrix and entries of the vector). These should be enforced by the rectify layout code in layout-optimization. So this removes the exact layout conditions on the pass and instead only enforces that the bare minimum conditions are satisfied in order to use a halevi-shoup kernel (e.g. the dimensions are power of two, the column dimension lines up with the vector size, etc). PiperOrigin-RevId: 820366527
9759079 to
2133695
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
layout: relax layout conditions to lower halevi-shoup kernel
Before, we restricted convert-to-ciphertext-semantics to only lowering to the halevi-shoup kernel if the layouts on the matrix were exactly the diagonalized layout for the matrix and the row major layout for the vector. however, layout optimization may tweak the layouts of the matrix and vector and still preserve functionality of the kernel (e.g. by simultaneously swapping columns of the matrix and entries of the vector). These should be enforced by the rectify layout code in layout-optimization.
So this removes the exact layout conditions on the pass and instead only enforces that the bare minimum conditions are satisfied in order to use a halevi-shoup kernel (e.g. the dimensions are power of two, the column dimension lines up with the vector size, etc).