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 | #ifndef TENSORFLOW_COMPILER_JIT_GET_COMPILER_IR_H_ |
16 | #define TENSORFLOW_COMPILER_JIT_GET_COMPILER_IR_H_ |
17 | |
18 | #include "absl/strings/string_view.h" |
19 | #include "absl/types/span.h" |
20 | #include "tensorflow/core/platform/statusor.h" |
21 | |
22 | namespace tensorflow { |
23 | |
24 | class ProcessFunctionLibraryRuntime; |
25 | class Device; |
26 | class Tensor; |
27 | class TensorHandle; |
28 | class EagerContext; |
29 | |
30 | enum class IrExportStage { |
31 | HLO, |
32 | HLO_NO_METADATA, |
33 | HLO_SERIALIZED, |
34 | OPTIMIZED_HLO, |
35 | OPTIMIZED_HLO_SERIALIZED, |
36 | OPTIMIZED_HLO_PROTO_SERIALIZED, |
37 | OPTIMIZED_HLO_DOT |
38 | }; |
39 | |
40 | // Returns the IR format of the selected stage for a given function `func_name` |
41 | // using library runtime `runtime` on a device `dev` with given `inputs`. |
42 | StatusOr<std::string> GetCompilerIr( |
43 | IrExportStage stage, ProcessFunctionLibraryRuntime* pflr, |
44 | absl::string_view func_name, Device* dev, EagerContext* context, |
45 | absl::Span<const TensorHandle* const> inputs); |
46 | |
47 | } // namespace tensorflow |
48 | |
49 | #endif // TENSORFLOW_COMPILER_JIT_GET_COMPILER_IR_H_ |
50 | |