gem5  v21.1.0.2
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 namespace gem5
57 {
58 
59 class ComputeUnit;
60 
62 {
63  public:
64  GlobalMemPipeline(const ComputeUnitParams &p, ComputeUnit &cu);
65  void init();
66  void exec();
67 
76 
81  void completeRequest(GPUDynInstPtr gpuDynInst);
82 
87  void issueRequest(GPUDynInstPtr gpuDynInst);
88 
94  void handleResponse(GPUDynInstPtr gpuDynInst);
95 
96  bool
97  isGMReqFIFOWrRdy(uint32_t pendReqs=0) const
98  {
99  return (gmIssuedRequests.size() + pendReqs) < gmQueueSize;
100  }
101 
102  const std::string &name() const { return _name; }
103  void
105  {
106  stats.loadVrfBankConflictCycles += num_cycles;
107  }
108 
109  bool coalescerReady(GPUDynInstPtr mp) const;
111 
113 
114  private:
116  const std::string _name;
119 
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  protected:
150  {
152 
153  // number of cycles of delaying the update of a VGPR that is the
154  // target of a load instruction (or the load component of an atomic)
155  // The delay is due to VRF bank conflicts
157  } stats;
158 };
159 
160 } // namespace gem5
161 
162 #endif // __GLOBAL_MEMORY_PIPELINE_HH__
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1927
gem5::GlobalMemPipeline::stats
gem5::GlobalMemPipeline::GlobalMemPipelineStats stats
gem5::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:277
group.hh
gem5::GlobalMemPipeline::inflightStores
int inflightStores
Definition: global_memory_pipeline.hh:123
gem5::GlobalMemPipeline::_name
const std::string _name
Definition: global_memory_pipeline.hh:116
gem5::GlobalMemPipeline::gmIssuedRequests
std::queue< GPUDynInstPtr > gmIssuedRequests
Definition: global_memory_pipeline.hh:146
misc.hh
gem5::ArmISA::mp
Bitfield< 11 > mp
Definition: misc_types.hh:768
gem5::GlobalMemPipeline::name
const std::string & name() const
Definition: global_memory_pipeline.hh:102
gem5::GlobalMemPipeline::init
void init()
Definition: global_memory_pipeline.cc:59
gem5::GlobalMemPipeline::inflightLoads
int inflightLoads
Definition: global_memory_pipeline.hh:124
stats.hh
gem5::ComputeUnit
Definition: compute_unit.hh:203
gem5::GlobalMemPipeline::GlobalMemPipelineStats::GlobalMemPipelineStats
GlobalMemPipelineStats(statistics::Group *parent)
Definition: global_memory_pipeline.cc:314
gem5::GlobalMemPipeline::GlobalMemPipelineStats::loadVrfBankConflictCycles
statistics::Scalar loadVrfBankConflictCycles
Definition: global_memory_pipeline.hh:156
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
statistics.hh
gem5::GlobalMemPipeline::isGMReqFIFOWrRdy
bool isGMReqFIFOWrRdy(uint32_t pendReqs=0) const
Definition: global_memory_pipeline.hh:97
gem5::GlobalMemPipeline::acqCoalescerToken
void acqCoalescerToken(GPUDynInstPtr mp)
Definition: global_memory_pipeline.cc:84
gem5::GlobalMemPipeline::outstandingReqsCheck
bool outstandingReqsCheck(GPUDynInstPtr mp) const
Definition: global_memory_pipeline.cc:96
gem5::GPUDynInstPtr
std::shared_ptr< GPUDynInst > GPUDynInstPtr
Definition: misc.hh:51
gem5::GlobalMemPipeline::incLoadVRFBankConflictCycles
void incLoadVRFBankConflictCycles(int num_cycles)
Definition: global_memory_pipeline.hh:104
gem5::GlobalMemPipeline::maxWaveRequests
int maxWaveRequests
Definition: global_memory_pipeline.hh:118
gem5::GlobalMemPipeline::coalescerReady
bool coalescerReady(GPUDynInstPtr mp) const
Definition: global_memory_pipeline.cc:65
gem5::GlobalMemPipeline::computeUnit
ComputeUnit & computeUnit
Definition: global_memory_pipeline.hh:115
gem5::GlobalMemPipeline
Definition: global_memory_pipeline.hh:61
gem5::GlobalMemPipeline::gmOrderedRespBuffer
std::map< uint64_t, std::pair< GPUDynInstPtr, bool > > gmOrderedRespBuffer
Definition: global_memory_pipeline.hh:142
gem5::statistics::Group
Statistics container.
Definition: group.hh:93
gem5::GlobalMemPipeline::completeRequest
void completeRequest(GPUDynInstPtr gpuDynInst)
once a memory request is finished we remove it from the buffer.
Definition: global_memory_pipeline.cc:256
gem5::GlobalMemPipeline::globalMemSize
int globalMemSize
Definition: global_memory_pipeline.hh:127
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::GlobalMemPipeline::gmQueueSize
int gmQueueSize
Definition: global_memory_pipeline.hh:117
gem5::GlobalMemPipeline::exec
void exec()
Definition: global_memory_pipeline.cc:109
gem5::GlobalMemPipeline::getNextReadyResp
GPUDynInstPtr getNextReadyResp()
Find the next ready response to service.
Definition: global_memory_pipeline.cc:242
gem5::GlobalMemPipeline::handleResponse
void handleResponse(GPUDynInstPtr gpuDynInst)
This method handles responses sent to this GM pipeline by the CU.
Definition: global_memory_pipeline.cc:303
gem5::GlobalMemPipeline::GlobalMemPipeline
GlobalMemPipeline(const ComputeUnitParams &p, ComputeUnit &cu)
Definition: global_memory_pipeline.cc:49
gem5::GlobalMemPipeline::GlobalMemPipelineStats
Definition: global_memory_pipeline.hh:149

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