diff options
author | Benjamin Maxwell <benjamin.maxwell@arm.com> | 2024-02-02 10:06:11 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-02 10:06:11 +0000 |
commit | c2dea7122cd9f559f64cd0b34431d21e61f5bf15 (patch) | |
tree | 171c3a5ea1fcaa728bb2a8c0093f2db468038a2a /llvm/lib/ProfileData/Coverage/CoverageMapping.cpp | |
parent | 84c8d0377de1f7f45e65e85d1f3cc69ca5e29af5 (diff) | |
download | llvm-c2dea7122cd9f559f64cd0b34431d21e61f5bf15.zip llvm-c2dea7122cd9f559f64cd0b34431d21e61f5bf15.tar.gz llvm-c2dea7122cd9f559f64cd0b34431d21e61f5bf15.tar.bz2 |
[mlir][ArmSME] Fold extracts from 3D create_masks of SME-like masks (#80148)
When unrolling the reduction dimension of something like a matmul for
SME, it is possible to get 3D masks, which are vectors of SME-like
masks. The 2D masks for individual operations are then extracted from
the 3D masks.
i.e.:
```mlir
%mask = vector.create_mask %nonConstantDim, %a, %b : vector<4x[4]x[4]xi1>
%subMask = vector.extract %mask[2]
: vector<[4]x[4]xi1> from vector<4x[4]x[4]xi1>
```
ArmSME only supports lowering 2D create_masks, so we must fold the
extract into the create_mask. This can be done by checking if the
extraction index is within the true region, then using that select the
first dimension of the 2D mask. This is shown below.
```mlir
%extractionInTrueRegion = arith.cmpi slt, %c2, %nonConstantDim : index
%newMaskFrontDim = arith.select %extractionInTrueRegion, %a, %c0 : index
%subMask = vector.create_mask %newMaskFrontDim, %b : vector<[4]x[4]xi1>
```
Diffstat (limited to 'llvm/lib/ProfileData/Coverage/CoverageMapping.cpp')
0 files changed, 0 insertions, 0 deletions