Loading...
Searching...
No Matches
VdfParallelExecutorDataManager< DerivedClass > Class Template Reference

This class provides functionality to manage executor data stored as VdfExecutorData from multiple threads. More...

#include <parallelExecutorDataManager.h>

+ Inheritance diagram for VdfParallelExecutorDataManager< DerivedClass >:

Public Types

typedef Vdf_ParallelExecutorDataManagerTraits< DerivedClass >::DataHandle DataHandle
 The data handle type defined via the specialized traits class.
 
typedef Vdf_ParallelExecutorDataManagerInterface< DerivedClass, DataHandleBase
 The base class type.
 

Public Member Functions

VdfVectorGetInputValue (const VdfConnection &connection, const VdfMask &mask) const
 Returns the input value flowing across the given connection with the given mask.
 
VdfVectorGetOutputValueForReading (const DataHandle dataHandle, const VdfMask &mask) const
 Returns the cached value for a given output and mask.
 
VdfVectorGetOrCreateOutputValueForWriting (const VdfOutput &output, const DataHandle dataHandle) const
 Returns a new or existing output value.
 
void SetOutputValue (const VdfOutput &output, const VdfVector &value, const VdfMask &mask)
 Sets the cached value for a given output, creating the output cache if necessary.
 
bool TakeOutputValue (const VdfOutput &output, VdfVector *value, const VdfMask &mask)
 Transfers the ownership of value to the given output.
 
void SetReferenceOutputValue (const VdfVector *sourceValue, const VdfId destOutputId) const
 Called to set destOutput's buffer output to be a reference to the sourceValue.
 
void DuplicateOutputData (const VdfOutput &sourceOutput, const VdfOutput &destOutput)
 Duplicates the output data associated with sourceOutput and copies it to destOutput.
 
bool IsOutputInvalid (const VdfId outputId, const VdfMask &invalidationMask) const
 Returns true if the output is already invalid for the given invalidationMask.
 
bool InvalidateOutput (const VdfOutput &output, const VdfMask &invalidationMask)
 Marks output as invalid.
 
void Touch (const VdfOutput &output) const
 Marks the data at the given output as having been touched by evaluation.
 
void UpdateInvalidationTimestamp (const VdfInvalidationTimestamp &timestamp)
 Increments the the current invalidation timestamp on this executor.
 
const VdfInvalidationTimestampGetInvalidationTimestamp () const
 Returns the current invalidation timestamp on this executor.
 
bool HasInvalidationTimestampMismatch (const DataHandle &sourceHandle, const DataHandle &destHandle) const
 Returns true, if the invalidation timestamps between sourceExecutorData and destExecutorData do not match, i.e.
 

Static Public Member Functions

static VdfVectorCreateOutputCache (const VdfOutput &output, VdfExecutorBufferData *bufferData)
 Creates a new cache for an output, given the output data object.
 
static VdfVectorCreateOutputCache (const VdfOutput &output, VdfExecutorBufferData *bufferData, const VdfMask::Bits &bits)
 Creates a new cache for an output, given the output data object.
 

Protected Member Functions

 VdfParallelExecutorDataManager ()
 Constructor.
 
 ~VdfParallelExecutorDataManager ()
 Prevent destruction via base class pointers (static polymorphism only).
 
- Protected Member Functions inherited from Vdf_ParallelExecutorDataManagerInterface< DerivedClass, Vdf_ParallelExecutorDataManagerTraits< DerivedClass >::DataHandle >
 Vdf_ParallelExecutorDataManagerInterface ()
 Allow construction via derived classes, only.
 
virtual ~Vdf_ParallelExecutorDataManagerInterface ()
 Prevent destruction via base class pointers (static polymorphism only).
 
void _Resize (const VdfNetwork &network)
 Resize the data manager to accommodate all the outputs in the given network.
 
bool _IsValidDataHandle (const Vdf_ParallelExecutorDataManagerTraits< DerivedClass >::DataHandle handle) const
 Returns true if the given data handle is valid, i.e.
 
Vdf_ParallelExecutorDataManagerTraits< DerivedClass >::DataHandle _GetOrCreateDataHandle (const VdfId outputId) const
 Returns an existing data handle, or creates a new one for the given outputId.
 
Vdf_ParallelExecutorDataManagerTraits< DerivedClass >::DataHandle _GetDataHandle (const VdfId outputId) const
 Returns an existing data handle for the given outputId.
 
VdfExecutorBufferData_GetPrivateBufferData (const Vdf_ParallelExecutorDataManagerTraits< DerivedClass >::DataHandle handle) const
 Returns the private VdfExecutorBufferData associated with the given handle.
 
