[Mlir-commits] [mlir] [mlir][IR] Add `VectorTypeElementInterface` with `!llvm.ptr` (PR #133455)

Matthias Springer llvmlistbot at llvm.org
Mon Apr 7 11:44:17 PDT 2025


================
@@ -16,7 +16,36 @@
 
 include "mlir/IR/OpBase.td"
 
-def FloatTypeInterface : TypeInterface<"FloatType"> {
+//===----------------------------------------------------------------------===//
+// VectorElementTypeInterface
+//===----------------------------------------------------------------------===//
+
+def VectorElementTypeInterface : TypeInterface<"VectorElementTypeInterface"> {
+  let cppNamespace = "::mlir";
+  let description = [{
+    Implementing this interface establishes a contract between this type and the
+    vector type, indicating that this type can be used as element of vectors.
+
+    Vector element types are treated as a bag of bits without any assumed
+    structure. The size of an element type must be constant, but it does not
+    necessarily have to be a compile-time constant.
----------------
matthias-springer wrote:

Yes, this is about intermediate transformations. At the very end, when emitting machine code, the size must be known.

The `vector.bitcast` verifier looks up the bitwidth of the source/result types in the closest `DataLayout`. I think that should work as is.


https://github.com/llvm/llvm-project/pull/133455


More information about the Mlir-commits mailing list