Skip to content

Rotom: Rolled Layout Representation - #3170

Merged
copybara-service[bot] merged 1 commit into
google:mainfrom
edwjchen:rotom-pr-02
Jul 13, 2026
Merged

Rotom: Rolled Layout Representation#3170
copybara-service[bot] merged 1 commit into
google:mainfrom
edwjchen:rotom-pr-02

Conversation

@edwjchen

@edwjchen edwjchen commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Part 2 of #2980 and stacked on #3169

Two extensions to roll(from, by) semantics that make diagonal packings expressible beyond the square, equal-extent case.

  1. Roll partners may be replication or gap dims. Previously both roll operands had to be traversal dims. Now the by (second) dim may also be a replication or gap dim.

  2. Roll extents need not match (mod-from). roll(i, j) now rewrites dims[i]'s index to (idx_i - idx_j) mod extent(dims[i]), well-defined for any partner extent - a smaller partner covers a prefix of the rotations, a larger one wraps. This unlocks rolled placements for rectangular (non-square-k) contractions.

  3. Rolled-by-gap bound. A rolled-by gap partner is bounded to the rolled dim's extent.

@edwjchen
edwjchen force-pushed the rotom-pr-02 branch 2 times, most recently from da5c4fe to 60ec4c7 Compare July 7, 2026 21:03
@edwjchen
edwjchen requested review from asraa and j2kun July 7, 2026 21:30

@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.

60ec4c7 LGTM, just little nits. Will wait to mark pull_ready until the parent PR is merged and this one is rebased.

Comment thread lib/Dialect/Rotom/Utils/RotomTensorExtLayoutLowering.cpp
Comment thread lib/Dialect/Rotom/Utils/RotomTensorExtLayoutLowering.cpp Outdated
@j2kun

j2kun commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Looks like this one is ready to be rebased

Two roll-semantics extensions that make diagonal packings expressible
beyond the square, equal-extent case:

- The roll-by (second) dim may be any kind. Rolling by a replication or
  gap dim shifts by that dim's block index, so each block holds a
  distinct cyclic rotation of the rolled dim -- the layout materializes
  every rotation and downstream alignment becomes block selection (the
  replicate-then-roll expansion of a compact operand is pure rotations).
  A rolled-by gap claims its blocks: it contributes an existential
  address term and counts toward the ciphertext count, unlike a plain
  gap. Rolls apply on both the ciphertext and slot address lines, so a
  roll can place a diagonal on the ciphertext axis (one ciphertext per
  diagonal); a from-dim absent from a line drops out of that line's
  address.
- Roll extents need not match: roll(i, j) rewrites dims[i]'s index to
  (idx_i - idx_j) mod extent(dims[i]), well-defined for any partner
  extent -- a smaller partner covers a prefix of the rotations, a larger
  one wraps. This unlocks rolled placements for rectangular (non-square
  k) contractions. A rolled-by gap is bounded to the rolled dim's extent
  (larger gaps would claim blocks holding repeated rotations that the
  accounting was never audited for); larger replication partners are the
  intended replicate-then-roll form and stay unbounded.

Materialization unit tests cover roll-by-replication, roll-by-gap
(claimed blocks), both unequal-extent orientations, and the verifier
rules; lit tests cover the mod-from positive case and the gap bound.
@edwjchen

Copy link
Copy Markdown
Collaborator Author

Rebased!

@j2kun j2kun added the pull_ready Indicates whether a PR is ready to pull. The copybara worker will import for internal testing label Jul 13, 2026
@copybara-service
copybara-service Bot merged commit 9ba0866 into google:main Jul 13, 2026
19 of 20 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