Loading...
Searching...
No Matches
executor.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_EXECUTOR_H
8#define PXR_EXEC_VDF_EXECUTOR_H
9
11
12#include "pxr/pxr.h"
13
22
23PXR_NAMESPACE_OPEN_SCOPE
24
26class VdfSchedule;
27
35template <
36 template <typename> class EngineType,
37 typename DataManagerType>
39 public VdfDataManagerBasedExecutor<DataManagerType, VdfExecutorInterface>
40{
41 // Base class type.
42 typedef
44 Base;
45
46 // The speculation executor engine alias declaration, to be bound as a
47 // template template parameter.
48 template <typename T>
49 using SpeculationEngineType =
50 typename EngineType<T>::SpeculationExecutorEngine;
51
52 // Executor factory.
53 typedef
54 VdfExecutorFactory<
55 VdfSubExecutor<EngineType, DataManagerType>,
57 _Factory;
58
59public:
60
63 VdfExecutor() : _engine(*this, &this->_dataManager) {}
64
67 virtual ~VdfExecutor() {}
68
71 virtual const VdfExecutorFactoryBase &GetFactory() const override final {
72 return _factory;
73 }
74
75private:
76
77 // Run this executor with the given \p schedule and \p request.
78 //
79 virtual void _Run(
80 const VdfSchedule &schedule,
81 const VdfRequest &computeRequest,
82 VdfExecutorErrorLogger *errorLogger) override;
83
84 // Causes the data manager to clear its temporary execution buffers.
85 //
86 virtual void _ClearData() override {
87 Base::_dataManager.Clear();
88 }
89
90private:
91
92 // The factory shared amongst executors of this type.
93 //
94 static const _Factory _factory;
95
96 // This is the engine that will do most of our hard work for us.
97 //
98 EngineType<DataManagerType> _engine;
99};
100
102
103template <template <typename> class EngineType, typename DataManagerType>
104const typename VdfExecutor<EngineType, DataManagerType>::_Factory
106
107template <template <typename> class EngineType, typename DataManagerType>
108void
110 const VdfSchedule &schedule,
111 const VdfRequest &computeRequest,
112 VdfExecutorErrorLogger *errorLogger)
113{
114 // If we have an empty request, bail.
115 if (computeRequest.IsEmpty()) {
116 return;
117 }
118
119 TRACE_FUNCTION();
120 TfAutoMallocTag2 tag("Ef", "VdfExecutor::Run");
121
122 _engine.RunSchedule(schedule, computeRequest, errorLogger);
123}
124
125PXR_NAMESPACE_CLOSE_SCOPE
126
127#endif
Scoped (i.e.
Definition mallocTag.h:251
Base class for executors that use a data manager.
A client may instantiate an object of this class and set it in an executor, to collect errors that ma...
Executes a VdfNetwork to compute a requested set of values.
Definition executor.h:40
VdfExecutor()
Default constructor.
Definition executor.h:63
virtual const VdfExecutorFactoryBase & GetFactory() const override final
Factory construction.
Definition executor.h:71
virtual ~VdfExecutor()
Destructor.
Definition executor.h:67
Contains a specification of how to execute a particular VdfNetwork.
Definition schedule.h:41
Executor used in speculation.