Closed dcaballe closed 5 years ago
Thanks for the quick feedback, Alex! I'll address your comments after clarifying this point:
Do you have a specific use case where you want to use one subscript for a zero-dimensional memref? If not, I would think that using zero subscripts is more consistent, and also makes the verification code simpler (and can be reconsidered in future)
In fact, the use case we have is for one subscript. We are modeling single-scalar tensors as zero-dimensional tensors and lower them to zero-dimensional memrefs in affine. We want to create affine loads/stores for them but we need to provide a map for that, IIUC. We provide {} -> 0
map, as you can see here:
https://github.com/tensorflow/mlir/pull/58/files#diff-3744a45b757312019c0aa9667cd244eeR1600, so affine loads/stores end up with one subscript. Maybe we could provide a {} -> {}
map? Could we add an interface to Builder
that does that?
Maybe we could provide a {} -> {} map? Could we add an interface to Builder that does that?
I think this would be great to have. There may be places in the code that assume affine maps have non-zero outputs though.
Maybe we could provide a {} -> {} map? Could we add an interface to Builder that does that?
I think this would be great to have. There may be places in the code that assume affine maps have non-zero outputs though.
Yeah, I did hit some asserts when I tried. Let me see how difficult would be to make that work and we can make a decision. Thanks!
LMK if there are too many changes involved. I'm fine with using constant zero subscript for zero-dimensional memrefs as a temporary solution. There are other places in the code that do that.
It was easier than expected. Last commit should address all the comments.
I think I addressed all the comments. Please, let me know if something else is missing. Thanks!
Good catch. Thanks!
Make sure to squash your commits.
For those doing the merge, there is an option to merge the changes doing a squash. That's the approach that I've seen in other projects. Are you asking me to do a explicit squash?
Our infra will squash anyway. The only advantage of the single commit is that we don’t have to reword the message ourselves on integration (otherwise it includes all the commits in the squashed commit message).
The problem with me doing the squash and a push force is that, IIRC, this messed up the review comments, but I don't remember the details. Yeah, just let me know. I can do a squash including my commits and the merge commits.
(Sorry, I was OOO for a while a missed the auto-squash update. Please disregard my comment then.)
Verification complained when using zero-dimensional memrefs in affine.load, affine.store, std.load and std.store. Assuming that tests provided are expected use cases for affine and std loads and stores, this PR extends verification so that those memrefs can be used.