<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/131602>131602</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir][vector] Unify Op argument names (draft)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir:vectorops
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
banach-space
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
banach-space
</td>
</tr>
</table>
<pre>
Below is a list of vector dialect operations that move values from an abstract
**source** to an abstract **destination**, i.e. "read"/"write" operations:
* `vector.load`, `vector.store`, `vector.transfer_read`,
`vector.transfer_write`, `vector.gather`, `vector.scatter`,
`vector.compressstore`, `vector.expandload`, `vector.maskedload`,
`vector.maskedstore`, `vector.extract`, `vector.insert`,
`vector.scalable_extract`, `vector.scalable_insert`,
`vector.extract_strided_slice`, `vector.insert_strided_slice`.
```
| **Vector Dialect Op** | **Operand Names** | **Operand Types** | **Result Name** | **Result Type** |
|--------------------------------|--------------------------|-------------------------------|------------------|----------------------|
| `vector.load` | `base` | `memref` | `result` | `vector` |
| `vector.store` | `valueToStore`, `base` | `vector`, `memref` | - | - |
| `vector.transfer_read` | `source` | `memref` / `tensor` | `vector` | `vector` |
| `vector.transfer_write` | `vector`, `source` | `vector`, `memref`/ `tensor` | `result` | `vector` |
| `vector.gather` | `base` | `memref` | `result` | `vector` |
| `vector.scatter` | `valueToStore`, `base` | `vector`, `memref` | - | - |
| `vector.expandload` | `base` | `memref` | `result` | `vector` |
| `vector.compressstore` | `valueToStore`,`base` | `vector`, `memref` | - | - |
| `vector.maskedload` | `base` | `memref` | `result` | `vector` |
| `vector.maskedstore` | `valueToStore`, `base` | `vector`, `memref` | - | - |
| `vector.extract` | `vector` | `vector` | `result` | `scalar` / `vector` |
| `vector.insert` | `source`, `dest` | `scalar` / `vector`, `vector` | `result` | `vector` |
| `vector.scalable_extract` | `source` | `vector` | `res` | `scalar` / `vector` |
| `vector.scalable_insert` | `source`, `dest` | `scalar` / `vector`, `vector` | `res` | `vector` |
| `vector.extract_strided_slice` | `vector` | `vector` | (missing name) | `vector` |
| `vector.insert_strided_slice` | `source`, `dest` | `vector` | `res` | `vector` |
```
Note that "read" operations take one operand ("from"), whereas "write"
operations require two ("value-to-store" and "to").
### Observations
Each "read" operation has a "from" argument, while each "write" operation has a
"to" and a "value-to-store" operand. However, the naming conventions are
**inconsistent**, making it difficult to extract common patterns or determine
operand roles. Here are some inconsistencies:
- `getBase()` in `vector.load` refers to the **"from"** operand (source).
- `getBase()` in `vector.store` refers to the **"to"** operand (destination).
- `vector.transfer_read` and `vector.transfer_write` use `getSource()`, which:
- **Conflicts** with the `vector.load` / `vector.store` naming pattern.
- **Does not clearly indicate** whether the operand represents a **source**
or **destination**.
- `vector.insert` defines `getSource()` and `getDest()`, making the distinction
between "to" and "from" operands **clear**. However, its sibling operation,
`vector.extract`, only defines `getVector()`, making it unclear whether it
represents a **source** or **destination**.
- `vector.store` uses `getValueToStore()`, whereas
`vector.insert_strided_slice` does not.
There is **no consistent way** to identify:
- `"from"` (read operand)
- `"to"` (write operand)
- `"value-to-store"` (written value)
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMWEuP2zYQ_jXyZWBDptf2-uCDN1sjpyzQpL0uKGlksZFIl6Ts-t8XfOgtxbtpUKwhJAtyHh8_DoczpEqxE0fcB-ungJCIchpnc3WmMQaEBOvnGS11JuS-PTOLRHLbP2EursAUUMiZ0iBSuGCshYSE0RxjDeKMkmomuAKdUQ2FuCBcaF6iglSKAigHGiktaayD8BAQ8ylRSuPc_A1atGXAjSaoNOPWsBsIyCdgC1xAQIhEmhjk5BgQcpVMm3W0kASrg3FlvUGwCR3kRS5oEmxCY6kZVFpIHIxqSblKUb5aV3Y2CA9jAs59X_9EdYZy6CymWlfjXYOxKM4SlRrHg_-cKU9GF1BQ9R1bU12zbnbKqNuV_jjjCqUes6ZimtMox9cp1Vpg2oZXfVVasgSTV5WzeIjN6Q-E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