MCPcopy Create free account
hub / github.com/PixarAnimationStudios/OpenUSD / _Compile

Method _Compile

pxr/exec/exec/cycleDetectingTask.cpp:19–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17#include <unordered_set>
18
19PXR_NAMESPACE_OPEN_SCOPE
20
21void
22Exec_CycleDetectingTask::_Compile(
23 Exec_CompilationState &compilationState,
24 TaskPhases &taskPhases)
25{
26 TRACE_FUNCTION();
27 TfAutoMallocTag tag("Exec", __ARCH_PRETTY_FUNCTION__);
28
29 taskPhases.Invoke(
30 [this, &compilationState](TaskDependencies &deps) {
31 TRACE_FUNCTION_SCOPE("search for potential cycles");
32
33 // If this node is a VdfSpeculationNode, traversal should not proceed
34 // upwards from here, because VdfSpeculationNodes are specifically
35 // created to break topological cycles, and there is no need to
36 // re-detect those cycles.
37 if (_node->IsSpeculationNode()) {
38 return;
39 }
40
41 const std::unordered_set<VdfInput *> &inputsRequiringRecompilation =
42 compilationState.GetProgram()->GetInputsRequiringRecompilation();
43
44 for (const auto &entry : _node->GetInputsIterator()) {
45 VdfInput *const input = entry.second;
46 if (inputsRequiringRecompilation.find(input) !=
47 inputsRequiringRecompilation.end()) {
48 // This input is being recompiled. This task cannot complete
49 // until the input has finished recompilation. If recompilation
50 // of the input depends on the current Exec_CycleDetectingTask,
51 // then the dependency added here introduces a task cycle, which
52 // will be caught by the Exec_TaskCycleDetector.
53 deps.WaitOnInputRecompilationTask(input);
54 continue;
55 }
56
57 // The input is not being recompiled. Recursively spawn more cycle
58 // detecting tasks for all nodes upstream of this input.
59 for (const VdfConnection *const connection :
60 input->GetConnections()) {
61 const VdfNode *const sourceNode = &connection->GetSourceNode();
62 if (deps.ClaimCycleDetectingTask(sourceNode)) {
63 deps.NewSubtask<Exec_CycleDetectingTask>(
64 compilationState,
65 sourceNode);
66 }
67 }
68 }
69 },
70 [this](TaskDependencies &deps) {
71 // Any upstream inputs undergoing recompilation have completed.
72 deps.MarkDoneCycleDetectingTask(_node);
73 }
74 );
75}
76

Callers

nothing calls this directly

Calls 10

IsSpeculationNodeMethod · 0.80
GetProgramMethod · 0.80
InvokeMethod · 0.45
findMethod · 0.45
endMethod · 0.45
GetConnectionsMethod · 0.45

Tested by

no test coverage detected