[PATCH] D75409: [mlir] NFC - Move Vector structure from RunnerUtils.h to CRunnerUtils.h
Nicolas Vasilache via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 29 10:42:53 PST 2020
nicolasvasilache created this revision.
Herald added subscribers: llvm-commits, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, burmako, jpienaar, rriddle, mehdi_amini.
Herald added a project: LLVM.
The Vector struct does not require a C++ runtime.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D75409
Files:
mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
mlir/include/mlir/ExecutionEngine/RunnerUtils.h
Index: mlir/include/mlir/ExecutionEngine/RunnerUtils.h
===================================================================
--- mlir/include/mlir/ExecutionEngine/RunnerUtils.h
+++ mlir/include/mlir/ExecutionEngine/RunnerUtils.h
@@ -60,18 +60,6 @@
<< "descriptor@ = " << reinterpret_cast<void *>(V.descriptor) << "\n";
}
-template <typename T, int Dim, int... Dims> struct Vector {
- Vector<T, Dims...> vector[Dim];
-};
-template <typename T, int Dim> struct Vector<T, Dim> { T vector[Dim]; };
-
-template <int D1, typename T> using Vector1D = Vector<T, D1>;
-template <int D1, int D2, typename T> using Vector2D = Vector<T, D1, D2>;
-template <int D1, int D2, int D3, typename T>
-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>;
-
////////////////////////////////////////////////////////////////////////////////
// Templated instantiation follows.
////////////////////////////////////////////////////////////////////////////////
Index: mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
===================================================================
--- mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
+++ mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
@@ -36,6 +36,24 @@
*(res + i - 1) = arr[i];
}
+//===----------------------------------------------------------------------===//
+// Codegen-compatible structures for Vector type.
+//===----------------------------------------------------------------------===//
+template <typename T, int Dim, int... Dims> struct Vector {
+ Vector<T, Dims...> vector[Dim];
+};
+template <typename T, int Dim> struct Vector<T, Dim> { T vector[Dim]; };
+
+template <int D1, typename T> using Vector1D = Vector<T, D1>;
+template <int D1, int D2, typename T> using Vector2D = Vector<T, D1, D2>;
+template <int D1, int D2, int D3, typename T>
+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>;
+
+//===----------------------------------------------------------------------===//
+// Codegen-compatible structures for StridedMemRef type.
+//===----------------------------------------------------------------------===//
/// StridedMemRef descriptor type with static rank.
template <typename T, int N> struct StridedMemRefType {
T *basePtr;
@@ -72,13 +90,18 @@
int64_t offset;
};
+//===----------------------------------------------------------------------===//
+// Codegen-compatible structure for UnrankedMemRef type.
+//===----------------------------------------------------------------------===//
// Unranked MemRef
template <typename T> struct UnrankedMemRefType {
int64_t rank;
void *descriptor;
};
-// Small runtime support "lib" for vector.print lowering.
+//===----------------------------------------------------------------------===//
+// Small runtime support "lib" for vector.print lowering during codegen.
+//===----------------------------------------------------------------------===//
extern "C" MLIR_CRUNNERUTILS_EXPORT void print_f32(float f);
extern "C" MLIR_CRUNNERUTILS_EXPORT void print_f64(double d);
extern "C" MLIR_CRUNNERUTILS_EXPORT void print_open();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75409.247452.patch
Type: text/x-patch
Size: 3243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200229/6fadbb2b/attachment.bin>
More information about the llvm-commits
mailing list