gem5  v21.1.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
schedule_stage.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2015 Advanced Micro Devices, Inc.
3  * All rights reserved.
4  *
5  * For use for simulation and test purposes only
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice,
11  * this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from this
19  * software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef __SCHEDULE_STAGE_HH__
35 #define __SCHEDULE_STAGE_HH__
36 
37 #include <deque>
38 #include <unordered_map>
39 #include <unordered_set>
40 #include <utility>
41 #include <vector>
42 
43 #include "base/statistics.hh"
44 #include "base/stats/group.hh"
46 #include "gpu-compute/misc.hh"
47 #include "gpu-compute/scheduler.hh"
48 
49 namespace gem5
50 {
51 
52 // Schedule or execution arbitration stage.
53 // From the pool of ready waves in the ready list,
54 // one wave is selected for each execution resource.
55 // The selection is made based on a scheduling policy
56 
57 class ComputeUnit;
58 class ScheduleToExecute;
59 class ScoreboardCheckToSchedule;
60 class Wavefront;
61 
62 struct ComputeUnitParams;
63 
65 {
66  public:
67  ScheduleStage(const ComputeUnitParams &p, ComputeUnit &cu,
68  ScoreboardCheckToSchedule &from_scoreboard_check,
69  ScheduleToExecute &to_execute);
71  void init();
72  void exec();
73 
74  // Stats related variables and methods
75  const std::string& name() const { return _name; }
77  {
98  };
100  {
105  };
107  {
114  };
115 
116  // Called by ExecStage to inform SCH of instruction execution
117  void deleteFromSch(Wavefront *w);
118 
119  // Schedule List status
121  {
122  RFBUSY = 0, // RF busy reading operands
123  RFREADY, // ready for exec
124  };
125 
126  private:
130 
131  // Each execution resource will have its own
132  // scheduler and a dispatch list
134 
135  const std::string _name;
136 
137  // called by exec() to add a wave to schList if the RFs can support it
138  bool addToSchList(int exeType, const GPUDynInstPtr &gpu_dyn_inst);
139  // re-insert a wave to schList if wave lost arbitration
140  // wave is inserted such that age order (oldest to youngest) is preserved
141  void reinsertToSchList(int exeType, const GPUDynInstPtr &gpu_dyn_inst);
142  // check waves in schList to see if RF reads complete
144  // check execution resources for readiness
153  // check status of memory pipes and RF to Mem buses
154  void checkMemResources();
155  // resource ready check called by fillDispatchList
156  bool dispatchReady(const GPUDynInstPtr &gpu_dyn_inst);
157  // pick waves from schList and populate dispatchList with one wave
158  // per EXE resource type
159  void fillDispatchList();
160  // arbitrate Shared Mem Pipe VRF/LDS bus for waves in dispatchList
161  void arbitrateVrfToLdsBus();
162  // schedule destination operand writes to register files for waves in
163  // dispatchList
164  void scheduleRfDestOperands();
165  // invoked by scheduleRfDestOperands to schedule RF writes for a wave
166  bool schedRfWrites(int exeType, const GPUDynInstPtr &gpu_dyn_inst);
167  // reserve resources for waves surviving arbitration in dispatchList
168  void reserveResources();
169 
170  void doDispatchListTransition(int unitId, DISPATCH_STATUS s,
171  const GPUDynInstPtr &gpu_dyn_inst);
172  void doDispatchListTransition(int unitId, DISPATCH_STATUS s);
173 
174  // Set tracking wfDynId for each wave present in schedule stage
175  // Used to allow only one instruction per wave in schedule
176  std::unordered_set<uint64_t> wavesInSch;
177 
178  // List of waves (one list per exe resource) that are in schedule
179  // stage. Waves are added to this list after selected by scheduler
180  // from readyList. Waves are removed from this list and placed on
181  // dispatchList when status reaches SCHREADY.
182  // Waves are kept ordered by age for each resource, always favoring
183  // forward progress for the oldest wave.
184  // The maximum number of waves per resource can be determined by either
185  // the VRF/SRF availability or limits imposed by paremeters (to be added)
186  // of the SCH stage or CU.
188 
189  protected:
191  {
192  ScheduleStageStats(statistics::Group *parent, int num_exec_units);
193 
194  // Number of cycles with empty (or not empty) readyList, per execution
195  // resource, when the CU is active (not sleeping)
198 
199  // Number of cycles, per execution resource, when at least one wave
200  // was on the readyList and picked by scheduler, but was unable to be
201  // added to the schList, when the CU is active (not sleeping)
203 
204  // Number of cycles, per execution resource, when a wave is selected
205  // as candidate for dispatchList from schList
206  // Note: may be arbitrated off dispatchList (e.g., LDS arbitration)
208 
209  // Per execution resource stat, incremented once per cycle if no wave
210  // was selected as candidate for dispatch and moved to dispatchList
212 
213  // Number of times a wave is selected by the scheduler but cannot
214  // be added to the schList due to register files not being able to
215  // support reads or writes of operands. RF_ACCESS_NRDY condition is
216  // always incremented if at least one read/write not supported, other
217  // conditions are incremented independently from each other.
219 
220  // Number of times a wave is executing FLAT instruction and
221  // forces another wave occupying its required local memory resource
222  // to be deselected for execution, and placed back on schList
224 
225  // Count of times VRF and/or SRF blocks waves on schList from
226  // performing RFBUSY->RFREADY transition
228 
229  // Count of times resource required for dispatch is not ready and
230  // blocks wave in RFREADY state on schList from potentially moving
231  // to dispatchList
233  } stats;
234 };
235 
236 } // namespace gem5
237 
238 #endif // __SCHEDULE_STAGE_HH__
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1927
gem5::ScheduleStage::wavesInSch
std::unordered_set< uint64_t > wavesInSch
Definition: schedule_stage.hh:176
gem5::ScheduleStage::fromScoreboardCheck
ScoreboardCheckToSchedule & fromScoreboardCheck
Definition: schedule_stage.hh:128
gem5::ScheduleStage::scheduleRfDestOperands
void scheduleRfDestOperands()
Definition: schedule_stage.cc:264
gem5::ScheduleStage::reinsertToSchList
void reinsertToSchList(int exeType, const GPUDynInstPtr &gpu_dyn_inst)
Definition: schedule_stage.cc:364
gem5::ScheduleStage::ScheduleStageStats::addToSchListStalls
statistics::Vector addToSchListStalls
Definition: schedule_stage.hh:202
gem5::ScheduleStage::ScheduleStageStats::ldsBusArbStalls
statistics::Scalar ldsBusArbStalls
Definition: schedule_stage.hh:223
gem5::ScheduleStage::SCH_FLAT_MEM_FIFO_NRDY
@ SCH_FLAT_MEM_FIFO_NRDY
Definition: schedule_stage.hh:95
gem5::MipsISA::w
Bitfield< 0 > w
Definition: pra_constants.hh:281
group.hh
gem5::ScheduleStage::SCH_NRDY_CONDITIONS
@ SCH_NRDY_CONDITIONS
Definition: schedule_stage.hh:97
gem5::ScheduleStage::RFREADY
@ RFREADY
Definition: schedule_stage.hh:123
gem5::ScheduleStage::SCH_SRF_RD_ACCESS_NRDY
@ SCH_SRF_RD_ACCESS_NRDY
Definition: schedule_stage.hh:110
gem5::ScheduleStage::SCH_RF_ACCESS_NRDY
@ SCH_RF_ACCESS_NRDY
Definition: schedule_stage.hh:112
gem5::ScheduleToExecute
Communication interface between Schedule and Execute stages.
Definition: comm.hh:100
gem5::ScheduleStage::SCH_RDY
@ SCH_RDY
Definition: schedule_stage.hh:96
gem5::ScheduleStage::scheduler
std::vector< Scheduler > scheduler
Definition: schedule_stage.hh:133
gem5::ScheduleStage::SchNonRdyType
SchNonRdyType
Definition: schedule_stage.hh:76
gem5::Wavefront
Definition: wavefront.hh:62
gem5::ScheduleStage::scalarMemIssueRdy
bool scalarMemIssueRdy
Definition: schedule_stage.hh:148
gem5::ScheduleStage::reserveResources
void reserveResources()
Definition: schedule_stage.cc:724
gem5::ScheduleStage::schList
std::vector< std::deque< std::pair< GPUDynInstPtr, SCH_STATUS > > > schList
Definition: schedule_stage.hh:187
gem5::ScheduleStage::SCH_FLAT_MEM_REQS_NRDY
@ SCH_FLAT_MEM_REQS_NRDY
Definition: schedule_stage.hh:94
gem5::ScheduleStage::locMemIssueRdy
bool locMemIssueRdy
Definition: schedule_stage.hh:152
gem5::ScheduleStage::SCH_VECTOR_ALU_NRDY
@ SCH_VECTOR_ALU_NRDY
Definition: schedule_stage.hh:79
misc.hh
gem5::ScheduleStage::ScheduleStageStats::rfAccessStalls
statistics::Vector rfAccessStalls
Definition: schedule_stage.hh:218
gem5::ScheduleStage::schopdnonrdytype_e
schopdnonrdytype_e
Definition: schedule_stage.hh:99
gem5::statistics::Vector
A vector of scalar stats.
Definition: statistics.hh:2003
std::vector
STL vector class.
Definition: stl.hh:37
gem5::ScheduleStage::dispatchReady
bool dispatchReady(const GPUDynInstPtr &gpu_dyn_inst)
Definition: schedule_stage.cc:418
gem5::ScheduleStage::SCH_FLAT_MEM_ISSUE_NRDY
@ SCH_FLAT_MEM_ISSUE_NRDY
Definition: schedule_stage.hh:91
gem5::ScheduleStage::vectorAluRdy
bool vectorAluRdy
Definition: schedule_stage.hh:145
gem5::ScheduleStage
Definition: schedule_stage.hh:64
gem5::ScheduleStage::scalarMemBusRdy
bool scalarMemBusRdy
Definition: schedule_stage.hh:147
gem5::ScheduleStage::scalarAluRdy
bool scalarAluRdy
Definition: schedule_stage.hh:146
gem5::ScheduleStage::~ScheduleStage
~ScheduleStage()
Definition: schedule_stage.cc:70
gem5::ScheduleStage::SCH_LOCAL_MEM_FIFO_NRDY
@ SCH_LOCAL_MEM_FIFO_NRDY
Definition: schedule_stage.hh:90
gem5::ScheduleStage::ScheduleStageStats::rdyListEmpty
statistics::Vector rdyListEmpty
Definition: schedule_stage.hh:196
gem5::ScheduleStage::toExecute
ScheduleToExecute & toExecute
Definition: schedule_stage.hh:129
gem5::ComputeUnit
Definition: compute_unit.hh:203
gem5::ScheduleStage::fillDispatchList
void fillDispatchList()
Definition: schedule_stage.cc:558
gem5::ScheduleStage::SCH_RF_OPD_NRDY_CONDITIONS
@ SCH_RF_OPD_NRDY_CONDITIONS
Definition: schedule_stage.hh:104
gem5::ScheduleStage::init
void init()
Definition: schedule_stage.cc:78
gem5::ScheduleStage::ScheduleStageStats::schListToDispList
statistics::Vector schListToDispList
Definition: schedule_stage.hh:207
gem5::ScheduleStage::schrfaccessnonrdytype_e
schrfaccessnonrdytype_e
Definition: schedule_stage.hh:106
gem5::ScheduleStage::SCH_RF_OPD_NRDY
@ SCH_RF_OPD_NRDY
Definition: schedule_stage.hh:103
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
statistics.hh
gem5::ScheduleStage::addToSchList
bool addToSchList(int exeType, const GPUDynInstPtr &gpu_dyn_inst)
Definition: schedule_stage.cc:296
gem5::ScheduleStage::SCH_VECTOR_MEM_ISSUE_NRDY
@ SCH_VECTOR_MEM_ISSUE_NRDY
Definition: schedule_stage.hh:80
gem5::ArmISA::s
Bitfield< 4 > s
Definition: misc_types.hh:561
gem5::ScheduleStage::ScheduleStage
ScheduleStage(const ComputeUnitParams &p, ComputeUnit &cu, ScoreboardCheckToSchedule &from_scoreboard_check, ScheduleToExecute &to_execute)
Definition: schedule_stage.cc:50
gem5::ScheduleStage::SCH_CEDE_SIMD_NRDY
@ SCH_CEDE_SIMD_NRDY
Definition: schedule_stage.hh:84
gem5::ScheduleStage::arbitrateVrfToLdsBus
void arbitrateVrfToLdsBus()
Definition: schedule_stage.cc:627
gem5::ScheduleStage::deleteFromSch
void deleteFromSch(Wavefront *w)
Definition: schedule_stage.cc:790
gem5::ScheduleStage::checkRfOperandReadComplete
void checkRfOperandReadComplete()
Definition: schedule_stage.cc:668
gem5::ScheduleStage::SCH_FLAT_MEM_BUS_BUSY_NRDY
@ SCH_FLAT_MEM_BUS_BUSY_NRDY
Definition: schedule_stage.hh:92
gem5::ScheduleStage::ScheduleStageStats::ScheduleStageStats
ScheduleStageStats(statistics::Group *parent, int num_exec_units)
Definition: schedule_stage.cc:795
gem5::ScheduleStage::ScheduleStageStats::schListToDispListStalls
statistics::Vector schListToDispListStalls
Definition: schedule_stage.hh:211
gem5::ScheduleStage::ScheduleStageStats::rdyListNotEmpty
statistics::Vector rdyListNotEmpty
Definition: schedule_stage.hh:197
gem5::ScheduleStage::ScheduleStageStats::opdNrdyStalls
statistics::Vector opdNrdyStalls
Definition: schedule_stage.hh:227
gem5::ScheduleStage::_name
const std::string _name
Definition: schedule_stage.hh:135
gem5::DISPATCH_STATUS
DISPATCH_STATUS
Definition: exec_stage.hh:61
scheduler.hh
gem5::ScheduleStage::SCH_VECTOR_MEM_REQS_NRDY
@ SCH_VECTOR_MEM_REQS_NRDY
Definition: schedule_stage.hh:83
gem5::GPUDynInstPtr
std::shared_ptr< GPUDynInst > GPUDynInstPtr
Definition: misc.hh:51
gem5::ScheduleStage::SCH_LOCAL_MEM_BUS_BUSY_NRDY
@ SCH_LOCAL_MEM_BUS_BUSY_NRDY
Definition: schedule_stage.hh:89
gem5::ScheduleStage::SCH_SCALAR_MEM_ISSUE_NRDY
@ SCH_SCALAR_MEM_ISSUE_NRDY
Definition: schedule_stage.hh:85
gem5::ScheduleStage::SCH_LOCAL_MEM_ISSUE_NRDY
@ SCH_LOCAL_MEM_ISSUE_NRDY
Definition: schedule_stage.hh:88
gem5::ScheduleStage::SCH_VRF_WR_ACCESS_NRDY
@ SCH_VRF_WR_ACCESS_NRDY
Definition: schedule_stage.hh:109
gem5::ScheduleStage::checkMemResources
void checkMemResources()
Definition: schedule_stage.cc:380
gem5::ScheduleStage::SCH_SCALAR_MEM_FIFO_NRDY
@ SCH_SCALAR_MEM_FIFO_NRDY
Definition: schedule_stage.hh:87
gem5::ScoreboardCheckToSchedule
Communication interface between ScoreboardCheck and Schedule stages.
Definition: comm.hh:64
gem5::ScheduleStage::stats
gem5::ScheduleStage::ScheduleStageStats stats
gem5::ScheduleStage::computeUnit
ComputeUnit & computeUnit
Definition: schedule_stage.hh:127
gem5::ScheduleStage::glbMemBusRdy
bool glbMemBusRdy
Definition: schedule_stage.hh:149
gem5::ScheduleStage::SCH_SRF_OPD_NRDY
@ SCH_SRF_OPD_NRDY
Definition: schedule_stage.hh:102
gem5::ScheduleStage::exec
void exec()
Definition: schedule_stage.cc:92
gem5::ScheduleStage::RFBUSY
@ RFBUSY
Definition: schedule_stage.hh:122
gem5::ScheduleStage::ScheduleStageStats::dispNrdyStalls
statistics::Vector dispNrdyStalls
Definition: schedule_stage.hh:232
gem5::ScheduleStage::SCH_SRF_WR_ACCESS_NRDY
@ SCH_SRF_WR_ACCESS_NRDY
Definition: schedule_stage.hh:111
gem5::ScheduleStage::SCH_VRF_OPD_NRDY
@ SCH_VRF_OPD_NRDY
Definition: schedule_stage.hh:101
gem5::statistics::Group
Statistics container.
Definition: group.hh:93
gem5::ScheduleStage::glbMemIssueRdy
bool glbMemIssueRdy
Definition: schedule_stage.hh:150
gem5::ScheduleStage::SCH_STATUS
SCH_STATUS
Definition: schedule_stage.hh:120
gem5::ScheduleStage::SCH_VRF_RD_ACCESS_NRDY
@ SCH_VRF_RD_ACCESS_NRDY
Definition: schedule_stage.hh:108
gem5::ScheduleStage::SCH_VECTOR_MEM_BUS_BUSY_NRDY
@ SCH_VECTOR_MEM_BUS_BUSY_NRDY
Definition: schedule_stage.hh:81
gem5::ScheduleStage::SCH_VECTOR_MEM_COALESCER_NRDY
@ SCH_VECTOR_MEM_COALESCER_NRDY
Definition: schedule_stage.hh:82
gem5::ScheduleStage::SCH_RF_ACCESS_NRDY_CONDITIONS
@ SCH_RF_ACCESS_NRDY_CONDITIONS
Definition: schedule_stage.hh:113
gem5::ScheduleStage::ScheduleStageStats
Definition: schedule_stage.hh:190
gem5::ScheduleStage::SCH_SCALAR_MEM_BUS_BUSY_NRDY
@ SCH_SCALAR_MEM_BUS_BUSY_NRDY
Definition: schedule_stage.hh:86
gem5::ScheduleStage::schedRfWrites
bool schedRfWrites(int exeType, const GPUDynInstPtr &gpu_dyn_inst)
Definition: schedule_stage.cc:228
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::ScheduleStage::locMemBusRdy
bool locMemBusRdy
Definition: schedule_stage.hh:151
exec_stage.hh
gem5::ScheduleStage::doDispatchListTransition
void doDispatchListTransition(int unitId, DISPATCH_STATUS s, const GPUDynInstPtr &gpu_dyn_inst)
Definition: schedule_stage.cc:215
gem5::ScheduleStage::name
const std::string & name() const
Definition: schedule_stage.hh:75
gem5::ScheduleStage::SCH_SCALAR_ALU_NRDY
@ SCH_SCALAR_ALU_NRDY
Definition: schedule_stage.hh:78
gem5::ScheduleStage::SCH_FLAT_MEM_COALESCER_NRDY
@ SCH_FLAT_MEM_COALESCER_NRDY
Definition: schedule_stage.hh:93

Generated on Tue Sep 21 2021 12:25:25 for gem5 by doxygen 1.8.17