1 // Copyright 2021 The TensorFlow Authors 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 // This file implements MLIR operations for the xlir_ops library. 16 17 #include "tensorflow/compiler/xla/service/gpu/xlir_ops.h" 18 19 #include "mlir/IR/TypeUtilities.h" 20 #include "tfrt/basic_kernels/opdefs/types.h" // from @tf_runtime 21 22 namespace xla { 23 namespace gpu { 24 25 //===----------------------------------------------------------------------===// 26 // XlirDialect Dialect 27 //===----------------------------------------------------------------------===// 28 XlirDialect(mlir::MLIRContext * context)29XlirDialect::XlirDialect(mlir::MLIRContext *context) 30 : Dialect(/*name*/ "xlir", context, TypeID::get<XlirDialect>()) { 31 allowUnknownTypes(); 32 allowUnknownOperations(); 33 34 addOperations< 35 #define GET_OP_LIST 36 #include "tensorflow/compiler/xla/service/gpu/xlir_opdefs.cpp.inc" 37 >(); 38 } 39 40 } // namespace gpu 41 } // namespace xla 42 43 // TableGen'd definitions 44 #define GET_OP_CLASSES 45 #include "tensorflow/compiler/xla/service/gpu/xlir_opdefs.cpp.inc" 46