1/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations 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
22namespace tensorflow {
23
24class ProcessFunctionLibraryRuntime;
25class Device;
26class Tensor;
27class TensorHandle;
28class EagerContext;
29
30enum 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`.
42StatusOr<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