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

Andrzej Warzyński llvmlistbot at llvm.org
Mon Apr 7 10:20:14 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.
----------------
banach-space wrote:

I am curious about this wording:

> The size of an element type must be constant, but it does not
    necessarily have to be a compile-time constant.
    
Is this specifically referring to types like index and llvm.ptr? I would have thought that their sizes are known when compiling to machine code. Perhaps this is more about intermediate transformations, where the exact bit-width isn't resolved yet? In those cases, I suppose we’d have to block certain operations - like `vector.bitcast` when the element type changes size.

This is a non-blocking comment.

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


More information about the Mlir-commits mailing list