Skip to content

Conversation

@pfultz2
Copy link
Collaborator

@pfultz2 pfultz2 commented Jan 16, 2026

Motivation

Analyze the indices of gather and rewrite it to transpose/reshape/broadcast/slice which can be more easily aliases or fused.

Technical Details

The analyzes the skips in indices and turns it into a shape of strides and an offset that represents that gather operation. The shape is then turned into a series of transpose/reshape/broadcast/slice operators to reproduce that strided access.

Not all sets of strides can be represented using those operators. We need to add an operator like pytorch's unfold to handle more of these cases in the future.

Since it can take time to analyze the indices, there is a flag to enable it so we can only run it once.

Changelog Category

Add a CHANGELOG.md entry for any option other than Not Applicable

    • Added: New functionality.
    • Changed: Changes to existing functionality.
    • Removed: Functionality or support that has been removed. (Compared to a previous release)
    • Optimized: Component performance that has been optimized or improved.
    • Resolved Issues: Known issues from a previous version that have been resolved.
    • Not Applicable: This PR is not to be included in the changelog.

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.

2 participants