1# Vector Dialect
2
3MLIR supports multi-dimensional `vector` types and custom operations on those
4types. A generic, retargetable, higher-order ``vector`` type (`n-D` with `n >
51`) is a structured type, that carries semantic information useful for
6transformations. This document discusses retargetable abstractions that exist
7in MLIR today and operate on ssa-values of type `vector` along with pattern
8rewrites and lowerings that enable targeting specific instructions on concrete
9targets. These abstractions serve to separate concerns between operations on
10`memref` (a.k.a buffers) and operations on ``vector`` values. This is not a
11new proposal but rather a textual documentation of existing MLIR components
12along with a rationale.
13
14## Positioning in the Codegen Infrastructure
15The following diagram, recently presented with the [StructuredOps
16abstractions](https://drive.google.com/corp/drive/u/0/folders/1sRAsgsd8Bvpm_IxREmZf2agsGU2KvrK-),
17captures the current codegen paths implemented in MLIR in the various existing
18lowering paths.
19![](https://user-images.githubusercontent.com/10148468/71177417-f78e4d80-2239-11ea-92ef-700f42ea503f.png)
20
21The following diagram seeks to isolate `vector` dialects from the complexity
22of the codegen paths and focus on the payload-carrying ops that operate on std
23and `vector` types. This diagram is not to be taken as set in stone and
24representative of what exists today but rather illustrates the layering of
25abstractions in MLIR.
26
27![`vector` Abstractions in MLIR](https://user-images.githubusercontent.com/10148468/71176949-e85ad000-2238-11ea-9806-200843bc4943.png)
28
29This  separates concerns related to (a) defining efficient operations on
30`vector` types from (b) program analyses + transformations on `memref`, loops
31and other types of structured ops (be they `HLO`, `LHLO`, `Linalg` or other ).
32Looking a bit forward in time, we can put a stake in the ground and venture
33that the higher level of `vector`-level primitives we build and target from
34codegen (or some user/language level), the simpler our task will be, the more
35complex patterns can be expressed and the better performance will be.
36
37## Components of a Generic Retargetable Vector-Level Dialect
38The existing MLIR `vector`-level dialects are related to the following
39bottom-up abstractions:
40
411. Representation in `LLVMIR` via data structures, instructions and
42intrinsics. This is referred to as the `LLVM` level.
432. Set of machine-specific operations and types that are built to translate
44almost 1-1 with the HW ISA. This is referred to as the Hardware Vector level;
45a.k.a `HWV`. For instance, we have (a) a `NVVM` dialect (for `CUDA`) with
46tensor core ops, (b) accelerator-specific dialects (internal), a potential
47(future) `CPU` dialect to capture `LLVM` intrinsics more closely and other
48dialects for specific hardware. Ideally this should be auto-generated as much
49as possible from the `LLVM` level.
503. Set of virtual, machine-agnostic, operations that are informed by costs at
51the `HWV`-level. This is referred to as the Virtual Vector level; a.k.a
52`VV`. This is the level that higher-level abstractions (codegen, automatic
53vectorization, potential vector language, ...) targets.
54
55The existing generic, retargetable, `vector`-level dialect is related to the
56following top-down rewrites and conversions:
57
581. MLIR Rewrite Patterns applied by the MLIR `PatternRewrite` infrastructure
59to progressively lower to implementations that match closer and closer to the
60`HWV`. Some patterns are "in-dialect" `VV -> VV` and some are conversions `VV
61-> HWV`.
622. `Virtual Vector -> Hardware Vector` lowering is specified as a set of MLIR
63lowering patterns that are specified manually for now.
643. `Hardware Vector -> LLVM` lowering is a mechanical process that is written
65manually at the moment and that should be automated, following the `LLVM ->
66Hardware Vector` ops generation as closely as possible.
67
68## Short Description of the Existing Infrastructure
69
70### LLVM level
71On CPU, the `n-D` `vector` type currently lowers to
72`!llvm<array<vector>>`. More concretely, `vector<4x8x128xf32>` lowers to
73`!llvm<[4 x [ 8 x [ 128 x float ]]]>`.
74There are tradeoffs involved related to how one can access subvectors and how
75one uses `llvm.extractelement`, `llvm.insertelement` and
76`llvm.shufflevector`. A [deeper dive section](#DeeperDive) discusses the
77current lowering choices and tradeoffs.
78
79### Hardware Vector Ops
80Hardware Vector Ops are implemented as one dialect per target.
81For internal hardware, we are auto-generating the specific HW dialects.
82For `GPU`, the `NVVM` dialect adds operations such as `mma.sync`, `shfl` and
83tests.
84For `CPU` things are somewhat in-flight because the abstraction is close to
85`LLVMIR`. The jury is still out on  whether a generic `CPU` dialect is
86concretely needed, but it seems reasonable to have the same levels of
87abstraction for all targets and perform cost-based lowering decisions in MLIR
88even for `LLVM`.
89Specialized `CPU` dialects that would capture specific features not well
90captured by LLVM peephole optimizations of on different types that core MLIR
91supports (e.g. Scalable Vectors) are welcome future extensions.
92
93### Virtual Vector Ops
94Some existing Standard and VectorOps Dialect on `n-D` `vector` types comprise:
95```
96%2 = std.addf %0, %1 : vector<3x7x8xf32>  // -> vector<3x7x8xf32>
97%2 = std.mulf %0, %1 : vector<3x7x8xf32>  // -> vector<3x7x8xf32>
98%2 = std.splat %1    : vector<3x7x8xf32>  // -> vector<3x7x8xf32>
99
100%1 = vector.extract %0[1]: vector<3x7x8xf32>                 // -> vector<7x8xf32>
101%1 = vector.extract %0[1, 5]: vector<3x7x8xf32>            // -> vector<8xf32>
102%2 = vector.outerproduct %0, %1: vector<4xf32>, vector<8xf32>     // -> vector<4x8xf32>
103%3 = vector.outerproduct %0, %1, %2: vector<4xf32>, vector<8xf32> // fma when adding %2
104%3 = vector.strided_slice %0 {offsets = [2, 2], sizes = [2, 2], strides = [1, 1]}:
105   vector<4x8x16xf32> // Returns a slice of type vector<2x2x16xf32>
106
107%2 = vector.transfer_read %A[%0, %1]
108  {permutation_map = (d0, d1) -> (d0)}: memref<7x?xf32>, vector<4xf32>
109
110vector.transfer_write %f1, %A[%i0, %i1, %i2, %i3]
111  {permutation_map = (d0, d1, d2, d3) -> (d3, d1, d0)} :
112    vector<5x4x3xf32>, memref<?x?x?x?xf32>
113```
114
115The list of VectorOps is currently undergoing evolutions and is best kept
116track of by following the evolution of the
117[VectorOps.td](https://github.com/llvm/llvm-project/blob/master/mlir/include/mlir/Dialect/VectorOps/VectorOps.td)
118ODS file (markdown documentation is automatically generated locally when
119building and populates the [Vector
120doc](https://github.com/llvm/llvm-project/blob/master/mlir/docs/Dialects/Vector.md)). Recent
121extensions are driven by concrete use cases of interest. A notable such use
122case is the `vector.contract` op which applies principles of the StructuredOps
123abstraction to `vector` types.
124
125### Virtual Vector Rewrite Patterns
126
127The following rewrite patterns exist at the `VV->VV` level:
128
1291. The now retired `MaterializeVector` pass used to legalize ops on a
130coarse-grained virtual `vector` to a finer-grained virtual `vector` by
131unrolling. This has been rewritten as a retargetable unroll-and-jam pattern on
132`vector` ops and `vector` types.
1332. The lowering of `vector_transfer` ops legalizes `vector` load/store ops to
134permuted loops over scalar load/stores. This should evolve to loops over
135`vector` load/stores + `mask` operations as they become available `vector` ops
136at the `VV` level.
137
138The general direction is to add more Virtual Vector level ops and implement
139more useful `VV -> VV` rewrites as composable patterns that the PatternRewrite
140infrastructure can apply iteratively.
141
142### Virtual Vector to Hardware Vector Lowering
143For now, `VV -> HWV`  are specified in C++ (see for instance the
144[SplatOpLowering for n-D
145vectors](https://github.com/tensorflow/mlir/commit/0a0c4867c6a6fcb0a2f17ef26a791c1d551fe33d)
146or the [VectorOuterProductOp
147lowering](https://github.com/tensorflow/mlir/commit/957b1ca9680b4aacabb3a480fbc4ebd2506334b8)).
148
149Simple [conversion
150tests](https://github.com/llvm/llvm-project/blob/master/mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir)
151are available for the `LLVM` target starting from the Virtual Vector Level.
152
153## Rationale
154### Hardware as `vector` Machines of Minimum Granularity
155
156Higher-dimensional `vector`s are ubiquitous in modern HPC hardware. One way to
157think about Generic Retargetable `vector`-Level Dialect is that it operates on
158`vector` types that are a multiples of a "good" `vector` size so the HW can
159efficiently implement a set of high-level primitives
160(e.g. `vector<8x8x8x16xf32>` when HW `vector` size is say `vector<4x8xf32>`).
161
162Some notable `vector` sizes of interest include:
163
1641. CPU: `vector<HW_vector_size * k>`,  `vector<core_count * k’ x
165HW_vector_size * k>` and  `vector<socket_count x core_count * k’ x
166HW_vector_size * k>`
1672. GPU: `vector<warp_size * k>`, `vector<warp_size * k  x float4>` and
168`vector<warp_size * k x 4 x 4 x 4>` for tensor_core sizes,
1693. Other accelerators:  n-D `vector` as first-class citizens in the HW.
170
171Depending on the target, ops on sizes that are not multiples of the HW
172`vector` size may either produce slow code (e.g. by going through `LLVM`
173legalization) or may not legalize at all (e.g. some unsupported accelerator X
174combination of ops and types).
175
176### Transformations Problems Avoided
177A `vector<16x32x64xf32>` virtual `vector` is a coarse-grained type that can be
178“unrolled” to HW-specific sizes. The multi-dimensional unrolling factors are
179carried in the IR by the `vector` type. After unrolling, traditional
180instruction-level scheduling can be run.
181
182The following key transformations (along with the supporting analyses and
183structural constraints) are completely avoided by operating on a ``vector``
184`ssa-value` abstraction:
185
1861. Loop unroll and unroll-and-jam.
1872. Loop and load-store restructuring for register reuse.
1883. Load to store forwarding and Mem2reg.
1894. Coarsening (raising) from finer-grained `vector` form.
190
191Note that “unrolling” in the context of `vector`s corresponds to partial loop
192unroll-and-jam and not full unrolling. As a consequence this is expected to
193compose with SW pipelining where applicable and does not result in ICache blow
194up.
195
196### The Big Out-Of-Scope Piece: Automatic Vectorization
197One important piece not discussed here is automatic vectorization
198(automatically raising from scalar to n-D `vector` ops and types). The TL;DR
199is that when the first "super-vectorization" prototype was implemented, MLIR
200was nowhere near as mature as it is today. As we continue building more
201abstractions in  `VV -> HWV`, there is an opportunity to revisit vectorization
202in MLIR.
203
204Since this topic touches on codegen abstractions, it is technically out of the
205scope of this survey document but there is a lot to discuss in light of
206structured op type representations and how a vectorization transformation can
207be reused across dialects. In particular, MLIR allows the definition of
208dialects at arbitrary levels of granularity and lends itself favorably to
209progressive lowering. The argument can be made that automatic vectorization on
210a loops + ops abstraction is akin to raising structural information that has
211been lost. Instead, it is possible to revisit vectorization as simple pattern
212rewrites, provided the IR is in a suitable form. For instance, vectorizing a
213`linalg.generic` op whose semantics match a `matmul` can be done [quite easily
214with a
215pattern](https://github.com/tensorflow/mlir/commit/bff722d6b59ab99b998f0c2b9fccd0267d9f93b5). In
216fact this pattern is trivial to generalize to any type of contraction when
217targeting the `vector.contract` op, as well as to any field (`+/*`, `min/+`,
218`max/+`, `or/and`, `logsumexp/+` ...) . In other words, by operating on a
219higher level of generic abstractions than affine loops, non-trivial
220transformations become significantly simpler and composable at a finer
221granularity.
222
223Irrespective of the existence of an auto-vectorizer, one can build a notional
224vector language based on the VectorOps dialect and build end-to-end models
225with expressing `vector`s in the IR directly and simple
226pattern-rewrites. [EDSC](https://github.com/llvm/llvm-project/blob/master/mlir/docs/EDSC.md)s
227provide a simple way of driving such a notional language directly in C++.
228
229## Bikeshed Naming Discussion
230There are arguments against naming an n-D level of abstraction `vector`
231because most people associate it with 1-D `vector`s. On the other hand,
232`vector`s are first-class n-D values in MLIR.
233The alternative name Tile has been proposed, which conveys higher-D
234meaning. But it also is one of the most overloaded terms in compilers and
235hardware.
236For now, we generally use the `n-D` `vector` name and are open to better
237suggestions.
238
239## DeeperDive
240
241This section describes the tradeoffs involved in lowering the MLIR n-D vector
242type and  operations on it to LLVM-IR. Putting aside the [LLVM
243Matrix](http://lists.llvm.org/pipermail/llvm-dev/2018-October/126871.html)
244proposal for now, this assumes LLVM only has built-in support for 1-D
245vector. The relationship with the LLVM Matrix proposal is discussed at the end
246of this document.
247
248MLIR does not currently support dynamic vector sizes (i.e. SVE style) so the
249discussion is limited to static rank and static vector sizes
250(e.g. `vector<4x8x16x32xf32>`). This section discusses operations on vectors
251in LLVM and MLIR.
252
253LLVM instructions are prefixed by the `llvm.` dialect prefix
254(e.g. `llvm.insertvalue`). Such ops operate exclusively on 1-D vectors and
255aggregates following the [LLVM LangRef](https://llvm.org/docs/LangRef.html).
256MLIR operations are prefixed by the `vector.` dialect prefix
257(e.g. `vector.insertelement`). Such ops operate exclusively on MLIR `n-D`
258`vector` types.
259
260### Alternatives For Lowering an n-D Vector Type to LLVM
261Consider a vector of rank n with  static sizes `{s_0, ... s_{n-1}}` (i.e. an
262MLIR `vector<s_0x...s_{n-1}xf32>`). Lowering such an `n-D` MLIR vector type to
263an LLVM descriptor can be done by either:
264
2651. Flattening to a `1-D` vector: `!llvm<"(s_0*...*s_{n-1})xfloat">` in the
266MLIR LLVM dialect.
2672. Nested aggregate type of `1-D` vector:
268`!llvm<"[s_0x[s_1x[...<s_{n-1}xfloat>]]]">` in the MLIR LLVM dialect.
2693. A mix of both.
270
271There are multiple tradeoffs involved in choosing one or the other that we
272discuss. It is important to note that “a mix of both” immediately reduces to
273“nested aggregate type of 1-D vector” with a `vector.cast %0:
274vector<4x8x16x32xf32> to vector<4x4096xf32>` operation, that flattens the most
275"k" minor dimensions.
276
277### Constraints Inherited from LLVM (see LangRef)
278The first constraint was already mentioned: LLVM only supports `1-D` `vector`
279types natively.
280Additional constraints are related to the difference in LLVM between vector
281and aggregate types:
282```
283 “Aggregate Types are a subset of derived types that can contain multiple
284 member types. Arrays and structs are aggregate types. Vectors are not
285 considered to be aggregate types.”.
286```
287
288This distinction is also reflected in some of the operations. For `1-D`
289vectors, the operations `llvm.extractelement`, `llvm.insertelement`, and
290`llvm.shufflevector` apply, with direct support for dynamic indices. For `n-D`
291vectors with `n>1`, and thus aggregate types at LLVM level, the more
292restrictive operations `llvm.extractvalue` and `llvm.insertvalue` apply, which
293only accept static indices. There is no direct shuffling support for aggregate
294types.
295
296The next sentence illustrates a recurrent tradeoff, also found in MLIR,
297between “value types” (subject to SSA use-def chains) and “memory types”
298(subject to aliasing and side-effects):
299```
300“Structures in memory are accessed using ‘load’ and ‘store’ by getting a
301pointer to a field with the llvm.getelementptr instruction. Structures in
302registers are accessed using the llvm.extractvalue and llvm.insertvalue
303instructions.”
304```
305
306When transposing this to MLIR, `llvm.getelementptr` works on pointers to `n-D`
307vectors in memory. For `n-D`, vectors values that live in registers we can use
308`vector.extract` and `vector.insert` which do not accept dynamic indices. Note
309that this is consistent with hardware considerations as discussed below.
310
311An alternative is to use an LLVM `1-D` `vector` type for which one can use
312`llvm.extractelement`, `llvm.insertelement` and `llvm.shufflevector`. These
313operations accept dynamic indices. The implication is that one has to use a
314flattened lowering of an MLIR n-D vector to an LLVM 1-D vector.
315
316There are multiple tradeoffs involved that mix implications on the programming
317model, execution on actual HW and what is visible or hidden from codegen. They
318are discussed in the following sections.
319
320### Nested Aggregate
321Pros:
322
3231. Natural encoding n-D vector -> (n-1)-D aggregate over 1-D vector.
3242. No need for linearization / delinearization logic inserted everywhere.
3253. `llvm.insertvalue`, `llvm.extractvalue` of `(n-k)-D` aggregate is natural.
3264. `llvm.insertelement`, `llvm.extractelement`, `llvm.shufflevector` over
327`1-D` vector type is natural.
328
329Cons:
330
3311. `llvm.insertvalue` / `llvm.extractvalue` does not accept dynamic indices
332but only static ones.
3332. Dynamic indexing on the non-most-minor dimension requires roundtrips to
334memory.
3353. Special intrinsics and native instructions in LLVM operate on `1-D`
336vectors. This is not expected to be a practical limitation thanks to a
337`vector.cast %0: vector<4x8x16x32xf32> to vector<4x4096xf32>` operation, that
338flattens the most minor dimensions (see the bigger picture in implications on
339codegen).
340
341### Flattened 1-D Vector Type
342
343Pros:
344
3451. `insertelement` / `extractelement` / `shufflevector` with dynamic indexing
346is possible over the whole lowered `n-D` vector type.
3472. Supports special intrinsics and native operations.
348
349Cons:
3501. Requires linearization/delinearization logic everywhere, translations are
351complex.
3522. Hides away the real HW structure behind dynamic indexing: at the end of the
353day, HW vector sizes are generally fixed and multiple vectors will be needed
354to hold a vector that is larger than the HW.
3553. Unlikely peephole optimizations will result in good code: arbitrary dynamic
356accesses, especially at HW vector boundaries unlikely to result in regular
357patterns.
358
359### Discussion
360#### HW Vectors and Implications on the SW and the Programming Model
361As of today, the LLVM model only support `1-D` vector types. This is
362unsurprising because historically, the vast majority of HW only supports `1-D`
363vector registers. We note that multiple HW vendors are in the process of
364evolving to higher-dimensional physical vectors.
365
366In the following discussion, let's assume the HW vector size is `1-D and the
367SW vector size is `n-D`, with `n >= 1`. The same discussion would apply with
368`2-D` HW `vector` size and `n >= 2`. In this context, most HW exhibit a vector
369register file. The number of such vectors is fixed.
370Depending on the rank and sizes of the SW vector abstraction and the HW vector
371sizes and number of registers, an `n-D` SW vector type may be materialized by
372a mix of multiple `1-D` HW vector registers + memory locations at a given
373point in time.
374
375The implication of the physical HW constraints on the programming model are
376that one cannot index dynamically across hardware registers: a register file
377can generally not be indexed dynamically. This is because the register number
378is fixed and one either needs to unroll explicitly to obtain fixed register
379numbers or go through memory. This is a constraint familiar to CUDA
380programmers: when declaring a `private float a[4]`; and subsequently indexing
381with a *dynamic* value results in so-called **local memory** usage
382(i.e. roundtripping to memory).
383
384#### Implication on codegen
385MLIR `n-D` vector types are currently represented as `(n-1)-D` arrays of `1-D`
386vectors when lowered to LLVM.
387This introduces the consequences on static vs dynamic indexing discussed
388previously: `extractelement`, `insertelement` and `shufflevector` on `n-D`
389vectors in MLIR only support static indices. Dynamic indices are only
390supported on the most minor `1-D` vector but not the outer `(n-1)-D`.
391For other cases, explicit load / stores are required.
392
393The implications on codegen are as follows:
394
3951. Loops around `vector` values are indirect addressing of vector values, they
396must operate on explicit load / store operations over `n-D` vector types.
3972. Once an `n-D` `vector` type is loaded into an SSA value (that may or may
398not live in `n` registers, with or without spilling, when eventually lowered),
399it may be unrolled to smaller `k-D` `vector` types and operations that
400correspond to the HW. This level of MLIR codegen is related to register
401allocation and spilling that occur much later in the LLVM pipeline.
4023. HW may support >1-D vectors with intrinsics for indirect addressing within
403these vectors. These can be targeted thanks to explicit `vector_cast`
404operations from MLIR `k-D` vector types and operations to LLVM `1-D` vectors +
405intrinsics.
406
407Alternatively, we argue that directly lowering to a linearized abstraction
408hides away the codegen complexities related to memory accesses by giving a
409false impression of magical dynamic indexing across registers. Instead we
410prefer to make those very explicit in MLIR and allow codegen to explore
411tradeoffs.
412Different HW will require different tradeoffs in the sizes involved in steps
4131., 2. and 3.
414
415Decisions made at the MLIR level will have implications at a much later stage
416in LLVM (after register allocation). We do not envision to expose concerns
417related to modeling of register allocation and spilling to MLIR
418explicitly. Instead, each target will expose a set of "good" target operations
419and `n-D` vector types, associated with costs that `PatterRewriters` at the
420MLIR level will be able to target. Such costs at the MLIR level will be
421abstract and used for ranking, not for accurate performance modeling. In the
422future such costs will be learned.
423
424#### Implication on Lowering to Accelerators
425To target accelerators that support higher dimensional vectors natively, we
426can start from either `1-D` or `n-D` vectors in MLIR and use `vector.cast` to
427flatten the most minor dimensions to `1-D` `vector<Kxf32>` where `K` is an
428appropriate constant. Then, the existing lowering to LLVM-IR immediately
429applies, with extensions for accelerator-specific intrinsics.
430
431It is the role of an Accelerator-specific vector dialect (see codegen flow in
432the figure above) to lower the `vector.cast`. Accelerator -> LLVM lowering
433would then consist of a bunch of `Accelerator -> Accelerator` rewrites to
434perform the casts composed with `Accelerator -> LLVM` conversions + intrinsics
435that operate on `1-D` `vector<Kxf32>`.
436
437Some of those rewrites may need extra handling, especially if a reduction is
438involved. For example, `vector.cast %0: vector<K1x...xKnxf32> to
439vector<Kxf32>` when `K != K1 * … * Kn` and some arbitrary irregular
440`vector.cast %0: vector<4x4x17xf32> to vector<Kxf32>` may introduce masking
441and intra-vector shuffling that may not be worthwhile or even feasible,
442i.e. infinite cost.
443
444However `vector.cast %0: vector<K1x...xKnxf32> to vector<Kxf32>` when `K =
445K1 * … * Kn` should be close to a noop.
446
447As we start building accelerator-specific abstractions, we hope to achieve
448retargetable codegen: the same infra is used for CPU, GPU and accelerators
449with extra MLIR patterns and costs.
450
451#### Implication on calling external functions that operate on vectors
452It is possible (likely) that we additionally need to linearize when calling an
453external function.
454
455### Relationship to LLVM matrix type proposal.
456The LLVM matrix proposal was formulated 1 year ago but seemed to be somewhat
457stalled until recently. In its current form, it is limited to 2-D matrix types
458and operations are implemented with LLVM intrinsics.
459In contrast, MLIR sits at a higher level of abstraction and allows the
460lowering of generic operations on generic n-D vector types from MLIR to
461aggregates of 1-D LLVM vectors.
462In the future, it could make sense to lower to the LLVM matrix abstraction
463also for CPU even though MLIR will continue needing higher level abstractions.
464
465On the other hand, one should note that as MLIR is moving to LLVM, this
466document could become the unifying abstraction that people should target for
467>1-D vectors and the LLVM matrix proposal can be viewed as a subset of this
468work.
469
470### Conclusion
471The flattened 1-D vector design in the LLVM matrix proposal is good in a
472HW-specific world with special intrinsics. This is a good abstraction for
473register allocation, Instruction-Level-Parallelism and
474SoftWare-Pipelining/Modulo Scheduling optimizations at the register level.
475However MLIR codegen operates at a higher level of abstraction where we want
476to target operations on coarser-grained vectors than the HW size and on which
477unroll-and-jam is applied and patterns across multiple HW vectors can be
478matched.
479
480This makes “nested aggregate type of 1-D vector” an appealing abstraction for
481lowering from MLIR because:
482
4831. it does not hide complexity related to the buffer vs value semantics and
484the memory subsystem and
4852. it does not rely on LLVM to magically make all the things work from a too
486low-level abstraction.
487
488The use of special intrinsics in a `1-D` LLVM world is still available thanks
489to an explicit `vector.cast` op.
490
491
492### Operations
493
494