MLIR  20.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  MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LinalgTransformDialectExtension)
34 
35  using Base::Base;
36 
37  void init() {
38  declareDependentDialect<linalg::LinalgDialect>();
39 
40  declareGeneratedDialect<affine::AffineDialect>();
41  declareGeneratedDialect<arith::ArithDialect>();
42  declareGeneratedDialect<index::IndexDialect>();
43  declareGeneratedDialect<scf::SCFDialect>();
44  declareGeneratedDialect<vector::VectorDialect>();
45  declareGeneratedDialect<gpu::GPUDialect>();
46  declareGeneratedDialect<tensor::TensorDialect>();
47 
48  registerTransformOps<
49 #define GET_OP_LIST
50 #include "mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp.inc"
51  >();
52  registerTransformOps<
53 #define GET_OP_LIST
54 #include "mlir/Dialect/Linalg/TransformOps/LinalgMatchOps.cpp.inc"
55  >();
56  }
57 };
58 } // namespace
59 
61  DialectRegistry &registry) {
62  registry.addExtensions<LinalgTransformDialectExtension>();
63 }
#define MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CLASS_NAME)
Definition: TypeID.h:274
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.