gem5 v24.0.0.0
Loading...
Searching...
No Matches
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 * 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 __VECTOR_REGISTER_FILE_HH__
33#define __VECTOR_REGISTER_FILE_HH__
34
35#include "arch/gpu_isa.hh"
36#include "config/the_gpu_isa.hh"
37#include "debug/GPUVRF.hh"
40
41namespace gem5
42{
43
44struct VectorRegisterFileParams;
45
46// Vector Register File
48{
49 public:
50 using VecRegContainer = TheGpuISA::VecRegContainerU32;
51
52 VectorRegisterFile(const VectorRegisterFileParams &p);
54
55 virtual bool operandsReady(Wavefront *w, GPUDynInstPtr ii) const override;
56 virtual void scheduleWriteOperands(Wavefront *w,
57 GPUDynInstPtr ii) override;
59 GPUDynInstPtr ii) override;
60 virtual void waveExecuteInst(Wavefront *w, GPUDynInstPtr ii) override;
61
62 void
63 setParent(ComputeUnit *_computeUnit) override
64 {
65 RegisterFile::setParent(_computeUnit);
66 }
67
68 // Read a register that is writeable (e.g., a DST operand)
70 readWriteable(int regIdx)
71 {
72 return regFile[regIdx];
73 }
74
75 // Read a register that is not writeable (e.g., src operand)
76 const VecRegContainer&
77 read(int regIdx) const
78 {
79 return regFile[regIdx];
80 }
81
82 // Write a register
83 void
84 write(int regIdx, const VecRegContainer &value)
85 {
86 regFile[regIdx] = value;
87 }
88
89 void
90 printReg(Wavefront *wf, int regIdx) const
91 {
92#ifndef NDEBUG
93 const auto &vec_reg_cont = regFile[regIdx];
94 auto vgpr = vec_reg_cont.as<TheGpuISA::VecElemU32>();
95
96 for (int lane = 0; lane < TheGpuISA::NumVecElemPerVecReg; ++lane) {
97 if (wf->execMask(lane)) {
98 DPRINTF(GPUVRF, "WF[%d][%d]: WV[%d] v[%d][%d] = %#x\n",
99 wf->simdId, wf->wfSlotId, wf->wfDynId, regIdx, lane,
100 vgpr[lane]);
101 }
102 }
103#endif
104 }
105
106 private:
108};
109
110} // namespace gem5
111
112#endif // __VECTOR_REGISTER_FILE_HH__
#define DPRINTF(x,...)
Definition trace.hh:210
virtual void setParent(ComputeUnit *_computeUnit)
Vector Register Abstraction This generic class is the model in a particularization of MVC,...
Definition vec_reg.hh:126
virtual void scheduleWriteOperands(Wavefront *w, GPUDynInstPtr ii) override
void printReg(Wavefront *wf, int regIdx) const
VectorRegisterFile(const VectorRegisterFileParams &p)
VecRegContainer & readWriteable(int regIdx)
virtual bool operandsReady(Wavefront *w, GPUDynInstPtr ii) const override
const VecRegContainer & read(int regIdx) const
void write(int regIdx, const VecRegContainer &value)
std::vector< VecRegContainer > regFile
TheGpuISA::VecRegContainerU32 VecRegContainer
void setParent(ComputeUnit *_computeUnit) override
virtual void waveExecuteInst(Wavefront *w, GPUDynInstPtr ii) override
virtual void scheduleWriteOperandsFromLoad(Wavefront *w, GPUDynInstPtr ii) override
const int simdId
Definition wavefront.hh:101
const int wfSlotId
Definition wavefront.hh:98
VectorMask & execMask()
uint64_t wfDynId
Definition wavefront.hh:233
STL vector class.
Definition stl.hh:37
Bitfield< 0 > p
Bitfield< 0 > w
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
std::shared_ptr< GPUDynInst > GPUDynInstPtr
Definition misc.hh:49

Generated on Tue Jun 18 2024 16:24:04 for gem5 by doxygen 1.11.0