• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7     http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 #ifndef TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TRANSFORMS_REWRITERS_H_
17 #define TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TRANSFORMS_REWRITERS_H_
18 
19 #include "mlir/IR/MLIRContext.h"  // from @llvm-project
20 
21 namespace mlir {
22 
23 class BufferizeTypeConverter;
24 class LLVMTypeConverter;
25 class MLIRContext;
26 class OwningRewritePatternList;
27 class TypeConverter;
28 
29 namespace kernel_gen {
30 namespace tf_framework {
31 
32 /// Collects a set of patterns to convert from the TF Framework dialect to LLVM.
33 void PopulateTFFrameworkToLLVMConversionPatterns(
34     LLVMTypeConverter *converter, OwningRewritePatternList *patterns);
35 
36 /// Collects a set of patterns to rewrite functions for use with TF framework
37 /// and also replace `alloc` and correspondign free operations with .
38 void PopulateEmbedTFFrameworkFunctionAndAllocConversionPatterns(
39     MLIRContext *context, OwningRewritePatternList *patterns);
40 
41 /// Collects a set of patterns to embed TF Framework.
42 void PopulateEmbedTFFrameworkAssertConversionPatterns(
43     MLIRContext *context, OwningRewritePatternList *patterns);
44 
45 }  // namespace tf_framework
46 
47 namespace transforms {
48 
49 /// Collects a set of patterns that bufferize operations from the standard
50 /// dialect.
51 void populateExtraStdBufferizePattern(MLIRContext *context,
52                                       BufferizeTypeConverter *converter,
53                                       OwningRewritePatternList *patterns);
54 }  // namespace transforms
55 }  // namespace kernel_gen
56 }  // namespace mlir
57 
58 #endif  // TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TRANSFORMS_REWRITERS_H_
59