[Mlir-commits] [mlir] [mlir][sparse][CRunnerUtils] Add shuffle in CRunnerUtils (PR #77124)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sun Jan 7 14:00:04 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 4ca1b5e094280ef1af40412e3cfcb62dc3cf15bc bd08525a24be6d75a7a37564f675566c5e38ef7f -- mlir/include/mlir/ExecutionEngine/CRunnerUtils.h mlir/lib/ExecutionEngine/CRunnerUtils.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/include/mlir/ExecutionEngine/CRunnerUtils.h b/mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
index eeb300935d..6ae60f3a86 100644
--- a/mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
+++ b/mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
@@ -482,13 +482,16 @@ extern "C" MLIR_CRUNNERUTILS_EXPORT double rtclock();
//===----------------------------------------------------------------------===//
// Uses a seed to initialize a random generator and returns the generator.
extern "C" MLIR_CRUNNERUTILS_EXPORT void *rtsrand(uint64_t s);
-// Uses a random number generator g and returns a random number in the range of [0, m).
+// Uses a random number generator g and returns a random number in the range of
+// [0, m).
extern "C" MLIR_CRUNNERUTILS_EXPORT uint64_t rtrand(void *g, uint64_t m);
// Deletes the random number generator.
extern "C" MLIR_CRUNNERUTILS_EXPORT void rtdrand(void *g);
-// Uses a random number generator g and std::shuffle to modify memref m in place.
-// m will be populated with unique and random numbers in the range of [0, size of m).
-extern "C" MLIR_CRUNNERUTILS_EXPORT void _mlir_ciface_shuffle(StridedMemRefType<uint64_t, 1> *m, void *g);
+// Uses a random number generator g and std::shuffle to modify memref m in
+// place. m will be populated with unique and random numbers in the range of [0,
+// size of m).
+extern "C" MLIR_CRUNNERUTILS_EXPORT void
+_mlir_ciface_shuffle(StridedMemRefType<uint64_t, 1> *m, void *g);
//===----------------------------------------------------------------------===//
// Runtime support library to allow the use of std::sort in MLIR program.
diff --git a/mlir/lib/ExecutionEngine/CRunnerUtils.cpp b/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
index 7949e759e7..c23249f0f4 100644
--- a/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
+++ b/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
@@ -176,7 +176,8 @@ extern "C" void rtdrand(void *g) {
delete generator;
}
-extern "C" void _mlir_ciface_shuffle(StridedMemRefType<uint64_t, 1> *m, void *g) {
+extern "C" void _mlir_ciface_shuffle(StridedMemRefType<uint64_t, 1> *m,
+ void *g) {
std::mt19937 *generator = static_cast<std::mt19937 *>(g);
uint64_t s = m->sizes[0];
std::vector<uint64_t> arr(s);
``````````
</details>
https://github.com/llvm/llvm-project/pull/77124
More information about the Mlir-commits
mailing list