fix: implement physical slot replication for bicyclic and tricyclic layout after - #3247
Open
copybara-service[bot] wants to merge 1 commit into
Open
fix: implement physical slot replication for bicyclic and tricyclic layout after#3247copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
copybara-service
Bot
force-pushed
the
test_953525822
branch
4 times, most recently
from
July 27, 2026 20:04
35a6dd4 to
a709ba3
Compare
…ayout after matrix multiplication. In the bicyclic layout, we require for each 0 <= slot < numSlot, (ct, slot) is mapped to (slot % n, slot % m). However, after computing through BSGS we can only guarantee for all 0 <= slot < n*m this property preserves (indeed we can guarantee more, but for the tail part it is not correct if n*m does not divide numSlot). In this commit, we add a new relation called `periodic replication relation` that replicate the first copy to all slots periodically. After each matrix multiplication with CRT layouts (bicyclic, tricyclic), we compose this relation to derive the result. The cost of the layout switching will be up to logN rotations. PiperOrigin-RevId: 953525822
copybara-service
Bot
force-pushed
the
test_953525822
branch
from
July 27, 2026 23:11
a709ba3 to
1f69e80
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.
fix: implement physical slot replication for bicyclic and tricyclic layout after
matrix multiplication.
In the bicyclic layout, we require for each 0 <= slot < numSlot, (ct, slot) is
mapped to (slot % n, slot % m). However, after computing through BSGS we can only
guarantee for all 0 <= slot < nm this property preserves (indeed we can guarantee
more, but for the tail part it is not correct if nm does not divide numSlot).
In this commit, we add a new relation called
periodic replication relationthat replicate the first copy to all slots periodically. After each matrix
multiplication with CRT layouts (bicyclic, tricyclic), we compose this relation
to derive the result.
The cost of the layout switching will be up to logN rotations.