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 DataManager to clear its temporary execution buffers.
85 //
86 virtual void _ClearData() override;
87
88private:
89
90 // The factory shared amongst executors of this type.
91 //
92 static const _Factory _factory;
93
94 // This is the engine that will do most of our hard work for us.
95 //
96 EngineType<DataManagerType> _engine;
97};
98
100
101template <template <typename> class EngineType, typename DataManagerType>
102const typename VdfExecutor<EngineType, DataManagerType>::_Factory
104
105template <template <typename> class EngineType, typename DataManagerType>
106void
108 const VdfSchedule &schedule,
109 const VdfRequest &computeRequest,
110 VdfExecutorErrorLogger *errorLogger)
111{
112 // If we have an empty request, bail.
113 if (computeRequest.IsEmpty()) {
114 return;
115 }
116
117 TRACE_FUNCTION();
118 TfAutoMallocTag2 tag("Ef", "VdfExecutor::Run");
119
120 _engine.RunSchedule(schedule, computeRequest, errorLogger);
121}
122
123template <template <typename> class EngineType, typename DataManagerType>
124void
126{
127 Base::_dataManager.Clear();
128}
129
130PXR_NAMESPACE_CLOSE_SCOPE
131
132#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.