blob: de3703b71acb081b854f0f6d3d62d91c90b8d805 [file] [log] [blame]
//===- LinalgBase.td - Linalg dialect base support ---------*- tablegen -*-===//
//
// 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 is the definition file for base linear algebra support.
//
//===----------------------------------------------------------------------===//
#ifndef LINALG_BASE
#define LINALG_BASE
include "mlir/IR/OpBase.td"
def Linalg_Dialect : Dialect {
let name = "linalg";
let description = [{
The `linalg` dialect groups together a set of types, operations and
transformations that are useful to implement a structured abstraction on
buffers and tensors. These abstractions are useful for transformations and
can lower to scalar load/store and other operations or to more general
library calls.
Additional [Linalg Dialect
Documentation](https://mlir.llvm.org/docs/Dialects/Linalg) and a
[Rationale
Document](https://mlir.llvm.org/docs/Rationale/RationaleLinalgDialect) are
are also available and should be read first before going in the details of
the op semantics.
}];
let cppNamespace = "::mlir::linalg";
let dependentDialects = [
"arith::ArithmeticDialect",
"AffineDialect",
"math::MathDialect",
"memref::MemRefDialect",
"StandardOpsDialect",
"tensor::TensorDialect",
];
let hasCanonicalizer = 1;
let hasOperationAttrVerify = 1;
let hasConstantMaterializer = 1;
let extraClassDeclaration = [{
/// Attribute name used to to memoize indexing maps for named ops.
constexpr const static ::llvm::StringLiteral
kMemoizedIndexingMapsAttrName = "linalg.memoized_indexing_maps";
using RegionBuilderFunType =
llvm::function_ref<void(ImplicitLocOpBuilder &b, Block &)>;
RegionBuilderFunType getRegionBuilder(StringRef name) {
return namedStructuredOpRegionBuilders.lookup(name);
}
private:
llvm::StringMap<RegionBuilderFunType> namedStructuredOpRegionBuilders;
}];
}
// Whether a type is a RangeType.
def LinalgIsRangeTypePred : CPred<"$_self.isa<RangeType>()">;
def Range : DialectType<Linalg_Dialect, LinalgIsRangeTypePred, "range">;
#endif // LINALG_BASE