1 //===-- AMDILDeviceInfo.cpp - AMDILDeviceInfo class -----------------------===// 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 // 10 /// \file 11 /// \brief Function that creates DeviceInfo from a device name and other information. 12 // 13 //==-----------------------------------------------------------------------===// 14 #include "AMDILDevices.h" 15 #include "AMDGPUSubtarget.h" 16 17 using namespace llvm; 18 namespace llvm { 19 namespace AMDGPUDeviceInfo { 20 getDeviceFromName(const std::string & deviceName,AMDGPUSubtarget * ptr,bool is64bit,bool is64on32bit)21AMDGPUDevice* getDeviceFromName(const std::string &deviceName, 22 AMDGPUSubtarget *ptr, 23 bool is64bit, bool is64on32bit) { 24 if (deviceName.c_str()[2] == '7') { 25 switch (deviceName.c_str()[3]) { 26 case '1': 27 return new AMDGPU710Device(ptr); 28 case '7': 29 return new AMDGPU770Device(ptr); 30 default: 31 return new AMDGPU7XXDevice(ptr); 32 } 33 } else if (deviceName == "cypress") { 34 #if DEBUG 35 assert(!is64bit && "This device does not support 64bit pointers!"); 36 assert(!is64on32bit && "This device does not support 64bit" 37 " on 32bit pointers!"); 38 #endif 39 return new AMDGPUCypressDevice(ptr); 40 } else if (deviceName == "juniper") { 41 #if DEBUG 42 assert(!is64bit && "This device does not support 64bit pointers!"); 43 assert(!is64on32bit && "This device does not support 64bit" 44 " on 32bit pointers!"); 45 #endif 46 return new AMDGPUEvergreenDevice(ptr); 47 } else if (deviceName == "redwood") { 48 #if DEBUG 49 assert(!is64bit && "This device does not support 64bit pointers!"); 50 assert(!is64on32bit && "This device does not support 64bit" 51 " on 32bit pointers!"); 52 #endif 53 return new AMDGPURedwoodDevice(ptr); 54 } else if (deviceName == "cedar") { 55 #if DEBUG 56 assert(!is64bit && "This device does not support 64bit pointers!"); 57 assert(!is64on32bit && "This device does not support 64bit" 58 " on 32bit pointers!"); 59 #endif 60 return new AMDGPUCedarDevice(ptr); 61 } else if (deviceName == "barts" || deviceName == "turks") { 62 #if DEBUG 63 assert(!is64bit && "This device does not support 64bit pointers!"); 64 assert(!is64on32bit && "This device does not support 64bit" 65 " on 32bit pointers!"); 66 #endif 67 return new AMDGPUNIDevice(ptr); 68 } else if (deviceName == "cayman") { 69 #if DEBUG 70 assert(!is64bit && "This device does not support 64bit pointers!"); 71 assert(!is64on32bit && "This device does not support 64bit" 72 " on 32bit pointers!"); 73 #endif 74 return new AMDGPUCaymanDevice(ptr); 75 } else if (deviceName == "caicos") { 76 #if DEBUG 77 assert(!is64bit && "This device does not support 64bit pointers!"); 78 assert(!is64on32bit && "This device does not support 64bit" 79 " on 32bit pointers!"); 80 #endif 81 return new AMDGPUNIDevice(ptr); 82 } else if (deviceName == "SI") { 83 return new AMDGPUSIDevice(ptr); 84 } else { 85 #if DEBUG 86 assert(!is64bit && "This device does not support 64bit pointers!"); 87 assert(!is64on32bit && "This device does not support 64bit" 88 " on 32bit pointers!"); 89 #endif 90 return new AMDGPU7XXDevice(ptr); 91 } 92 } 93 } // End namespace AMDGPUDeviceInfo 94 } // End namespace llvm 95