Peano
Loading...
Searching...
No Matches
tarch::multicore::taskfusion::ProcessOneReadyTask Class Reference

Process one ready tasks. More...

#include <ProcessOneReadyTask.h>

Inheritance diagram for tarch::multicore::taskfusion::ProcessOneReadyTask:
Collaboration diagram for tarch::multicore::taskfusion::ProcessOneReadyTask:

Public Member Functions

 ProcessOneReadyTask (TaskNumber taskNumber, FusableTasksQueue &taskQueue)
 Construct task.
 
virtual void run () override
 Run the task.
 
- Public Member Functions inherited from tarch::multicore::Task
 Task (int taskType, int priority)
 Construct task.
 
virtual ~Task ()
 
int getTaskType () const
 
int getPriority () const
 
void setPriority (int priority)
 Set priority.
 
virtual bool canFuse () const
 
virtual void fuse (const std::vector< Task * > &otherTasks, int targetDevice=Host)
 Fuse multiple tasks.
 
virtual std::string toString () const
 

Private Attributes

FusableTasksQueue & _taskQueue
 
const TaskNumber _taskNumber
 

Static Private Attributes

static tarch::logging::Log _log
 
static const std::string ProcessOneReadyTaskFromFusableTasksStatisticsIdentifier
 Track how often runtime extracted single task from fusable task queue.
 
static const std::string WaitedForOneReadyTaskFromFusableTasksStatisticsIdentifier
 Along the same lines, tarch::multicore::taskfusion::ProcessOneReadyTask::WaitedForOneReadyTaskFromFusableTasksStatisticsIdentifier tracks how often the runtime tried to extract a task from the queue but it had, at that point, already been processed by someone else.
 

Additional Inherited Members

- Static Public Attributes inherited from tarch::multicore::Task
static constexpr int DefaultPriority = 1024
 
static constexpr int Host = -1
 
static constexpr int DontFuse = -1
 
- Protected Attributes inherited from tarch::multicore::Task
const int _taskType
 
int _priority
 

Detailed Description

Process one ready tasks.

See also
ProcessSetOfReadyTasks for further implementation remarks
FusionImplementation::ProducerConsumerTaskSequence for context

Definition at line 29 of file ProcessOneReadyTask.h.

Constructor & Destructor Documentation

◆ ProcessOneReadyTask()

tarch::multicore::taskfusion::ProcessOneReadyTask::ProcessOneReadyTask ( TaskNumber  taskNumber,
FusableTasksQueue &  taskQueue 
)

Construct task.

Member Function Documentation

◆ run()

virtual void tarch::multicore::taskfusion::ProcessOneReadyTask::run ( )
overridevirtual

Run the task.

Will return if and only if the task with taskNumber is completed. We ensure this by calling processTasks() which in turn invokes tryToProcessOneTask().

If the task we are tied to is already completed - a property we can check through hasTaskBeenProcessed() - we return immediately and nothing is to be done. Another ProcessReadyTask instance has snapped "our" task and we can degenerate.

If the task is handled by an instance of ProcessSetOfReadyTasks, we wait for this one.

If neither of the two cases hold, we'll only process the one single tasks that we are responsible for (and therefore will afterwards terminate the while loop). But we might

Ensure one particular task is completed.

Search for the one task we are waiting for. If you find it, process it. It could be that we don't have this task anymore among the ready tasks but that it is currently merged into a bigger fusable task set and processed. In this case, we have to issue a native wait on the task that handles the actual fusion.

See also
Consult the page Task fusion strategies for recommendations and hints on task fusion strategies.
Consult the namespace documentation of tarch::multicore::taskfusion for details on the realisation of the task fusion.

Implements tarch::multicore::Task.

Field Documentation

◆ _log

tarch::logging::Log tarch::multicore::taskfusion::ProcessOneReadyTask::_log
staticprivate

Definition at line 34 of file ProcessOneReadyTask.h.

◆ _taskNumber

const TaskNumber tarch::multicore::taskfusion::ProcessOneReadyTask::_taskNumber
private

Definition at line 32 of file ProcessOneReadyTask.h.

◆ _taskQueue

FusableTasksQueue& tarch::multicore::taskfusion::ProcessOneReadyTask::_taskQueue
private

Definition at line 31 of file ProcessOneReadyTask.h.

◆ ProcessOneReadyTaskFromFusableTasksStatisticsIdentifier

const std::string tarch::multicore::taskfusion::ProcessOneReadyTask::ProcessOneReadyTaskFromFusableTasksStatisticsIdentifier
staticprivate

Track how often runtime extracted single task from fusable task queue.

The quantity tells us how many fusable tasks have been manually removed from the fusable queue, as the runtime requested the task outcome asap.

The impact/implication of this tracker is discussed on Task fusion strategies. To visualise it, you can follow the same scheme as used for tarch::multicore::SpawnedTasksStatisticsIdentifier.

If this counter is high compared to the total number of fusable tasks, it means that the runtime had been asked frequently that a task outcome is now urgently needed. Therefore, it decided to interrupt the fusion, search for this one task, complete it "manually" with high priority and return. A high counter hence means that the fusion is not really efficient.

See also
WaitedForOneReadyTaskFromFusableTasksStatisticsIdentifier

Definition at line 57 of file ProcessOneReadyTask.h.

◆ WaitedForOneReadyTaskFromFusableTasksStatisticsIdentifier

const std::string tarch::multicore::taskfusion::ProcessOneReadyTask::WaitedForOneReadyTaskFromFusableTasksStatisticsIdentifier
staticprivate

Along the same lines, tarch::multicore::taskfusion::ProcessOneReadyTask::WaitedForOneReadyTaskFromFusableTasksStatisticsIdentifier tracks how often the runtime tried to extract a task from the queue but it had, at that point, already been processed by someone else.

We therefore had to wait.

Definition at line 66 of file ProcessOneReadyTask.h.


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