This is a follow-up of https://reviews.llvm.org/D153372 in which `numScalableDims` (single integer) was effectively replaced with `isScalableDim` bitmask. This change is a part of a larger effort to enable scalable vectorisation in Linalg. See this RFC for more context: * https://discourse.llvm.org/t/rfc-scalable-vectorisation-in-linalg/ Differential Revision: https://reviews.llvm.org/D153412
55 lines
1.9 KiB
C++
55 lines
1.9 KiB
C++
//===- ArmSVEDialect.cpp - MLIR ArmSVE dialect implementation -------------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file implements the ArmSVE dialect and its operations.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir/Dialect/ArmSVE/ArmSVEDialect.h"
|
|
#include "mlir/Dialect/LLVMIR/LLVMTypes.h"
|
|
#include "mlir/IR/Builders.h"
|
|
#include "mlir/IR/DialectImplementation.h"
|
|
#include "mlir/IR/OpImplementation.h"
|
|
#include "mlir/IR/TypeUtilities.h"
|
|
#include "llvm/ADT/TypeSwitch.h"
|
|
|
|
using namespace mlir;
|
|
using namespace mlir::arm_sve;
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ScalableVector versions of general helpers for comparison ops
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
/// Return the scalable vector of the same shape and containing i1.
|
|
static Type getI1SameShape(Type type) {
|
|
auto i1Type = IntegerType::get(type.getContext(), 1);
|
|
if (auto sVectorType = llvm::dyn_cast<VectorType>(type))
|
|
return VectorType::get(sVectorType.getShape(), i1Type,
|
|
sVectorType.getScalableDims());
|
|
return nullptr;
|
|
}
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Tablegen Definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir/Dialect/ArmSVE/ArmSVEDialect.cpp.inc"
|
|
|
|
#define GET_OP_CLASSES
|
|
#include "mlir/Dialect/ArmSVE/ArmSVE.cpp.inc"
|
|
|
|
#define GET_TYPEDEF_CLASSES
|
|
#include "mlir/Dialect/ArmSVE/ArmSVETypes.cpp.inc"
|
|
|
|
void ArmSVEDialect::initialize() {
|
|
addOperations<
|
|
#define GET_OP_LIST
|
|
#include "mlir/Dialect/ArmSVE/ArmSVE.cpp.inc"
|
|
>();
|
|
}
|