VdfExecutorBufferData_GetScratchBufferData (const Vdf_ParallelExecutorDataManagerTraits< DerivedClass >::DataHandle handle) const
 Returns the scratch VdfExecutorBufferData associated with the given handle.
 
VdfExecutorBufferData_GetPublicBufferData (const Vdf_ParallelExecutorDataManagerTraits< DerivedClass >::DataHandle handle) const
 Returns the public VdfExecutorBufferData associated with the given handle.
 
void _PublishPrivateBufferData (const Vdf_ParallelExecutorDataManagerTraits< DerivedClass >::DataHandle handle) const
 Publishes the private VdfExecutorBufferData, and retains the previously public VdfExecutorBufferData as private data.
 
void _PublishScratchBufferData (const Vdf_ParallelExecutorDataManagerTraits< DerivedClass >::DataHandle handle) const
 Publishes the scratch VdfExecutorBufferData, and retains the previously public VdfExecutorBufferData as scratch data.
 
VdfExecutorBufferData_GetTransferredBufferData (const Vdf_ParallelExecutorDataManagerTraits< DerivedClass >::DataHandle handle) const
 Returns the transferred VdfExecutorBufferData associated with the given handle.
 
bool _TransferBufferData (const Vdf_ParallelExecutorDataManagerTraits< DerivedClass >::DataHandle handle, VdfVector *value, const VdfMask &mask)
 Transfers ownership of the value to the output associated with handle.
 
void _ResetTransferredBufferData (const Vdf_ParallelExecutorDataManagerTraits< DerivedClass >::DataHandle handle)
 Resets the transferred buffer associated with the given handle.
 
VdfExecutorInvalidationData * _GetInvalidationData (const Vdf_ParallelExecutorDataManagerTraits< DerivedClass >::DataHandle handle) const
 Returns the VdfExecutorInvalidationData associated with the given handle.
 
VdfInvalidationTimestamp _GetInvalidationTimestamp (const Vdf_ParallelExecutorDataManagerTraits< DerivedClass >::DataHandle handle) const
 Returns the VdfInvalidationTimestamp associated with the given handle.
 
void _SetInvalidationTimestamp (const Vdf_ParallelExecutorDataManagerTraits< DerivedClass >::DataHandle handle, VdfInvalidationTimestamp ts)
 Sets the invalidation timestamp for the give data handle.
 
bool _IsTouched (const VdfId outputId) const
 Returns true if the data at the given output has been touched by evaluation.
 
void _Touch (const VdfId outputId) const
 Marks the data at the given output as having been touched by evaluation.
 
bool _Untouch (const VdfId outputId)
 Marks the data at the given output as not having been touched by evaluation.
 
void _ClearDataForOutput (const VdfOutput &output)
 Clears the executor data for a specific output.
 

Detailed Description

template<typename DerivedClass>
class VdfParallelExecutorDataManager< DerivedClass >

This class provides functionality to manage executor data stored as VdfExecutorData from multiple threads.

The methods in this data manager are thread-safe unless called out to not be thread-safe in the documentation.

Definition at line 42 of file parallelExecutorDataManager.h.

Member Typedef Documentation

◆ Base

The base class type.

Definition at line 60 of file parallelExecutorDataManager.h.

◆ DataHandle

typedef Vdf_ParallelExecutorDataManagerTraits<DerivedClass>::DataHandle DataHandle

The data handle type defined via the specialized traits class.

Definition at line 54 of file parallelExecutorDataManager.h.

Constructor & Destructor Documentation

◆ VdfParallelExecutorDataManager()

VdfParallelExecutorDataManager ( )
inlineprotected

Constructor.

Definition at line 199 of file parallelExecutorDataManager.h.

◆ ~VdfParallelExecutorDataManager()

~VdfParallelExecutorDataManager ( )
inlineprotected

Prevent destruction via base class pointers (static polymorphism only).

Definition at line 206 of file parallelExecutorDataManager.h.

Member Function Documentation

◆ CreateOutputCache() [1/2]

VdfVector * CreateOutputCache ( const VdfOutput output,
VdfExecutorBufferData bufferData 
)
static

Creates a new cache for an output, given the output data object.

Definition at line 402 of file parallelExecutorDataManager.h.

◆ CreateOutputCache() [2/2]

VdfVector * CreateOutputCache ( const VdfOutput output,
VdfExecutorBufferData bufferData,
const VdfMask::Bits bits 
)
static

