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