This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] Improve sort operation by generating inlined code to compare values.
ClosedPublic

Authored by bixia on Mar 6 2023, 3:24 PM.

Details

Summary

Previously, we generate function calls to compare values for sorting. It turns
out that the compiler doesn't inline those function calls. We now directly
generate inlined code. Also, modify the code for comparing values to use less
number of branches.

This improves all sort implementation in general. For arabic-2005.mtx CSR, the
improvement is around 25%.

Diff Detail

Event Timeline

bixia created this revision.Mar 6 2023, 3:24 PM
Herald added a project: Restricted Project. · View Herald Transcript
bixia requested review of this revision.Mar 6 2023, 3:24 PM

any perf result you can put in the description?

also, can we have some very high level and robust CHECK testing on the generated code, just for peace of mind? wdyt?

bixia updated this revision to Diff 503812.Mar 9 2023, 9:38 AM

Generate inlined code to compare values.

bixia retitled this revision from [mlir][sparse] Modify the compare functions to use less if-stmts. to [mlir][sparse] Improve sort operation by generating inlined code to compare values..Mar 9 2023, 9:39 AM
bixia edited the summary of this revision. (Show Details)
bixia updated this revision to Diff 504333.Mar 10 2023, 8:44 PM

Rebase.

aartbik accepted this revision.Mar 14 2023, 10:16 AM
This revision is now accepted and ready to land.Mar 14 2023, 10:16 AM