tf_1.8_xla_doc
Public Member Functions | Private Member Functions | List of all members
xla::UserComputation Class Referenceabstract

#include <user_computation.h>

Public Member Functions

StatusOr< ComputationDataHandle > AddParameterInstruction (const ParameterRequest &parameter_request)
 Enqueue a parameter-retrieving instruction onto this UserComputation. More...
 
VersionedComputationHandle GetVersionedHandle () const
 Lock mutex and call GetVersionedHandleInternal() More...
 
StatusOr< std::unique_ptr< HloComputation > > BuildHloComputation (VersionedComputationHandle::Version version, HloComputationResolver hlo_resolver, const DebugOptions &debug_options, bool include_unreachable_instructions=true) const
 Build a HLO computation from the UserComputation More...
 

Private Member Functions

VersionedComputationHandle GetVersionedHandleInternal () const EXCLUSIVE_LOCKS_REQUIRED(mutex_)
 Get the VersionedComputationHandle recorded in UserComputation object. More...
 

Detailed Description

Google Docs:

A UserComputation is the built-up computation that users create via the XLA Service interface.

The XLA service adds instructions to a user computation via this interface. The state of the computation is stored as a SessionComputation proto which holds a record of all operation-building requests received by the XLA service.

UserComputations are lowered to HloComputations which are passed to the high level compiler interface.

Member Function Documentation

◆ AddParameterInstruction()

StatusOr< ComputationDataHandle > xla::UserComputation::AddParameterInstruction ( const ParameterRequest &  parameter_request)

Enqueue a parameter-retrieving instruction onto this UserComputation.

  1. Check whether this parameter has been registered by member parameter_requests (map<parameter_number, OperationRequest>).
  2. Create a new ComputationDataHandle object which will use the next_handle_value_ as value.
  3. Register an OperationRequest object in member session_computation_'s requests map by using the value of ComputationDataHandle as a key.
  4. Register the ComputationDataHandle object created in step 2 in the map mentioned in step 1.
  5. Return the ComputationDataHandle which represents the index of OperationRequest object.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BuildHloComputation()

StatusOr< std::unique_ptr< HloComputation > > xla::UserComputation::BuildHloComputation ( VersionedComputationHandle::Version  version,
HloComputationResolver  hlo_resolver,
const DebugOptions &  debug_options,
bool  include_unreachable_instructions = true 
) const

Build a HLO computation from the UserComputation

  1. Call xla::anonymous_namespace{user_computation.cc}::ComputationLowerer::Lower() to build a HloComputation.
Here is the caller graph for this function:

◆ GetVersionedHandle()

VersionedComputationHandle xla::UserComputation::GetVersionedHandle ( ) const

Lock mutex and call GetVersionedHandleInternal()

  • VersionedComputationHandle
    • Contains
      • ComputationHandle which represents an UserComputation
      • Version (int64) which represents an specific ComputationDataHandle which represents an OpRequest recorded in session_computation_
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetVersionedHandleInternal()

VersionedComputationHandle xla::UserComputation::GetVersionedHandleInternal ( ) const
private

Get the VersionedComputationHandle recorded in UserComputation object.

  • Check the member handle_to_return_
    • Default to be 0 which means no specific ComputationDataHandle has been assigned. Therefore this function will return the last enqueued OpRequest's ComputationDataHandle which is usually the output node of a graph.
    • If it's non-zero, just return the specific ComputationDataHandle.
Here is the caller graph for this function:

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