gem5  v20.1.0.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 "gpu-compute/misc.hh"
41 #include "params/ComputeUnit.hh"
42 #include "sim/stats.hh"
43 
44 /*
45  * @file global_memory_pipeline.hh
46  *
47  * The global memory pipeline issues newly created global memory packets
48  * from the pipeline to DTLB. The exec() method of the memory packet issues
49  * the packet to the DTLB if there is space available in the return fifo.
50  * This stage also retires previously issued loads and stores that have
51  * returned from the memory sub-system.
52  */
53 
54 class ComputeUnit;
55 
57 {
58  public:
59  GlobalMemPipeline(const ComputeUnitParams *p, ComputeUnit &cu);
60  void init();
61  void exec();
62 
71 
76  void completeRequest(GPUDynInstPtr gpuDynInst);
77 
82  void issueRequest(GPUDynInstPtr gpuDynInst);
83 
89  void handleResponse(GPUDynInstPtr gpuDynInst);
90 
91  bool
92  isGMReqFIFOWrRdy(uint32_t pendReqs=0) const
93  {
94  return (gmIssuedRequests.size() + pendReqs) < gmQueueSize;
95  }
96 
97  const std::string &name() const { return _name; }
98  void regStats();
99  void
101  {
102  loadVrfBankConflictCycles += num_cycles;
103  }
104 
105  bool coalescerReady(GPUDynInstPtr mp) const;
107 
109 
110  private:
112  const std::string _name;
115 
116  // number of cycles of delaying the update of a VGPR that is the
117  // target of a load instruction (or the load component of an atomic)
118  // The delay is due to VRF bank conflicts
120  // Counters to track the inflight loads and stores
121  // so that we can provide the proper backpressure
122  // on the number of inflight memory operations.
125 
126  // The size of global memory.
128 
129  /*
130  * This buffer holds the memory responses in order data - the responses
131  * are ordered by their unique sequence number, which is monotonically
132  * increasing. When a memory request returns its "done" flag is set to
133  * true. During each tick the the GM pipeline will check if the oldest
134  * request is finished, and if so it will be removed from the queue.
135  *
136  * key: memory instruction's sequence ID
137  *
138  * value: pair holding the instruction pointer and a bool that
139  * is used to indicate whether or not the request has
140  * completed
141  */
142  std::map<uint64_t, std::pair<GPUDynInstPtr, bool>> gmOrderedRespBuffer;
143 
144  // Global Memory Request FIFO: all global memory requests
145  // are issued to this FIFO from the memory pipelines
146  std::queue<GPUDynInstPtr> gmIssuedRequests;
147 };
148 
149 #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:267
GlobalMemPipeline::inflightLoads
int inflightLoads
Definition: global_memory_pipeline.hh:124
GlobalMemPipeline::acqCoalescerToken
void acqCoalescerToken(GPUDynInstPtr mp)
Definition: global_memory_pipeline.cc:81
GlobalMemPipeline::gmIssuedRequests
std::queue< GPUDynInstPtr > gmIssuedRequests
Definition: global_memory_pipeline.hh:146
misc.hh
GlobalMemPipeline::_name
const std::string _name
Definition: global_memory_pipeline.hh:112
GlobalMemPipeline::exec
void exec()
Definition: global_memory_pipeline.cc:106
GlobalMemPipeline::regStats
void regStats()
Definition: global_memory_pipeline.cc:286
GlobalMemPipeline::loadVrfBankConflictCycles
Stats::Scalar loadVrfBankConflictCycles
Definition: global_memory_pipeline.hh:119
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:2533
ComputeUnit
Definition: compute_unit.hh:198
stats.hh
GlobalMemPipeline::maxWaveRequests
int maxWaveRequests
Definition: global_memory_pipeline.hh:114
GlobalMemPipeline::getNextReadyResp
GPUDynInstPtr getNextReadyResp()
Find the next ready response to service.
Definition: global_memory_pipeline.cc:232
GlobalMemPipeline::gmQueueSize
int gmQueueSize
Definition: global_memory_pipeline.hh:113
GlobalMemPipeline::globalMemSize
int globalMemSize
Definition: global_memory_pipeline.hh:127
GlobalMemPipeline::GlobalMemPipeline
GlobalMemPipeline(const ComputeUnitParams *p, ComputeUnit &cu)
Definition: global_memory_pipeline.cc:46
GlobalMemPipeline::inflightStores
int inflightStores
Definition: global_memory_pipeline.hh:123
GlobalMemPipeline::isGMReqFIFOWrRdy
bool isGMReqFIFOWrRdy(uint32_t pendReqs=0) const
Definition: global_memory_pipeline.hh:92
GPUDynInstPtr
std::shared_ptr< GPUDynInst > GPUDynInstPtr
Definition: misc.hh:48
GlobalMemPipeline::incLoadVRFBankConflictCycles
void incLoadVRFBankConflictCycles(int num_cycles)
Definition: global_memory_pipeline.hh:100
GlobalMemPipeline::computeUnit
ComputeUnit & computeUnit
Definition: global_memory_pipeline.hh:111
GlobalMemPipeline::name
const std::string & name() const
Definition: global_memory_pipeline.hh:97
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:246
GlobalMemPipeline::handleResponse
void handleResponse(GPUDynInstPtr gpuDynInst)
This method handles responses sent to this GM pipeline by the CU.
Definition: global_memory_pipeline.cc:275
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:142
GlobalMemPipeline
Definition: global_memory_pipeline.hh:56

Generated on Wed Sep 30 2020 14:02:12 for gem5 by doxygen 1.8.17