[Mlir-commits] [mlir] f58d2cc - Fix MLIR build on powerpc

Mehdi Amini llvmlistbot at llvm.org
Sun May 21 18:06:41 PDT 2023


Author: Mehdi Amini
Date: 2023-05-21T18:04:39-07:00
New Revision: f58d2cc5a0c2336b17686460343de2bd6ce337b9

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

LOG: Fix MLIR build on powerpc

The RNG initalization relied on implicit conversion that wasn't guaranteed in
the MLIR TestUseListOrders.
Also made the RNG state a pass member, the random sequence is not not reset
for each op anymore.

Added: 
    

Modified: 
    mlir/test/lib/IR/TestUseListOrders.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/test/lib/IR/TestUseListOrders.cpp b/mlir/test/lib/IR/TestUseListOrders.cpp
index ff195ec95f72..47300090d3d6 100644
--- a/mlir/test/lib/IR/TestUseListOrders.cpp
+++ b/mlir/test/lib/IR/TestUseListOrders.cpp
@@ -37,6 +37,12 @@ class TestPreserveUseListOrders
   Option<unsigned> rngSeed{*this, "rng-seed",
                            llvm::cl::desc("Specify an input random seed"),
                            llvm::cl::init(1)};
+
+  LogicalResult initialize(MLIRContext *context) override {
+    rng.seed(static_cast<unsigned>(rngSeed));
+    return success();
+  }
+
   void runOnOperation() override {
     // Clone the module so that we can plug in this pass to any other
     // independently.
@@ -199,7 +205,6 @@ class TestPreserveUseListOrders
     SmallVector<unsigned> permutation(numUses);
     unsigned zero = 0;
     std::iota(permutation.begin(), permutation.end(), zero);
-    auto rng = std::default_random_engine(rngSeed);
     std::shuffle(permutation.begin(), permutation.end(), rng);
     return permutation;
   }
@@ -209,6 +214,8 @@ class TestPreserveUseListOrders
 
   /// Map each operation to its global ID.
   DenseMap<Operation *, uint32_t> opNumbering;
+
+  std::default_random_engine rng;
 };
 } // namespace
 


        


More information about the Mlir-commits mailing list