Home | History | Annotate | Download | only in aot
      1 /* Copyright 2017 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 #ifndef TENSORFLOW_COMPILER_AOT_COMPILE_H_
     17 #define TENSORFLOW_COMPILER_AOT_COMPILE_H_
     18 
     19 #include <memory>
     20 #include <string>
     21 
     22 #include "tensorflow/compiler/aot/flags.h"
     23 #include "tensorflow/compiler/tf2xla/tf2xla.pb.h"
     24 #include "tensorflow/compiler/xla/service/cpu/cpu_compiler.h"
     25 #include "tensorflow/compiler/xla/xla_data.pb.h"
     26 #include "tensorflow/core/framework/graph.pb.h"
     27 
     28 namespace tensorflow {
     29 namespace tfcompile {
     30 
     31 // CompileResult describes the output of CompileGraph, where the object file
     32 // data and meta-information is available in aot.
     33 struct CompileResult {
     34   // Contains object file and meta-info.
     35   std::unique_ptr<xla::cpu::CpuAotCompilationResult> aot;
     36   xla::ProgramShape program_shape;  // Static shape of args and results.
     37   string entry_point;               // Name of generated function.
     38   int pointer_size = 0;             // Size of a pointer in bytes.
     39 };
     40 
     41 // CompileGraph compiles the graph_def into an object file containing a function
     42 // that performs the graph operations.
     43 //
     44 // The XLA compilation options are specified in the flags.
     45 Status CompileGraph(const GraphDef& graph_def, const tf2xla::Config& config,
     46                     const MainFlags& flags, CompileResult* compile_result);
     47 
     48 }  // namespace tfcompile
     49 }  // namespace tensorflow
     50 
     51 #endif  // TENSORFLOW_COMPILER_AOT_COMPILE_H_
     52