1 //===-- AMDIL7XXDevice.cpp - Device Info for 7XX GPUs ---------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //==-----------------------------------------------------------------------===// 9 #include "AMDIL7XXDevice.h" 10 #include "AMDGPUSubtarget.h" 11 #include "AMDILDevice.h" 12 13 using namespace llvm; 14 AMDGPU7XXDevice(AMDGPUSubtarget * ST)15AMDGPU7XXDevice::AMDGPU7XXDevice(AMDGPUSubtarget *ST) : AMDGPUDevice(ST) 16 { 17 setCaps(); 18 std::string name = mSTM->getDeviceName(); 19 if (name == "rv710") { 20 mDeviceFlag = OCL_DEVICE_RV710; 21 } else if (name == "rv730") { 22 mDeviceFlag = OCL_DEVICE_RV730; 23 } else { 24 mDeviceFlag = OCL_DEVICE_RV770; 25 } 26 } 27 ~AMDGPU7XXDevice()28AMDGPU7XXDevice::~AMDGPU7XXDevice() 29 { 30 } 31 setCaps()32void AMDGPU7XXDevice::setCaps() 33 { 34 mSWBits.set(AMDGPUDeviceInfo::LocalMem); 35 } 36 getMaxLDSSize() const37size_t AMDGPU7XXDevice::getMaxLDSSize() const 38 { 39 if (usesHardware(AMDGPUDeviceInfo::LocalMem)) { 40 return MAX_LDS_SIZE_700; 41 } 42 return 0; 43 } 44 getWavefrontSize() const45size_t AMDGPU7XXDevice::getWavefrontSize() const 46 { 47 return AMDGPUDevice::HalfWavefrontSize; 48 } 49 getGeneration() const50uint32_t AMDGPU7XXDevice::getGeneration() const 51 { 52 return AMDGPUDeviceInfo::HD4XXX; 53 } 54 getResourceID(uint32_t DeviceID) const55uint32_t AMDGPU7XXDevice::getResourceID(uint32_t DeviceID) const 56 { 57 switch (DeviceID) { 58 default: 59 assert(0 && "ID type passed in is unknown!"); 60 break; 61 case GLOBAL_ID: 62 case CONSTANT_ID: 63 case RAW_UAV_ID: 64 case ARENA_UAV_ID: 65 break; 66 case LDS_ID: 67 if (usesHardware(AMDGPUDeviceInfo::LocalMem)) { 68 return DEFAULT_LDS_ID; 69 } 70 break; 71 case SCRATCH_ID: 72 if (usesHardware(AMDGPUDeviceInfo::PrivateMem)) { 73 return DEFAULT_SCRATCH_ID; 74 } 75 break; 76 case GDS_ID: 77 assert(0 && "GDS UAV ID is not supported on this chip"); 78 if (usesHardware(AMDGPUDeviceInfo::RegionMem)) { 79 return DEFAULT_GDS_ID; 80 } 81 break; 82 }; 83 84 return 0; 85 } 86 getMaxNumUAVs() const87uint32_t AMDGPU7XXDevice::getMaxNumUAVs() const 88 { 89 return 1; 90 } 91 AMDGPU770Device(AMDGPUSubtarget * ST)92AMDGPU770Device::AMDGPU770Device(AMDGPUSubtarget *ST): AMDGPU7XXDevice(ST) 93 { 94 setCaps(); 95 } 96 ~AMDGPU770Device()97AMDGPU770Device::~AMDGPU770Device() 98 { 99 } 100 setCaps()101void AMDGPU770Device::setCaps() 102 { 103 if (mSTM->isOverride(AMDGPUDeviceInfo::DoubleOps)) { 104 mSWBits.set(AMDGPUDeviceInfo::FMA); 105 mHWBits.set(AMDGPUDeviceInfo::DoubleOps); 106 } 107 mSWBits.set(AMDGPUDeviceInfo::BarrierDetect); 108 mHWBits.reset(AMDGPUDeviceInfo::LongOps); 109 mSWBits.set(AMDGPUDeviceInfo::LongOps); 110 mSWBits.set(AMDGPUDeviceInfo::LocalMem); 111 } 112 getWavefrontSize() const113size_t AMDGPU770Device::getWavefrontSize() const 114 { 115 return AMDGPUDevice::WavefrontSize; 116 } 117 AMDGPU710Device(AMDGPUSubtarget * ST)118AMDGPU710Device::AMDGPU710Device(AMDGPUSubtarget *ST) : AMDGPU7XXDevice(ST) 119 { 120 } 121 ~AMDGPU710Device()122AMDGPU710Device::~AMDGPU710Device() 123 { 124 } 125 getWavefrontSize() const126size_t AMDGPU710Device::getWavefrontSize() const 127 { 128 return AMDGPUDevice::QuarterWavefrontSize; 129 } 130