MLIR  19.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 
23 
24 using namespace mlir;
25 
26 namespace {
27 /// Registers new ops and declares PDL as dependent dialect since the
28 /// additional ops are using PDL types for operands and results.
29 class LinalgTransformDialectExtension
31  LinalgTransformDialectExtension> {
32 public:
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 }
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.