This is an archive of the discontinued LLVM Phabricator instance.

Allow IndexType inside tensors.
ClosedPublic

Authored by silvas on Mar 24 2020, 12:51 PM.

Details

Summary

It's common in many dialects to use tensors to themselves hold tensor shapes (for example, the shape is itself the result of some non-trivial calculation). Currently, such dialects have to use tensor<?xi64> or worse (like allowing either i32 or i64 tensors to represent shapes). tensor<?xindex> is the natural type to represent this, but is currently disallowed. This patch allows it.

Diff Detail

Event Timeline

silvas created this revision.Mar 24 2020, 12:51 PM
Herald added a project: Restricted Project. · View Herald Transcript
silvas updated this revision to Diff 252410.Mar 24 2020, 12:53 PM

Fix extraneous stuff in the diff

Harbormaster completed remote builds in B50301: Diff 252409.
silvas updated this revision to Diff 252439.Mar 24 2020, 3:13 PM

Update Rationale.md

silvas updated this revision to Diff 252440.Mar 24 2020, 3:15 PM

Address comments

Thanks @mehdi_amini, addressed.

Harbormaster completed remote builds in B50319: Diff 252439.
mehdi_amini accepted this revision.Mar 25 2020, 8:40 PM

Since we accept tensors of dialect specific type, I am not sure why we should forbid the index type, so LGTM.

rriddle accepted this revision.Mar 25 2020, 9:17 PM

LGTM

This revision is now accepted and ready to land.Mar 25 2020, 9:17 PM
jpienaar accepted this revision.Mar 25 2020, 10:05 PM

Thanks!

herhut accepted this revision.Mar 26 2020, 7:06 AM
herhut added a subscriber: herhut.

Thanks for adding this. Looking forward to removing the index -> i64 -> index casting chains!

This revision was automatically updated to reflect the committed changes.