Skip to content

Move tensor->flow passes to Dialect/Flow/Conversion/TensorToFlow. - #6586

Merged
ScottTodd merged 10 commits into
iree-org:mainfrom
ScottTodd:tensor-to-flow
Aug 3, 2021
Merged

ScottTodd merged 10 commits into
iree-org:mainfrom
ScottTodd:tensor-to-flow

Conversation

@ScottTodd

@ScottTodd ScottTodd commented Jul 29, 2021 •

Copy link
Copy Markdown
Member

General cleanup and the tensor->flow conversions will be useful outside of iree/compiler/InputConversion/Common/, particularly for detensoring (#1159).

  • Moved all patterns in iree/compiler/InputConversion/Common/ConvertUpstreamToIREE.cpp into iree/compiler/Dialect/Flow/Conversion/TensorToFlow/ConvertTensorToFlow.cpp and folded that pass into IREE::Flow::createConvertToFlowTensorOpsPass
  • Moved tensor->flow patterns and their tests from iree/compiler/Dialect/Flow/Transforms/ into the new Flow/Conversion/TensorToFlow directory. Changed them from OpRewritePatterns to OpConversionPatterns. linalg->flow passes remain in their original location
  • Updated pattern names, test case names, comments, etc. following the renaming in llvm/llvm-project@060208b / 7f89eb6

@ScottTodd ScottTodd added the compiler/dialects Relating to the IREE compiler dialects (flow, hal, vm) label Jul 29, 2021
@google-cla google-cla Bot added the cla: yes label Jul 29, 2021
Comment thread iree/tools/init_iree_passes.h Resolved
Comment thread iree/tools/init_iree_passes.h Resolved
@ScottTodd
ScottTodd marked this pull request as ready for review August 2, 2021 17:03
@ScottTodd

Copy link
Copy Markdown
Member Author

(The commit history isn't well organized, LMK if you'd prefer for me to split this into a more cohesive set of commits for review and/or non-squash merge)

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

If this passes all tests, then this is fine.

@ScottTodd
ScottTodd merged commit 2568e68 into iree-org:main Aug 3, 2021
@ScottTodd
ScottTodd deleted the tensor-to-flow branch August 3, 2021 16:33
This was referenced Aug 4, 2021
ScottTodd added a commit that referenced this pull request Aug 4, 2021
ScottTodd added a commit that referenced this pull request Aug 5, 2021
Reverts #6648, rolling-forward #6586.

First commit is the pure revert, second is a set of proposed fixes for the performance regression. The single pass (with a true/false option) is now split further:
* `createConvertTensorOpsPass`
* `createConvertLinalgTensorOpsPass(true)`
* `createConvertLinalgTensorOpsPass(false)`

---

This gets the original change closer to an NFC (but it is still not an NFC).

Before this change:

| stage | patterns |
| --- | --- |
| `buildCommonInputConversionPassPipeline` | `tensor::CastOp`, `tensor::FromElementsOp` |
| Flow, before DispatchRegionFormation | `tensor::InsertSliceOp`, `tensor::ExtractSliceOp`, <br> `linalg::TensorCollapseShapeOp`, `linalg::TensorExpandShapeOp` |
| Flow, after DispatchRegionFormation | `linalg::FillOp` |

After this change:

| stage | patterns |
| --- | --- |
| `buildCommonInputConversionPassPipeline` | (deleted) |
| Flow, before DispatchRegionFormation | `tensor::CastOp`, `tensor::FromElementsOp`, <br>`tensor::InsertSliceOp`,  `tensor::ExtractSliceOp`, <br>`linalg::TensorCollapseShapeOp`, `linalg::TensorExpandShapeOp` |
| Flow, after DispatchRegionFormation | `linalg::FillOp` |

Passes on `linalg` ops are the same, but two `tensor` ops are now converted after linalg fusion, rather than at input conversion time. The first version of this change had those `linalg` ops converted during the "common input conversion pipeline".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler/dialects Relating to the IREE compiler dialects (flow, hal, vm)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants