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

A ComputeResource that wraps a MicroScheduler. More...

#include <MicroScheduler_ComputeResource.h>

Inherits gts::ComputeResource.

Classes

struct  CheckForTasksData
 

Public Member Functions

 MicroScheduler_ComputeResource (MicroScheduler *pMicroScheduler, uint32_t vectorWidth, uint32_t physicalProcessorCount)
 
bool init (MicroScheduler *pMicroScheduler)
 
GTS_INLINE MicroSchedulermicroScheduler ()
 
GTS_INLINE SchedulecurrentSchedule ()
 
virtual GTS_INLINE ComputeResourceType::Enum type () const final
 
GTS_INLINE uint32_t vectorWidth ()
 
virtual bool process (Schedule *pSchedule, bool canBlock)
 
virtual bool canExecute (Node *pNode) const final
 
virtual uint32_t processorCount () const final
 
virtual void notify (Schedule *pSchedule) final
 
virtual void registerSchedule (Schedule *pSchedulue) final
 
virtual void unregisterSchedule (Schedule *pSchedulue) final
 
virtual void spawnReadyChildren (WorkloadContext const &workloadContext, Task *pCurrentTask)
 
- Public Member Functions inherited from gts::ComputeResource
 ComputeResource ()
 
virtual ~ComputeResource ()=default
 
GTS_INLINE uint32_t maxRank () const
 
GTS_INLINE double executionNormalizationFactor () const
 
GTS_INLINE ComputeResourceId id () const
 
void setExecutionNormalizationFactor (double exeWeight)
 Sets the normalization factor applied to each Nodes execution time. This factor normalizes all execution times into a single ComputeResrouce's execution space. More...
 
GTS_INLINE void _setMaxRank (uint32_t maxRank)
 Sets the maximum Node rank this ComputeResouce can execute. More...
 

Protected Member Functions

bool _tryRunNextNode (Schedule *pSchedule, bool myQueuesOnly)
 
Task_tryGetNextTask (CheckForTasksData *pData, bool myQueuesOnly, bool &executedTask)
 
bool _buildTaskAndRun (Schedule *pSchedule, Node *pNode)
 
Task_buildTask (Schedule *pSchedule, Node *pNode)
 
bool _tryToStealWork ()
 

Static Protected Member Functions

static TaskonCheckForTask (void *pUserData, MicroScheduler *, OwnedId, bool isCallerExternal, bool &executedTask)
 

Protected Attributes

MicroSchedulerm_pMicroScheduler = nullptr
 
- Protected Attributes inherited from gts::ComputeResource
QueueMPSC< Node * > m_affinityQueue
 

Friends

class MicroScheduler_Task
 

Detailed Description

Member Function Documentation

◆ canExecute()

virtual bool gts::MicroScheduler_ComputeResource::canExecute ( Node pNode) const
finalvirtual
Returns
True if this ComputeResource can execute the specified Node.

Implements gts::ComputeResource.

◆ notify()

virtual void gts::MicroScheduler_ComputeResource::notify ( Schedule pSchedule)
finalvirtual

Notify this ComputeResrouce of work available.

Implements gts::ComputeResource.

◆ process()

virtual bool gts::MicroScheduler_ComputeResource::process ( Schedule pSchedule,
bool  canBlock 
)
virtual

Process pSchedule until it is complete. If 'canBlock' is true, this ComputeResouces can use the calling thread; if false, it must fork its own thread.

Returns
True if a node was processed.

Implements gts::ComputeResource.

◆ processorCount()

virtual uint32_t gts::MicroScheduler_ComputeResource::processorCount ( ) const
finalvirtual
Returns
The number of independent processing elements.

Implements gts::ComputeResource.

◆ registerSchedule()

virtual void gts::MicroScheduler_ComputeResource::registerSchedule ( Schedule )
finalvirtual

Register a Schedule with this ComputeResrouce.

Reimplemented from gts::ComputeResource.

◆ type()

virtual GTS_INLINE ComputeResourceType::Enum gts::MicroScheduler_ComputeResource::type ( ) const
inlinefinalvirtual
Returns
This ComputeResource's type.

Implements gts::ComputeResource.

◆ unregisterSchedule()

virtual void gts::MicroScheduler_ComputeResource::unregisterSchedule ( Schedule )
finalvirtual

Unregister a Schedule from this ComputeResrouce.

Reimplemented from gts::ComputeResource.