Rotom: Roll arguments can name a whole tensor axis - #3174
Open
edwjchen wants to merge 1 commit into
Open
Conversation
Collaborator
|
@edwjchen Could you rebase this one? |
j2kun
self-requested a review
July 16, 2026 21:36
j2kun
reviewed
Jul 17, 2026
edwjchen
force-pushed
the
rotom-pr-03
branch
2 times, most recently
from
August 2, 2026 22:20
0bb5a0c to
187f110
Compare
edwjchen
marked this pull request as draft
August 3, 2026 07:28
edwjchen
force-pushed
the
rotom-pr-03
branch
3 times, most recently
from
August 10, 2026 04:31
886dccf to
5530486
Compare
edwjchen
marked this pull request as ready for review
August 10, 2026 05:16
A roll argument is now either a piece -- a dims-list position, the
original Rotom reading -- or a whole tensor axis, spelled 'axis N' and
stored as -(axis+1) in the flat rolls array. An axis argument is legal
only when the axis is packed as more than one piece; the piece spelling
is canonical for an unsplit axis, where the two coincide.
A piece FROM rewrites only the part of the axis index that piece reads
-- the original per-piece semantics, now materialized correctly on split
axes, where nothing carries from one piece into the next. An axis FROM
rewrites the whole axis index modulo its full extent, each piece then
taking its part of the rolled index: that carry across pieces is what
diagonal packings over a split axis need, and no combination of piece
rolls can express it. A BY piece of a split axis shifts by that piece's
part of the axis's current (possibly already-rolled) expression.
Rolls stay a pure packing description: a roll shifts by exactly its BY
argument's index, and a layout describes its value's packed bytes in
full. Kernel schedules that shift by a MULTIPLE of a piece's offset --
the baby-step/giant-step giant shift -- are not layout vocabulary and
are not folded into any value's packing; the kernel emits them as
rotations of its coefficient operand, which for plaintext weights a
backend folds into the encoded constants.
The BSGS diagonal packing is then an ordinary layout:
#rotom.layout<n = 16, rolls = [(axis 1, 2)],
dims = [[1:4:4], [1:4:1] | [0:16:1]]>
where the roll diagonalizes the whole split k against i (ciphertext
(g, b) holds the parts of (k - i) mod 16).
edwjchen
force-pushed
the
rotom-pr-03
branch
2 times, most recently
from
August 28, 2026 19:01
773b8db to
ab081b8
Compare
edwjchen
force-pushed
the
rotom-pr-03
branch
2 times, most recently
from
August 29, 2026 04:34
8e900c0 to
a011181
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.
Part 3 of #2980 and stacked on #3170
A Rotom roll decorates a layout:
roll(from, by)rewrites thefromindex by subtracting thebyargument's index. Until now a roll argument could only be a piece, a position in thedimslist. This PR lets it also be a whole tensor axis, spelledaxis Nand stored as-(axis+1)in the flat rolls array.