Loading...
Searching...
No Matches
VdfScheduler Class Reference

Used to make a VdfSchedule. More...

#include <scheduler.h>

Public Types

typedef std::vector< std::pair< VdfPoolChainIndex, const VdfOutput * > > PoolPriorityVector
 
using NodeToRequestMap
 A map from VdfNode * to VdfMaskedOutputVector.
 

Public Member Functions

VDF_API VdfScheduler (const std::atomic_bool *interruptionFlag)
 Constructs a scheduler.
 
VDF_API bool CreateSchedule (const VdfRequest &request, VdfSchedule *schedule, bool topologicallySort)
 Generates a schedule.
 

Static Public Member Functions

static VDF_API void Schedule (const VdfRequest &request, VdfSchedule *schedule, bool topologicallySort)
 Generates a schedule.
 
static VDF_API bool UpdateAffectsMaskForOutput (VdfSchedule *schedule, const VdfOutput &output)
 Update schedule after the affects mask changed on output.
 

Protected Member Functions

bool _HasBeenInterrupted () const
 Returns true if the scheduler has been interrupted, if the scheduler supports interruption.
 
VDF_API bool _InitializeRequestMasks (const VdfRequest &request, VdfSchedule *schedule, PoolPriorityVector *poolOutputs)
 Initializes the request masks for all the outputs that will be computed as a result of request.
 
VDF_API bool _ScheduleBufferPasses (const VdfRequest &request, VdfSchedule *schedule)
 Method to schedule the buffer passes and the "keep" masks for the scheduled nodes.
 
VDF_API bool _ScheduleForPassThroughs (const VdfRequest &request, VdfSchedule *schedule, const PoolPriorityVector &sortedPoolOutputs)
 Schedule the outputs from which buffers should be passed.
 
VDF_API void _GenerateTasks (VdfSchedule *schedule, const PoolPriorityVector &sortedPoolOutputs)
 Generate tasks for the scheduled task graph.
 
VDF_API bool _ScheduleTaskGraph (VdfSchedule *schedule, const PoolPriorityVector &sortedPoolOutputs)
 Schedule the task graph for multi-threaded munging.
 
VDF_API bool _ApplyAffectsMasks (VdfSchedule *schedule)
 Applies the affects mask to the schedule.
 

Static Protected Member Functions

static VDF_API void _SetScheduleValid (VdfSchedule *schedule, const VdfNetwork *network)
 Method to signal that a schedule is done being built and that it is now valid for the given network.
 
static VDF_API void _MarkSmallSchedule (VdfSchedule *schedule)
 Marks the schedule as small if it is indeed small.
 
static VDF_API void _ComputeLockMasks (const VdfRequest &request, VdfSchedule *schedule, const PoolPriorityVector &sortedPoolOutputs)
 Setup the lock masks require for sparse mung buffer locking for all the outputs in the pool chain.
 
static VDF_API bool _ApplyAffectsMasksForNode (VdfScheduleNode *node)
 Applies the affects masks to the scheduled node.
 
static VDF_API void _UpdateAffectsMaskForInvocation (VdfSchedule *schedule, VdfScheduleNode *node)
 Updates the affects mask on an existing scheduled node invocation.
 
static VDF_API bool _UpdateAffectsMasksForNode (VdfSchedule *schedule, VdfScheduleNode *node)
 Updates schedule for node if affects mask changed.
 
static VDF_API void _UpdateLockMaskForNode (VdfSchedule *schedule, VdfScheduleNode *node)
 Updates schedule for node if the lock mask changed.
 

Detailed Description

Used to make a VdfSchedule.

Definition at line 40 of file scheduler.h.

Member Typedef Documentation

◆ NodeToRequestMap

Initial value:
TfHashMap<const VdfNode *, VdfMaskedOutputVector, TfHash>

A map from VdfNode * to VdfMaskedOutputVector.

Definition at line 49 of file scheduler.h.

◆ PoolPriorityVector

std::vector< std::pair<VdfPoolChainIndex, const VdfOutput *> > PoolPriorityVector

Definition at line 46 of file scheduler.h.

Constructor & Destructor Documentation

◆ VdfScheduler()

VDF_API VdfScheduler ( const std::atomic_bool * interruptionFlag)

Constructs a scheduler.

If include is non-null, the pointed-to atomic flag is checked during scheduling to determine if the client has requested scheduling to be interrupted. If scheduling is interrupted, CreateSchedule attempts to return quickly (on the order of a few ms), leaving the resulting schedule in an unknown state.

Member Function Documentation

◆ _ApplyAffectsMasks()

VDF_API bool _ApplyAffectsMasks ( VdfSchedule * schedule)
protected

Applies the affects mask to the schedule.

Returns false if scheduling has been interrupted.

◆ _ApplyAffectsMasksForNode()

static VDF_API bool _ApplyAffectsMasksForNode ( VdfScheduleNode * node)
staticprotected

Applies the affects masks to the scheduled node.

