gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
exec_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 contributors
18  * may be used to endorse or promote products derived from this software
19  * 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  * Author: John Kalamatianos, Sooraj Puthoor
34  */
35 
36 #ifndef __EXEC_STAGE_HH__
37 #define __EXEC_STAGE_HH__
38 
39 #include <string>
40 #include <utility>
41 #include <vector>
42 
43 #include "sim/stats.hh"
44 
45 class ComputeUnit;
46 class Wavefront;
47 struct ComputeUnitParams;
48 
50 {
54 };
55 
57 {
58  EMPTY = 0,
60 };
61 
62 // Execution stage.
63 // Each execution resource executes the
64 // wave which is in its dispatch list.
65 // The schedule stage is responsible for
66 // adding a wave into each execution resource's
67 // dispatch list.
68 
69 class ExecStage
70 {
71  public:
72  ExecStage(const ComputeUnitParams* params);
73  ~ExecStage() { }
74  void init(ComputeUnit *cu);
75  void exec();
76 
77  std::string name() { return _name; }
78  void regStats();
79  // number of idle cycles
81  // number of busy cycles
83  // number of cycles (per execution unit) during which at least one
84  // instruction was issued to that unit
86  // number of idle cycles (per execution unit) during which the unit issued
87  // no instruction targeting that unit, even though there is at least one
88  // Wavefront with such an instruction as the oldest
90  // SIMDs active per cycle
92 
93  private:
94  void collectStatistics(enum STAT_STATUS stage, int unitId);
95  void initStatistics();
97  uint32_t numSIMDs;
98 
99  // Number of memory execution resources;
100  // both global and local memory execution resources in CU
101  uint32_t numMemUnits;
102 
103  // List of waves which will be dispatched to
104  // each execution resource. A FILLED implies
105  // dispatch list is non-empty and
106  // execution unit has something to execute
107  // this cycle. Currently, the dispatch list of
108  // an execution resource can hold only one wave because
109  // an execution resource can execute only one wave in a cycle.
110  // dispatchList is used to communicate between schedule
111  // and exec stage
113  // flag per vector SIMD unit that is set when there is at least one
114  // WV that has a vector ALU instruction as the oldest in its
115  // Instruction Buffer
125  uint64_t idle_dur;
126  std::string _name;
127 };
128 
129 #endif // __EXEC_STAGE_HH__
uint32_t executionResourcesUsed
Definition: exec_stage.hh:124
uint32_t numSIMDs
Definition: exec_stage.hh:97
std::string _name
Definition: exec_stage.hh:126
Stats::Distribution idleDur
Definition: exec_stage.hh:123
A vector of scalar stats.
Definition: statistics.hh:2499
Stats::Vector numCyclesWithInstrTypeIssued
Definition: exec_stage.hh:85
Stats::Scalar numCyclesWithInstrIssued
Definition: exec_stage.hh:82
std::string name()
Definition: exec_stage.hh:77
Stats::Distribution spc
Definition: exec_stage.hh:91
ExecStage(const ComputeUnitParams *params)
Definition: exec_stage.cc:41
void collectStatistics(enum STAT_STATUS stage, int unitId)
Definition: exec_stage.cc:65
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2475
STL vector class.
Definition: stl.hh:40
ComputeUnit * computeUnit
Definition: exec_stage.hh:96
DISPATCH_STATUS
Definition: exec_stage.hh:56
uint64_t idle_dur
Definition: exec_stage.hh:125
A simple distribution stat.
Definition: statistics.hh:2523
bool lastTimeInstExecuted
Definition: exec_stage.hh:119
Stats::Scalar numCyclesWithNoIssue
Definition: exec_stage.hh:80
void exec()
Definition: exec_stage.cc:128
bool instrExecuted
Definition: exec_stage.hh:121
void init(ComputeUnit *cu)
Definition: exec_stage.cc:53
Stats::Vector numCyclesWithNoInstrTypeIssued
Definition: exec_stage.hh:89
int * glbMemInstAvail
Definition: exec_stage.hh:117
STAT_STATUS
Definition: exec_stage.hh:49
std::vector< std::pair< Wavefront *, DISPATCH_STATUS > > * dispatchList
Definition: exec_stage.hh:112
void initStatistics()
Definition: exec_stage.cc:120
Stats::Scalar numTransActiveIdle
Definition: exec_stage.hh:122
std::vector< bool > * vectorAluInstAvail
Definition: exec_stage.hh:116
int * shrMemInstAvail
Definition: exec_stage.hh:118
uint32_t numMemUnits
Definition: exec_stage.hh:101
void regStats()
Definition: exec_stage.cc:152
bool thisTimeInstExecuted
Definition: exec_stage.hh:120

Generated on Fri Jun 9 2017 13:03:47 for gem5 by doxygen 1.8.6