llvm / llvm/llvm-project

[mlir] Vectorize directly to a named contraction in e2e tests

Open
#159,749 2 comments 0 reactions 1 assignee Claimed by @banach-space View on GitHub
mlir
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Following #147296, we should try simplify our lowering pipelines for [e2e tests](https://github.com/llvm/llvm-project/tree/0d989b2aefe8d8f66981f1d39f56ce0214b5de86/mlir/test/Integration/Dialect/Linalg/CPU). Specifically,
* We should lower directly to named contractions, i.e. `vector.contract`, rather than via `vector.multi_reduction`.

Below are links to two examples. Specifically, lowering steps that we should be able to avoid if we lowered directly to `vector.contract`.

https://github.com/llvm/llvm-project/blob/0d989b2aefe8d8f66981f1d39f56ce0214b5de86/mlir/test/Integration/Dialect/Linalg/CPU/mmt4d.mlir#L82-L86

https://github.com/llvm/llvm-project/blob/0d989b2aefe8d8f66981f1d39f56ce0214b5de86/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/matmul.mlir#L105-L111

Another example is being added here: https://github.com/llvm/llvm-project/pull/157815

Note, in order to enable lowering directly to `vector.contract`, update:
```mlir
transform.structured.vectorize %op_to_vectorize vector_sizes [...] : !transform.any_op
```

as
```mlir
transform.structured.vectorize %op_to_vectorize vector_sizes [...] {create_named_contraction} : !transform.any_op
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.