HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
scheduleTasks.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_SCHEDULE_TASKS_H
8 #define PXR_EXEC_VDF_SCHEDULE_TASKS_H
9 
10 /// \file
11 
12 #include "pxr/pxr.h"
13 
14 #include "pxr/exec/vdf/mask.h"
15 
16 #include "pxr/base/tf/diagnostic.h"
17 
19 
20 class VdfOutput;
21 
22 /// Type describing a task id. An id is comprised of an index, as well as
23 /// one bit of additional information.
24 ///
25 typedef uint32_t VdfScheduleTaskId;
26 
27 /// Type describing a task index.
28 ///
29 typedef uint32_t VdfScheduleTaskIndex;
30 
31 /// Type describing a number of task indices or ids.
32 ///
33 typedef uint32_t VdfScheduleTaskNum;
34 
35 /// A sentinel value used to describe an invalid task index or id.
36 ///
37 static const uint32_t VdfScheduleTaskInvalid = uint32_t(-1);
38 
39 /// Returns true if the given task index or id is invalid.
40 ///
41 inline bool VdfScheduleTaskIsInvalid(uint32_t task) {
42  return task == VdfScheduleTaskInvalid;
43 }
44 
45 /// A structure describing a range of task ids, beginning at taskId and
46 /// ending at taskId + taskNum.
47 ///
51 };
52 
53 /// A bit field with additional flags to further describe a
54 /// VdfScheduleComputeTask.
55 ///
57  bool isAffective : 1; // Is this compute task affective?
58  bool hasKeep : 1; // Does this compute task keep any data?
59 };
60 
61 /// A VdfScheduleComputeTask represents a unit of computation for the parallel
62 /// evaluation engine. Every scheduled node has at least one of these tasks.
63 ///
65  // The index into the VdfScheduleNodeInvocation array. This is an invalid
66  // index for nodes with only one compute task.
68 
69  // The corresponding inputs task. This is an invalid task index for nodes
70  // with only one compute task, and without prereqs and reads, which could
71  // be run in parallel with read/writes.
73 
74  // The corresponding node preparation task. Every scheduled node has at
75  // most one of these. The task is shared amongst all invocations of that
76  // node. An invalid index denotes that node preparation need not be
77  // synchronized.
79 
80  // Index into the input dependencies array. The first required input
81  // dependency, i.e. read/write or read not dependent on prereqs.
83 
84  // The number of required input dependencies.
86 
87  // Additional bit flags.
89 };
90 
91 /// Further describes every invocation of a single node. Note, that nodes with
92 /// invocations always have exactly one output, and the data in this structure
93 /// is relevant to that single output.
94 ///
99 };
100 
101 /// Structure describing an additional task used to run prereqs and reads
102 /// concurrently with read/write input dependencies.
103 ///
108 };
109 
110 /// A sequential index assigned to the unique output and mask combination of a
111 /// VdfScheduleInputDependency instance. This index aids in effectively
112 /// de-duplicating individual input dependencies referring to the same output
113 /// and mask.
114 ///
116 
117 /// Describes a single input dependency, i.e. the output and mask to be used
118 /// to check for a cache hit, as well as the compute task id and number of
119 /// compute tasks (or a single keep task) to invoke on cache misses.
120 ///
122  // A unique index for the output and mask combination of this dependency.
124 
125  // The requested output at the source end of the input dependency.
127 
128  // The requested mask at the source end of the input dependency.
130 
131  // The compute task id of the first task to be invoked to fulfill this
132  // input dependency. Note, this can be a compute task id, or a keep task
133  // index. If this is a keep task index, computeTaskNum shall be set to 0.
135 
136  // The number of compute task ids to be invoked to fulfill this input
137  // dependency. If this is 0, the input dependency is for a keep task.
139 };
140 
142 
143 #endif
VdfScheduleTaskId taskId
Definition: scheduleTasks.h:49
VdfScheduleInputDependencyUniqueIndex uniqueIndex
uint32_t VdfScheduleTaskNum
Definition: scheduleTasks.h:33
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
VdfScheduleTaskIndex inputDepIndex
A VdfMask is placed on connections to specify the data flowing through them.
Definition: mask.h:36
VdfScheduleTaskIndex requiredsIndex
Definition: scheduleTasks.h:82
VdfScheduleTaskNum computeTaskNum
VdfScheduleTaskNum requiredsNum
Definition: scheduleTasks.h:85
VdfScheduleTaskNum prereqsNum
uint32_t VdfScheduleTaskId
Definition: scheduleTasks.h:20
VdfScheduleTaskIndex prepTaskIndex
Definition: scheduleTasks.h:78
VdfScheduleTaskNum taskNum
Definition: scheduleTasks.h:50
const VdfOutput & output
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
bool VdfScheduleTaskIsInvalid(uint32_t task)
Definition: scheduleTasks.h:41
uint32_t VdfScheduleTaskIndex
Definition: scheduleTasks.h:29
VdfScheduleTaskNum optionalsNum
VdfScheduleTaskId computeOrKeepTaskId
VdfScheduleTaskIndex inputsTaskIndex
Definition: scheduleTasks.h:72
uint32_t VdfScheduleInputDependencyUniqueIndex
VdfScheduleComputeTaskFlags flags
Definition: scheduleTasks.h:88
VdfScheduleTaskIndex invocationIndex
Definition: scheduleTasks.h:67