1 /* Copyright 2021 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 #ifndef TENSORFLOW_CORE_RUNTIME_FALLBACK_OPDEFS_TFRT_FALLBACK_H_ 16 #define TENSORFLOW_CORE_RUNTIME_FALLBACK_OPDEFS_TFRT_FALLBACK_H_ 17 18 #include "mlir/IR/BuiltinOps.h" // from @llvm-project 19 #include "mlir/IR/Dialect.h" // from @llvm-project 20 #include "mlir/IR/OpDefinition.h" // from @llvm-project 21 #include "mlir/IR/OpImplementation.h" // from @llvm-project 22 #include "mlir/Interfaces/SideEffectInterfaces.h" // from @llvm-project 23 24 using namespace mlir; // NOLINT 25 26 namespace tfrt { 27 namespace fallback { 28 29 // Dialect for fallback operations. 30 class FallbackDialect : public Dialect { 31 public: 32 explicit FallbackDialect(MLIRContext *context); getDialectNamespace()33 static StringRef getDialectNamespace() { return "tfrt_fallback"; } 34 35 Type parseType(DialectAsmParser &parser) const override; 36 void printType(Type type, DialectAsmPrinter &os) const override; 37 }; 38 39 // The tensor descriptor type represents a tensorflow::Tensor. 40 class TFTensorType : public Type::TypeBase<TFTensorType, Type, TypeStorage> { 41 public: 42 using Base::Base; 43 }; 44 45 } // namespace fallback 46 } // namespace tfrt 47 48 #define GET_OP_CLASSES 49 #include "tensorflow/core/runtime_fallback/opdefs/tfrt_fallback.h.inc" 50 51 #endif // TENSORFLOW_CORE_RUNTIME_FALLBACK_OPDEFS_TFRT_FALLBACK_H_ 52