gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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__
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1929
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:279
group.hh
gem5::GlobalMemPipeline::inflightStores
int inflightStores
Definition: global_memory_pipeline.hh:121
gem5::GlobalMemPipeline::_name
const std::string _name
Definition: global_memory_pipeline.hh:114
gem5::GlobalMemPipeline::gmIssuedRequests
std::queue< GPUDynInstPtr > gmIssuedRequests
Definition: global_memory_pipeline.hh:144
misc.hh
gem5::ArmISA::mp
Bitfield< 11 > mp
Definition: misc_types.hh:910
gem5::GlobalMemPipeline::name
const std::string & name() const
Definition: global_memory_pipeline.hh:100
gem5::GlobalMemPipeline::init
void init()
Definition: global_memory_pipeline.cc:57
gem5::GlobalMemPipeline::inflightLoads
int inflightLoads
Definition: global_memory_pipeline.hh:122
stats.hh
gem5::ComputeUnit
Definition: compute_unit.hh:201
gem5::GlobalMemPipeline::GlobalMemPipelineStats::GlobalMemPipelineStats
GlobalMemPipelineStats(statistics::Group *parent)
Definition: global_memory_pipeline.cc:316
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::GlobalMemPipeline::GlobalMemPipelineStats::loadVrfBankConflictCycles
statistics::Scalar loadVrfBankConflictCycles
Definition: global_memory_pipeline.hh:154
statistics.hh
gem5::GlobalMemPipeline::isGMReqFIFOWrRdy
bool isGMReqFIFOWrRdy(uint32_t pendReqs=0) const
Definition: global_memory_pipeline.hh:95
gem5::GlobalMemPipeline::acqCoalescerToken
void acqCoalescerToken(GPUDynInstPtr mp)
Definition: global_memory_pipeline.cc:86
gem5::GlobalMemPipeline::outstandingReqsCheck
bool outstandingReqsCheck(GPUDynInstPtr mp) const
Definition: global_memory_pipeline.cc:98
gem5::GPUDynInstPtr
std::shared_ptr< GPUDynInst > GPUDynInstPtr
Definition: misc.hh:49
gem5::GlobalMemPipeline::incLoadVRFBankConflictCycles
void incLoadVRFBankConflictCycles(int num_cycles)
Definition: global_memory_pipeline.hh:102
gem5::GlobalMemPipeline::maxWaveRequests
int maxWaveRequests
Definition: global_memory_pipeline.hh:116
gem5::GlobalMemPipeline::coalescerReady
bool coalescerReady(GPUDynInstPtr mp) const
Definition: global_memory_pipeline.cc:63
gem5::GlobalMemPipeline::computeUnit
ComputeUnit & computeUnit
Definition: global_memory_pipeline.hh:113
gem5::GlobalMemPipeline
Definition: global_memory_pipeline.hh:59
gem5::GlobalMemPipeline::gmOrderedRespBuffer
std::map< uint64_t, std::pair< GPUDynInstPtr, bool > > gmOrderedRespBuffer
Definition: global_memory_pipeline.hh:140
gem5::statistics::Group
Statistics container.
Definition: group.hh:92
gem5::GlobalMemPipeline::completeRequest
void completeRequest(GPUDynInstPtr gpuDynInst)
once a memory request is finished we remove it from the buffer.
Definition: global_memory_pipeline.cc:258
gem5::GlobalMemPipeline::globalMemSize
int globalMemSize
Definition: global_memory_pipeline.hh:125
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::GlobalMemPipeline::gmQueueSize
int gmQueueSize
Definition: global_memory_pipeline.hh:115
gem5::GlobalMemPipeline::exec
void exec()
Definition: global_memory_pipeline.cc:111
gem5::GlobalMemPipeline::getNextReadyResp
GPUDynInstPtr getNextReadyResp()
Find the next ready response to service.
Definition: global_memory_pipeline.cc:244
gem5::GlobalMemPipeline::handleResponse
void handleResponse(GPUDynInstPtr gpuDynInst)
This method handles responses sent to this GM pipeline by the CU.
Definition: global_memory_pipeline.cc:305
gem5::GlobalMemPipeline::GlobalMemPipeline
GlobalMemPipeline(const ComputeUnitParams &p, ComputeUnit &cu)
Definition: global_memory_pipeline.cc:47
gem5::GlobalMemPipeline::GlobalMemPipelineStats
Definition: global_memory_pipeline.hh:147

Generated on Sun Jul 30 2023 01:56:57 for gem5 by doxygen 1.8.17