2020-07-20 08:15:31 -04:00
|
|
|
//===- VectorInterfaces.cpp - Unrollable vector operations -*- C++ -*-===//
|
2020-07-06 06:28:50 -04:00
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2020-07-20 08:15:31 -04:00
|
|
|
#include "mlir/Interfaces/VectorInterfaces.h"
|
2020-07-06 06:28:50 -04:00
|
|
|
|
|
|
|
using namespace mlir;
|
|
|
|
|
2021-05-13 11:57:10 +09:00
|
|
|
VectorType mlir::vector::detail::transferMaskType(VectorType vecType,
|
|
|
|
AffineMap map) {
|
|
|
|
auto i1Type = IntegerType::get(map.getContext(), 1);
|
|
|
|
SmallVector<int64_t, 8> shape;
|
|
|
|
for (int64_t i = 0; i < vecType.getRank(); ++i) {
|
|
|
|
// Only result dims have a corresponding dim in the mask.
|
2021-05-13 12:57:45 +09:00
|
|
|
if (map.getResult(i).template isa<AffineDimExpr>()) {
|
2021-05-13 11:57:10 +09:00
|
|
|
shape.push_back(vecType.getDimSize(i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return shape.empty() ? VectorType() : VectorType::get(shape, i1Type);
|
|
|
|
}
|
|
|
|
|
2020-07-06 06:28:50 -04:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// VectorUnroll Interfaces
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2020-10-29 04:03:15 +09:00
|
|
|
/// Include the definitions of the VectorUnroll interfaces.
|
2020-07-20 08:15:31 -04:00
|
|
|
#include "mlir/Interfaces/VectorInterfaces.cpp.inc"
|