omni::graph::exec::unstable::PassPipelineT

Defined in omni/graph/exec/unstable/PassPipeline.h

template<typename GraphBuilderT, typename ...Bases>
class PassPipelineT : public omni::graph::exec::unstable::Implements<Bases...>

Runs registered passes.

The role of pass pipeline is to populate and prepare the execution graph. The base implementation runs passes based on the type and registration order. Most applications will define their own pass pipeline to control how the execution graph is generated.

See Pass Concepts for an in-depth guide on how passes are used during graph construction.

See omni::graph::exec::unstable::PassPipeline for a concrete implementation of this interface.

See Passes for more pass related functionality.

Public Functions

inline void acquire() noexcept

Increments the object’s reference count.

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

inline void release() noexcept

Decrements the objects reference count.

Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement).

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

inline uint32_t getUseCount() noexcept

Returns the number of different instances (this included) referencing the current object.

Thread Safety

This method is thread safe.

inline void *cast(omni::core::TypeId id) noexcept

See omni::core::IObject::cast.

inline void *castWithoutAcquire(omni::core::TypeId id) noexcept

See omni::graph::exec::unstable::IBase_abi::castWithoutAcquire_abi.

Public Static Functions

static inline omni::core::ObjectPtr<PassPipelineT> create() noexcept

Creates and returns a IPassPipeline.

This method always returns a valid object.

Protected Types

using PopulatePassCache = std::unordered_map<NameHash, PassTypeRegistryEntry>

Type of acceleration structure holding population passes.

Protected Functions

inline bool needsConstruction_abi() noexcept override

Test if the pipeline needs to rebuild (mostly for its acceleration structures).

An example of when a pipeline would need to be reconstructed is when a pass is either added or removed from omni::graph::exec::unstable::IPassRegistry.

inline void construct_abi() noexcept override

Build the pipeline (mostly for its acceleration structures).

inline bool needsRun_abi(Stamp globalTopology) noexcept override

Test if pipeline needs to run (after topology changes in the graph).

inline void run_abi(IGraphBuilderContext *builderContext, INodeGraphDef *nodeGraphDef) noexcept override

Run the graph transformations pipeline.

Acceleration structure is generated on changes to omni::graph::exec::unstable::IPassRegistry to organize passes for this pipeline.

Note

Passes are run single-threaded in core implementation because we have no access to rich threading library in OV. We have parallel version available in omni.kit.exec.core.

inline void _runPopulatePass(IGraphBuilderContext *builderContext, INodeGraphDef *nodeGraphDef)

Run populate passes.

The algorithm will traverse the graph with DFS order serially. For each visited node, it will give a chance to registered population passes to populate the definition of discovered omni::graph::exec::unstable::INode or omni::graph::exec::unstable::INodeGraphDef.

To preserve instancing within a single NodeGraphDef, algorithm will keep a track of discovered NodeGraphDefs and populate/continue traversal of only first visited node that instantiates it. Later when internal state goes out of scope, all instances are updated to point to same definition.

This algorithm is wrote in a way to follow the multithreaded version from omni.kit.exec.core and the goal is to replace it with multithreaded version once OM-70769 is closed.

inline void _runPartitionPass(IGraphBuilderContext *builderContext, INodeGraphDef *nodeGraphDef)

Run partition passes.

inline void _runGlobalPass(IGraphBuilderContext *builderContext, INodeGraphDef *nodeGraphDef)

Run global passes.

template<typename T, typename Compare>
inline std::vector<T>::iterator _insert_sorted(std::vector<T> &vec, T const &item, Compare comp)

Helper function to insert an item into a vector in sorted order.

inline void acquire_abi() noexcept override

Increments the object’s reference count.

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

inline void release_abi() noexcept override

Decrements the objects reference count.

Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement).

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

inline uint32_t getUseCount_abi() noexcept override

Returns the number of different instances (this included) referencing the current object.

inline void *cast_abi(omni::core::TypeId id) noexcept override

Returns a pointer to the interface defined by the given type id if this object implements the type id’s interface.

Objects can support multiple interfaces, even interfaces that are in different inheritance chains.

The returned object will have omni::core::IObject::acquire() called on it before it is returned, meaning it is up to the caller to call omni::core::IObject::release() on the returned pointer.

The returned pointer can be safely reinterpret_cast<> to the type id’s C++ class. For example, “omni.windowing.IWindow” can be cast to omni::windowing::IWindow.

Do not directly use this method, rather use a wrapper function like omni::core::cast() or omni::core::ObjectPtr::as().

Thread Safety

This method is thread safe.

inline void *castWithoutAcquire_abi(omni::core::TypeId id) noexcept override

Casts this object to the type described the the given id.

Returns nullptr if the cast was not successful.

Unlike omni::core::IObject::cast(), this casting method does not call omni::core::IObject::acquire().

Thread Safety

This method is thread safe.

Protected Attributes

SyncStamp m_registryCache

Synchronized with cache registry version allows us to detect changes.

SyncStamp m_globalTopology

Synchronized with execution graph allows us to detect changes to run the pipeline.

PopulatePassCache m_populatePasses

Acceleration structure for this pipeline to speed up the searches.

std::vector<PassTypeRegistryEntry> m_partitionPasses

Acceleration structure to keep passes ordered for this pipeline. We order from the highest priority to the lowest.

std::atomic<uint32_t> m_refCount

Reference count.