• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2019 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 file defines the tf_device dialect: it contains operations that model
17 // TensorFlow's actions to launch computations on accelerator devices.
18 
19 #ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_DEVICE_H_
20 #define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_DEVICE_H_
21 
22 #include "mlir/IR/Builders.h"  // from @llvm-project
23 #include "mlir/IR/BuiltinOps.h"  // from @llvm-project
24 #include "mlir/IR/Dialect.h"  // from @llvm-project
25 #include "mlir/IR/OpDefinition.h"  // from @llvm-project
26 #include "mlir/IR/Value.h"  // from @llvm-project
27 #include "mlir/Interfaces/ControlFlowInterfaces.h"  // from @llvm-project
28 #include "mlir/Interfaces/SideEffectInterfaces.h"  // from @llvm-project
29 
30 namespace mlir {
31 namespace tf_device {
32 
33 // The TensorFlow Device dialect.
34 //
35 // This dialect contains operations to describe/launch computations on devices.
36 // These operations do not map 1-1 to TensorFlow ops and requires a lowering
37 // pass later to transform them into Compile/Run op pairs, like XlaCompile and
38 // XlaRun.
39 class TensorFlowDeviceDialect : public Dialect {
40  public:
getDialectNamespace()41   static StringRef getDialectNamespace() { return "tf_device"; }
42   // Constructing TensorFlowDevice dialect under an non-null MLIRContext.
43   explicit TensorFlowDeviceDialect(MLIRContext* context);
44 };
45 
46 }  // namespace tf_device
47 }  // namespace mlir
48 
49 // Declares the operations for this dialect using the generated header.
50 #define GET_OP_CLASSES
51 #include "tensorflow/compiler/mlir/tensorflow/ir/tf_device.h.inc"
52 
53 #endif  // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_DEVICE_H_
54