Loading...
Searching...
No Matches
VdfSchedule Class Reference

Contains a specification of how to execute a particular VdfNetwork. More...

#include <schedule.h>

Classes

class  IteratorRange
 Minimal iterator range that the schedule returns instances of, in order to facilitate iterating over sub-sections of the internal containers. More...
 
class  OutputId
 An OutputId is a small key object that, once obtained for a particular VdfOutput, can be used to query the schedule about that VdfOutput. More...
 

Public Types

using ScheduleNodeVector = std::vector< VdfScheduleNode >
 The type for the vector of schedule nodes in the schedule.
 
using TaskIdRange = IteratorRange< Vdf_CountingIterator< VdfScheduleTaskId > >
 An iterable range of task ids.
 
using InputDependencyRange = IteratorRange< std::vector< VdfScheduleInputDependency >::const_iterator >
 An iterable range of input dependencies.
 
using InputsRange = IteratorRange< std::vector< VdfScheduleInput >::const_iterator >
 An iterable range of scheduled inputs.
 

Public Member Functions

 VdfSchedule (const VdfSchedule &)=delete
 Noncopyable.
 
VdfScheduleoperator= (const VdfSchedule &)=delete
 
VDF_API VdfSchedule ()
 Constructs an empty schedule.
 
VDF_API ~VdfSchedule ()
 Destructor.
 
VDF_API void Clear ()
 Clears the schedule.
 
bool IsValid () const
 Returns whether or not this schedule is valid and can be used for execution.
 
const VdfNetworkGetNetwork () const
 Returns the network for this schedule.
 
VDF_API void ForEachScheduledOutput (const VdfNode &node, const VdfScheduledOutputCallback &callback) const
 Loops over each scheduled output of node and calls callback with the output and request mask in an efficient manner.
 
size_t GetNumUniqueInputDependencies () const
 Returns the number of unique input dependencies created for the scheduled task graph.
 
size_t GetNumComputeTasks () const
 Returns the total number of compute tasks in the schedule.
 
size_t GetNumInputsTasks () const
 Returns the total number of inputs tasks in the schedule.
 
size_t GetNumPrepTasks () const
 Returns the total number of prep tasks in the schedule.
 
size_t GetNumKeepTasks () const
 Returns the total number of keep tasks in the schedule.
 
const TaskIdRange GetComputeTaskIds (const VdfNode &node) const
 Returns a range of ids describing compute tasks associated with the given node.
 
TaskIdRange GetComputeTaskIds (const VdfScheduleInputDependency &input) const
 Returns an iterable range of task indices given an input dependency.
 
const VdfScheduleTaskIndex GetKeepTaskIndex (const VdfNode &node) const
 Returns an index to the keep task associated with the given node.
 
const VdfScheduleComputeTaskGetComputeTask (const VdfScheduleTaskIndex index) const
 Returns the compute task associated with the given task index.
 
const VdfScheduleInputsTaskGetInputsTask (const VdfScheduleTaskIndex index) const
 Returns the inputs task associated with the given task index.
 
InputDependencyRange GetPrereqInputDependencies (const VdfScheduleInputsTask &task) const
 Returns an iterable range of prereq input dependencies for the given inputs task.
 