This mask is the ANDing of the request mask and the affects mask (if any). It is used by iterators to quickly skip only to the elements that are affected by the node. It is an optional mask, and if it doesn't exist, the scheduled affects mask will simply be request mask (a super set of the truly affected elements).

◆ _ComputeLockMasks()

static VDF_API void _ComputeLockMasks ( const VdfRequest & request,
VdfSchedule * schedule,
const PoolPriorityVector & sortedPoolOutputs )
staticprotected

Setup the lock masks require for sparse mung buffer locking for all the outputs in the pool chain.

sortedPoolOutputs contains all the pool outputs in the schedule. Callers are responsible for ensuring that sortedPoolOutputs are in descending order of their respective pool chain index, i.e. the pool output furthest downstream will be at the front of the vector.

◆ _GenerateTasks()

VDF_API void _GenerateTasks ( VdfSchedule * schedule,
const PoolPriorityVector & sortedPoolOutputs )
protected

Generate tasks for the scheduled task graph.

The task graph is used by the parallel evaluation engine.

Returns false if scheduling has been interrupted.

◆ _HasBeenInterrupted()

bool _HasBeenInterrupted ( ) const
inlineprotected

Returns true if the scheduler has been interrupted, if the scheduler supports interruption.

If interruption is not supported, i.e. no interruption flag has been set, this will always return false.

Definition at line 93 of file scheduler.h.

◆ _InitializeRequestMasks()

VDF_API bool _InitializeRequestMasks ( const VdfRequest & request,
VdfSchedule * schedule,
PoolPriorityVector * poolOutputs )
protected

Initializes the request masks for all the outputs that will be computed as a result of request.

poolOutputs is an output parameter. The vector will contain all the pool outputs scheduled with request masks, sorted in reverse order of pool chain index, i.e. the pool output furthest downstream will be at the front of the vector.

Returns false if scheduling has been interrupted, or if an error has been detected.

◆ _MarkSmallSchedule()

static VDF_API void _MarkSmallSchedule ( VdfSchedule * schedule)
staticprotected

Marks the schedule as small if it is indeed small.

◆ _ScheduleBufferPasses()

VDF_API bool _ScheduleBufferPasses ( const VdfRequest & request,
VdfSchedule * schedule )
protected

Method to schedule the buffer passes and the "keep" masks for the scheduled nodes.

Schedulers that care about performance will want to call this after all the outputs have gone through the _ScheduleOutput method above.

Returns false if scheduling has been interrupted.

◆ _ScheduleForPassThroughs()

VDF_API bool _ScheduleForPassThroughs ( const VdfRequest & request,
VdfSchedule * schedule,
const PoolPriorityVector & sortedPoolOutputs )
protected

Schedule the outputs from which buffers should be passed.

This helps ensure that potentially large portions of the network that won't have any effect in this schedule are skipped when passing buffers.

sortedPoolOutputs contains all the pool outputs in the schedule. Callers are responsible for ensuring that sortedPoolOutputs are in descending order of their respective pool chain index, i.e. the pool output furthest downstream will be at the front of the vector.

Returns false if scheduling has been interrupted.

◆ _ScheduleTaskGraph()

VDF_API bool _ScheduleTaskGraph ( VdfSchedule * schedule,
const PoolPriorityVector & sortedPoolOutputs )
protected

Schedule the task graph for multi-threaded munging.

This will generate tasks and invocations, as well as dependencies between them.

Returns false if scheduling has been interrupted.

◆ _SetScheduleValid()

static VDF_API void _SetScheduleValid ( VdfSchedule * schedule,
const VdfNetwork * network )
staticprotected

Method to signal that a schedule is done being built and that it is now valid for the given network.

◆ _UpdateAffectsMaskForInvocation()

static VDF_API void _UpdateAffectsMaskForInvocation ( VdfSchedule * schedule,
VdfScheduleNode * node )
staticprotected

Updates the affects mask on an existing scheduled node invocation.

◆ _UpdateAffectsMasksForNode()

static VDF_API bool _UpdateAffectsMasksForNode ( VdfSchedule * schedule,
VdfScheduleNode * node )
staticprotected

Updates schedule for node if affects mask changed.

◆ _UpdateLockMaskForNode()

static VDF_API void _UpdateLockMaskForNode ( VdfSchedule * schedule,
VdfScheduleNode * node )
staticprotected

Updates schedule for node if the lock mask changed.

◆ CreateSchedule()

VDF_API bool CreateSchedule ( const VdfRequest & request,
VdfSchedule * schedule,
bool topologicallySort )

Generates a schedule.

This method supports optional scheduling interruption.

Returns false if scheduling was interrupted, and true otherwise.

◆ Schedule()

static VDF_API void Schedule ( const VdfRequest & request,
VdfSchedule * schedule,
bool topologicallySort )
static

Generates a schedule.

◆ UpdateAffectsMaskForOutput()

static VDF_API bool UpdateAffectsMaskForOutput ( VdfSchedule * schedule,
const VdfOutput & output )
static

Update schedule after the affects mask changed on output.


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