gem5  v20.0.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
vector_register_file.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2017 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 __VECTOR_REGISTER_FILE_HH__
35 #define __VECTOR_REGISTER_FILE_HH__
36 
37 #include <list>
38 
39 #include "base/statistics.hh"
40 #include "base/trace.hh"
41 #include "base/types.hh"
42 #include "debug/GPUVRF.hh"
44 #include "sim/sim_object.hh"
45 
46 class ComputeUnit;
47 class Shader;
48 class SimplePoolManager;
49 class Wavefront;
50 
51 struct VectorRegisterFileParams;
52 
53 enum class VrfAccessType : uint8_t
54 {
55  READ = 0x01,
56  WRITE = 0x02,
57  RD_WR = READ | WRITE
58 };
59 
60 // Vector Register File
62 {
63  public:
64  VectorRegisterFile(const VectorRegisterFileParams *p);
65 
66  void setParent(ComputeUnit *_computeUnit);
67 
68  // Read a register
69  template<typename T>
70  T
71  read(int regIdx, int threadId=0)
72  {
73  T p0 = vgprState->read<T>(regIdx, threadId);
74  DPRINTF(GPUVRF, "reading vreg[%d][%d] = %u\n", regIdx, threadId, (uint64_t)p0);
75 
76  return p0;
77  }
78 
79  // Write a register
80  template<typename T>
81  void
82  write(int regIdx, T value, int threadId=0)
83  {
84  DPRINTF(GPUVRF, "writing vreg[%d][%d] = %u\n", regIdx, threadId, (uint64_t)value);
85  vgprState->write<T>(regIdx, value, threadId);
86  }
87 
88  uint8_t regBusy(int idx, uint32_t operandSize) const;
89  uint8_t regNxtBusy(int idx, uint32_t operandSize) const;
90 
91  int numRegs() const { return numRegsPerSimd; }
92 
93  void markReg(int regIdx, uint32_t operandSize, uint8_t value);
94  void preMarkReg(int regIdx, uint32_t operandSize, uint8_t value);
95 
96  virtual void exec(GPUDynInstPtr ii, Wavefront *w);
97 
98  virtual int exec(uint64_t dynamic_id, Wavefront *w,
99  std::vector<uint32_t> &regVec, uint32_t operandSize,
100  uint64_t timestamp);
101 
102  bool operandsReady(Wavefront *w, GPUDynInstPtr ii) const;
103  virtual void updateEvents() { }
104  virtual void updateResources(Wavefront *w, GPUDynInstPtr ii);
105 
106  virtual bool
107  isReadConflict(int memWfId, int exeWfId) const
108  {
109  return false;
110  }
111 
112  virtual bool
113  isWriteConflict(int memWfId, int exeWfId) const
114  {
115  return false;
116  }
117 
118  virtual bool vrfOperandAccessReady(uint64_t dynamic_id, Wavefront *w,
119  GPUDynInstPtr ii,
120  VrfAccessType accessType);
121 
122  virtual bool vrfOperandAccessReady(Wavefront *w, GPUDynInstPtr ii,
123  VrfAccessType accessType);
124 
126 
127  protected:
129  int simdId;
130 
131  // flag indicating if a register is busy
133  // flag indicating if a register will be busy (by instructions
134  // in the SIMD pipeline)
136 
137  // numer of registers (bank size) per simd unit (bank)
139 
140  // vector register state
142 };
143 
144 #endif // __VECTOR_REGISTER_FILE_HH__
#define DPRINTF(x,...)
Definition: trace.hh:222
std::vector< uint8_t > nxtBusy
Definition: shader.hh:76
virtual bool isWriteConflict(int memWfId, int exeWfId) const
Declaration of Statistics objects.
void write(int regIdx, T value, int threadId=0)
std::shared_ptr< GPUDynInst > GPUDynInstPtr
Definition: misc.hh:46
VecRegisterState * vgprState
T read(int regIdx, int threadId=0)
Bitfield< 0 > w
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
SimplePoolManager * manager
std::vector< uint8_t > busy
Bitfield< 0 > p
Abstract superclass for simulation objects.
Definition: sim_object.hh:92
virtual bool isReadConflict(int memWfId, int exeWfId) const

Generated on Mon Jun 8 2020 15:45:11 for gem5 by doxygen 1.8.13