1 //===- VectorInterfaces.cpp - Unrollable vector operations -*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "mlir/Interfaces/VectorInterfaces.h"
10 
11 using namespace mlir;
12 
13 namespace mlir {
14 namespace vector {
15 namespace detail {
16 
17 VectorType transferMaskType(VectorType vecType, AffineMap map) {
18   auto i1Type = IntegerType::get(map.getContext(), 1);
19   SmallVector<int64_t, 8> shape;
20   for (int64_t i = 0; i < vecType.getRank(); ++i) {
21     // Only result dims have a corresponding dim in the mask.
22     if (auto expr = map.getResult(i).template isa<AffineDimExpr>()) {
23       shape.push_back(vecType.getDimSize(i));
24     }
25   }
26   return VectorType::get(shape, i1Type);
27 }
28 
29 } // namespace detail
30 } // namespace vector
31 } // namespace mlir
32 
33 //===----------------------------------------------------------------------===//
34 // VectorUnroll Interfaces
35 //===----------------------------------------------------------------------===//
36 
37 /// Include the definitions of the VectorUnroll interfaces.
38 #include "mlir/Interfaces/VectorInterfaces.cpp.inc"
39