gem5  v21.0.1.0
global_memory_pipeline.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 __GLOBAL_MEMORY_PIPELINE_HH__
35 #define __GLOBAL_MEMORY_PIPELINE_HH__
36 
37 #include <queue>
38 #include <string>
39 
40 #include "base/statistics.hh"
41 #include "base/stats/group.hh"
42 #include "gpu-compute/misc.hh"
43 #include "params/ComputeUnit.hh"
44 #include "sim/stats.hh"
45 
46 /*
47  * @file global_memory_pipeline.hh
48  *
49  * The global memory pipeline issues newly created global memory packets
50  * from the pipeline to DTLB. The exec() method of the memory packet issues
51  * the packet to the DTLB if there is space available in the return fifo.
52  * This stage also retires previously issued loads and stores that have
53  * returned from the memory sub-system.
54  */
55 
56 class ComputeUnit;
57 
59 {
60  public:
61  GlobalMemPipeline(const ComputeUnitParams &p, ComputeUnit &cu);
62  void init();
63  void exec();
64 
73 
78  void completeRequest(GPUDynInstPtr gpuDynInst);
79 
84  void issueRequest(GPUDynInstPtr gpuDynInst);
85 
91  void handleResponse(GPUDynInstPtr gpuDynInst);
92 
93  bool
94  isGMReqFIFOWrRdy(uint32_t pendReqs=0) const
95  {
96  return (gmIssuedRequests.size() + pendReqs) < gmQueueSize;
97  }
98 
99  const std::string &name() const { return _name; }
100  void
102  {
103  stats.loadVrfBankConflictCycles += num_cycles;
104  }
105 
106  bool coalescerReady(GPUDynInstPtr mp) const;
108 
110 
111  private:
113  const std::string _name;
116 
117  // Counters to track the inflight loads and stores
118  // so that we can provide the proper backpressure
119  // on the number of inflight memory operations.
122 
123  // The size of global memory.
125 
126  /*
127  * This buffer holds the memory responses in order data - the responses
128  * are ordered by their unique sequence number, which is monotonically
129  * increasing. When a memory request returns its "done" flag is set to
130  * true. During each tick the the GM pipeline will check if the oldest
131  * request is finished, and if so it will be removed from the queue.
132  *
133  * key: memory instruction's sequence ID
134  *
135  * value: pair holding the instruction pointer and a bool that
136  * is used to indicate whether or not the request has
137  * completed
138  */
139  std::map<uint64_t, std::pair<GPUDynInstPtr, bool>> gmOrderedRespBuffer;
140 
141  // Global Memory Request FIFO: all global memory requests
142  // are issued to this FIFO from the memory pipelines
143  std::queue<GPUDynInstPtr> gmIssuedRequests;
144 
145  protected:
147  {
149 
150  // number of cycles of delaying the update of a VGPR that is the
151  // target of a load instruction (or the load component of an atomic)
152  // The delay is due to VRF bank conflicts
154  } stats;
155 };
156 
157 #endif // __GLOBAL_MEMORY_PIPELINE_HH__
GlobalMemPipeline::issueRequest
void issueRequest(GPUDynInstPtr gpuDynInst)
Issues a request to the pipeline (i.e., enqueue it in the request buffer).
Definition: global_memory_pipeline.cc:274
GlobalMemPipeline::inflightLoads
int inflightLoads
Definition: global_memory_pipeline.hh:121
GlobalMemPipeline::acqCoalescerToken
void acqCoalescerToken(GPUDynInstPtr mp)
Definition: global_memory_pipeline.cc:81
GlobalMemPipeline::stats
GlobalMemPipeline::GlobalMemPipelineStats stats
group.hh
GlobalMemPipeline::gmIssuedRequests
std::queue< GPUDynInstPtr > gmIssuedRequests
Definition: global_memory_pipeline.hh:143
misc.hh
GlobalMemPipeline::_name
const std::string _name
Definition: global_memory_pipeline.hh:113
GlobalMemPipeline::exec
void exec()
Definition: global_memory_pipeline.cc:106
GlobalMemPipeline::outstandingReqsCheck
bool outstandingReqsCheck(GPUDynInstPtr mp) const
Definition: global_memory_pipeline.cc:93
Stats::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1933
ComputeUnit
Definition: compute_unit.hh:200
stats.hh
GlobalMemPipeline::maxWaveRequests
int maxWaveRequests
Definition: global_memory_pipeline.hh:115
GlobalMemPipeline::getNextReadyResp
GPUDynInstPtr getNextReadyResp()
Find the next ready response to service.
Definition: global_memory_pipeline.cc:239
GlobalMemPipeline::GlobalMemPipelineStats
Definition: global_memory_pipeline.hh:146
GlobalMemPipeline::gmQueueSize
int gmQueueSize
Definition: global_memory_pipeline.hh:114
statistics.hh
GlobalMemPipeline::globalMemSize
int globalMemSize
Definition: global_memory_pipeline.hh:124
GlobalMemPipeline::inflightStores
int inflightStores
Definition: global_memory_pipeline.hh:120
GlobalMemPipeline::GlobalMemPipeline
GlobalMemPipeline(const ComputeUnitParams &p, ComputeUnit &cu)
Definition: global_memory_pipeline.cc:46
GlobalMemPipeline::GlobalMemPipelineStats::loadVrfBankConflictCycles
Stats::Scalar loadVrfBankConflictCycles
Definition: global_memory_pipeline.hh:153
GlobalMemPipeline::GlobalMemPipelineStats::GlobalMemPipelineStats
GlobalMemPipelineStats(Stats::Group *parent)
Definition: global_memory_pipeline.cc:293
GlobalMemPipeline::isGMReqFIFOWrRdy
bool isGMReqFIFOWrRdy(uint32_t pendReqs=0) const
Definition: global_memory_pipeline.hh:94
Stats::Group
Statistics container.
Definition: group.hh:87
GPUDynInstPtr
std::shared_ptr< GPUDynInst > GPUDynInstPtr
Definition: misc.hh:48
GlobalMemPipeline::incLoadVRFBankConflictCycles
void incLoadVRFBankConflictCycles(int num_cycles)
Definition: global_memory_pipeline.hh:101
GlobalMemPipeline::computeUnit
ComputeUnit & computeUnit
Definition: global_memory_pipeline.hh:112
GlobalMemPipeline::name
const std::string & name() const
Definition: global_memory_pipeline.hh:99
GlobalMemPipeline::init
void init()
Definition: global_memory_pipeline.cc:56
ArmISA::mp
Bitfield< 11 > mp
Definition: miscregs_types.hh:762
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
GlobalMemPipeline::completeRequest
void completeRequest(GPUDynInstPtr gpuDynInst)
once a memory request is finished we remove it from the buffer.
Definition: global_memory_pipeline.cc:253
GlobalMemPipeline::handleResponse
void handleResponse(GPUDynInstPtr gpuDynInst)
This method handles responses sent to this GM pipeline by the CU.
Definition: global_memory_pipeline.cc:282
GlobalMemPipeline::coalescerReady
bool coalescerReady(GPUDynInstPtr mp) const
Definition: global_memory_pipeline.cc:62
GlobalMemPipeline::gmOrderedRespBuffer
std::map< uint64_t, std::pair< GPUDynInstPtr, bool > > gmOrderedRespBuffer
Definition: global_memory_pipeline.hh:139
GlobalMemPipeline
Definition: global_memory_pipeline.hh:58

Generated on Tue Jun 22 2021 15:28:28 for gem5 by doxygen 1.8.17