Loading...
Searching...
No Matches
scheduler.h
Go to the documentation of this file.
1//
2// Copyright 2025 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_EXEC_VDF_SCHEDULER_H
8#define PXR_EXEC_VDF_SCHEDULER_H
9
11
12#include "pxr/pxr.h"
13
14#include "pxr/exec/vdf/api.h"
16
17PXR_NAMESPACE_OPEN_SCOPE
18
19class VdfMaskedOutput;
20using VdfMaskedOutputVector = std::vector<VdfMaskedOutput>;
21class VdfNetwork;
22class VdfNode;
23class VdfRequest;
24class VdfSchedule;
25class VdfScheduleNode;
26class VdfScheduleOutput;
27
35{
36public:
37 // Vector of priorities for pool outputs.
38 typedef std::vector<
39 std::pair<VdfPoolChainIndex, const VdfOutput *>
40 > PoolPriorityVector;
41
43 typedef
44 TfHashMap<const VdfNode *, VdfMaskedOutputVector, TfHash> NodeToRequestMap;
45
48 VDF_API
49 static void Schedule(const VdfRequest &request, VdfSchedule *schedule,
50 bool topologicallySort);
51
54 VDF_API
56 VdfSchedule *schedule,
57 const VdfOutput &output);
58
59protected:
63 VDF_API
64 static void _SetScheduleValid(
65 VdfSchedule *schedule,
66 const VdfNetwork *network);
67
76 VDF_API
78 const VdfRequest &request,
79 VdfSchedule *schedule,
80 PoolPriorityVector *poolOutputs);
81
83 VDF_API
84 static void _MarkSmallSchedule(VdfSchedule *schedule);
85
92 VDF_API
94 const VdfRequest &request,
95 VdfSchedule *schedule);
96
106 VDF_API
108 const VdfRequest &request,
109 VdfSchedule *schedule,
110 const PoolPriorityVector &sortedPoolOutputs);
111
115 VDF_API
116 static void _GenerateTasks(
117 VdfSchedule *schedule,
118 const PoolPriorityVector &sortedPoolOutputs);
119
123 VDF_API
125 VdfSchedule *schedule,
126 const PoolPriorityVector &sortedPoolOutputs);
127
136 VDF_API
137 static void _ComputeLockMasks(
138 const VdfRequest &request,
139 VdfSchedule *schedule,
140 const PoolPriorityVector &sortedPoolOutputs);
141
144 VDF_API
145 static void _ApplyAffectsMasks(VdfSchedule *schedule);
146
155 VDF_API
157
160 VDF_API
162 VdfSchedule *schedule,
163 VdfScheduleNode *node);
164
167 VDF_API
169 VdfSchedule *schedule,
170 VdfScheduleNode *node);
171
174 VDF_API
176 VdfSchedule *schedule,
177 VdfScheduleNode *node);
178
179};
180
182
183PXR_NAMESPACE_CLOSE_SCOPE
184
185#endif
Class to hold on to an externally owned output and a mask.
Definition: maskedOutput.h:32
A VdfNetwork is a collection of VdfNodes and their connections.
Definition: network.h:60
This is the base class for all nodes in a VdfNetwork.
Definition: node.h:53
A VdfOutput represents an output on a node.
Definition: output.h:32
Contains a specification of how to execute a particular VdfNetwork.
Definition: schedule.h:41
This class contains scheduling information necessary to run a single VdfNode.
Definition: scheduleNode.h:94
Used to make a VdfSchedule.
Definition: scheduler.h:35
static VDF_API void _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.
static VDF_API void _MarkSmallSchedule(VdfSchedule *schedule)
Marks the schedule as small if it is indeed small.
static VDF_API void _ApplyAffectsMasks(VdfSchedule *schedule)
Applies the affects mask to the schedule.
static VDF_API void _ScheduleBufferPasses(const VdfRequest &request, VdfSchedule *schedule)
Method to schedule the buffer passes and the "keep" masks for the scheduled nodes.
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 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 _ScheduleForPassThroughs(const VdfRequest &request, VdfSchedule *schedule, const PoolPriorityVector &sortedPoolOutputs)
Schedule the outputs from which buffers should be passed.
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 _ScheduleTaskGraph(VdfSchedule *schedule, const PoolPriorityVector &sortedPoolOutputs)
Schedule the task graph for multi-threaded munging.
static VDF_API bool UpdateAffectsMaskForOutput(VdfSchedule *schedule, const VdfOutput &output)
Update schedule after the affects mask changed on output.
static VDF_API void _GenerateTasks(VdfSchedule *schedule, const PoolPriorityVector &sortedPoolOutputs)
Generate tasks for the scheduled task graph.
TfHashMap< const VdfNode *, VdfMaskedOutputVector, TfHash > NodeToRequestMap
A map from VdfNode * to VdfMaskedOutputVector.
Definition: scheduler.h:44