[Mlir-commits] [mlir] [mlir][vector] Add vector.step operation (PR #96776)

Benjamin Maxwell llvmlistbot at llvm.org
Wed Jul 3 07:34:41 PDT 2024


================
@@ -3017,6 +3017,35 @@ def Vector_ScanOp :
   let hasVerifier = 1;
 }
 
+//===----------------------------------------------------------------------===//
+// VectorStepOp
+//===----------------------------------------------------------------------===//
+
+def Vector_StepOp : Vector_Op<"step", [Pure]> {
+  let summary = "A linear sequence of values from 0 to N";
+  let description = [{
+    A `step` operation produces an index vector, i.e. a 1-D vector of values of
+    index type that represents a linear sequence from 0 to N-1, where N is the
+    number of elements in the `result` vector.
+
+    Supports fixed-width and scalable vectors. For a fixed-width `step` vector,
+    the canonical representation is `arith.constant dense<[0, .., N-1]>`. A
+    scalable step cannot be represented as a constant and is lowered to the
+    [llvm.experimental.stepvector](https://llvm.org/docs/LangRef.html#llvm-experimental-stepvector-intrinsic)
+    intrinsic.
----------------
MacDue wrote:

I don't think a Vector level operation has a specific lowering (not all paths out of Vector go through LLVM). You could maybe reword it slightly to say "When lowering to LLVM a scalable step can be...". 

However, I'm not sure it's necessary to talk about how an op is lowered (i.e. specific intrinsic) within the operation description.  

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


More information about the Mlir-commits mailing list