gpu-compute: Cleanup the scheduler a bit
Change-Id: If2c626544f208e15c91be975dee9253126862ced Reviewed-on: https://gem5-review.googlesource.com/10222 Reviewed-by: Alexandru Duțu <alexandru.dutu@amd.com> Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>
This commit is contained in:
committed by
Anthony Gutierrez
parent
ce00e6042d
commit
7c46a8eb2b
@@ -65,9 +65,7 @@ Source('hsa_object.cc')
|
||||
Source('kernel_cfg.cc')
|
||||
Source('lds_state.cc')
|
||||
Source('local_memory_pipeline.cc')
|
||||
Source('of_scheduling_policy.cc')
|
||||
Source('pool_manager.cc')
|
||||
Source('rr_scheduling_policy.cc')
|
||||
Source('schedule_stage.cc')
|
||||
Source('scheduler.cc')
|
||||
Source('scoreboard_check_stage.cc')
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* For use for simulation and test purposes only
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Sooraj Puthoor
|
||||
*/
|
||||
|
||||
#include "gpu-compute/of_scheduling_policy.hh"
|
||||
|
||||
#include "gpu-compute/wavefront.hh"
|
||||
|
||||
Wavefront*
|
||||
OFSchedulingPolicy::chooseWave()
|
||||
{
|
||||
// Set when policy choose a wave to schedule
|
||||
bool waveChosen = false;
|
||||
Wavefront *selectedWave = nullptr;
|
||||
int selectedWaveID = -1;
|
||||
uint32_t selectedPosition = 0;
|
||||
|
||||
for (int position = 0; position < scheduleList->size(); ++position) {
|
||||
Wavefront *curWave = scheduleList->at(position);
|
||||
uint32_t curWaveID = curWave->wfDynId;
|
||||
|
||||
// Choosed wave with the lowest wave ID
|
||||
if (selectedWaveID == -1 || curWaveID < selectedWaveID) {
|
||||
waveChosen = true;
|
||||
selectedWaveID = curWaveID;
|
||||
selectedWave = curWave;
|
||||
selectedPosition = position;
|
||||
}
|
||||
}
|
||||
|
||||
// Check to make sure ready list had atleast one schedulable wave
|
||||
if (waveChosen) {
|
||||
scheduleList->erase(scheduleList->begin() + selectedPosition);
|
||||
} else {
|
||||
panic("Empty ready list");
|
||||
}
|
||||
|
||||
return selectedWave;
|
||||
}
|
||||
|
||||
void
|
||||
OFSchedulingPolicy::bindList(std::vector<Wavefront*> *list)
|
||||
{
|
||||
scheduleList = list;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Advanced Micro Devices, Inc.
|
||||
* Copyright (c) 2014-2017 Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* For use for simulation and test purposes only
|
||||
@@ -14,9 +14,9 @@
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
@@ -30,32 +30,54 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Sooraj Puthoor
|
||||
* Authors: Sooraj Puthoor,
|
||||
* Anthony Gutierrez
|
||||
*/
|
||||
|
||||
#ifndef __OF_SCHEDULING_POLICY_HH__
|
||||
#define __OF_SCHEDULING_POLICY_HH__
|
||||
#ifndef __GPU_COMPUTE_OF_SCHEDULING_POLICY_HH__
|
||||
#define __GPU_COMPUTE_OF_SCHEDULING_POLICY_HH__
|
||||
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
#include "base/logging.hh"
|
||||
#include "gpu-compute/scheduling_policy.hh"
|
||||
#include "gpu-compute/wavefront.hh"
|
||||
|
||||
class Wavefront;
|
||||
|
||||
// Oldest First where age is marked by the wave id
|
||||
class OFSchedulingPolicy
|
||||
// oldest first where age is marked by the wave id
|
||||
class OFSchedulingPolicy final : public __SchedulingPolicy<OFSchedulingPolicy>
|
||||
{
|
||||
public:
|
||||
OFSchedulingPolicy() : scheduleList(nullptr) { }
|
||||
OFSchedulingPolicy()
|
||||
{
|
||||
}
|
||||
|
||||
Wavefront* chooseWave();
|
||||
void bindList(std::vector<Wavefront*> *list);
|
||||
static Wavefront*
|
||||
__chooseWave(std::vector<Wavefront*> *sched_list)
|
||||
{
|
||||
panic_if(!sched_list->size(), "OF scheduling policy sched list is "
|
||||
"empty.\n");
|
||||
// set when policy choose a wave to schedule
|
||||
Wavefront *selected_wave(nullptr);
|
||||
int selected_wave_id = -1;
|
||||
int selected_position = 0;
|
||||
|
||||
private:
|
||||
// List of waves which are participating in scheduling.
|
||||
// This scheduler selects the oldest wave from this list
|
||||
std::vector<Wavefront*> *scheduleList;
|
||||
for (int position = 0; position < sched_list->size(); ++position) {
|
||||
Wavefront *cur_wave = sched_list->at(position);
|
||||
int cur_wave_id = cur_wave->wfDynId;
|
||||
|
||||
// Choosed wave with the lowest wave ID
|
||||
if (selected_wave_id == -1 || cur_wave_id < selected_wave_id) {
|
||||
selected_wave_id = cur_wave_id;
|
||||
selected_wave = cur_wave;
|
||||
selected_position = position;
|
||||
}
|
||||
}
|
||||
|
||||
// Check to make sure ready list had at least one schedulable wave
|
||||
panic_if(!selected_wave, "No wave found by OF scheduling policy.\n");
|
||||
sched_list->erase(sched_list->begin() + selected_position);
|
||||
|
||||
return selected_wave;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __OF_SCHEDULING_POLICY_HH__
|
||||
#endif // __GPU_COMPUTE_OF_SCHEDULING_POLICY_HH__
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* For use for simulation and test purposes only
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Sooraj Puthoor
|
||||
*/
|
||||
|
||||
#include "gpu-compute/rr_scheduling_policy.hh"
|
||||
|
||||
#include "gpu-compute/wavefront.hh"
|
||||
|
||||
Wavefront*
|
||||
RRSchedulingPolicy::chooseWave()
|
||||
{
|
||||
Wavefront *selectedWave = nullptr;
|
||||
|
||||
// Check to make sure ready list had atleast one schedulable wave
|
||||
if (scheduleList->size()) {
|
||||
// For RR policy, select the wave which is at the
|
||||
// front of the list. The selected wave is popped
|
||||
// out from the schedule list immediately after selection
|
||||
// to avoid starvation. It is the responsibility of the
|
||||
// module invoking the RR scheduler to make surei scheduling
|
||||
// eligible waves are added to the back of the schedule
|
||||
// list
|
||||
selectedWave = scheduleList->front();
|
||||
scheduleList->erase(scheduleList->begin() + 0);
|
||||
} else {
|
||||
panic("Empty ready list");
|
||||
}
|
||||
|
||||
return selectedWave;
|
||||
}
|
||||
|
||||
void
|
||||
RRSchedulingPolicy::bindList(std::vector<Wavefront*> *list)
|
||||
{
|
||||
scheduleList = list;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Advanced Micro Devices, Inc.
|
||||
* Copyright (c) 2014-2017 Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* For use for simulation and test purposes only
|
||||
@@ -14,9 +14,9 @@
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
@@ -30,36 +30,47 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Sooraj Puthoor
|
||||
* Authors: Sooraj Puthoor,
|
||||
* Anthony Gutierrez
|
||||
*/
|
||||
|
||||
#ifndef __RR_SCHEDULING_POLICY_HH__
|
||||
#define __RR_SCHEDULING_POLICY_HH__
|
||||
#ifndef __GPU_COMPUTE_RR_SCHEDULING_POLICY_HH__
|
||||
#define __GPU_COMPUTE_RR_SCHEDULING_POLICY_HH__
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "base/logging.hh"
|
||||
#include "gpu-compute/scheduling_policy.hh"
|
||||
#include "gpu-compute/wavefront.hh"
|
||||
|
||||
class Wavefront;
|
||||
|
||||
// Round-Robin pick among the list of ready waves
|
||||
class RRSchedulingPolicy
|
||||
// round-robin pick among the list of ready waves
|
||||
class RRSchedulingPolicy final : public __SchedulingPolicy<RRSchedulingPolicy>
|
||||
{
|
||||
public:
|
||||
RRSchedulingPolicy() : scheduleList(nullptr) { }
|
||||
RRSchedulingPolicy()
|
||||
{
|
||||
}
|
||||
|
||||
Wavefront* chooseWave();
|
||||
void bindList(std::vector<Wavefront*> *list);
|
||||
static Wavefront*
|
||||
__chooseWave(std::vector<Wavefront*> *sched_list)
|
||||
{
|
||||
panic_if(!sched_list->size(), "RR scheduling policy sched list is "
|
||||
"empty.\n");
|
||||
Wavefront *selected_wave(nullptr);
|
||||
|
||||
private:
|
||||
// List of waves which are participating in scheduling.
|
||||
// This scheduler selects one wave from this list based on
|
||||
// round robin policy
|
||||
std::vector<Wavefront*> *scheduleList;
|
||||
/**
|
||||
* For RR policy, select the wave that is at the front of
|
||||
* the list. The selected wave is popped out from the schedule
|
||||
* list immediately after selection to avoid starvation. It
|
||||
* is the responsibility of the module invoking the RR scheduler
|
||||
* to make sure it is scheduling eligible waves are added to the
|
||||
* back of the schedule list.
|
||||
*/
|
||||
selected_wave = sched_list->front();
|
||||
panic_if(!selected_wave, "No wave found by RR scheduling policy.\n");
|
||||
sched_list->erase(sched_list->begin());
|
||||
|
||||
return selected_wave;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __RR_SCHEDULING_POLICY_HH__
|
||||
#endif // __GPU_COMPUTE_RR_SCHEDULING_POLICY_HH__
|
||||
|
||||
@@ -45,8 +45,7 @@ ScheduleStage::ScheduleStage(const ComputeUnitParams *p)
|
||||
numMemUnits(p->num_global_mem_pipes + p->num_shared_mem_pipes)
|
||||
{
|
||||
for (int j = 0; j < numSIMDs + numMemUnits; ++j) {
|
||||
Scheduler newScheduler(p);
|
||||
scheduler.push_back(newScheduler);
|
||||
scheduler.emplace_back(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Advanced Micro Devices, Inc.
|
||||
* Copyright (c) 2014-2017 Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* For use for simulation and test purposes only
|
||||
@@ -14,9 +14,9 @@
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
@@ -30,42 +30,35 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Sooraj Puthoor
|
||||
* Authors: Sooraj Puthoor,
|
||||
* Anthony Gutierrez
|
||||
*/
|
||||
|
||||
#include "gpu-compute/scheduler.hh"
|
||||
|
||||
#include "gpu-compute/of_scheduling_policy.hh"
|
||||
#include "gpu-compute/rr_scheduling_policy.hh"
|
||||
#include "params/ComputeUnit.hh"
|
||||
|
||||
Scheduler::Scheduler(const ComputeUnitParams *p)
|
||||
{
|
||||
if (p->execPolicy == "OLDEST-FIRST") {
|
||||
schedPolicy = SCHED_POLICY::OF_POLICY;
|
||||
} else if (p->execPolicy == "ROUND-ROBIN") {
|
||||
schedPolicy = SCHED_POLICY::RR_POLICY;
|
||||
if (p->execPolicy == "OLDEST-FIRST") {
|
||||
schedPolicy = new OFSchedulingPolicy();
|
||||
} else if (p->execPolicy == "ROUND-ROBIN") {
|
||||
schedPolicy = new RRSchedulingPolicy();
|
||||
} else {
|
||||
fatal("Unimplemented scheduling policy");
|
||||
fatal("Unimplemented scheduling policy.\n");
|
||||
}
|
||||
}
|
||||
|
||||
Wavefront*
|
||||
Scheduler::chooseWave()
|
||||
{
|
||||
if (schedPolicy == SCHED_POLICY::OF_POLICY) {
|
||||
return OFSchedPolicy.chooseWave();
|
||||
} else if (schedPolicy == SCHED_POLICY::RR_POLICY) {
|
||||
return RRSchedPolicy.chooseWave();
|
||||
} else {
|
||||
fatal("Unimplemented scheduling policy");
|
||||
}
|
||||
return schedPolicy->chooseWave(scheduleList);
|
||||
}
|
||||
|
||||
void
|
||||
Scheduler::bindList(std::vector<Wavefront*> *list)
|
||||
Scheduler::bindList(std::vector<Wavefront*> *sched_list)
|
||||
{
|
||||
if (schedPolicy == SCHED_POLICY::OF_POLICY) {
|
||||
OFSchedPolicy.bindList(list);
|
||||
} else if (schedPolicy == SCHED_POLICY::RR_POLICY) {
|
||||
RRSchedPolicy.bindList(list);
|
||||
} else {
|
||||
fatal("Unimplemented scheduling policy");
|
||||
}
|
||||
scheduleList = sched_list;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Advanced Micro Devices, Inc.
|
||||
* Copyright (c) 2014-2017 Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* For use for simulation and test purposes only
|
||||
@@ -14,9 +14,9 @@
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
@@ -30,34 +30,33 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Sooraj Puthoor
|
||||
* Authors: Sooraj Puthoor,
|
||||
* Anthony Gutierrez
|
||||
*/
|
||||
|
||||
#ifndef __SCHEDULER_HH__
|
||||
#define __SCHEDULER_HH__
|
||||
#ifndef __GPU_COMPUTE_SCHEDULER_HH__
|
||||
#define __GPU_COMPUTE_SCHEDULER_HH__
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "gpu-compute/of_scheduling_policy.hh"
|
||||
#include "gpu-compute/rr_scheduling_policy.hh"
|
||||
#include "gpu-compute/scheduling_policy.hh"
|
||||
#include "params/ComputeUnit.hh"
|
||||
|
||||
enum SCHED_POLICY
|
||||
{
|
||||
OF_POLICY = 0,
|
||||
RR_POLICY
|
||||
};
|
||||
class ComputeUnitParams;
|
||||
|
||||
class Scheduler
|
||||
{
|
||||
public:
|
||||
Scheduler(const ComputeUnitParams *params);
|
||||
Wavefront *chooseWave();
|
||||
void bindList(std::vector<Wavefront*> *list);
|
||||
void bindList(std::vector<Wavefront*> *sched_list);
|
||||
|
||||
private:
|
||||
SCHED_POLICY schedPolicy;
|
||||
SchedulingPolicy<RRSchedulingPolicy> RRSchedPolicy;
|
||||
SchedulingPolicy<OFSchedulingPolicy> OFSchedPolicy;
|
||||
/**
|
||||
* Scheduling policy. Currently the model can support oldest-first
|
||||
* or round-robin scheduling.
|
||||
*/
|
||||
SchedulingPolicy *schedPolicy;
|
||||
std::vector<Wavefront*> *scheduleList;
|
||||
};
|
||||
|
||||
#endif // __SCHEDULER_HH__
|
||||
#endif // __GPU_COMPUTE_SCHEDULER_HH__
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Advanced Micro Devices, Inc.
|
||||
* Copyright (c) 2014-2017 Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* For use for simulation and test purposes only
|
||||
@@ -14,9 +14,9 @@
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
@@ -30,28 +30,46 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: Sooraj Puthoor
|
||||
* Authors: Sooraj Puthoor,
|
||||
* Anthony Gutierrez
|
||||
*/
|
||||
|
||||
#ifndef __SCHEDULING_POLICY_HH__
|
||||
#define __SCHEDULING_POLICY_HH__
|
||||
#ifndef __GPU_COMPUTE_SCHEDULING_POLICY_HH__
|
||||
#define __GPU_COMPUTE_SCHEDULING_POLICY_HH__
|
||||
|
||||
#include <vector>
|
||||
|
||||
template<typename Impl>
|
||||
class Wavefront;
|
||||
|
||||
/**
|
||||
* Interface class for the wave scheduling policy.
|
||||
*/
|
||||
class SchedulingPolicy
|
||||
{
|
||||
public:
|
||||
Wavefront* chooseWave() { return policyImpl.chooseWave(); }
|
||||
|
||||
void
|
||||
bindList(std::vector<Wavefront*> *list)
|
||||
{
|
||||
return policyImpl.bindList(list);
|
||||
}
|
||||
|
||||
private:
|
||||
Impl policyImpl;
|
||||
SchedulingPolicy() { }
|
||||
virtual Wavefront *chooseWave(std::vector<Wavefront*> *sched_list) = 0;
|
||||
};
|
||||
|
||||
#endif // __SCHEDULING_POLICY_HH__
|
||||
/**
|
||||
* Intermediate class that derives from the i-face class, and implements
|
||||
* its API. It uses the CRTP to take in the actual scheduling policy
|
||||
* implementation as a template parameter. This allows us to use a pointer
|
||||
* to SchedulingPolicy and instantiate whichever policy we want. The
|
||||
* derived policies implement the scheduler arbitration logic using
|
||||
* the static member method called __chooseWave();
|
||||
*/
|
||||
template<typename Policy>
|
||||
class __SchedulingPolicy : public SchedulingPolicy
|
||||
{
|
||||
public:
|
||||
__SchedulingPolicy() { }
|
||||
|
||||
Wavefront*
|
||||
chooseWave(std::vector<Wavefront*> *sched_list) override
|
||||
{
|
||||
return Policy::__chooseWave(sched_list);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __GPU_COMPUTE_SCHEDULING_POLICY_HH__
|
||||
|
||||
Reference in New Issue
Block a user