[Mlir-commits] [mlir] 79aa9bf - [mlir] Fix RunnerUtils template specialization

Nicolas Vasilache llvmlistbot at llvm.org
Wed May 27 13:18:51 PDT 2020


Author: Nicolas Vasilache
Date: 2020-05-27T16:14:43-04:00
New Revision: 79aa9bfdb819c02faa3c6c78e307b20ae7f69057

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

LOG: [mlir] Fix RunnerUtils template specialization

Undoing a spurious change that broke SFINAE for some out of core use
cases.

Added: 
    

Modified: 
    mlir/include/mlir/ExecutionEngine/CRunnerUtils.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/ExecutionEngine/CRunnerUtils.h b/mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
index bc59d3de2086..604e90258ca0 100644
--- a/mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
+++ b/mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
@@ -106,6 +106,12 @@ using Vector3D = Vector<T, D1, D2, D3>;
 template <int D1, int D2, int D3, int D4, typename T>
 using Vector4D = Vector<T, D1, D2, D3, D4>;
 
+template <int N>
+void dropFront(int64_t arr[N], int64_t *res) {
+  for (unsigned i = 1; i < N; ++i)
+    *(res + i - 1) = arr[i];
+}
+
 //===----------------------------------------------------------------------===//
 // Codegen-compatible structures for StridedMemRef type.
 //===----------------------------------------------------------------------===//
@@ -123,10 +129,6 @@ struct StridedMemRefType {
     res.basePtr = basePtr;
     res.data = data;
     res.offset = offset + idx * strides[0];
-    auto dropFront = [](const int64_t *arr, int64_t *res) {
-      for (unsigned i = 1; i < N; ++i)
-        res[i - 1] = arr[i];
-    };
     dropFront<N>(sizes, res.sizes);
     dropFront<N>(strides, res.strides);
     return res;
@@ -209,3 +211,4 @@ extern "C" MLIR_CRUNNERUTILS_EXPORT void print_comma();
 extern "C" MLIR_CRUNNERUTILS_EXPORT void print_newline();
 
 #endif // EXECUTIONENGINE_CRUNNERUTILS_H_
+


        


More information about the Mlir-commits mailing list