InputDependencyRange GetOptionalInputDependencies (const VdfScheduleInputsTask &task) const
 Returns an iterable range of optional (i.e.
 
InputDependencyRange GetRequiredInputDependencies (const VdfScheduleComputeTask &task) const
 Returns an iterable range of required (i.e.
 
VDF_API VdfScheduleInputDependencyUniqueIndex GetUniqueIndex (const OutputId outputId) const
 Returns the unique index assigned to the output.
 
Queries
VDF_API bool IsScheduled (const VdfNode &node) const
 Returns whether this schedule includes node in any way.
 
VDF_API OutputId GetOutputId (const VdfOutput &output) const
 Returns a small, cheap OutputId, which can be passed to other Get* methods in this class to efficiently get scheduling information about a particular VdfOutput.
 
VDF_API OutputId GetOrCreateOutputId (const VdfOutput &output)
 Similar to GetOutputId, but creates an OutptuId if none exists, effectively adding the output to the schedule.
 
VDF_API void AddInput (const VdfConnection &connection, const VdfMask &mask)
 Adds the input targeted by the given connection to the schedule.
 
VDF_API void DeduplicateInputs ()
 Consolidates scheduled input entries added by AddInput.
 
VDF_API const VdfNodeGetNode (const OutputId &outputId) const
 Returns the VdfNode that owns the VdfOutput associated with the given outputId.
 
VDF_API OutputId GetOutputIdsBegin (const VdfNode &node) const
 Gets an OutputId identifying the first scheduled output for the given node, if any.
 
VDF_API OutputId GetOutputIdsEnd (const VdfNode &node) const
 Gets an OutputId identifying the "end" of the scheduled outputs for a node.
 
VDF_API InputsRange GetInputs (const VdfNode &node) const
 Returns a range of inputs scheduled for the given node.
 
VDF_API bool IsAffective (const OutputId &outputId) const
 Returns true if the output is expected to have an effect on its corresponding input, and false otherwise.
 
Queries By OutputId

Any time the schedule is queried by OutputId, the caller must ensure the OutputId's IsValid() method returns true beforehand. As an optimization, the schedule does not verify this for the calls below.

VDF_API const VdfOutputGetOutput (const OutputId &outputId) const
 Returns the scheduled VdfOutput associated with the given OutputId.
 
VDF_API const VdfOutputGetOutputToClear (const VdfNode &node) const
 Returns the output whose temporary buffer can be immediately deallocated after node has finished executing.
 
VDF_API const VdfMaskGetRequestMask (const OutputId &outputId) const
 Returns the request mask associated with the given OutputId.
 
const VdfMaskGetRequestMask (const VdfScheduleTaskIndex invocationIndex) const
 Returns the request mask for the given node invocation.
 
VDF_API void GetRequestAndAffectsMask (const OutputId &outputId, const VdfMask **requestMask, const VdfMask **affectsMask) const
 Returns pointers to the request and affects masks simultaneously, saving on the overhead of making two queries when client code just needs both masks.
 
void GetRequestAndAffectsMask (const VdfScheduleTaskIndex invocationIndex, const VdfMask **requestMask, const VdfMask **affectsMask) const
 Returns pointers to the request and affects masks for the given node invocation index.
 
VDF_API const VdfMaskGetAffectsMask (const OutputId &outputId) const
 Returns the affects mask associated with the given OutputId.
 
VDF_API const VdfMaskGetKeepMask (const OutputId &outputId) const
 Returns the keep mask associated with the given OutputId.
 
const VdfMaskGetKeepMask (const VdfScheduleTaskIndex invocationIndex) const
 Returns the keep mask for the given node invocation index.
 
VDF_API const VdfOutputGetPassToOutput (const OutputId &outputId) const
 Returns the "pass to" output associated with the given OutputId.
 
VDF_API const VdfOutputGetFromBufferOutput (const OutputId &outputId) const
 Returns the "from buffer's" output associated with the given OutputId.
 
bool HasSMBL () const
 Returns true if this schedule participates in sparse mung buffer locking.
 
Scheduler Data Access
bool IsSmallSchedule () const
 Returns whether this schedule is small enough to avoid overhead incurred by the _nodesToIndexMap mapping, which is otherwise of great benefit to schedule node lookup time.
 
VDF_API void SetRequest (const VdfRequest &request)
 Sets the request that was used to make up this schedule.
 
const VdfRequest & GetRequest () const
 Returns the request for this schedule.
 
ScheduleNodeVectorGetScheduleNodeVector ()
 Returns the vector of schedule nodes in this schedule.
 
const ScheduleNodeVectorGetScheduleNodeVector () const
 
int GetScheduleNodeIndex (const OutputId &outputId) const
 Returns the node index of the schedule node associated with the given outputId.
 
const TfBitsGetScheduledNodeBits () const
 Returns a set of bits where each set bit's index corresponds to the node index of a node in this schedule.
 
VDF_API void SetRequestMask (const OutputId &outputId, const VdfMask &mask)
 Registers a request mask for the output indicated by outputId.
 
VDF_API void SetAffectsMask (const OutputId &outputId, const VdfMask &mask)
 Registers an affects mask for the output indicated by outputId.
 
VDF_API void SetKeepMask (const OutputId &outputId, const VdfMask &mask)
 Registers a keep mask for the output indicated by outputId.
 
VDF_API void SetPassToOutput (const OutputId &outputId, const VdfOutput *output)
 Registers a "pass to" output for the output indicated by outputId.
 
VDF_API void SetFromBufferOutput (const OutputId &outputId, const VdfOutput *output)
 Registers a "from buffer" for the output indicated by outputId.
 
VDF_API void SetOutputToClear (const VdfNode &node, const VdfOutput *outputToClear)
 Registers an output whose temporary buffer can be eagerly cleared as soon as node has finished executing.
 
VDF_API void InitializeFromNetwork (const VdfNetwork &network)
 Initializes structures based on the size of the network.
 
void SetHasSMBL (bool enable)
 Enables SMBL for this schedule.
 

Friends

class VdfScheduler
 

Detailed Description

Contains a specification of how to execute a particular VdfNetwork.

Contains ordering and dependency information about the nodes in a network.

Definition at line 40 of file schedule.h.

Member Typedef Documentation

◆ InputDependencyRange

using InputDependencyRange = IteratorRange<std::vector<VdfScheduleInputDependency>::const_iterator>

An iterable range of input dependencies.

Definition at line 78 of file schedule.h.

◆ InputsRange

using InputsRange = IteratorRange<std::vector<VdfScheduleInput>::const_iterator>

An iterable range of scheduled inputs.

Definition at line 83 of file schedule.h.

◆ ScheduleNodeVector

using ScheduleNodeVector = std::vector<VdfScheduleNode>

The type for the vector of schedule nodes in the schedule.

Definition at line 70 of file schedule.h.

◆ TaskIdRange

An iterable range of task ids.

Definition at line 74 of file schedule.h.

Constructor & Destructor Documentation

◆ VdfSchedule() [1/2]

VdfSchedule ( const VdfSchedule )
delete

Noncopyable.

◆ VdfSchedule() [2/2]

VDF_API VdfSchedule ( )

Constructs an empty schedule.

◆ ~VdfSchedule()

VDF_API ~VdfSchedule ( )

Destructor.

Member Function Documentation

◆ AddInput()

VDF_API void AddInput ( const VdfConnection connection,
const VdfMask mask 
)

Adds the input targeted by the given connection to the schedule.

The specified mask indicates which data elements the input depends on.

See also
DeduplicateInputs

◆ Clear()

VDF_API void Clear ( )

Clears the schedule.

This marks the schedule as invalid and is no longer suitable for execution.

◆ DeduplicateInputs()

VDF_API void DeduplicateInputs ( )

Consolidates scheduled input entries added by AddInput.

Ensures that each pair of scheduled input and source output has a unique entry that accumulates the masks passed to AddInput. The scheduler is responsible for calling this method after all inputs have been added and before any call to GetInputs.

◆ ForEachScheduledOutput()

VDF_API void ForEachScheduledOutput ( const VdfNode node,
const VdfScheduledOutputCallback callback 
) const

Loops over each scheduled output of node and calls callback with the output and request mask in an efficient manner.

◆ GetAffectsMask()

VDF_API const VdfMask & GetAffectsMask ( const OutputId outputId) const

Returns the affects mask associated with the given OutputId.

◆ GetComputeTask()

const VdfScheduleComputeTask & GetComputeTask ( const VdfScheduleTaskIndex  index) const
inline

Returns the compute task associated with the given task index.

Definition at line 431 of file schedule.h.

◆ GetComputeTaskIds() [1/2]

const TaskIdRange GetComputeTaskIds ( const VdfNode node) const
inline

Returns a range of ids describing compute tasks associated with the given node.

Definition at line 402 of file schedule.h.

◆ GetComputeTaskIds() [2/2]

TaskIdRange GetComputeTaskIds ( const VdfScheduleInputDependency input) const
inline

Returns an iterable range of task indices given an input dependency.

Definition at line 413 of file schedule.h.

◆ GetFromBufferOutput()

VDF_API const VdfOutput * GetFromBufferOutput ( const OutputId outputId) const

Returns the "from buffer's" output associated with the given OutputId.

◆ GetInputs()

VDF_API InputsRange GetInputs ( const VdfNode node) const

Returns a range of inputs scheduled for the given node.

Note that not all inputs in the network are also scheduled for the node.

◆ GetInputsTask()

const VdfScheduleInputsTask & GetInputsTask ( const VdfScheduleTaskIndex  index) const
inline

Returns the inputs task associated with the given task index.

Definition at line 439 of file schedule.h.

◆ GetKeepMask() [1/2]

VDF_API const VdfMask & GetKeepMask ( const OutputId outputId) const

Returns the keep mask associated with the given OutputId.

◆ GetKeepMask() [2/2]

const VdfMask & GetKeepMask ( const VdfScheduleTaskIndex  invocationIndex) const
inline

Returns the keep mask for the given node invocation index.

Definition at line 334 of file schedule.h.

◆ GetKeepTaskIndex()

const VdfScheduleTaskIndex GetKeepTaskIndex ( const VdfNode node) const
inline

Returns an index to the keep task associated with the given node.

Definition at line 422 of file schedule.h.

◆ GetNetwork()

const VdfNetwork * GetNetwork ( ) const
inline

Returns the network for this schedule.

Definition at line 178 of file schedule.h.

◆ GetNode()

VDF_API const VdfNode * GetNode ( const OutputId outputId) const

Returns the VdfNode that owns the VdfOutput associated with the given outputId.

◆ GetNumComputeTasks()

size_t GetNumComputeTasks ( ) const
inline

Returns the total number of compute tasks in the schedule.

Definition at line 377 of file schedule.h.

◆ GetNumInputsTasks()

size_t GetNumInputsTasks ( ) const
inline

Returns the total number of inputs tasks in the schedule.

Definition at line 383 of file schedule.h.

◆ GetNumKeepTasks()

size_t GetNumKeepTasks ( ) const
inline

Returns the total number of keep tasks in the schedule.

Definition at line 395 of file schedule.h.

◆ GetNumPrepTasks()

size_t GetNumPrepTasks ( ) const
inline

Returns the total number of prep tasks in the schedule.

Definition at line 389 of file schedule.h.

◆ GetNumUniqueInputDependencies()

size_t GetNumUniqueInputDependencies ( ) const
inline

Returns the number of unique input dependencies created for the scheduled task graph.

Each unique input dependency refers to the same output and mask combination.

Definition at line 371 of file schedule.h.

◆ GetOptionalInputDependencies()

InputDependencyRange GetOptionalInputDependencies ( const VdfScheduleInputsTask task) const
inline

Returns an iterable range of optional (i.e.

dependent on prereq results) input dependencies for the given inputs task.

Definition at line 458 of file schedule.h.

◆ GetOrCreateOutputId()

VDF_API OutputId GetOrCreateOutputId ( const VdfOutput output)

Similar to GetOutputId, but creates an OutptuId if none exists, effectively adding the output to the schedule.

So you want to be very careful how you use this method.

◆ GetOutput()

VDF_API const VdfOutput * GetOutput ( const OutputId outputId) const

Returns the scheduled VdfOutput associated with the given OutputId.

◆ GetOutputId()

VDF_API OutputId GetOutputId ( const VdfOutput output) const

Returns a small, cheap OutputId, which can be passed to other Get* methods in this class to efficiently get scheduling information about a particular VdfOutput.

If the schedule does not include output, the returned OutputId's IsValid() method will return false.

◆ GetOutputIdsBegin()

VDF_API OutputId GetOutputIdsBegin ( const VdfNode node) const

Gets an OutputId identifying the first scheduled output for the given node, if any.

The returned OutputId may be invalid if there are no scheduled outputs for node.

Note that node must be scheduled for this API to work, cf. IsScheduled().

Rather than calling this method directly, consider using VDF_FOR_EACH_SCHEDULED_OUTPUT_ID(...) instead.

◆ GetOutputIdsEnd()

VDF_API OutputId GetOutputIdsEnd ( const VdfNode node) const

Gets an OutputId identifying the "end" of the scheduled outputs for a node.

This OutputId should never be used to query the schedule, as it never represents a particular scheduled output. See GetOutputIdsBegin().

Note that node must be scheduled for this API to work, cf. IsScheduled().

Rather than calling this method directly, consider using VDF_FOR_EACH_SCHEDULED_OUTPUT_ID(...) instead.

◆ GetOutputToClear()

VDF_API const VdfOutput * GetOutputToClear ( const VdfNode node) const

Returns the output whose temporary buffer can be immediately deallocated after node has finished executing.

◆ GetPassToOutput()

VDF_API const VdfOutput * GetPassToOutput ( const OutputId outputId) const

Returns the "pass to" output associated with the given OutputId.

◆ GetPrereqInputDependencies()

InputDependencyRange GetPrereqInputDependencies ( const VdfScheduleInputsTask task) const
inline

Returns an iterable range of prereq input dependencies for the given inputs task.

Definition at line 448 of file schedule.h.

◆ GetRequest()

const VdfRequest & GetRequest ( ) const
inline

Returns the request for this schedule.

Definition at line 496 of file schedule.h.

◆ GetRequestAndAffectsMask() [1/2]

VDF_API void GetRequestAndAffectsMask ( const OutputId outputId,
const VdfMask **  requestMask,
const VdfMask **  affectsMask 
) const

Returns pointers to the request and affects masks simultaneously, saving on the overhead of making two queries when client code just needs both masks.

◆ GetRequestAndAffectsMask() [2/2]

void GetRequestAndAffectsMask ( const VdfScheduleTaskIndex  invocationIndex,
const VdfMask **  requestMask,
const VdfMask **  affectsMask 
) const
inline

Returns pointers to the request and affects masks for the given node invocation index.

Definition at line 313 of file schedule.h.

◆ GetRequestMask() [1/2]

VDF_API const VdfMask & GetRequestMask ( const OutputId outputId) const

Returns the request mask associated with the given OutputId.

◆ GetRequestMask() [2/2]

const VdfMask & GetRequestMask ( const VdfScheduleTaskIndex  invocationIndex) const
inline

Returns the request mask for the given node invocation.

Definition at line 294 of file schedule.h.

◆ GetRequiredInputDependencies()

InputDependencyRange GetRequiredInputDependencies ( const VdfScheduleComputeTask task) const
inline

Returns an iterable range of required (i.e.

read/writes and reads not dependent on prereqs) input dependencies for the given compute task.

Definition at line 468 of file schedule.h.

◆ GetScheduledNodeBits()

const TfBits & GetScheduledNodeBits ( ) const
inline

Returns a set of bits where each set bit's index corresponds to the node index of a node in this schedule.

Definition at line 521 of file schedule.h.

◆ GetScheduleNodeIndex()

int GetScheduleNodeIndex ( const OutputId outputId) const
inline

Returns the node index of the schedule node associated with the given outputId.

Definition at line 514 of file schedule.h.

◆ GetScheduleNodeVector() [1/2]

ScheduleNodeVector & GetScheduleNodeVector ( )
inline

Returns the vector of schedule nodes in this schedule.

It is never appropriate to access the vector of schedule nodes directly except during scheduling.

Definition at line 503 of file schedule.h.

◆ GetScheduleNodeVector() [2/2]

const ScheduleNodeVector & GetScheduleNodeVector ( ) const
inline

Definition at line 507 of file schedule.h.

◆ GetUniqueIndex()

VDF_API VdfScheduleInputDependencyUniqueIndex GetUniqueIndex ( const OutputId  outputId) const

Returns the unique index assigned to the output.

◆ HasSMBL()

bool HasSMBL ( ) const
inline

Returns true if this schedule participates in sparse mung buffer locking.

Definition at line 353 of file schedule.h.

◆ InitializeFromNetwork()

VDF_API void InitializeFromNetwork ( const VdfNetwork network)

Initializes structures based on the size of the network.

◆ IsAffective()

VDF_API bool IsAffective ( const OutputId outputId) const

Returns true if the output is expected to have an effect on its corresponding input, and false otherwise.

Outputs that don't have an 'affects' mask or a corresponding input are always considered to affect their data.

◆ IsScheduled()

VDF_API bool IsScheduled ( const VdfNode node) const

Returns whether this schedule includes node in any way.

◆ IsSmallSchedule()

bool IsSmallSchedule ( ) const
inline

Returns whether this schedule is small enough to avoid overhead incurred by the _nodesToIndexMap mapping, which is otherwise of great benefit to schedule node lookup time.

Definition at line 487 of file schedule.h.

◆ IsValid()

bool IsValid ( ) const
inline

Returns whether or not this schedule is valid and can be used for execution.

Definition at line 172 of file schedule.h.

◆ SetAffectsMask()

VDF_API void SetAffectsMask ( const OutputId outputId,
const VdfMask mask 
)

Registers an affects mask for the output indicated by outputId.

◆ SetFromBufferOutput()

VDF_API void SetFromBufferOutput ( const OutputId outputId,
const VdfOutput output 
)

Registers a "from buffer" for the output indicated by outputId.

◆ SetHasSMBL()

void SetHasSMBL ( bool  enable)
inline

Enables SMBL for this schedule.

Definition at line 561 of file schedule.h.

◆ SetKeepMask()

VDF_API void SetKeepMask ( const OutputId outputId,
const VdfMask mask 
)

Registers a keep mask for the output indicated by outputId.

◆ SetOutputToClear()

VDF_API void SetOutputToClear ( const VdfNode node,
const VdfOutput outputToClear 
)

Registers an output whose temporary buffer can be eagerly cleared as soon as node has finished executing.

◆ SetPassToOutput()

VDF_API void SetPassToOutput ( const OutputId outputId,
const VdfOutput output 
)

Registers a "pass to" output for the output indicated by outputId.

◆ SetRequest()

VDF_API void SetRequest ( const VdfRequest &  request)

Sets the request that was used to make up this schedule.

◆ SetRequestMask()

VDF_API void SetRequestMask ( const OutputId outputId,
const VdfMask mask 
)

Registers a request mask for the output indicated by outputId.

Friends And Related Function Documentation

◆ VdfScheduler

friend class VdfScheduler
friend

Definition at line 571 of file schedule.h.


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