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 VectorType mlir::vector::detail::transferMaskType(VectorType vecType,
14                                                   AffineMap map) {
15   auto i1Type = IntegerType::get(map.getContext(), 1);
16   SmallVector<int64_t, 8> shape;
17   for (int64_t i = 0; i < vecType.getRank(); ++i) {
18     // Only result dims have a corresponding dim in the mask.
19     if (map.getResult(i).template isa<AffineDimExpr>()) {
20       shape.push_back(vecType.getDimSize(i));
21     }
22   }
23   return VectorType::get(shape, i1Type);
24 }
25 
26 //===----------------------------------------------------------------------===//
27 // VectorUnroll Interfaces
28 //===----------------------------------------------------------------------===//
29 
30 /// Include the definitions of the VectorUnroll interfaces.
31 #include "mlir/Interfaces/VectorInterfaces.cpp.inc"
32