7#ifndef PXR_EXEC_VDF_SCHEDULER_H
8#define PXR_EXEC_VDF_SCHEDULER_H
14#include "pxr/exec/vdf/api.h"
17#include "pxr/base/tf/hashmap.h"
23PXR_NAMESPACE_OPEN_SCOPE
26using VdfMaskedOutputVector = std::vector<VdfMaskedOutput>;
32class VdfScheduleOutput;
45 std::pair<VdfPoolChainIndex, const VdfOutput *>
50 TfHashMap<const VdfNode *, VdfMaskedOutputVector, TfHash>;
67 bool topologicallySort);
77 bool topologicallySort);
94 return _interruptionFlag &&
95 _interruptionFlag->load(std::memory_order_relaxed);
119 const VdfRequest &request,
121 PoolPriorityVector *poolOutputs);
137 const VdfRequest &request,
153 const VdfRequest &request,
155 const PoolPriorityVector &sortedPoolOutputs);
165 const PoolPriorityVector &sortedPoolOutputs);
175 const PoolPriorityVector &sortedPoolOutputs);
187 const VdfRequest &request,
189 const PoolPriorityVector &sortedPoolOutputs);
233 const std::atomic_bool *_interruptionFlag =
nullptr;
238PXR_NAMESPACE_CLOSE_SCOPE
Class to hold on to an externally owned output and a mask.
A VdfNetwork is a collection of VdfNodes and their connections.
This is the base class for all nodes in a VdfNetwork.
A VdfOutput represents an output on a node.
Contains a specification of how to execute a particular VdfNetwork.
This class contains scheduling information necessary to run a single VdfNode.
Used to make a VdfSchedule.
static VDF_API void _MarkSmallSchedule(VdfSchedule *schedule)
Marks the schedule as small if it is indeed small.
VDF_API bool _ScheduleForPassThroughs(const VdfRequest &request, VdfSchedule *schedule, const PoolPriorityVector &sortedPoolOutputs)
Schedule the outputs from which buffers should be passed.
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.
VDF_API bool _ScheduleBufferPasses(const VdfRequest &request, VdfSchedule *schedule)
Method to schedule the buffer passes and the "keep" masks for the scheduled nodes.
static VDF_API void Schedule(const VdfRequest &request, VdfSchedule *schedule, bool topologicallySort)
Generates a schedule.
static VDF_API void _UpdateLockMaskForNode(VdfSchedule *schedule, VdfScheduleNode *node)
Updates schedule for node if the lock mask changed.
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.
bool _HasBeenInterrupted() const
Returns true if the scheduler has been interrupted, if the scheduler supports interruption.
static VDF_API bool _ApplyAffectsMasksForNode(VdfScheduleNode *node)
Applies the affects masks to the scheduled node.
VDF_API bool _ScheduleTaskGraph(VdfSchedule *schedule, const PoolPriorityVector &sortedPoolOutputs)
Schedule the task graph for multi-threaded munging.
VDF_API void _GenerateTasks(VdfSchedule *schedule, const PoolPriorityVector &sortedPoolOutputs)
Generate tasks for the scheduled task graph.
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.
TfHashMap< const VdfNode *, VdfMaskedOutputVector, TfHash > NodeToRequestMap
A map from VdfNode * to VdfMaskedOutputVector.
VDF_API bool CreateSchedule(const VdfRequest &request, VdfSchedule *schedule, bool topologicallySort)
Generates a schedule.
VDF_API bool _ApplyAffectsMasks(VdfSchedule *schedule)
Applies the affects mask to the schedule.
VDF_API VdfScheduler(const std::atomic_bool *interruptionFlag)
Constructs a scheduler.
static VDF_API bool UpdateAffectsMaskForOutput(VdfSchedule *schedule, const VdfOutput &output)
Update schedule after the affects mask changed on output.
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.