Creates a new cache for an output, given the output data object.

This method makes sure that the returned vector is properly resized to accommodate all the elements set in the specified bits.

Definition at line 419 of file parallelExecutorDataManager.h.

◆ DuplicateOutputData()

void DuplicateOutputData ( const VdfOutput sourceOutput,
const VdfOutput destOutput 
)

Duplicates the output data associated with sourceOutput and copies it to destOutput.

This method is not thread-safe.

Definition at line 437 of file parallelExecutorDataManager.h.

◆ GetInputValue()

VdfVector * GetInputValue ( const VdfConnection connection,
const VdfMask mask 
) const

Returns the input value flowing across the given connection with the given mask.

If the the cache is not valid, or if the cache does not contain all the elements in mask, returns NULL. If no output data exists for output, it will not be created.

Definition at line 228 of file parallelExecutorDataManager.h.

◆ GetInvalidationTimestamp()

const VdfInvalidationTimestamp & GetInvalidationTimestamp ( ) const
inline

Returns the current invalidation timestamp on this executor.

Definition at line 183 of file parallelExecutorDataManager.h.

◆ GetOrCreateOutputValueForWriting()

VdfVector * GetOrCreateOutputValueForWriting ( const VdfOutput output,
const DataHandle  dataHandle 
) const

Returns a new or existing output value.

Definition at line 291 of file parallelExecutorDataManager.h.

◆ GetOutputValueForReading()

VdfVector * GetOutputValueForReading ( const DataHandle  dataHandle,
const VdfMask mask 
) const

Returns the cached value for a given output and mask.

If the the cache is not valid, or if the cache does not contain all the elements in mask, returns NULL. If no output data exists for output, it will not be created.

Definition at line 261 of file parallelExecutorDataManager.h.

◆ HasInvalidationTimestampMismatch()

bool HasInvalidationTimestampMismatch ( const DataHandle sourceHandle,
const DataHandle destHandle 
) const

Returns true, if the invalidation timestamps between sourceExecutorData and destExecutorData do not match, i.e.

the source output should be mung buffer locked.

Definition at line 596 of file parallelExecutorDataManager.h.

◆ InvalidateOutput()

bool InvalidateOutput ( const VdfOutput output,
const VdfMask invalidationMask 
)

Marks output as invalid.

Returns true if there was anything to invalidate and false if the output was already invalid.

This method is not thread-safe.

Definition at line 505 of file parallelExecutorDataManager.h.

◆ IsOutputInvalid()

bool IsOutputInvalid ( const VdfId  outputId,
const VdfMask invalidationMask 
) const

Returns true if the output is already invalid for the given invalidationMask.

Definition at line 480 of file parallelExecutorDataManager.h.

◆ SetOutputValue()

void SetOutputValue ( const VdfOutput output,
const VdfVector value,
const VdfMask mask 
)

Sets the cached value for a given output, creating the output cache if necessary.

If the output already contains data, it will be merged with the new data as indicated by value and mask.

This method provides very limited thread-safety: It is safe to call this method if the data manager is already sized appropriately, and during a round of evaluation, data is set no more than once per individual output. It is not safe to call this method concurrently on the same output, including an output that may have its value mutated as part of a concurrent round of evaluation.

Definition at line 315 of file parallelExecutorDataManager.h.

◆ SetReferenceOutputValue()

void SetReferenceOutputValue ( const VdfVector sourceValue,
const VdfId  destOutputId 
) const

Called to set destOutput's buffer output to be a reference to the sourceValue.

Definition at line 387 of file parallelExecutorDataManager.h.

◆ TakeOutputValue()

bool TakeOutputValue ( const VdfOutput output,
VdfVector value,
const VdfMask mask 
)

Transfers the ownership of value to the given output.

Returns true if this succeeds. The output will assume responsibility for the lifetime management of value, if successful. Otherwise, the call site maintains this responsibility.

If a value has previously been transferred to this output, the method will fail to transfer the ownership of this value and return false.

Definition at line 365 of file parallelExecutorDataManager.h.

◆ Touch()

void Touch ( const VdfOutput output) const

Marks the data at the given output as having been touched by evaluation.

Definition at line 588 of file parallelExecutorDataManager.h.

◆ UpdateInvalidationTimestamp()

void UpdateInvalidationTimestamp ( const VdfInvalidationTimestamp timestamp)
inline

Increments the the current invalidation timestamp on this executor.

This method is not thread-safe.

Definition at line 176 of file parallelExecutorDataManager.h.


The documentation for this class was generated from the following file: