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/compiler/xla/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_SERIALIZED, 33 OPTIMIZED_HLO, 34 OPTIMIZED_HLO_SERIALIZED, 35 OPTIMIZED_HLO_DOT 36 }; 37 38 // Returns the IR format of the selected stage for a given function `func_name` 39 // using library runtime `runtime` on a device `dev` with given `inputs`. 40 xla::StatusOr<std::string> GetCompilerIr( 41 IrExportStage stage, ProcessFunctionLibraryRuntime* pflr, 42 absl::string_view func_name, Device* dev, EagerContext* context, 43 absl::Span<const TensorHandle* const> inputs); 44 45 } // namespace tensorflow 46 47 #endif // TENSORFLOW_COMPILER_JIT_GET_COMPILER_IR_H_ 48