Page MenuHomePhabricator

Sparse String Elements support.
ClosedPublic

Authored by rsuderman on Apr 24 2020, 5:24 PM.

Details

Summary

Added support for sparse strings elements. This is a follow up from the original DenseStringElements.

Diff Detail

Event Timeline

rsuderman created this revision.Apr 24 2020, 5:24 PM
Herald added a project: Restricted Project. · View Herald Transcript

You also need to add a SparseElementsAttr::getZeroValue<StringRef> so that getValues<T> works:
https://github.com/llvm/llvm-project/blob/5339029ff79c0b6a501ef6bb7baeb07cb099f0b7/mlir/include/mlir/IR/Attributes.h#L1257

mlir/lib/IR/AsmPrinter.cpp
1491

Use cast here as it is guaranteed to be DenseIntOrFPElementsAttr, dyn_cast implies that it may return null.

rsuderman updated this revision to Diff 260048.Apr 24 2020, 6:20 PM

Added getZeroValue() for string.

rsuderman updated this revision to Diff 260049.Apr 24 2020, 6:21 PM
rsuderman marked an inline comment as done.

Inserted missing newline.

rriddle added inline comments.Apr 24 2020, 6:24 PM
mlir/include/mlir/IR/Attributes.h
1255

You can just inline this in the getZeroValue<StringRef> below. The other methods are only defined like this because the values can't be constructed inline in the header file.

1279

This needs to be a SFINAE template to avoid having ambiguous methods.

1285

nit: Newline before here.

rsuderman updated this revision to Diff 260052.Apr 24 2020, 6:32 PM

Removed unneeded helper function.

rsuderman marked 3 inline comments as done.Apr 24 2020, 6:33 PM
rriddle accepted this revision.Apr 24 2020, 6:33 PM
This revision is now accepted and ready to land.Apr 24 2020, 6:33 PM
Harbormaster completed remote builds in B54658: Diff 260049.
This revision was automatically updated to reflect the committed changes.