Games Task Scheduler (GTS)
A multi-processor scheduling framework for games engines
AdaptivePartitioner Class Reference

Adaptively subdivides a TRange based on demand from the scheduler. More...

#include <AdaptivePartitioner.h>

Public Types

using splitter_type = EvenSplitter
 

Public Member Functions

GTS_INLINE AdaptivePartitioner (uint16_t initialMaxSplitDepth=4)
 Constructs an AdaptivePartitioner object and defines how deep is can split a Range object. More...
 
template<typename TRange >
GTS_INLINE AdaptivePartitioner (AdaptivePartitioner &other, uint16_t depth, TRange const &)
 
template<typename TPattern , typename TRange >
GTS_INLINE Task * execute (TaskContext const &ctx, TPattern *pPattern, TRange &range)
 
template<typename TPattern , typename TRange >
GTS_INLINE void initialOffer (TaskContext const &ctx, TPattern *pPattern, TRange &range, splitter_type const &splitter)
 
template<typename TPattern , typename TRange >
GTS_INLINE Task * doExecute (TaskContext const &ctx, TPattern *pPattern, TRange &range, splitter_type const &splitter)
 
template<typename TPattern , typename TRange >
GTS_INLINE void balanceAndExecute (TaskContext const &ctx, TPattern *pPattern, TRange &range, splitter_type const &splitter)
 
template<typename TRange >
GTS_INLINE bool hasDemand (TaskContext const &ctx)
 
template<typename TRange >
GTS_INLINE void adjustIfStolen (Task *pThisTask)
 
template<typename TRange >
GTS_INLINE void initialize (uint16_t workerCount)
 
template<typename TRange >
GTS_INLINE void split ()
 
template<typename TRange >
GTS_INLINE void increaseDepth ()
 
GTS_INLINE bool isDivisible ()
 
GTS_INLINE uint16_t maxBalancedSplitDepth () const
 

Static Public Member Functions

template<typename TRange >
static GTS_INLINE uint16_t getSplit (AdaptivePartitioner &partitioner)
 

Detailed Description

Adaptively subdivides a TRange based on demand from the scheduler.

Constructor & Destructor Documentation

◆ AdaptivePartitioner()

GTS_INLINE AdaptivePartitioner::AdaptivePartitioner ( uint16_t  initialMaxSplitDepth = 4)
inlineexplicit

Constructs an AdaptivePartitioner object and defines how deep is can split a Range object.

Parameters
initialMaxSplitDepthDefines how deep the initial binary tree generated by subdividing the a Range can get. The default value is good for most situations. The caller can increase the value for more irregular workloads, or decrease the value for more regular workloads.