This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Parser] Update DenseElementsAttr to print in hex when the number of elements is over a certain threshold.
ClosedPublic

Authored by rriddle on Feb 20 2020, 11:48 AM.

Details

Summary

DenseElementsAttr is used to store tensor data, which in some cases can become extremely large(100s of mb). In these cases it is much more efficient to format the data as a string of hex values instead.

Diff Detail

Event Timeline

rriddle created this revision.Feb 20 2020, 11:48 AM
mehdi_amini accepted this revision.Feb 20 2020, 2:22 PM
mehdi_amini added inline comments.
mlir/lib/IR/AsmPrinter.cpp
66

Can we make it an int and use -1 to disable?

70

I'd lower this to 100 or 500 or something like this: the idea of the threshold to me is that this is the number at which it is unlikely someone really care about reading individual value from the IR text file manually (and they can just round-trip with a higher threshold to get them)

This revision is now accepted and ready to land.Feb 20 2020, 2:22 PM
rriddle updated this revision to Diff 245748.Feb 20 2020, 2:28 PM
rriddle marked 2 inline comments as done.

Resolve comments

This revision was automatically updated to reflect the committed changes.