[mlir][sparse] Improve sort operation by generating inlined code to compare values.
authorbixia1 <bixia@google.com>
Thu, 9 Mar 2023 17:38:09 +0000 (09:38 -0800)
committerbixia1 <bixia@google.com>
Tue, 14 Mar 2023 22:14:49 +0000 (15:14 -0700)
commit2ef416273f85ed355f4cbaa996fd8d9c229dbfab
tree538f571877f733ff24a07a4aca30b9518b8e215d
parentc1125ae5b05f5e23c7e61e85afb359e095444d18
[mlir][sparse] Improve sort operation by generating inlined code to compare values.

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%.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D145442
mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
mlir/test/Dialect/SparseTensor/buffer_rewriting.mlir