This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] properly record dimension level type and properties
ClosedPublic

Authored by aartbik on Sep 9 2022, 4:11 PM.

Details

Summary

A next step towards supporting the new dimension level types and
properties. This changes properly records the properties in the
Merger, so that subsequent computations (lattice optimizations)
and code generation (during sparsification) can do the right thing.

https://github.com/llvm/llvm-project/issues/51658

Diff Detail

Event Timeline

aartbik created this revision.Sep 9 2022, 4:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 9 2022, 4:11 PM
aartbik requested review of this revision.Sep 9 2022, 4:11 PM
aartbik edited the summary of this revision. (Show Details)Sep 9 2022, 4:12 PM
Peiming added inline comments.Sep 9 2022, 5:18 PM
mlir/include/mlir/Dialect/SparseTensor/Utils/Merger.h
268

Should be a cheap copy for now. If we are supporting more property in the future, maybe a bitvector for property is better?

But I am okay with it now

mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
309–311

Why not just !isDimLevelType(tensor, i, kDense)

357–359

Same here?

1162

I actually prefer an enum class over enum for dimLvlType

aartbik marked 3 inline comments as done.Sep 10 2022, 12:36 PM
aartbik added inline comments.
mlir/include/mlir/Dialect/SparseTensor/Utils/Merger.h
268

Yeah, we can make that const & but that has all sort of complications with inserting in the vector while "holding" on to the reference

mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
309–311

Because there is also undef that we want to move in the other direction

1162

Okay, also note DimLvl instead of DimLevel since we had another enum of that name already ;-)

aartbik marked 2 inline comments as done.Sep 10 2022, 12:43 PM
aartbik added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
357–359

It may be possible here. Will clean that up when implementing.

aartbik updated this revision to Diff 459309.Sep 10 2022, 1:17 PM

addressed comments, also fixed a has_value/value warning that was lingering in this file

Peiming accepted this revision.Sep 12 2022, 9:19 AM
This revision is now accepted and ready to land.Sep 12 2022, 9:19 AM
aartbik updated this revision to Diff 459489.Sep 12 2022, 9:29 AM

rebased with main

This revision was landed with ongoing or failed builds.Sep 12 2022, 10:00 AM
This revision was automatically updated to reflect the committed changes.