Skip to content

Conversation

j2kun
Copy link
Collaborator

@j2kun j2kun commented Aug 27, 2025

One of the ops for lowering key_switch_inner is to partition the coefficients of a polynomial. This op will eventually lower to a combination of

tensor.extract_slice (extract the divisible part)
tensor.reshape (reshape the divisible part)
tensor.extract_slice (extract the extra piece)

This actually kind of makes me think we don't need a dedicated op at all. We can just lower directly to the three ops this will lower to. Is there an advantage to having this intermediate op? I suppose that would depend on how other methods of implementing keyswitch might differ with this one.

Part of #2157

CC @crockea @AlexanderViand

@j2kun j2kun changed the title [WIP]: initial draft of partition op Add tensor_ext.partition op Aug 27, 2025
@j2kun
Copy link
Collaborator Author

j2kun commented Aug 28, 2025

OK I added a second commit (so we can see them side by side) that shows what the lowering would look like if we skipped having a dedicated partition op and lowered to what tensor_ext.partition would have lowered to anyway. It seems tidy enough that I think we should just do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant