tf_1.8_xla_doc
Public Member Functions | List of all members
xla::cpu::IrEmitter Class Reference

#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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ IrEmitter()

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.

Parameters
hlo_moduleThe HLO module we are emitting IR for.
assignmentA BufferAssignment from which we know which temporary buffers are used by the HLO nodes.
llvm_moduleThe LLVM module to emit IR into.
instruction_to_profile_idxThe mapping from HLO instructions to their index in the profiling array.
computation_to_profile_idxThe mapping from HLO computations to their index in the profiling array.
external_constant_poolIf non-null, points to an ExternalConstantPool instance into which the Ir emitter can spill constants.

Member Function Documentation

◆ EmitComputation()

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.

Parameters
function_name_prefixThe 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_computationIt has the following meanings for each CPU backend:
  • sequential: indicates that this is the entry computation of the HLO module.
  • parallel: indices that this is the callee of a kCall HLO in the entry computation of the HLO module.
instruction_orderIf 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.
Todo:
See what it does

The documentation for this class was generated from the following files: