Skip to content

Commit e2e97c8

Browse files
committed
fixup! fixup! [mlir][vector][docs] Document indexed vs. non-indexed arguments
Move renaming to #131602
1 parent 747cb61 commit e2e97c8

File tree

1 file changed

+19
-59
lines changed

1 file changed

+19
-59
lines changed

mlir/docs/Dialects/Vector.md

Lines changed: 19 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -269,63 +269,23 @@ Below is a list of vector dialect operations that move values from an abstract
269269
`vector.scalable_extract`, `vector.scalable_insert`,
270270
`vector.extract_strided_slice`, `vector.insert_strided_slice`.
271271

272-
#### Current Naming in Vector Dialect
273-
| **Vector Dialect Op** | **Operand Names** | **Operand Types** | **Result Name** | **Result Type** |
274-
|--------------------------------|--------------------------|-------------------------------|------------------|----------------------|
275-
| `vector.load` | `base` | `memref` | `result` | `vector` |
276-
| `vector.store` | `valueToStore`, `base` | `vector`, `memref` | - | - |
277-
| `vector.transfer_read` | `source` | `memref` / `tensor` | `vector` | `vector` |
278-
| `vector.transfer_write` | `vector`, `source` | `vector`, `memref`/ `tensor` | `result` | `vector` |
279-
| `vector.gather` | `base` | `memref` | `result` | `vector` |
280-
| `vector.scatter` | `valueToStore`, `base` | `vector`, `memref` | - | - |
281-
| `vector.expandload` | `base` | `memref` | `result` | `vector` |
282-
| `vector.compressstore` | `valueToStore`,`base` | `vector`, `memref` | - | - |
283-
| `vector.maskedload` | `base` | `memref` | `result` | `vector` |
284-
| `vector.maskedstore` | `valueToStore`, `base` | `vector`, `memref` | - | - |
285-
| `vector.extract` | `vector` | `vector` | `result` | `scalar` / `vector` |
286-
| `vector.insert` | `source`, `dest` | `scalar` / `vector`, `vector` | `result` | `vector` |
287-
| `vector.scalable_extract` | `source` | `vector` | `res` | `scalar` / `vector` |
288-
| `vector.scalable_insert` | `source`, `dest` | `scalar` / `vector`, `vector` | `res` | `vector` |
289-
| `vector.extract_strided_slice` | `vector` | `vector` | (missing name) | `vector` |
290-
| `vector.insert_strided_slice` | `source`, `dest` | `vector` | `res` | `vector` |
291-
292-
Note that "read" operations take one operand ("from"), whereas "write"
293-
operations require two ("value-to-store" and "to").
294-
295-
### Observations
296-
Each "read" operation has a "from" argument, while each "write" operation has a
297-
"to" and a "value-to-store" operand. However, the naming conventions are
298-
**inconsistent**, making it difficult to extract common patterns or determine
299-
operand roles. Here are some inconsistencies:
300-
301-
- `getBase()` in `vector.load` refers to the **"from"** operand (source).
302-
- `getBase()` in `vector.store` refers to the **"to"** operand (destination).
303-
- `vector.transfer_read` and `vector.transfer_write` use `getSource()`, which:
304-
- **Conflicts** with the `vector.load` / `vector.store` naming pattern.
305-
- **Does not clearly indicate** whether the operand represents a **source**
306-
or **destination**.
307-
- `vector.insert` defines `getSource()` and `getDest()`, making the distinction
308-
between "to" and "from" operands **clear**. However, its sibling operation,
309-
`vector.extract`, only defines `getVector()`, making it unclear whether it
310-
represents a **source** or **destination**.
311-
- `vector.store` uses `getValueToStore()`, whereas
312-
`vector.insert_strided_slice` does not.
313-
314-
There is **no consistent way** to identify:
315-
- `"from"` (read operand)
316-
- `"to"` (write operand)
317-
- `"value-to-store"` (written value)
272+
These operations share the following properties:
273+
- One of their arguments must be a `vector`.
274+
- The other argument (or result) can be either a `vector` or a scalar.
275+
276+
Our existing taxonomies make it difficult to differentiate between the two.
318277

319278
### Indexed vs. Non-Indexed Taxonomy
320-
A more consistent way to classify "to", "from", and "value-to-store" arguments
321-
is by determining whether an operand is _indexed_ or _non-indexed_.
279+
A useful way to classify arguments in "read"/"write" operations is to determine
280+
whether an operand is **indexed** or **non-indexed**.
322281

323282
The distinction is somewhat intuitive, but for clarity:
324-
- Indexed operands require indices to specify an element/slice (e.g., `%A[0]`).
325-
- Non-indexed operands do not require indices as they are accessed in their
326-
entirety (e.g., `%B`).
283+
- **Indexed operands** require indices to specify an element or slice
284+
(e.g., `%A[0]`).
285+
- **Non-indexed operands** do not require indices, as they are accessed in
286+
their entirety (e.g., `%B`).
327287

328-
Below is an example using: `vector.transfer_read` and `vector.transfer_write`
288+
Below is an example using `vector.transfer_read` and `vector.transfer_write`:
329289
```mlir
330290
Indexed Operand
331291
|
@@ -342,15 +302,15 @@ vector.transfer_write %4, %arg1[%c3, %c3]
342302
: vector<1x1x4x3xf32>, memref<?x?xvector<4x3xf32>>
343303
```
344304

345-
Using the "indexed" vs. "non-indexed" classification, we can systematically
346-
differentiate between "to", "from" and "value-to-store" arguments across
305+
Using the indexed vs. non-indexed classification, we can also systematically
306+
differentiate between "to", "from", and "value-to-store" arguments across
347307
operations:
348-
* "to" is always _indexed_ for "write" operations, "value-to-store" is
349-
_non-indexed_,
350-
* "from" is always _indexed_ for "read" operations.
351308

352-
In addition, for "read" operations, we can view the "result" as a non-indexed
353-
argument.
309+
* "to" is always indexed for "write" operations (i.e., always a `vector`), while
310+
"value-to-store" is non-indexed (i.e., either a `vector` or a scalar).
311+
* "from" is always indexed for "read" operations (i.e., a `vector`).
312+
313+
Finally, for "read" operations, the "result" can be viewed as a non-indexed argument.
354314

355315
## Bikeshed Naming Discussion
356316

0 commit comments

Comments
 (0)