| 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> |
| 27 | { |
| 28 | StringRef getName() final |
| 29 | { |
| 30 | return "Variable"; |
| 31 | } |
| 32 | }; |
| 33 | |
| 34 | struct Stack : ::mlir::SideEffects::Resource::Base<Stack> |
| 35 | { |
| 36 | StringRef getName() final |
| 37 | { |
| 38 | return "Stack"; |
| 39 | } |
| 40 | }; |
| 41 | |
| 42 | struct TensorArray : ::mlir::SideEffects::Resource::Base<TensorArray> |
| 43 | { |
| 44 | StringRef getName() final |
| 45 | { |
| 46 | return "TensorArray"; |
| 47 | } |
| 48 | }; |
| 49 | |
| 50 | struct Summary : ::mlir::SideEffects::Resource::Base<Summary> |
| 51 | { |
| 52 | StringRef getName() final |
| 53 | { |
| 54 | return "Summary"; |
| 55 | } |
| 56 | }; |
| 57 | |
| 58 | struct LookupTable : ::mlir::SideEffects::Resource::Base<LookupTable> |
| 59 | { |
| 60 | StringRef getName() final |
| 61 | { |
| 62 | return "LookupTable"; |
| 63 | } |
| 64 | }; |
| 65 | |
| 66 | struct DatasetSeedGenerator |
| 67 | : ::mlir::SideEffects::Resource::Base<DatasetSeedGenerator> |
| 68 | { |
| 69 | StringRef getName() final |
| 70 | { |
| 71 | return "DatasetSeedGenerator"; |
| 72 | } |
| 73 | }; |
| 74 | |
| 75 | struct DatasetMemoryCache |
| 76 | : ::mlir::SideEffects::Resource::Base<DatasetMemoryCache> |
| 77 | { |
| 78 | StringRef getName() final |
| 79 | { |
| 80 | return "DatasetMemoryCache"; |
| 81 | } |
| 82 | }; |
| 83 | |
| 84 | struct DatasetIterator : ::mlir::SideEffects::Resource::Base<DatasetIterator> |
| 85 | { |
| 86 | StringRef getName() final |
| 87 | { |
| 88 | return "DatasetIterator"; |
| 89 | } |
| 90 | }; |
| 91 | |
| 92 | // Special resource type to track TPU Embedding specific ops, which must execute |
| 93 | // but do not have side effects with one another or with resource variable ops. |
| 94 | struct TPUEmbedding : ::mlir::SideEffects::Resource::Base<TPUEmbedding> |
| 95 | { |
| 96 | StringRef getName() final |
| 97 | { |
| 98 | return "TPUEmbedding"; |
| 99 | } |
| 100 | }; |
| 101 | |
| 102 | } // namespace ResourceEffects |
| 103 | } // namespace TF |
| 104 | } // namespace mlir |
| 105 | |
| 106 | #endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_SIDE_EFFECTS_H_ |