aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon/AMDILEvergreenDevice.cpp
blob: 3532a28fe0fd84f432c72f5bc5a6d57b06bf66d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
//===-- AMDILEvergreenDevice.cpp - Device Info for Evergreen --------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//==-----------------------------------------------------------------------===//
#include "AMDILEvergreenDevice.h"

using namespace llvm;

AMDGPUEvergreenDevice::AMDGPUEvergreenDevice(AMDGPUSubtarget *ST)
: AMDGPUDevice(ST) {
  setCaps();
  std::string name = ST->getDeviceName();
  if (name == "cedar") {
    mDeviceFlag = OCL_DEVICE_CEDAR;
  } else if (name == "redwood") {
    mDeviceFlag = OCL_DEVICE_REDWOOD;
  } else if (name == "cypress") {
    mDeviceFlag = OCL_DEVICE_CYPRESS;
  } else {
    mDeviceFlag = OCL_DEVICE_JUNIPER;
  }
}

AMDGPUEvergreenDevice::~AMDGPUEvergreenDevice() {
}

size_t AMDGPUEvergreenDevice::getMaxLDSSize() const {
  if (usesHardware(AMDGPUDeviceInfo::LocalMem)) {
    return MAX_LDS_SIZE_800;
  } else {
    return 0;
  }
}
size_t AMDGPUEvergreenDevice::getMaxGDSSize() const {
  if (usesHardware(AMDGPUDeviceInfo::RegionMem)) {
    return MAX_LDS_SIZE_800;
  } else {
    return 0;
  }
}
uint32_t AMDGPUEvergreenDevice::getMaxNumUAVs() const {
  return 12;
}

uint32_t AMDGPUEvergreenDevice::getResourceID(uint32_t id) const {
  switch(id) {
  default:
    assert(0 && "ID type passed in is unknown!");
    break;
  case CONSTANT_ID:
  case RAW_UAV_ID:
    return GLOBAL_RETURN_RAW_UAV_ID;
  case GLOBAL_ID:
  case ARENA_UAV_ID:
    return DEFAULT_ARENA_UAV_ID;
  case LDS_ID:
    if (usesHardware(AMDGPUDeviceInfo::LocalMem)) {
      return DEFAULT_LDS_ID;
    } else {
      return DEFAULT_ARENA_UAV_ID;
    }
  case GDS_ID:
    if (usesHardware(AMDGPUDeviceInfo::RegionMem)) {
      return DEFAULT_GDS_ID;
    } else {
      return DEFAULT_ARENA_UAV_ID;
    }
  case SCRATCH_ID:
    if (usesHardware(AMDGPUDeviceInfo::PrivateMem)) {
      return DEFAULT_SCRATCH_ID;
    } else {
      return DEFAULT_ARENA_UAV_ID;
    }
  };
  return 0;
}

size_t AMDGPUEvergreenDevice::getWavefrontSize() const {
  return AMDGPUDevice::WavefrontSize;
}

uint32_t AMDGPUEvergreenDevice::getGeneration() const {
  return AMDGPUDeviceInfo::HD5XXX;
}

void AMDGPUEvergreenDevice::setCaps() {
  mSWBits.set(AMDGPUDeviceInfo::ArenaSegment);
  mHWBits.set(AMDGPUDeviceInfo::ArenaUAV);
  mHWBits.set(AMDGPUDeviceInfo::HW64BitDivMod);
  mSWBits.reset(AMDGPUDeviceInfo::HW64BitDivMod);
  mSWBits.set(AMDGPUDeviceInfo::Signed24BitOps);
  if (mSTM->isOverride(AMDGPUDeviceInfo::ByteStores)) {
    mHWBits.set(AMDGPUDeviceInfo::ByteStores);
  }
  if (mSTM->isOverride(AMDGPUDeviceInfo::Debug)) {
    mSWBits.set(AMDGPUDeviceInfo::LocalMem);
    mSWBits.set(AMDGPUDeviceInfo::RegionMem);
  } else {
    mHWBits.set(AMDGPUDeviceInfo::LocalMem);
    mHWBits.set(AMDGPUDeviceInfo::RegionMem);
  }
  mHWBits.set(AMDGPUDeviceInfo::Images);
  if (mSTM->isOverride(AMDGPUDeviceInfo::NoAlias)) {
    mHWBits.set(AMDGPUDeviceInfo::NoAlias);
  }
  mHWBits.set(AMDGPUDeviceInfo::CachedMem);
  if (mSTM->isOverride(AMDGPUDeviceInfo::MultiUAV)) {
    mHWBits.set(AMDGPUDeviceInfo::MultiUAV);
  }
  mHWBits.set(AMDGPUDeviceInfo::ByteLDSOps);
  mSWBits.reset(AMDGPUDeviceInfo::ByteLDSOps);
  mHWBits.set(AMDGPUDeviceInfo::ArenaVectors);
  mHWBits.set(AMDGPUDeviceInfo::LongOps);
  mSWBits.reset(AMDGPUDeviceInfo::LongOps);
  mHWBits.set(AMDGPUDeviceInfo::TmrReg);
}

AMDGPUCypressDevice::AMDGPUCypressDevice(AMDGPUSubtarget *ST)
  : AMDGPUEvergreenDevice(ST) {
  setCaps();
}

AMDGPUCypressDevice::~AMDGPUCypressDevice() {
}

void AMDGPUCypressDevice::setCaps() {
  if (mSTM->isOverride(AMDGPUDeviceInfo::DoubleOps)) {
    mHWBits.set(AMDGPUDeviceInfo::DoubleOps);
    mHWBits.set(AMDGPUDeviceInfo::FMA);
  }
}


AMDGPUCedarDevice::AMDGPUCedarDevice(AMDGPUSubtarget *ST)
  : AMDGPUEvergreenDevice(ST) {
  setCaps();
}

AMDGPUCedarDevice::~AMDGPUCedarDevice() {
}

void AMDGPUCedarDevice::setCaps() {
  mSWBits.set(AMDGPUDeviceInfo::FMA);
}

size_t AMDGPUCedarDevice::getWavefrontSize() const {
  return AMDGPUDevice::QuarterWavefrontSize;
}

AMDGPURedwoodDevice::AMDGPURedwoodDevice(AMDGPUSubtarget *ST)
  : AMDGPUEvergreenDevice(ST) {
  setCaps();
}

AMDGPURedwoodDevice::~AMDGPURedwoodDevice()
{
}

void AMDGPURedwoodDevice::setCaps() {
  mSWBits.set(AMDGPUDeviceInfo::FMA);
}

size_t AMDGPURedwoodDevice::getWavefrontSize() const {
  return AMDGPUDevice::HalfWavefrontSize;
}