Skip to content

Lower linalg.tensor_reshape to flow.tensor.reshape. - #5392

Closed
MaheshRavishankar wants to merge 1 commit into
iree-org:mainfrom
MaheshRavishankar:issue_5310
Closed

MaheshRavishankar wants to merge 1 commit into
iree-org:mainfrom
MaheshRavishankar:issue_5310

Conversation

@MaheshRavishankar

@MaheshRavishankar MaheshRavishankar commented Apr 9, 2021 •

Copy link
Copy Markdown
Collaborator

Inlining reshapes into dispatch regions cause subtle issue. Lowering subtensor -> tensor_reshape causes issues during bufferization.

To avoid this two approaches are possible

  1. Fuse reshapes with other operations as much as possible during
    fusion on linalg ops.
  2. Lower reshapes to flow.tensor.reshape before dispatch region
    creation.

@google-cla google-cla Bot added the cla: yes label Apr 9, 2021
@benvanik

benvanik commented Apr 9, 2021 •

Copy link
Copy Markdown
Collaborator

The reshape can hamper using tied operands since the type of the operand/result might mismatch.

I removed the check for that so you should be able to have them mismatch (or is this linalg-specific?)

@MaheshRavishankar

Copy link
Copy Markdown
Collaborator Author

The reshape can hamper using tied operands since the type of the operand/result might mismatch.

I removed the check for that so you should be able to have them mismatch (or is this linalg-specific?)

Updated stale comment thanks

Inlining reshapes into dispatch regions cause subtle issues. The
`subtensor` -> `tensor_reshape` pattern causes issues during
bufferization.

To avoid this two approaches are possible
1) Fuse reshapes with other operations as much as possible during
   fusion on linalg ops.
2) Lower reshapes to `flow.tensor.reshape` before dispatch region
   creation.
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