gem5  v20.1.0.0
operand.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2018 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  * Authors: Anthony Gutierrez
34  */
35 
36 #ifndef __ARCH_GCN3_OPERAND_HH__
37 #define __ARCH_GCN3_OPERAND_HH__
38 
39 #include <array>
40 
41 #include "arch/gcn3/registers.hh"
42 #include "arch/generic/vec_reg.hh"
45 #include "gpu-compute/wavefront.hh"
46 
53 namespace Gcn3ISA
54 {
60  template<typename T> struct OpTraits { typedef float FloatT; };
61  template<> struct OpTraits<ScalarRegF64> { typedef double FloatT; };
62  template<> struct OpTraits<ScalarRegU64> { typedef double FloatT; };
63 
64  class Operand
65  {
66  public:
67  Operand() = delete;
68 
69  Operand(GPUDynInstPtr gpuDynInst, int opIdx)
70  : _gpuDynInst(gpuDynInst), _opIdx(opIdx)
71  {
72  assert(_gpuDynInst);
73  assert(_opIdx >= 0);
74  }
75 
80  virtual void read() = 0;
81  virtual void write() = 0;
82 
83  protected:
94  int _opIdx;
95  };
96 
97  template<typename DataType, bool Const, size_t NumDwords>
99 
100  template<typename DataType, bool Const,
101  size_t NumDwords = sizeof(DataType) / sizeof(VecElemU32)>
102  class VecOperand final : public Operand
103  {
104  static_assert(NumDwords >= 1 && NumDwords <= MaxOperandDwords,
105  "Incorrect number of DWORDS for GCN3 operand.");
106 
107  public:
108  VecOperand() = delete;
109 
110  VecOperand(GPUDynInstPtr gpuDynInst, int opIdx)
111  : Operand(gpuDynInst, opIdx), scalar(false), absMod(false),
112  negMod(false), scRegData(gpuDynInst, _opIdx),
113  vrfData{{ nullptr }}
114  {
115  vecReg.zero();
116  }
117 
119  {
120  }
121 
130  void
132  {
133  if (isVectorReg(_opIdx)) {
135  ->reservedScalarRegs);
136  read();
137  } else {
138  readScalar();
139  }
140  }
141 
146  void
147  read() override
148  {
149  assert(_gpuDynInst);
150  assert(_gpuDynInst->wavefront());
151  assert(_gpuDynInst->computeUnit());
152  Wavefront *wf = _gpuDynInst->wavefront();
153  ComputeUnit *cu = _gpuDynInst->computeUnit();
154 
155  for (auto i = 0; i < NumDwords; ++i) {
156  int vgprIdx = cu->registerManager->mapVgpr(wf, _opIdx + i);
157  vrfData[i] = &cu->vrf[wf->simdId]->readWriteable(vgprIdx);
158 
159  DPRINTF(GPUVRF, "Read v[%d]\n", vgprIdx);
160  cu->vrf[wf->simdId]->printReg(wf, vgprIdx);
161  }
162 
163  if (NumDwords == 1) {
164  assert(vrfData[0]);
165  auto vgpr = vecReg.template as<DataType>();
166  auto reg_file_vgpr = vrfData[0]->template as<VecElemU32>();
167  for (int lane = 0; lane < NumVecElemPerVecReg; ++lane) {
168  std::memcpy((void*)&vgpr[lane],
169  (void*)&reg_file_vgpr[lane], sizeof(DataType));
170  }
171  } else if (NumDwords == 2) {
172  assert(vrfData[0]);
173  assert(vrfData[1]);
174  auto vgpr = vecReg.template as<VecElemU64>();
175  auto reg_file_vgpr0 = vrfData[0]->template as<VecElemU32>();
176  auto reg_file_vgpr1 = vrfData[1]->template as<VecElemU32>();
177 
178  for (int lane = 0; lane < NumVecElemPerVecReg; ++lane) {
179  VecElemU64 tmp_val(0);
180  ((VecElemU32*)&tmp_val)[0] = reg_file_vgpr0[lane];
181  ((VecElemU32*)&tmp_val)[1] = reg_file_vgpr1[lane];
182  vgpr[lane] = tmp_val;
183  }
184  }
185  }
186 
198  void
199  write() override
200  {
201  assert(_gpuDynInst);
202  assert(_gpuDynInst->wavefront());
203  assert(_gpuDynInst->computeUnit());
204  Wavefront *wf = _gpuDynInst->wavefront();
205  ComputeUnit *cu = _gpuDynInst->computeUnit();
206  VectorMask &exec_mask = _gpuDynInst->isLoad()
207  ? _gpuDynInst->exec_mask : wf->execMask();
208 
209  if (NumDwords == 1) {
210  int vgprIdx = cu->registerManager->mapVgpr(wf, _opIdx);
211  vrfData[0] = &cu->vrf[wf->simdId]->readWriteable(vgprIdx);
212  assert(vrfData[0]);
213  auto reg_file_vgpr = vrfData[0]->template as<VecElemU32>();
214  auto vgpr = vecReg.template as<DataType>();
215 
216  for (int lane = 0; lane < NumVecElemPerVecReg; ++lane) {
217  if (exec_mask[lane] || _gpuDynInst->ignoreExec()) {
218  std::memcpy((void*)&reg_file_vgpr[lane],
219  (void*)&vgpr[lane], sizeof(DataType));
220  }
221  }
222 
223  DPRINTF(GPUVRF, "Write v[%d]\n", vgprIdx);
224  cu->vrf[wf->simdId]->printReg(wf, vgprIdx);
225  } else if (NumDwords == 2) {
226  int vgprIdx0 = cu->registerManager->mapVgpr(wf, _opIdx);
227  int vgprIdx1 = cu->registerManager->mapVgpr(wf, _opIdx + 1);
228  vrfData[0] = &cu->vrf[wf->simdId]->readWriteable(vgprIdx0);
229  vrfData[1] = &cu->vrf[wf->simdId]->readWriteable(vgprIdx1);
230  assert(vrfData[0]);
231  assert(vrfData[1]);
232  auto reg_file_vgpr0 = vrfData[0]->template as<VecElemU32>();
233  auto reg_file_vgpr1 = vrfData[1]->template as<VecElemU32>();
234  auto vgpr = vecReg.template as<VecElemU64>();
235 
236  for (int lane = 0; lane < NumVecElemPerVecReg; ++lane) {
237  if (exec_mask[lane] || _gpuDynInst->ignoreExec()) {
238  reg_file_vgpr0[lane] = ((VecElemU32*)&vgpr[lane])[0];
239  reg_file_vgpr1[lane] = ((VecElemU32*)&vgpr[lane])[1];
240  }
241  }
242 
243  DPRINTF(GPUVRF, "Write v[%d:%d]\n", vgprIdx0, vgprIdx1);
244  cu->vrf[wf->simdId]->printReg(wf, vgprIdx0);
245  cu->vrf[wf->simdId]->printReg(wf, vgprIdx1);
246  }
247  }
248 
249  void
251  {
252  negMod = true;
253  }
254 
255  void
257  {
258  absMod = true;
259  }
260 
266  template<bool Condition = (NumDwords == 1 || NumDwords == 2) && Const>
268  operator[](size_t idx) const
269  {
270  assert(idx < NumVecElemPerVecReg);
271 
272  if (scalar) {
273  DataType ret_val = scRegData.rawData();
274 
275  if (absMod) {
276  assert(std::is_floating_point<DataType>::value);
277  ret_val = std::fabs(ret_val);
278  }
279 
280  if (negMod) {
281  assert(std::is_floating_point<DataType>::value);
282  ret_val = -ret_val;
283  }
284 
285  return ret_val;
286  } else {
287  auto vgpr = vecReg.template as<DataType>();
288  DataType ret_val = vgpr[idx];
289 
290  if (absMod) {
291  assert(std::is_floating_point<DataType>::value);
292  ret_val = std::fabs(ret_val);
293  }
294 
295  if (negMod) {
296  assert(std::is_floating_point<DataType>::value);
297  ret_val = -ret_val;
298  }
299 
300  return ret_val;
301  }
302  }
303 
309  template<bool Condition = (NumDwords == 1 || NumDwords == 2) && !Const>
311  operator[](size_t idx)
312  {
313  assert(!scalar);
314  assert(idx < NumVecElemPerVecReg);
315 
316  return vecReg.template as<DataType>()[idx];
317  }
318 
319  private:
324  void
326  {
327  scalar = true;
328  scRegData.read();
329  }
330 
331  using VecRegCont = typename std::conditional<NumDwords == 2,
332  VecRegContainerU64, typename std::conditional<sizeof(DataType)
333  == sizeof(VecElemU16), VecRegContainerU16,
334  typename std::conditional<sizeof(DataType)
335  == sizeof(VecElemU8), VecRegContainerU8,
337 
341  bool scalar;
348  bool absMod;
349  bool negMod;
365  std::array<VecRegContainerU32*, NumDwords> vrfData;
366  };
367 
368  template<typename DataType, bool Const,
369  size_t NumDwords = sizeof(DataType) / sizeof(ScalarRegU32)>
370  class ScalarOperand final : public Operand
371  {
372  static_assert(NumDwords >= 1 && NumDwords <= MaxOperandDwords,
373  "Incorrect number of DWORDS for GCN3 operand.");
374  public:
375  ScalarOperand() = delete;
376 
377  ScalarOperand(GPUDynInstPtr gpuDynInst, int opIdx)
378  : Operand(gpuDynInst, opIdx)
379  {
380  std::memset(srfData.data(), 0, NumDwords * sizeof(ScalarRegU32));
381  }
382 
384  {
385  }
386 
394  template<bool Condition = NumDwords == 1 || NumDwords == 2>
396  rawData() const
397  {
398  assert(sizeof(DataType) <= sizeof(srfData));
399  DataType raw_data((DataType)0);
400  std::memcpy((void*)&raw_data, (void*)srfData.data(),
401  sizeof(DataType));
402 
403  return raw_data;
404  }
405 
406  void*
408  {
409  return (void*)srfData.data();
410  }
411 
412  void
413  read() override
414  {
415  Wavefront *wf = _gpuDynInst->wavefront();
416  ComputeUnit *cu = _gpuDynInst->computeUnit();
417 
418  if (!isScalarReg(_opIdx)) {
419  readSpecialVal();
420  } else {
421  for (auto i = 0; i < NumDwords; ++i) {
422  int sgprIdx = regIdx(i);
423  srfData[i] = cu->srf[wf->simdId]->read(sgprIdx);
424  DPRINTF(GPUSRF, "Read s[%d]\n", sgprIdx);
425  cu->srf[wf->simdId]->printReg(wf, sgprIdx);
426  }
427  }
428  }
429 
430  void
431  write() override
432  {
433  Wavefront *wf = _gpuDynInst->wavefront();
434  ComputeUnit *cu = _gpuDynInst->computeUnit();
435 
436  if (!isScalarReg(_opIdx)) {
437  if (_opIdx == REG_EXEC_LO) {
438  ScalarRegU64 new_exec_mask_val
439  = wf->execMask().to_ullong();
440  if (NumDwords == 1) {
441  std::memcpy((void*)&new_exec_mask_val,
442  (void*)srfData.data(), sizeof(VecElemU32));
443  } else if (NumDwords == 2) {
444  std::memcpy((void*)&new_exec_mask_val,
445  (void*)srfData.data(), sizeof(VecElemU64));
446  } else {
447  panic("Trying to write more than 2 DWORDS to EXEC\n");
448  }
449  VectorMask new_exec_mask(new_exec_mask_val);
450  wf->execMask() = new_exec_mask;
451  DPRINTF(GPUSRF, "Write EXEC\n");
452  DPRINTF(GPUSRF, "EXEC = %#x\n", new_exec_mask_val);
453  } else if (_opIdx == REG_EXEC_HI) {
458  assert(NumDwords == 1);
459  ScalarRegU32 new_exec_mask_hi_val(0);
460  ScalarRegU64 new_exec_mask_val
461  = wf->execMask().to_ullong();
462  std::memcpy((void*)&new_exec_mask_hi_val,
463  (void*)srfData.data(), sizeof(new_exec_mask_hi_val));
464  replaceBits(new_exec_mask_val, 63, 32,
465  new_exec_mask_hi_val);
466  VectorMask new_exec_mask(new_exec_mask_val);
467  wf->execMask() = new_exec_mask;
468  DPRINTF(GPUSRF, "Write EXEC\n");
469  DPRINTF(GPUSRF, "EXEC = %#x\n", new_exec_mask_val);
470  } else {
471  _gpuDynInst->writeMiscReg(_opIdx, srfData[0]);
472  }
473  } else {
474  for (auto i = 0; i < NumDwords; ++i) {
475  int sgprIdx = regIdx(i);
476  auto &sgpr = cu->srf[wf->simdId]->readWriteable(sgprIdx);
477  if (_gpuDynInst->isLoad()) {
478  assert(sizeof(DataType) <= sizeof(ScalarRegU64));
479  sgpr = reinterpret_cast<ScalarRegU32*>(
480  _gpuDynInst->scalar_data)[i];
481  } else {
482  sgpr = srfData[i];
483  }
484  DPRINTF(GPUSRF, "Write s[%d]\n", sgprIdx);
485  cu->srf[wf->simdId]->printReg(wf, sgprIdx);
486  }
487  }
488  }
489 
493  template<bool Condition = NumDwords == 1 || NumDwords == 2>
495  setBit(int bit, int bit_val)
496  {
497  DataType &sgpr = *((DataType*)srfData.data());
498  replaceBits(sgpr, bit, bit_val);
499  }
500 
501  template<bool Condition = (NumDwords == 1 || NumDwords == 2) && !Const>
503  operator=(DataType rhs)
504  {
505  std::memcpy((void*)srfData.data(), (void*)&rhs, sizeof(DataType));
506  return *this;
507  }
508 
509  private:
516  void
518  {
519  assert(NumDwords == 1 || NumDwords == 2);
520 
521  switch(_opIdx) {
522  case REG_EXEC_LO:
523  {
524  if (NumDwords == 1) {
525  ScalarRegU32 exec_mask = _gpuDynInst->wavefront()->
526  execMask().to_ulong();
527  std::memcpy((void*)srfData.data(), (void*)&exec_mask,
528  sizeof(exec_mask));
529  DPRINTF(GPUSRF, "Read EXEC\n");
530  DPRINTF(GPUSRF, "EXEC = %#x\n", exec_mask);
531  } else {
532  assert(NumDwords == 2);
533  ScalarRegU64 exec_mask = _gpuDynInst->wavefront()->
534  execMask().to_ullong();
535  std::memcpy((void*)srfData.data(), (void*)&exec_mask,
536  sizeof(exec_mask));
537  DPRINTF(GPUSRF, "Read EXEC\n");
538  DPRINTF(GPUSRF, "EXEC = %#x\n", exec_mask);
539  }
540  }
541  break;
542  case REG_EXEC_HI:
543  {
548  assert(NumDwords == 1);
549  ScalarRegU64 exec_mask = _gpuDynInst->wavefront()
550  ->execMask().to_ullong();
551 
552  ScalarRegU32 exec_mask_hi = bits(exec_mask, 63, 32);
553  std::memcpy((void*)srfData.data(), (void*)&exec_mask_hi,
554  sizeof(exec_mask_hi));
555  DPRINTF(GPUSRF, "Read EXEC_HI\n");
556  DPRINTF(GPUSRF, "EXEC_HI = %#x\n", exec_mask_hi);
557  }
558  break;
559  case REG_SRC_SWDA:
560  case REG_SRC_DPP:
561  case REG_SRC_LITERAL:
562  assert(NumDwords == 1);
563  srfData[0] = _gpuDynInst->srcLiteral();
564  break;
565  case REG_POS_HALF:
566  {
567  typename OpTraits<DataType>::FloatT pos_half = 0.5;
568  std::memcpy((void*)srfData.data(), (void*)&pos_half,
569  sizeof(pos_half));
570 
571  }
572  break;
573  case REG_NEG_HALF:
574  {
575  typename OpTraits<DataType>::FloatT neg_half = -0.5;
576  std::memcpy((void*)srfData.data(), (void*)&neg_half,
577  sizeof(neg_half));
578  }
579  break;
580  case REG_POS_ONE:
581  {
582  typename OpTraits<DataType>::FloatT pos_one = 1.0;
583  std::memcpy(srfData.data(), &pos_one, sizeof(pos_one));
584  }
585  break;
586  case REG_NEG_ONE:
587  {
588  typename OpTraits<DataType>::FloatT neg_one = -1.0;
589  std::memcpy(srfData.data(), &neg_one, sizeof(neg_one));
590  }
591  break;
592  case REG_POS_TWO:
593  {
594  typename OpTraits<DataType>::FloatT pos_two = 2.0;
595  std::memcpy(srfData.data(), &pos_two, sizeof(pos_two));
596  }
597  break;
598  case REG_NEG_TWO:
599  {
600  typename OpTraits<DataType>::FloatT neg_two = -2.0;
601  std::memcpy(srfData.data(), &neg_two, sizeof(neg_two));
602  }
603  break;
604  case REG_POS_FOUR:
605  {
606  typename OpTraits<DataType>::FloatT pos_four = 4.0;
607  std::memcpy(srfData.data(), &pos_four, sizeof(pos_four));
608  }
609  break;
610  case REG_NEG_FOUR:
611  {
612  typename OpTraits<DataType>::FloatT neg_four = -4.0;
613  std::memcpy((void*)srfData.data(), (void*)&neg_four ,
614  sizeof(neg_four));
615  }
616  break;
617  case REG_PI:
618  {
619  assert(sizeof(DataType) == sizeof(ScalarRegF64)
620  || sizeof(DataType) == sizeof(ScalarRegF32));
621 
622  const ScalarRegU32 pi_u32(0x3e22f983UL);
623  const ScalarRegU64 pi_u64(0x3fc45f306dc9c882ULL);
624 
625  if (sizeof(DataType) == sizeof(ScalarRegF64)) {
626  std::memcpy((void*)srfData.data(),
627  (void*)&pi_u64, sizeof(pi_u64));
628  } else {
629  std::memcpy((void*)srfData.data(),
630  (void*)&pi_u32, sizeof(pi_u32));
631  }
632  }
633  break;
634  default:
635  {
636  assert(sizeof(DataType) <= sizeof(srfData));
637  DataType misc_val(0);
638  if (isConstVal(_opIdx)) {
639  misc_val = (DataType)_gpuDynInst
640  ->readConstVal<DataType>(_opIdx);
641  } else {
642  misc_val = (DataType)_gpuDynInst->readMiscReg(_opIdx);
643  }
644  std::memcpy((void*)srfData.data(), (void*)&misc_val,
645  sizeof(DataType));
646  }
647  }
648  }
649 
655  int
656  regIdx(int dword) const
657  {
658  Wavefront *wf = _gpuDynInst->wavefront();
659  ComputeUnit *cu = _gpuDynInst->computeUnit();
660  int sgprIdx(-1);
661 
662  if (_opIdx == REG_VCC_LO) {
663  sgprIdx = cu->registerManager
664  ->mapSgpr(wf, wf->reservedScalarRegs - 2 + dword);
665  } else if (_opIdx == REG_FLAT_SCRATCH_HI) {
666  sgprIdx = cu->registerManager
667  ->mapSgpr(wf, wf->reservedScalarRegs - 3 + dword);
668  } else if (_opIdx == REG_FLAT_SCRATCH_LO) {
669  assert(NumDwords == 1);
670  sgprIdx = cu->registerManager
671  ->mapSgpr(wf, wf->reservedScalarRegs - 4 + dword);
672  } else {
673  sgprIdx = cu->registerManager->mapSgpr(wf, _opIdx + dword);
674  }
675 
676  assert(sgprIdx > -1);
677 
678  return sgprIdx;
679  }
680 
689  std::array<ScalarRegU32, NumDwords> srfData;
690  };
691 
692  // typedefs for the various sizes/types of scalar operands
706  // non-writeable versions of scalar operands
720  // typedefs for the various sizes/types of vector operands
735  // non-writeable versions of vector operands
750 }
751 
752 #endif // __ARCH_GCN3_OPERAND_HH__
Gcn3ISA::Operand::read
virtual void read()=0
read from and write to the underlying register(s) that this operand is referring to.
Gcn3ISA::OpTraits< ScalarRegU64 >::FloatT
double FloatT
Definition: operand.hh:62
Gcn3ISA::Operand
Definition: operand.hh:64
Gcn3ISA::VecElemU16
uint16_t VecElemU16
Definition: registers.hh:164
Gcn3ISA::REG_SRC_DPP
@ REG_SRC_DPP
Definition: registers.hh:126
Gcn3ISA::NumVecElemPerVecReg
const int NumVecElemPerVecReg(64)
Gcn3ISA::ScalarOperand::rawData
std::enable_if< Condition, DataType >::type rawData() const
we store scalar data in a std::array, however if we need the full operand data we use this method to ...
Definition: operand.hh:396
Gcn3ISA::Operand::Operand
Operand(GPUDynInstPtr gpuDynInst, int opIdx)
Definition: operand.hh:69
Gcn3ISA::REG_POS_FOUR
@ REG_POS_FOUR
Definition: registers.hh:121
replaceBits
void replaceBits(T &val, int first, int last, B bit_val)
A convenience function to replace bits first to last of val with bit_val in place.
Definition: bitfield.hh:179
Gcn3ISA::VecOperand::readScalar
void readScalar()
if we determine that this operand is a scalar (reg or constant) then we read the scalar data into the...
Definition: operand.hh:325
Gcn3ISA::ScalarOperand::rawDataPtr
void * rawDataPtr()
Definition: operand.hh:407
Gcn3ISA::VecOperand::absModifier
void absModifier()
Definition: operand.hh:256
Gcn3ISA::VecOperand::operator[]
std::enable_if< Condition, DataType & >::type operator[](size_t idx)
setter [] operator.
Definition: operand.hh:311
Gcn3ISA::ScalarRegF64
double ScalarRegF64
Definition: registers.hh:159
ArmISA::i
Bitfield< 7 > i
Definition: miscregs_types.hh:63
Gcn3ISA::VecOperand::scalar
bool scalar
whether this operand a scalar or not.
Definition: operand.hh:341
Gcn3ISA::isScalarReg
bool isScalarReg(int opIdx)
Definition: registers.cc:217
type
uint8_t type
Definition: inet.hh:421
Gcn3ISA::REG_FLAT_SCRATCH_LO
@ REG_FLAT_SCRATCH_LO
Definition: registers.hh:53
Gcn3ISA::REG_POS_HALF
@ REG_POS_HALF
Definition: registers.hh:115
Gcn3ISA::ScalarRegF32
float ScalarRegF32
Definition: registers.hh:156
Gcn3ISA::ScalarRegU64
uint64_t ScalarRegU64
Definition: registers.hh:157
RegisterManager::mapSgpr
int mapSgpr(Wavefront *w, int sgprIndex)
Definition: register_manager.cc:101
ComputeUnit::registerManager
RegisterManager * registerManager
Definition: compute_unit.hh:275
Gcn3ISA::VecOperand::absMod
bool absMod
absolute value and negative modifiers.
Definition: operand.hh:348
Gcn3ISA::REG_VCC_LO
@ REG_VCC_LO
Definition: registers.hh:57
Gcn3ISA::REG_EXEC_LO
@ REG_EXEC_LO
Definition: registers.hh:77
registers.hh
Gcn3ISA::ScalarOperand::~ScalarOperand
~ScalarOperand()
Definition: operand.hh:383
Gcn3ISA::Operand::Operand
Operand()=delete
Gcn3ISA::VecElemU32
uint32_t VecElemU32
Definition: registers.hh:166
Gcn3ISA::isVectorReg
bool isVectorReg(int opIdx)
Definition: registers.cc:230
Gcn3ISA::OpTraits::FloatT
float FloatT
Definition: operand.hh:60
wavefront.hh
Gcn3ISA::ScalarOperand::regIdx
int regIdx(int dword) const
for scalars we need to do some extra work to figure out how to map the op selector to the sgpr idx be...
Definition: operand.hh:656
Gcn3ISA::ScalarOperand::operator=
std::enable_if< Condition, ScalarOperand & >::type operator=(DataType rhs)
Definition: operand.hh:503
Gcn3ISA::VecOperand::negMod
bool negMod
Definition: operand.hh:349
ComputeUnit
Definition: compute_unit.hh:198
Gcn3ISA::REG_SRC_LITERAL
@ REG_SRC_LITERAL
Definition: registers.hh:131
Gcn3ISA::VecOperand::VecOperand
VecOperand()=delete
ComputeUnit::srf
std::vector< ScalarRegisterFile * > srf
Definition: compute_unit.hh:294
vector_register_file.hh
Gcn3ISA
classes that represnt vector/scalar operands in GCN3 ISA.
Definition: decoder.cc:44
Gcn3ISA::OpTraits< ScalarRegF64 >::FloatT
double FloatT
Definition: operand.hh:61
Gcn3ISA::VecOperand
Definition: operand.hh:102
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:234
Gcn3ISA::Operand::_opIdx
int _opIdx
op selector value for this operand.
Definition: operand.hh:94
Gcn3ISA::opSelectorToRegIdx
int opSelectorToRegIdx(int idx, int numScalarRegs)
Definition: registers.cc:123
Gcn3ISA::VecOperand::VecOperand
VecOperand(GPUDynInstPtr gpuDynInst, int opIdx)
Definition: operand.hh:110
ComputeUnit::vrf
std::vector< VectorRegisterFile * > vrf
Definition: compute_unit.hh:292
Gcn3ISA::Operand::_gpuDynInst
GPUDynInstPtr _gpuDynInst
instruction object that owns this operand
Definition: operand.hh:87
Gcn3ISA::ScalarOperand::write
void write() override
Definition: operand.hh:431
Gcn3ISA::VecRegContainerU16
VecRegU16::Container VecRegContainerU16
Definition: registers.hh:197
scalar_register_file.hh
Gcn3ISA::VecRegContainerU64
VecRegU64::Container VecRegContainerU64
Definition: registers.hh:199
Gcn3ISA::REG_FLAT_SCRATCH_HI
@ REG_FLAT_SCRATCH_HI
Definition: registers.hh:54
Gcn3ISA::OpTraits
convenience traits so we can automatically infer the correct FP type without looking at the number of...
Definition: operand.hh:60
Gcn3ISA::ScalarOperand::readSpecialVal
void readSpecialVal()
we have determined that we are not reading our scalar operand data from the register file,...
Definition: operand.hh:517
Gcn3ISA::REG_POS_TWO
@ REG_POS_TWO
Definition: registers.hh:119
Wavefront::simdId
const int simdId
Definition: wavefront.hh:92
Gcn3ISA::VecOperand::readSrc
void readSrc()
certain vector operands can read from the vrf/srf or constants.
Definition: operand.hh:131
Gcn3ISA::REG_NEG_ONE
@ REG_NEG_ONE
Definition: registers.hh:118
vec_reg.hh
Gcn3ISA::REG_POS_ONE
@ REG_POS_ONE
Definition: registers.hh:117
Gcn3ISA::VecOperand::~VecOperand
~VecOperand()
Definition: operand.hh:118
Gcn3ISA::ScalarOperand::ScalarOperand
ScalarOperand(GPUDynInstPtr gpuDynInst, int opIdx)
Definition: operand.hh:377
Gcn3ISA::Operand::write
virtual void write()=0
Gcn3ISA::VecOperand::scRegData
ScalarOperand< DataType, Const, NumDwords > scRegData
for src operands that read scalars (i.e., scalar regs or a scalar constant).
Definition: operand.hh:360
Gcn3ISA::VecOperand::negModifier
void negModifier()
Definition: operand.hh:250
Gcn3ISA::ScalarOperand::srfData
std::array< ScalarRegU32, NumDwords > srfData
in GCN3 each register is represented as a 32b unsigned value, however operands may require up to 16 r...
Definition: operand.hh:689
Wavefront
Definition: wavefront.hh:57
Gcn3ISA::ScalarOperand
Definition: operand.hh:98
Wavefront::execMask
VectorMask & execMask()
Definition: wavefront.cc:1398
Gcn3ISA::ScalarOperand::setBit
std::enable_if< Condition, void >::type setBit(int bit, int bit_val)
bit access to scalar data.
Definition: operand.hh:495
GPUDynInstPtr
std::shared_ptr< GPUDynInst > GPUDynInstPtr
Definition: misc.hh:48
Gcn3ISA::ScalarRegU32
uint32_t ScalarRegU32
Definition: registers.hh:154
Gcn3ISA::REG_NEG_TWO
@ REG_NEG_TWO
Definition: registers.hh:120
Gcn3ISA::ScalarOperand::ScalarOperand
ScalarOperand()=delete
RegisterManager::mapVgpr
int mapVgpr(Wavefront *w, int vgprIndex)
Definition: register_manager.cc:94
Gcn3ISA::VecElemU8
uint8_t VecElemU8
Definition: registers.hh:162
Gcn3ISA::REG_NEG_HALF
@ REG_NEG_HALF
Definition: registers.hh:116
Gcn3ISA::VecRegContainerU32
VecRegU32::Container VecRegContainerU32
Definition: registers.hh:198
Gcn3ISA::REG_SRC_SWDA
@ REG_SRC_SWDA
Definition: registers.hh:125
Gcn3ISA::REG_NEG_FOUR
@ REG_NEG_FOUR
Definition: registers.hh:122
Gcn3ISA::VecOperand::read
void read() override
read from the vrf.
Definition: operand.hh:147
Gcn3ISA::VecElemU64
uint64_t VecElemU64
Definition: registers.hh:169
VectorMask
std::bitset< std::numeric_limits< unsigned long long >::digits > VectorMask
Definition: misc.hh:44
Gcn3ISA::REG_PI
@ REG_PI
Definition: registers.hh:123
Gcn3ISA::ScalarOperand::read
void read() override
Definition: operand.hh:413
Wavefront::reservedScalarRegs
int reservedScalarRegs
Definition: wavefront.hh:188
Gcn3ISA::VecOperand::operator[]
std::enable_if< Condition, const DataType >::type operator[](size_t idx) const
getter [] operator.
Definition: operand.hh:268
Gcn3ISA::REG_EXEC_HI
@ REG_EXEC_HI
Definition: registers.hh:78
Gcn3ISA::MaxOperandDwords
constexpr size_t MaxOperandDwords(16)
Gcn3ISA::VecRegContainerU8
VecRegU8::Container VecRegContainerU8
Definition: registers.hh:196
Gcn3ISA::VecOperand::vecReg
VecRegCont vecReg
this holds all the operand data in a single vector register object (i.e., if an operand is 64b,...
Definition: operand.hh:355
Gcn3ISA::VecOperand::vrfData
std::array< VecRegContainerU32 *, NumDwords > vrfData
pointers to the underlyding registers (i.e., the actual registers in the register file).
Definition: operand.hh:365
Gcn3ISA::isConstVal
bool isConstVal(int opIdx)
Definition: registers.cc:186
Gcn3ISA::VecOperand::VecRegCont
typename std::conditional< NumDwords==2, VecRegContainerU64, typename std::conditional< sizeof(DataType)==sizeof(VecElemU16), VecRegContainerU16, typename std::conditional< sizeof(DataType)==sizeof(VecElemU8), VecRegContainerU8, VecRegContainerU32 >::type >::type >::type VecRegCont
Definition: operand.hh:336
Gcn3ISA::VecOperand::write
void write() override
write to the vrf.
Definition: operand.hh:199
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:171
bits
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Definition: bitfield.hh:75

Generated on Wed Sep 30 2020 14:02:07 for gem5 by doxygen 1.8.17