[Mlir-commits] [mlir] 4e9526b - [mlir][sparse] using stable_sort to make sure the compiled code are consistent between different builds configuration

Peiming Liu llvmlistbot at llvm.org
Thu Jun 15 14:09:39 PDT 2023


Author: Peiming Liu
Date: 2023-06-15T21:09:35Z
New Revision: 4e9526b9eac5d1b1d8f8e99e37109353ef8787e6

URL: https://github.com/llvm/llvm-project/commit/4e9526b9eac5d1b1d8f8e99e37109353ef8787e6
DIFF: https://github.com/llvm/llvm-project/commit/4e9526b9eac5d1b1d8f8e99e37109353ef8787e6.diff

LOG: [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

Added: 
    

Modified: 
    mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp
index e3abe100a46d4..9a130ec04445d 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<uint8_t>(lhs.second) > static_cast<uint8_t>(rhs.second);
   });


        


More information about the Mlir-commits mailing list