This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Toy][LowerToAffineLoops] Handle tensors of rank 0
ClosedPublic

Authored by djtodoro on Apr 4 2020, 9:46 AM.

Details

Summary

This will fix the case:

toyc -emit=jit test.toy

def main() {
  var a = 1;
  print(a);
}

Without this patch it would trigger an assertion.

Diff Detail

Event Timeline

djtodoro created this revision.Apr 4 2020, 9:46 AM
mehdi_amini accepted this revision.Apr 4 2020, 10:59 AM
This revision is now accepted and ready to land.Apr 4 2020, 10:59 AM
bondhugula accepted this revision.Apr 4 2020, 4:47 PM
bondhugula added a subscriber: bondhugula.
bondhugula added inline comments.
mlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp
159

Nit: !valueShape.empty() if you prefer.

mlir/examples/toy/Ch6/mlir/LowerToAffineLoops.cpp
159

Likewise.

mehdi_amini added inline comments.Apr 4 2020, 7:17 PM
mlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp
159

+1 for empty() :)

djtodoro marked an inline comment as done.Apr 5 2020, 6:08 AM
djtodoro added inline comments.
mlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp
159

Makes sense to me. Thanks :)

djtodoro updated this revision to Diff 255147.Apr 5 2020, 6:08 AM

-addressing comments

mehdi_amini accepted this revision.Apr 5 2020, 4:15 PM

Still LGTM, let me know if you need someone to land it for you

(Seems like you didn't use arc, so I'd need the info on what to put in the author field of the commit)

I have the access, thanks. :)
I’ve just started learning MLIR and come up with this, but I actually work on some other LLVM parts :)

Ah great, thanks for extending your contributions to MLIR then :)

This revision was automatically updated to reflect the committed changes.