tf_1.8_xla_doc
|
#include <ir_emitter.h>
Inherits DfsHloVisitorWithDefault.
Public Member Functions | |
IrEmitter (const HloModule &hlo_module, const BufferAssignment &assignment, llvm::Module *llvm_module, std::unordered_map< const HloInstruction *, int64 > instruction_to_profile_idx, std::unordered_map< const HloComputation *, int64 > computation_to_profile_idx, llvm::TargetMachine *target_machine, ExternalConstantPool *external_constant_pool) | |
Create a new LLVM IR emitter. More... | |
StatusOr< llvm::Function * > | EmitComputation (HloComputation *computation, const string &function_name_prefix, bool is_top_level_computation, std::vector< const HloInstruction *> *instruction_order) |
Google docs:
This class is the top-level API for the XLA HLO –> LLVM IR compiler. It implements the DfsHloVisitor interface and emits HLO computations as LLVM IR functions.
xla::cpu::IrEmitter::IrEmitter | ( | const HloModule & | hlo_module, |
const BufferAssignment & | assignment, | ||
llvm::Module * | llvm_module, | ||
std::unordered_map< const HloInstruction *, int64 > | instruction_to_profile_idx, | ||
std::unordered_map< const HloComputation *, int64 > | computation_to_profile_idx, | ||
llvm::TargetMachine * | target_machine, | ||
ExternalConstantPool * | external_constant_pool | ||
) |
Create a new LLVM IR emitter.
hlo_module | The HLO module we are emitting IR for. |
assignment | A BufferAssignment from which we know which temporary buffers are used by the HLO nodes. |
llvm_module | The LLVM module to emit IR into. |
instruction_to_profile_idx | The mapping from HLO instructions to their index in the profiling array. |
computation_to_profile_idx | The mapping from HLO computations to their index in the profiling array. |
external_constant_pool | If non-null, points to an ExternalConstantPool instance into which the Ir emitter can spill constants. |
StatusOr< llvm::Function * > xla::cpu::IrEmitter::EmitComputation | ( | HloComputation * | computation, |
const string & | function_name_prefix, | ||
bool | is_top_level_computation, | ||
std::vector< const HloInstruction *> * | instruction_order | ||
) |
The followings are from google docs.
Emit and return the given HLO computation as an LLVM IR function.
function_name_prefix | The desired name of the function. If the name is not unique among already emitted functions then a suffix is appended to make the name unique. |
is_top_level_computation | It has the following meanings for each CPU backend:
|
instruction_order | If not NULL, then the HLO instructions are emitted in the given order. In this case, 'instruction_order' must be a topological sort of the set of nodes accessible from the root of the computation. |