This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] Pass down constant coefficients of affine index expressions to LoopEmitter.
ClosedPublic

Authored by Peiming on Aug 25 2023, 4:41 PM.

Diff Detail

Event Timeline

Peiming created this revision.Aug 25 2023, 4:41 PM
Herald added a project: Restricted Project. · View Herald Transcript
Peiming requested review of this revision.Aug 25 2023, 4:41 PM
aartbik added inline comments.Aug 29 2023, 6:26 PM
mlir/include/mlir/Dialect/SparseTensor/Utils/Merger.h
62

it -> its

63

I would remove "linalg". The affine map concept exists outside the linalg dialect

mlir/lib/Dialect/SparseTensor/Transforms/CodegenEnv.cpp
110

use plural: list of loop indices .... list of ... pairs

mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.h
87–92

This was already there, but "affine expression index" reads a bit verbose. Just index in affine expression or so?

87–92

h

87–92

x

343

why is this absolute now?

727–729

Why is this conceptual?

mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
328

This TODO does not make much sense?
"only" and "more complex"?

Peiming added inline comments.Aug 29 2023, 7:48 PM
mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.h
343

It has always been absolute, but it does not really matter for now because we only handle 2-variable expressions, the absolute offset equals to the relative offset for the first slice (since it parent is the sparse tensor itself). I changed it just for future reference here.

727–729

Maybe I should rephrase it to "The (size, stride) for each conceptual slice"?

mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
328

Yeah, this is wired, but we can handle 2 * d0 + d1 but not 2 * d0. More specifically, we can handle coefficients when "reducing" the index variable (i.e., for slice-driven loop) but not when "resolving" the index variable (i.e., TACO-like co-iteration).

Peiming marked 8 inline comments as done.Aug 29 2023, 7:55 PM
Peiming updated this revision to Diff 554552.Aug 29 2023, 7:56 PM

address comments.

aartbik accepted this revision.Aug 30 2023, 10:49 AM
This revision is now accepted and ready to land.Aug 30 2023, 10:49 AM