gem5  v22.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  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its
16  * contributors may be used to endorse or promote products derived from this
17  * software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef __GLOBAL_MEMORY_PIPELINE_HH__
33 #define __GLOBAL_MEMORY_PIPELINE_HH__
34 
35 #include <queue>
36 #include <string>
37 
38 #include "base/statistics.hh"
39 #include "base/stats/group.hh"
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 namespace gem5
55 {
56 
57 class ComputeUnit;
58 
60 {
61  public:
62  GlobalMemPipeline(const ComputeUnitParams &p, ComputeUnit &cu);
63  void init();
64  void exec();
65 
74 
79  void completeRequest(GPUDynInstPtr gpuDynInst);
80 
85  void issueRequest(GPUDynInstPtr gpuDynInst);
86 
92  void handleResponse(GPUDynInstPtr gpuDynInst);
93 
94  bool
95  isGMReqFIFOWrRdy(uint32_t pendReqs=0) const
96  {
97  return (gmIssuedRequests.size() + pendReqs) < gmQueueSize;
98  }
99 
100  const std::string &name() const { return _name; }
101  void
103  {
104  stats.loadVrfBankConflictCycles += num_cycles;
105  }
106 
107  bool coalescerReady(GPUDynInstPtr mp) const;
109 
111 
112  private:
114  const std::string _name;
117 
118  // Counters to track the inflight loads and stores
119  // so that we can provide the proper backpressure
120  // on the number of inflight memory operations.
123 
124  // The size of global memory.
126 
127  /*
128  * This buffer holds the memory responses in order data - the responses
129  * are ordered by their unique sequence number, which is monotonically
130  * increasing. When a memory request returns its "done" flag is set to
131  * true. During each tick the the GM pipeline will check if the oldest
132  * request is finished, and if so it will be removed from the queue.
133  *
134  * key: memory instruction's sequence ID
135  *
136  * value: pair holding the instruction pointer and a bool that
137  * is used to indicate whether or not the request has
138  * completed
139  */
140  std::map<uint64_t, std::pair<GPUDynInstPtr, bool>> gmOrderedRespBuffer;
141 
142  // Global Memory Request FIFO: all global memory requests
143  // are issued to this FIFO from the memory pipelines
144  std::queue<GPUDynInstPtr> gmIssuedRequests;
145 
146  protected:
148  {
150 
151  // number of cycles of delaying the update of a VGPR that is the
152  // target of a load instruction (or the load component of an atomic)
153  // The delay is due to VRF bank conflicts
155  } stats;
156 };
157 
158 } // namespace gem5
159 
160 #endif // __GLOBAL_MEMORY_PIPELINE_HH__
GPUDynInstPtr getNextReadyResp()
Find the next ready response to service.
void completeRequest(GPUDynInstPtr gpuDynInst)
once a memory request is finished we remove it from the buffer.
void issueRequest(GPUDynInstPtr gpuDynInst)
Issues a request to the pipeline (i.e., enqueue it in the request buffer).
bool outstandingReqsCheck(GPUDynInstPtr mp) const
const std::string & name() const
void handleResponse(GPUDynInstPtr gpuDynInst)
This method handles responses sent to this GM pipeline by the CU.
bool isGMReqFIFOWrRdy(uint32_t pendReqs=0) const
void acqCoalescerToken(GPUDynInstPtr mp)
void incLoadVRFBankConflictCycles(int num_cycles)
GlobalMemPipeline(const ComputeUnitParams &p, ComputeUnit &cu)
std::map< uint64_t, std::pair< GPUDynInstPtr, bool > > gmOrderedRespBuffer
std::queue< GPUDynInstPtr > gmIssuedRequests
bool coalescerReady(GPUDynInstPtr mp) const
gem5::GlobalMemPipeline::GlobalMemPipelineStats stats
Statistics container.
Definition: group.hh:94
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1931
Bitfield< 11 > mp
Definition: misc_types.hh:827
Bitfield< 54 > p
Definition: pagetable.hh:70
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::shared_ptr< GPUDynInst > GPUDynInstPtr
Definition: misc.hh:49
Declaration of Statistics objects.

Generated on Wed Dec 21 2022 10:22:35 for gem5 by doxygen 1.9.1