This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Propagate arith.index_cast past tensor.extract
ClosedPublic

Authored by rsuderman on Jan 25 2022, 4:54 PM.

Details

Summary

If we are extracting it is more useful to push the index_cast past the
extraction. This increases the chance the tensor.extract can evaluated at
compile time.

Diff Detail

Event Timeline

rsuderman created this revision.Jan 25 2022, 4:54 PM
rsuderman requested review of this revision.Jan 25 2022, 4:54 PM

Missing a test?

mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
428–429

Does this generalize to other similar element casts?

rsuderman updated this revision to Diff 403084.Jan 25 2022, 5:06 PM

Added missing test.

Missing a test?

Yup, realized that just as I sent it out. Test sent.

rsuderman marked an inline comment as done.Jan 25 2022, 5:10 PM
rsuderman added inline comments.
mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
428–429

This would hold true for any cast op. So feasibly I could template this and repeat for all of Arith's cast operations.

rriddle accepted this revision.Jan 25 2022, 6:34 PM
rriddle added inline comments.
mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
452
This revision is now accepted and ready to land.Jan 25 2022, 6:34 PM
rsuderman marked an inline comment as done.

Updated comment and type information.

This revision was landed with ongoing or failed builds.Jan 25 2022, 10:19 PM
This revision was automatically updated to reflect the committed changes.