This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] Extend sorting function generator to support operand beyond (lo, hi, xs, ys).
ClosedPublic

Authored by bixia on Jan 27 2023, 8:26 AM.

Details

Summary

This is to prepare for implementing a hybrid quick sort, which switches to heap
sort when the recursive depth exceeds certain limits.

Diff Detail

Event Timeline

bixia created this revision.Jan 27 2023, 8:26 AM
Herald added a project: Restricted Project. · View Herald Transcript
bixia requested review of this revision.Jan 27 2023, 8:26 AM
aartbik accepted this revision.Jan 27 2023, 10:51 AM
aartbik added inline comments.
mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
254

I find this a very distracting idiom to force use of an otherwise unused parameter. Is there no better way to achieve this?

This revision is now accepted and ready to land.Jan 27 2023, 10:51 AM
aartbik added inline comments.Jan 27 2023, 10:53 AM
mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.h
284

not really used in this revision?

wrengr added inline comments.Jan 27 2023, 2:32 PM
mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
254

Assuming the issue here is warnings about unused variables, then iirc you should be able to rephrase the prototype to (..., uint32_t = 0) —i.e., simply drop the name of the variable.

If there are more complicated problems at hand, then I'm thinking you should rephrase the typedef to something like template <typename ...Args> using FuncGeneratorType = function_ref<void(blah blah blah, Args&&...)>; so that this particular function instantiates that template at the empty Args

bixia updated this revision to Diff 493178.Jan 29 2023, 6:54 PM
bixia marked an inline comment as done.

Removed irrelevant changes.

mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.h
284

Reversed this change.

mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
254

Please refer to discussion (void)unused_var; is in LLVM style guide, when we have c++ 17 we can use [[maybe_unused]] attribute.
I am keeping (void)nTrailingP here and in other places, it also allows "assert" in debug mode.

bixia updated this revision to Diff 493181.Jan 29 2023, 7:26 PM

Rebase.

bixia updated this revision to Diff 493632.Jan 31 2023, 8:20 AM

Rebase.

bixia updated this revision to Diff 493638.Jan 31 2023, 8:36 AM

Rebase.