tf_1.8_xla_doc
Classes | Public Member Functions | Private Member Functions | List of all members
xla::HloComputation Class Reference

#include <hlo_computation.h>

Collaboration diagram for xla::HloComputation:
[legend]

Classes

class  Builder
 Builder class for HloComputation. More...
 

Public Member Functions

HloInstructionAddInstruction (std::unique_ptr< HloInstruction > instruction)
 
std::list< HloComputation * > MakeEmbeddedComputationsList () const
 
HloInstructionCreateFusionInstruction (tensorflow::gtl::ArraySlice< HloInstruction *> instructions_to_fuse, HloInstruction::FusionKind fusion_kind)
 

Private Member Functions

HloInstructionAddInstructionInternal (std::unique_ptr< HloInstruction > instruction)
 
void FuseInstructionsInto (tensorflow::gtl::ArraySlice< HloInstruction *> instructions_to_fuse, HloInstruction *fusion_instruction)
 

Detailed Description

Google docs:

Describes a computation at the HLO level.

An HloComputation contains a directed acyclic graph of HLO instructions. The computation has a single root instruction which produces the output of the computation.

Member Function Documentation

◆ AddInstruction()

HloInstruction * xla::HloComputation::AddInstruction ( std::unique_ptr< HloInstruction instruction)
  1. Instruction cannot be kParameter
  2. Call xla::HloComputation::AddInstructionInternal()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddInstructionInternal()

HloInstruction * xla::HloComputation::AddInstructionInternal ( std::unique_ptr< HloInstruction instruction)
private
  1. If the instruction is not root then
    • Set the instruction's unique name and id to parent
  2. Set parent to self
  3. Add the instruction into instruction list
Here is the caller graph for this function:

◆ CreateFusionInstruction()

HloInstruction * xla::HloComputation::CreateFusionInstruction ( tensorflow::gtl::ArraySlice< HloInstruction *>  instructions_to_fuse,
HloInstruction::FusionKind  fusion_kind 
)

Creates a fusion instruction containing the given instructions. fusion_kind indicates the type of the fusion, e.g., loop fusion or fusion into a library call. Instructions must be in reverse topological order (root of the fused expression first). Replaces all uses of the original root instruction with the fusion instruction. The original instructions are removed if they have no uses after fusion (this is necessarily true for at least the root).

Called by xla::TransposeFolding and xla::BatchNormExpander

  • Root is instructions_to_fuse.
  1. Use xla::HloComputation::AddInstruction and xla::HloInstruction::CreateFusion() to generate instruction.
  2. And then use xla::HloComputation::FuseInstructionsInto to inject into instruction.
Here is the call graph for this function:

◆ FuseInstructionsInto()

void xla::HloComputation::FuseInstructionsInto ( tensorflow::gtl::ArraySlice< HloInstruction *>  instructions_to_fuse,
HloInstruction fusion_instruction 
)
private
  1. Check the instruction is type kFusion
  2. Merge fusion_instruction to instructions_to_fuse
Here is the caller graph for this function:

◆ MakeEmbeddedComputationsList()

std::list< HloComputation * > xla::HloComputation::MakeEmbeddedComputationsList ( ) const

Google docs:

Creates and returns a list of the embedded computations called by this computation. This includes all embedded computations called directly or transitively. The embedded computations are sorted such that if computation A calls computation B (eg, via a map instruction) then A will appear after B in the list.


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