This is an archive of the discontinued LLVM Phabricator instance.

[mlir][IR] Add an Operation::eraseOperands that supports batch erasure
ClosedPublic

Authored by rriddle on Mar 9 2021, 1:13 PM.

Details

Summary

This method allows for removing multiple disjoint operands at once, reducing the need to erase operands individually (which results in shifting the operand list).

Depends On D98071

Diff Detail

Event Timeline

rriddle created this revision.Mar 9 2021, 1:13 PM
rriddle requested review of this revision.Mar 9 2021, 1:13 PM
jpienaar accepted this revision.Mar 9 2021, 1:25 PM

Nice, thanks

mlir/lib/IR/OperationSupport.cpp
307

This is to avoid needing to disambiguate between only prefix specified or not? (meaning, alternative could have been considering indexes from one end and this is up to the Nth operand, instead require all operands to be specified).

Did you consider a list of indices? esp for wher you have large number of operands but small number of operands to remove

This revision is now accepted and ready to land.Mar 9 2021, 1:25 PM
rriddle marked an inline comment as done.Mar 9 2021, 2:30 PM
rriddle added inline comments.
mlir/lib/IR/OperationSupport.cpp
307

This is to avoid needing to disambiguate between only prefix specified or not? (meaning, alternative could have been considering indexes from one end and this is up to the Nth operand, instead require all operands to be specified).

Essentially yes. I don't have a valid use case that is worth the differentiation behavior, so I don't see a need yet in supporting it.

Did you consider a list of indices? esp for wher you have large number of operands but small number of operands to remove

The list approach only really works if you know for a fact that a) you have a very large number of operands, and b) you have a small number of operands to remove. If either of those are false, you don't gain anything by the list approach and often end up using much more memory. For all of the use cases I've encountered so far that needed this, one of the above has been false. We can add another API in the future if there is a need for one.

This revision was landed with ongoing or failed builds.Mar 9 2021, 3:08 PM
This revision was automatically updated to reflect the committed changes.
rriddle marked an inline comment as done.