MLIR 22.0.0git
DialectExtension.cpp
Go to the documentation of this file.
1//===- DialectExtension.cpp - Linalg transform dialect extension ----------===//
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
21
22using namespace mlir;
23
24namespace {
25/// Registers new ops and declares PDL as dependent dialect since the
26/// additional ops are using PDL types for operands and results.
27class LinalgTransformDialectExtension
29 LinalgTransformDialectExtension> {
30public:
31 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgTransformDialectExtension)
32
33 using Base::Base;
34
35 void init() {
36 declareDependentDialect<linalg::LinalgDialect>();
37
38 declareGeneratedDialect<affine::AffineDialect>();
39 declareGeneratedDialect<arith::ArithDialect>();
40 declareGeneratedDialect<index::IndexDialect>();
41 declareGeneratedDialect<scf::SCFDialect>();
42 declareGeneratedDialect<vector::VectorDialect>();
43 declareGeneratedDialect<gpu::GPUDialect>();
44 declareGeneratedDialect<tensor::TensorDialect>();
45
46 registerTransformOps<
47#define GET_OP_LIST
48#include "mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp.inc"
49 >();
50 registerTransformOps<
51#define GET_OP_LIST
52#include "mlir/Dialect/Linalg/TransformOps/LinalgMatchOps.cpp.inc"
53 >();
54 }
55};
56} // namespace
57
59 DialectRegistry &registry) {
60 registry.addExtensions<LinalgTransformDialectExtension>();
61}
#define MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CLASS_NAME)
Definition TypeID.h:331
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
void addExtensions()
Add the given extensions to the registry.
Base class for extensions of the Transform dialect that supports injecting operations into the Transf...
void registerTransformDialectExtension(DialectRegistry &registry)
Include the generated interface declarations.