From 4e9526b9eac5d1b1d8f8e99e37109353ef8787e6 Mon Sep 17 00:00:00 2001 From: Peiming Liu Date: Thu, 15 Jun 2023 21:04:46 +0000 Subject: [PATCH] [mlir][sparse] using stable_sort to make sure the compiled code are consistent between different builds configuration Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D153074 --- mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp index e3abe10..9a130ec 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp @@ -528,7 +528,7 @@ void LoopEmitter::categorizeLoopCondition( makeLoopCondKind(isSparse, isSlice, isAffine, isUnRedu)); } - std::sort(spConds.begin(), spConds.end(), [](auto lhs, auto rhs) { + std::stable_sort(spConds.begin(), spConds.end(), [](auto lhs, auto rhs) { // AffineUnRed > Affine > Slice > Trivial return static_cast(lhs.second) > static_cast(rhs.second); }); -- 2.7.4