P4 to Git Change 1455464 by asalmanp@asalmanp-ocl-stg on 2017/09/05 18:07:43
SWDEV-79278 - [OCL][PAL] refactoring PAL Null device create function to account for creating all the gfx9+ subtarget devices such as gfx901/gfx902/etc
ReviewboardURL = http://ocltc.amd.com/reviews/r/13378/
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldefs.hpp#21 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#53 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.hpp#18 edit
[ROCm/clr commit: 9772217dcb]
Tá an tiomantas seo le fáil i:
@@ -147,33 +147,21 @@ static const AMDDeviceInfo DeviceInfo[] = {
|
|||||||
/* Baffin */ {"Baffin", "baffin", 4, 16, 1, 256, 64 * Ki, 32, 804},
|
/* Baffin */ {"Baffin", "baffin", 4, 16, 1, 256, 64 * Ki, 32, 804},
|
||||||
};
|
};
|
||||||
|
|
||||||
// The GfxIpDeviceInfo table must match with GfxIpLevel enum
|
|
||||||
// (located in //depot/stg/pal/inc/core/palDevice.h).
|
|
||||||
static const AMDDeviceInfo GfxIpDeviceInfo[] = {
|
|
||||||
/* Unknown */ {"unknown", "unknown", 4, 16, 1, 256, 64 * Ki, 32, 000},
|
|
||||||
/* GFX600 */ {"gfx600", "gfx600", 4, 16, 1, 256, 64 * Ki, 32, 600},
|
|
||||||
/* GFX700 */ {"gfx700", "gfx700", 4, 16, 1, 256, 64 * Ki, 32, 700},
|
|
||||||
/* GFX800 */ {"gfx800", "gfx800", 4, 16, 1, 256, 64 * Ki, 32, 800},
|
|
||||||
/* GFX810 */ {"gfx810", "gfx810", 4, 16, 1, 256, 64 * Ki, 32, 810},
|
|
||||||
/* GFX900 */ {"gfx900", "gfx900", 4, 16, 1, 256, 64 * Ki, 32, 900},
|
|
||||||
/* GFX1000 */ {"gfx1000", "gfx1000", 4, 16, 1, 256, 64 * Ki, 32, 1000 },
|
|
||||||
};
|
|
||||||
|
|
||||||
// Ordering as per AsicRevision# in //depot/stg/pal/inc/core/palDevice.h and
|
// Ordering as per AsicRevision# in //depot/stg/pal/inc/core/palDevice.h and
|
||||||
// http://confluence.amd.com/pages/viewpage.action?spaceKey=ASLC&title=AMDGPU+Target+Names
|
// http://confluence.amd.com/pages/viewpage.action?spaceKey=ASLC&title=AMDGPU+Target+Names
|
||||||
static const AMDDeviceInfo Gfx9PlusSubDeviceInfo[] = {
|
static const AMDDeviceInfo Gfx9PlusSubDeviceInfo[] = {
|
||||||
/* Vega10 */{"gfx900", "gfx900", 4, 16, 1, 256, 64 * Ki, 32, 900},
|
/* Vega10 */{"gfx900", "gfx900", 4, 16, 1, 256, 64 * Ki, 32, 900},
|
||||||
/* Vega10 XNACK */{"gfx901", "gfx901", 4, 16, 1, 256, 64 * Ki, 32, 901},
|
/* Vega10 XNACK */{"gfx901", "gfx901", 4, 16, 1, 256, 64 * Ki, 32, 901},
|
||||||
/* Vega12 */{"gfx904", "gfx904", 4, 16, 1, 256, 64 * Ki, 32, 904},
|
/* Vega12 */{ "", "", 4, 16, 1, 256, 64 * Ki, 32, 904},
|
||||||
/* Vega12 XNACK */{"gfx905", "gfx905", 4, 16, 1, 256, 64 * Ki, 32, 905},
|
/* Vega12 XNACK */{ "", "", 4, 16, 1, 256, 64 * Ki, 32, 905},
|
||||||
/* Vega20 */{"gfx906", "gfx906", 4, 16, 1, 256, 64 * Ki, 32, 906},
|
/* Vega20 */{ "", "", 4, 16, 1, 256, 64 * Ki, 32, 906},
|
||||||
/* Vega20 XNACK */{"gfx907", "gfx907", 4, 16, 1, 256, 64 * Ki, 32, 907},
|
/* Vega20 XNACK */{ "", "", 4, 16, 1, 256, 64 * Ki, 32, 907},
|
||||||
/* Raven */{"gfx902", "gfx902", 4, 16, 1, 256, 64 * Ki, 32, 902},
|
/* Raven */{"gfx902", "gfx902", 4, 16, 1, 256, 64 * Ki, 32, 902},
|
||||||
/* Raven XNACK */{"gfx903", "gfx903", 4, 16, 1, 256, 64 * Ki, 32, 903},
|
/* Raven XNACK */{"gfx903", "gfx903", 4, 16, 1, 256, 64 * Ki, 32, 903},
|
||||||
/* Raven2 */{0},
|
/* Raven2 */{"" , "" , 0, 0 , 0, 0 , 0 , 0 , 0},
|
||||||
/* Raven2 XNACK */{0},
|
/* Raven2 XNACK */{"" , "" , 0, 0 , 0, 0 , 0 , 0 , 0},
|
||||||
/* Navi10 */{"gfx1000", "gfx1000", 4, 16, 1, 256, 64 * Ki, 32, 1000},
|
/* Navi10 */{ "", "", 4, 16, 1, 256, 64 * Ki, 32, 1000},
|
||||||
/* Navi10 XNACK */{"gfx1001", "gfx1001", 4, 16, 1, 256, 64 * Ki, 32, 1001},
|
/* Navi10 XNACK */{ "", "", 4, 16, 1, 256, 64 * Ki, 32, 1001},
|
||||||
};
|
};
|
||||||
|
|
||||||
enum gfx_handle {
|
enum gfx_handle {
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ NullDevice::NullDevice()
|
|||||||
|
|
||||||
bool NullDevice::init() {
|
bool NullDevice::init() {
|
||||||
std::vector<Device*> devices;
|
std::vector<Device*> devices;
|
||||||
|
std::string driverVersion;
|
||||||
|
|
||||||
devices = getDevices(CL_DEVICE_TYPE_GPU, false);
|
devices = getDevices(CL_DEVICE_TYPE_GPU, false);
|
||||||
|
|
||||||
@@ -74,11 +75,14 @@ bool NullDevice::init() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop through all active devices and see if we match one
|
// Loop through all active PAL devices and see if we match one
|
||||||
for (uint i = 0; i < devices.size(); ++i) {
|
for (uint i = 0; i < devices.size(); ++i) {
|
||||||
if (static_cast<NullDevice*>(devices[i])->asicRevision() == revision) {
|
driverVersion = static_cast<amd::Device*>(devices[i])->info().driverVersion_;
|
||||||
foundActive = true;
|
if (driverVersion.find("PAL") != std::string::npos) {
|
||||||
break;
|
if (static_cast<NullDevice*>(devices[i])->asicRevision() == revision) {
|
||||||
|
foundActive = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,42 +102,89 @@ bool NullDevice::init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Loop through all supported devices and create each of them
|
// Loop through all supported devices and create each of them
|
||||||
for (uint id = static_cast<uint>(Pal::GfxIpLevel::GfxIp7);
|
for (uint id = 0;
|
||||||
id <= static_cast<uint>(Pal::GfxIpLevel::GfxIp10); ++id) {
|
id < sizeof(Gfx9PlusSubDeviceInfo)/sizeof(AMDDeviceInfo); ++id) {
|
||||||
bool foundActive = false;
|
bool foundActive = false;
|
||||||
Pal::GfxIpLevel ipLevel = static_cast<Pal::GfxIpLevel>(id);
|
uint gfxipVersion = pal::Gfx9PlusSubDeviceInfo[id].gfxipVersion_;
|
||||||
|
|
||||||
if (pal::GfxIpDeviceInfo[id].targetName_[0] == '\0') {
|
if (pal::Gfx9PlusSubDeviceInfo[id].targetName_[0] == '\0') {
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
// Loop through all active devices and see if we match one
|
|
||||||
for (uint i = 0; i < devices.size(); ++i) {
|
|
||||||
if (static_cast<NullDevice*>(devices[i])->ipLevel() == ipLevel) {
|
|
||||||
foundActive = true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Don't report an offline device if it's active
|
// Loop through all active PAL devices and see if we match one
|
||||||
if (foundActive) {
|
for (uint i = 0; i < devices.size(); ++i) {
|
||||||
continue;
|
driverVersion = static_cast<amd::Device*>(devices[i])->info().driverVersion_;
|
||||||
}
|
if (driverVersion.find("PAL") != std::string::npos) {
|
||||||
|
if (static_cast<NullDevice*>(devices[i])->hwInfo()->gfxipVersion_ ==
|
||||||
NullDevice* dev = new NullDevice();
|
gfxipVersion) {
|
||||||
if (nullptr != dev) {
|
foundActive = true;
|
||||||
if (!dev->create(Pal::AsicRevision::Unknown, ipLevel)) {
|
break;
|
||||||
delete dev;
|
}
|
||||||
} else {
|
}
|
||||||
dev->registerDevice();
|
}
|
||||||
|
|
||||||
|
// Don't report an offline device if it's active
|
||||||
|
if (foundActive) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pal::GfxIpLevel ipLevel = Pal::GfxIpLevel::_None;
|
||||||
|
uint ipLevelMajor = round(pal::Gfx9PlusSubDeviceInfo[id].gfxipVersion_ / 100);
|
||||||
|
switch (ipLevelMajor) {
|
||||||
|
case 9:
|
||||||
|
ipLevel = Pal::GfxIpLevel::GfxIp9;
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
ipLevel = Pal::GfxIpLevel::GfxIp10;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pal::AsicRevision revision = Pal::AsicRevision::Unknown;
|
||||||
|
uint xNACKSupported = 0;
|
||||||
|
switch (pal::Gfx9PlusSubDeviceInfo[id].gfxipVersion_) {
|
||||||
|
case 901:
|
||||||
|
xNACKSupported = 1;
|
||||||
|
case 900:
|
||||||
|
revision = Pal::AsicRevision::Vega10;
|
||||||
|
break;
|
||||||
|
case 903:
|
||||||
|
xNACKSupported = 1;
|
||||||
|
case 902:
|
||||||
|
revision = Pal::AsicRevision::Raven;
|
||||||
|
break;
|
||||||
|
case 905:
|
||||||
|
xNACKSupported = 1;
|
||||||
|
case 904:
|
||||||
|
revision = Pal::AsicRevision::Vega12;
|
||||||
|
break;
|
||||||
|
case 907:
|
||||||
|
xNACKSupported = 1;
|
||||||
|
case 906:
|
||||||
|
revision = Pal::AsicRevision::Vega20;
|
||||||
|
break;
|
||||||
|
case 1001:
|
||||||
|
xNACKSupported = 1;
|
||||||
|
case 1000:
|
||||||
|
revision = Pal::AsicRevision::Navi10;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
NullDevice* dev = new NullDevice();
|
||||||
|
if (nullptr != dev) {
|
||||||
|
if (!dev->create(revision, ipLevel, xNACKSupported)) {
|
||||||
|
delete dev;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dev->registerDevice();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NullDevice::create(Pal::AsicRevision asicRevision, Pal::GfxIpLevel ipLevel) {
|
bool NullDevice::create(Pal::AsicRevision asicRevision, Pal::GfxIpLevel ipLevel,
|
||||||
|
uint xNACKSupported) {
|
||||||
online_ = false;
|
online_ = false;
|
||||||
Pal::DeviceProperties properties = {};
|
Pal::DeviceProperties properties = {};
|
||||||
|
|
||||||
@@ -142,12 +193,17 @@ bool NullDevice::create(Pal::AsicRevision asicRevision, Pal::GfxIpLevel ipLevel)
|
|||||||
ipLevel_ = ipLevel;
|
ipLevel_ = ipLevel;
|
||||||
properties.revision = asicRevision;
|
properties.revision = asicRevision;
|
||||||
properties.gfxLevel = ipLevel;
|
properties.gfxLevel = ipLevel;
|
||||||
|
uint subtarget = 0;
|
||||||
|
|
||||||
// Update HW info for the device
|
// Update HW info for the device
|
||||||
if ((GPU_ENABLE_PAL == 1) && (ipLevel == Pal::GfxIpLevel::_None)) {
|
if ((GPU_ENABLE_PAL == 1) && (ipLevel == Pal::GfxIpLevel::_None)) {
|
||||||
hwInfo_ = &DeviceInfo[static_cast<uint>(asicRevision)];
|
hwInfo_ = &DeviceInfo[static_cast<uint>(asicRevision)];
|
||||||
} else if (ipLevel >= Pal::GfxIpLevel::GfxIp9) {
|
} else if (ipLevel >= Pal::GfxIpLevel::GfxIp9) {
|
||||||
hwInfo_ = &GfxIpDeviceInfo[static_cast<uint>(ipLevel)];
|
subtarget = (static_cast<uint>(asicRevision_) %
|
||||||
|
static_cast<uint>(Pal::AsicRevision::Vega10))
|
||||||
|
<< 1 | xNACKSupported;
|
||||||
|
hwInfo_ = &Gfx9PlusSubDeviceInfo[subtarget];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,9 @@ class NullDevice : public amd::Device {
|
|||||||
|
|
||||||
//! Creates an offline device with the specified target
|
//! Creates an offline device with the specified target
|
||||||
bool create(Pal::AsicRevision asicRevision, //!< GPU ASIC revision
|
bool create(Pal::AsicRevision asicRevision, //!< GPU ASIC revision
|
||||||
Pal::GfxIpLevel ipLevel //!< GPU ip level
|
Pal::GfxIpLevel ipLevel, //!< GPU ip level
|
||||||
);
|
uint xNACKSupported = 0 //!< GPU xNACKSupported
|
||||||
|
);
|
||||||
|
|
||||||
virtual cl_int createSubDevices(device::CreateSubDevicesInfo& create_info, cl_uint num_entries,
|
virtual cl_int createSubDevices(device::CreateSubDevicesInfo& create_info, cl_uint num_entries,
|
||||||
cl_device_id* devices, cl_uint* num_devices) {
|
cl_device_id* devices, cl_uint* num_devices) {
|
||||||
|
|||||||
Tagairt in Eagrán Nua
Cuir bac ar úsáideoir