This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] add getPointerType/getIndexType to SparseTensorEncodingAttr.
ClosedPublic

Authored by Peiming on Dec 1 2022, 1:24 PM.

Details

Summary

add new interfaces to SparseTensorEncodingAttr to construct the pointer/index types based on pointer/index bitwidth.

Diff Detail

Event Timeline

Peiming created this revision.Dec 1 2022, 1:24 PM
Herald added a project: Restricted Project. · View Herald Transcript
Peiming requested review of this revision.Dec 1 2022, 1:24 PM
aartbik accepted this revision.Dec 1 2022, 1:31 PM
This revision is now accepted and ready to land.Dec 1 2022, 1:31 PM
wrengr added inline comments.Dec 1 2022, 1:37 PM
mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
47

You should also pass in the signedness semantics here. The default is Signless but we really do mean Unsigned.

53

ditto.

wrengr added inline comments.Dec 1 2022, 1:39 PM
mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td
162

Should this use "///" so that the comment is picked up by doxygen? (I don't know what the style guide is re extraClassDeclaration)

165

ditto

Peiming updated this revision to Diff 479416.Dec 1 2022, 1:46 PM

rebase against main

Peiming updated this revision to Diff 479417.Dec 1 2022, 1:48 PM

change comment style.

Peiming marked 2 inline comments as done.Dec 1 2022, 1:49 PM
Peiming added inline comments.
mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td
162

You are right, I checked other td file to confirm.

wrengr added inline comments.Dec 1 2022, 1:49 PM
mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
46

Any reason why this floated out rather than inlined at the use site? If you instead floated out auto ctx = getContext(); you might be able to fit everything on one line, if that's the concern

47

After some offline discussion, I rescind this suggestion. Let's handle that in a separate CL instead.

52

ditto

Still LGTM, if you fix Wren's doc suggestion.

mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
47

Discussed internally, keep for now i32/i64 in this refactoring, and investigate ui32/ui64 independently.

wrengr accepted this revision.Dec 1 2022, 1:51 PM
aartbik added inline comments.Dec 1 2022, 1:53 PM
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
213–214

Should this go to next line?

Peiming marked 4 inline comments as done.Dec 1 2022, 1:53 PM
Peiming added inline comments.
mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
46

Yes, because IndexType and IntegerType are incompatible to be used by ?: operator

Peiming updated this revision to Diff 479420.Dec 1 2022, 1:55 PM
Peiming marked an inline comment as done.

fix comments.

Peiming marked an inline comment as done.Dec 1 2022, 1:55 PM
Peiming marked 3 inline comments as done.
This revision was landed with ongoing or failed builds.Dec 1 2022, 2:01 PM
This revision was automatically updated to reflect the committed changes.