7 Commits

Author SHA1 Message Date
Andrzej Warzyński
e276dcec17
[mlir][arith] Refine the verifier for arith.constant (#87999)
Disallows initialization of scalable vectors with an attribute of
arbitrary values, e.g.:
```mlir
  %c = arith.constant dense<[0, 1]> : vector<[2] x i32>
```

Initialization using vector splats remains allowed (i.e. when all the
init values are identical):
```mlir
  %c = arith.constant dense<[1, 1]> : vector<[2] x i32>
```

Note: This is a re-upload of #86178
2024-04-08 21:22:00 +01:00
Han-Chung Wang
ef5a710911
[mlir][vector] Skip 0D vectors in vector linearization. (#87577) 2024-04-03 17:00:56 -07:00
Andrzej Warzyński
d3aa92ed14
[mlir][vector] Add support for scalable vectors to VectorLinearize (#86786)
Adds support for scalable vectors to patterns defined in
VectorLineralize.cpp.

Linearization is disable in 2 notable cases:
  * vectors with more than 1 scalable dimension (we cannot represent
    vscale^2),
  * vectors initialised with arith.constant that's not a vector splat
    (such arith.constant Ops cannot be flattened).
2024-03-28 14:53:21 +00:00
Andrzej Warzyński
bf4fc00bb7
[mlir][vector] Refactor linearize.mlir (#86648)
This patch refactors the `linearize.mlir` test - currently it contains
some duplication and can be tricky to follow.

Summary of changes:
  * reduce duplication by introducing a shared check prefix (`ALL`) and
    by introducing `-check-prefixes`,
  * make sure that every "check" line is directly above the
    corresponding line of input MLIR,
  * group check lines corresponding to a particular prefix together (so
    that it's easier to see the expected output for a particular
    prefix),
  * remove `CHECK` from prefix names (with multiple prefixes that's just
    noise that can be avoided) and use a bit more descriptive prefixes
    instead (`CHECK0` -> `BW-0`, where `BW` stands for bitwidth),
  * unify indentation,
  * `nonvec_result` -> `test_tensor_no_linearize` (for consistency with
    `test_index_no_linearize`).

NOTE: This change only updates the format of the "CHECK" lines and
doesn't affect what's being tested.

This change is intended as preparation for adding support for scalable
vectors to `LinearizeConstant` and `LinearizeVectorizable` - i.e.
patterns that `linearlize.mlir` is meant to test.
2024-03-26 16:58:41 +00:00
Balaji V. Iyer
5f1f9cfaa4
[mlir][Vector] Fix an assertion on failing cast in vector-transfer-flatten-patterns (#86030)
When the result is not a vectorType, there is an assert. This patch will
do the check and bail when the result is not a VectorType.
2024-03-25 16:05:09 -05:00
Balaji V. Iyer
6f5c4f2eac
[mlir][vector]Add Vector bitwidth target to Linearize Vectorizable and Constant Ops (#83314)
Added a new flag `targetVectorBitwidth` to capture bit-width input.
2024-03-04 19:17:51 -06:00
Ivan Butygin
35ef3994bf
[mlir][vector] ND vectors linearization pass (#81159)
Common backends (LLVM, SPIR-V) only supports 1D vectors, LLVM conversion
handles ND vectors (N >= 2) as `array<array<... vector>>` and SPIR-V
conversion doesn't handle them at all at the moment. Sometimes it's
preferable to treat multidim vectors as linearized 1D. Add pass to do
this. Only constants and simple elementwise ops are supported for now.

@krzysz00 I've extracted yours result type conversion code from
LegalizeToF32 and moved it to common place.

Also, add ConversionPattern class operating on traits.
2024-02-13 15:30:58 +03:00