7#ifndef PXR_EXEC_VDF_EXECUTOR_API_H
8#define PXR_EXEC_VDF_EXECUTOR_API_H
14#include "pxr/exec/vdf/api.h"
18#include "pxr/base/tf/hashset.h"
24PXR_NAMESPACE_OPEN_SCOPE
34class VdfExecutorFactoryBase;
76 const VdfRequest &computeRequest,
88 virtual const VdfExecutorFactoryBase &
GetFactory()
const = 0;
144 return _GetOutputValueForReading(output, mask);
163 return _parentExecutor;
190 const VdfMaskedOutputVector &invalidationRequest);
229 ++_executorInvalidationTimestamp;
235 _executorInvalidationTimestamp =
242 return _executorInvalidationTimestamp;
262 _interruptionFlag = interruptionFlag;
268 return _interruptionFlag;
276 return _interruptionFlag && _interruptionFlag->load();
319 const VdfRequest &computeRequest,
326 const VdfMask &mask)
const = 0;
332 const VdfMask &mask)
const = 0;
343 const VdfId outputId,
344 const VdfMask &invalidationMask)
const = 0;
354 const VdfMask &invalidationMask) = 0;
362 const VdfMaskedOutputVector &invalidationRequest,
363 VdfMaskedOutputVector *processedRequest) {
391 const VdfMask &sourceMask)
const = 0;
413 template<
template <
typename>
class E,
class D>
424 std::unique_ptr<VdfExecutorInvalidator> _invalidator;
431 typedef TfHashSet<const VdfExecutorObserver *, TfHash> _Observers;
432 mutable _Observers _observers;
440 mutable std::recursive_mutex _observersLock;
451 const std::atomic_bool *_interruptionFlag;
457PXR_NAMESPACE_CLOSE_SCOPE
A class that fully represents a connection between two VdfNodes.
A context is the parameter bundle passed to callbacks of computations.
Execution stats profiling event logger.
A client may instantiate an object of this class and set it in an executor, to collect errors that ma...
Abstract base class for classes that execute a VdfNetwork to compute a requested set of values.
void IncrementExecutorInvalidationTimestamp()
Increment this executor's invalidation timestamp for mung buffer locking.
VDF_API void Run(const VdfSchedule &schedule, VdfExecutorErrorLogger *errorLogger=NULL)
Executes the schedule.
VDF_API void ClearDataForOutput(const VdfId outputId, const VdfId nodeId)
Clears the executor buffers for a specific output.
virtual bool IsEmpty() const =0
Returns true if the executor buffers are empty.
virtual bool _InvalidateOutput(const VdfOutput &output, const VdfMask &invalidationMask)=0
Called during invalidation to mark outputs as invalid and determine when the traversal can terminate ...
virtual bool HasInvalidationTimestampMismatch(const VdfOutput &source, const VdfOutput &dest) const =0
Returns true, if the invalidation timestamps between the source and dest outputs do not match,...
virtual void _Run(const VdfSchedule &schedule, const VdfRequest &computeRequest, VdfExecutorErrorLogger *errorLogger)=0
Run this executor with the given schedule and request.
bool HasBeenInterrupted() const
Returns whether or not the executor has been interrupted, if the executor supports interruption.
void SetInterruptionFlag(const std::atomic_bool *interruptionFlag)
Set the interruption flag.
const VdfVector * GetOutputValue(const VdfOutput &output, const VdfMask &mask) const
Returns the cached value for a given output if it has a cache that contains all values specified by m...
VDF_API VdfExecutorInterface()
Protected default constructor.
VDF_API void ClearData()
Clears the executors buffers.
const std::atomic_bool * GetInterruptionFlag() const
Returns the interruption flag.
void SetExecutionStats(VdfExecutionStats *stats)
Sets an execution stats object.
virtual void _TouchOutput(const VdfOutput &output) const =0
Mark the output as having been visited.
virtual void Resize(const VdfNetwork &network)
Resize the executor to accomodate data for the given network.
VdfExecutorInterface(const VdfExecutorInterface &)=delete
Noncopyable.
VDF_API void SetParentExecutor(const VdfExecutorInterface *parentExecutor)
Sets the parent executor.
virtual VDF_API void _ClearDataForOutput(const VdfId outputId, const VdfId nodeId)
Virtual implementation of the ClearDataForOutput call.
VDF_API void InvalidateValues(const VdfMaskedOutputVector &invalidationRequest)
Invalidates the network, starting from the masked outputs in request.
VDF_API void InvalidateTopologicalState()
Invalidate all state depending on network topology.
const VdfExecutorInterface * GetParentExecutor() const
Returns the parent executor, if any.
virtual const VdfExecutorFactoryBase & GetFactory() const =0
Returns a factory class facilitating the construction of new executors that share traits with this ex...
VDF_API void RegisterObserver(const VdfExecutorObserver *observer) const
Can be called by clients to register a VdfExecutorObserver with this executor.
virtual VDF_API ~VdfExecutorInterface()
Destructor.
virtual void DuplicateOutputData(const VdfOutput &sourceOutput, const VdfOutput &destOutput)=0
Duplicates the output data associated with sourceOutput and copies it to destOutput.
virtual void _SetReferenceOutputValue(const VdfOutput &destOutput, const VdfOutput &sourceOutput, const VdfMask &sourceMask) const =0
Called to set destOutput's buffer output to be a reference to the buffer output of sourceOutput.
VDF_API void Run(const VdfSchedule &schedule, const VdfRequest &computeRequest, VdfExecutorErrorLogger *errorLogger=NULL)
Executes the schedule.
VDF_API VdfExecutorInterface(const VdfExecutorInterface *parentExecutor)
Construct with a parent executor.
virtual void _UpdateInvalidationTimestamp()=0
Called before invalidation begins to update the timestamp that will be written for every VdfOutput vi...
VdfExecutionStats * GetExecutionStats() const
Returns the Execution Stats object, if any.
virtual VDF_API void _ClearData()
Virtual implementation of the ClearData call.
virtual bool TakeOutputValue(const VdfOutput &output, VdfVector *value, const VdfMask &mask)=0
Transfers ownership of the value to the given output.
virtual bool _IsOutputInvalid(const VdfId outputId, const VdfMask &invalidationMask) const =0
Returns true if the output is already invalid for the given invalidationMask.
virtual const VdfVector * _GetInputValue(const VdfConnection &connection, const VdfMask &mask) const =0
Returns a value for the cache that flows across connection.
void InheritExecutorInvalidationTimestamp(const VdfExecutorInterface &executor)
Inherit the invalidation timestamp from another executor.
virtual VdfVector * _GetOutputValueForWriting(const VdfOutput &output) const =0
Returns an output value for writing.
virtual bool _PreProcessInvalidation(const VdfMaskedOutputVector &invalidationRequest, VdfMaskedOutputVector *processedRequest)
This method is called as a pre-processing step before an InvalidateValues() call.
VdfInvalidationTimestamp GetExecutorInvalidationTimestamp() const
Returns this executor's invalidation timestamp.
virtual const VdfVector * _GetOutputValueForReading(const VdfOutput &output, const VdfMask &mask) const =0
Returns an output value for reading.
VDF_API void UnregisterObserver(const VdfExecutorObserver *observer) const
Must be called by clients to unregister a VdfExecutorObserver, which has been previously registered w...
virtual void SetOutputValue(const VdfOutput &output, const VdfVector &value, const VdfMask &mask)=0
Sets the cached value for a given output.
Invalidates state and temporary buffers of all outputs dependent on the outputs supplied in the inval...
This is an interface for any class that wants to listen to specific executor events,...
Base class for libVdf iterators.
A VdfMask is placed on connections to specify the data flowing through them.
A VdfNetwork is a collection of VdfNodes and their connections.
A VdfOutput represents an output on a node.
An executor engine used for parallel speculation node evaluation, deriving from VdfParallelExecutorEn...
This class is a collection of common functions used by pulled based executors.
Contains a specification of how to execute a particular VdfNetwork.
This class provides an executor engine to the speculation executor.
Executor used in speculation.
A node that pulls on a vector of value that are downstream of the current execution position.
This class is used to abstract away knowledge of the cache data used for each node.
uint64_t VdfId
The unique identifier type for Vdf objects.
unsigned int VdfInvalidationTimestamp
Type of the timestamp that identifies the most recent round of invalidation.