Skip to content

Add support for transfer ops bufferization - #4445

Merged
ThomasRaoux merged 1 commit into
iree-org:mainfrom
ThomasRaoux:bufferization
Jan 11, 2021
Merged

ThomasRaoux merged 1 commit into
iree-org:mainfrom
ThomasRaoux:bufferization

Conversation

@ThomasRaoux

Copy link
Copy Markdown
Contributor

Allow converting transfer ops on tensor to transfer ops on buffer.


// Replace the tensor operand.
if (auto readOp = dyn_cast<vector::TransferReadOp>(op.getOperation())) {
auto newRead = b.create<vector::TransferReadOp>(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to just set some readOp.mutableXXX and no need to RAUW.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, changed it.

readOp->replaceAllUsesWith(newRead);
readOp->erase();
} else {
auto writeOp = cast<vector::TransferWriteOp>(op.getOperation());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here just use mutableXXX and do the update inplace.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I can do in-place update since the original transfer_write returns a new tensor that still have uses at this point. Let me know if you think there is a way to do that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, sorry about the noise.

Allow converting transfer ops on tensor to transfer ops on buffer.
@ThomasRaoux
ThomasRaoux merged commit 5a9cec9 into iree-org:main Jan 11, 2021
This was referenced Jan 11, 2021
@ThomasRaoux
ThomasRaoux deleted the bufferization branch February 16, 2021 23:43
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