• 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 // This is the side effect definition file for TensorFlow.
17 #ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_SIDE_EFFECTS_H_
18 #define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_SIDE_EFFECTS_H_
19 
20 #include "mlir/Interfaces/SideEffectInterfaces.h"  // from @llvm-project
21 
22 namespace mlir {
23 namespace TF {
24 namespace ResourceEffects {
25 
26 struct Variable : ::mlir::SideEffects::Resource::Base<Variable> {
getNameVariable27   StringRef getName() final { return "Variable"; }
28 };
29 
30 struct Stack : ::mlir::SideEffects::Resource::Base<Stack> {
getNameStack31   StringRef getName() final { return "Stack"; }
32 };
33 
34 struct TensorArray : ::mlir::SideEffects::Resource::Base<TensorArray> {
getNameTensorArray35   StringRef getName() final { return "TensorArray"; }
36 };
37 
38 struct Summary : ::mlir::SideEffects::Resource::Base<Summary> {
getNameSummary39   StringRef getName() final { return "Summary"; }
40 };
41 
42 struct LookupTable : ::mlir::SideEffects::Resource::Base<LookupTable> {
getNameLookupTable43   StringRef getName() final { return "LookupTable"; }
44 };
45 
46 struct DatasetSeedGenerator
47     : ::mlir::SideEffects::Resource::Base<DatasetSeedGenerator> {
getNameDatasetSeedGenerator48   StringRef getName() final { return "DatasetSeedGenerator"; }
49 };
50 
51 struct DatasetMemoryCache
52     : ::mlir::SideEffects::Resource::Base<DatasetMemoryCache> {
getNameDatasetMemoryCache53   StringRef getName() final { return "DatasetMemoryCache"; }
54 };
55 
56 struct DatasetIterator : ::mlir::SideEffects::Resource::Base<DatasetIterator> {
getNameDatasetIterator57   StringRef getName() final { return "DatasetIterator"; }
58 };
59 
60 // Special resource type to track TPU Embedding specific ops, which must execute
61 // but do not have side effects with one another or with resource variable ops.
62 struct TPUEmbedding : ::mlir::SideEffects::Resource::Base<TPUEmbedding> {
getNameTPUEmbedding63   StringRef getName() final { return "TPUEmbedding"; }
64 };
65 
66 }  // namespace ResourceEffects
67 }  // namespace TF
68 }  // namespace mlir
69 
70 #endif  // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_SIDE_EFFECTS_H_
71