[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
This commit is contained in:
Peiming Liu
2023-06-15 21:04:46 +00:00
parent 65bfd5cb25
commit 4e9526b9ea

View File

@@ -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<uint8_t>(lhs.second) > static_cast<uint8_t>(rhs.second);
});