From c828fa8498fa2a989b1a7ff09535e1aafe0fb4cc Mon Sep 17 00:00:00 2001 From: foreman Date: Sun, 11 Sep 2016 15:30:45 -0400 Subject: [PATCH] P4 to Git Change 1313121 by lmoriche@lmoriche_opencl_dev on 2016/09/11 15:21:47 SWDEV-94611 - [OCL-LC-ROCm] Use GFX IP for device name. Set the name to "gfx[M][m][s]" (M:major,m:minor,stepping). Removed the device name strings from the DeviceInfo table. Keep the machineTarget_ field until the compiler is changed to accept gfxip strings. Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdefs.hpp#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#15 edit --- rocclr/runtime/device/rocm/rocdefs.hpp | 18 +++++++++--------- rocclr/runtime/device/rocm/rocdevice.cpp | 17 +++++++++++------ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/rocclr/runtime/device/rocm/rocdefs.hpp b/rocclr/runtime/device/rocm/rocdefs.hpp index 45a809e447..0598f0c827 100644 --- a/rocclr/runtime/device/rocm/rocdefs.hpp +++ b/rocclr/runtime/device/rocm/rocdefs.hpp @@ -34,15 +34,15 @@ const HsaDeviceId HSA_INVALID_DEVICE_ID = -1; static const AMDDeviceInfo DeviceInfo[] = { // targetName machineTarget - /* TARGET_KAVERI_SPECTRE */ {HSA_SPECTRE_ID, "Spectre", "kaveri", 4, 16, 1, 256, 64 * Ki, 32, 0, 0 }, - /* TARGET_KAVERI_SPOOKY */ {HSA_SPOOKY_ID, "Spooky", "kaveri", 4, 16, 1, 256, 64 * Ki, 32, 0, 0 }, - /* TARGET_TONGA */ {HSA_TONGA_ID, "Tonga", "tonga", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}, - /* TARGET_CARRIZO */ {HSA_CARRIZO_ID, "Carrizo", "carrizo", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}, - /* TARGET_ICELAND */ {HSA_ICELAND_ID, "Topaz", "iceland", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}, - /* TARGET_FIJI */ {HSA_FIJI_ID, "Fiji", "fiji", 4, 16, 1, 256, 64 * Ki, 32, 0, 0 }, - /* TARGET HAWAII */ {HSA_HAWAII_ID, "Hawaii", "hawaii", 4, 16, 1, 256, 64 * Ki, 32, 0, 0 }, - /* TARGET ELLESMERE */ {HSA_ELLESMERE_ID, "Ellesmere", "polaris10", 4, 16, 1, 256, 64 * Ki, 32, 0, 0 }, - /* TARGET BAFFIN */ {HSA_BAFFIN_ID, "Baffin", "polaris11", 4, 16, 1, 256, 64 * Ki, 32, 0, 0 } + /* TARGET_KAVERI_SPECTRE */ {HSA_SPECTRE_ID, "", "kaveri", 4, 16, 1, 256, 64 * Ki, 32, 0, 0 }, + /* TARGET_KAVERI_SPOOKY */ {HSA_SPOOKY_ID, "", "kaveri", 4, 16, 1, 256, 64 * Ki, 32, 0, 0 }, + /* TARGET_TONGA */ {HSA_TONGA_ID, "", "tonga", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}, + /* TARGET_CARRIZO */ {HSA_CARRIZO_ID, "", "carrizo", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}, + /* TARGET_ICELAND */ {HSA_ICELAND_ID, "", "iceland", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}, + /* TARGET_FIJI */ {HSA_FIJI_ID, "", "fiji", 4, 16, 1, 256, 64 * Ki, 32, 0, 0 }, + /* TARGET HAWAII */ {HSA_HAWAII_ID, "", "hawaii", 4, 16, 1, 256, 64 * Ki, 32, 0, 0 }, + /* TARGET ELLESMERE */ {HSA_ELLESMERE_ID, "", "polaris10", 4, 16, 1, 256, 64 * Ki, 32, 0, 0 }, + /* TARGET BAFFIN */ {HSA_BAFFIN_ID, "", "polaris11", 4, 16, 1, 256, 64 * Ki, 32, 0, 0 } }; } diff --git a/rocclr/runtime/device/rocm/rocdevice.cpp b/rocclr/runtime/device/rocm/rocdevice.cpp index a95d632526..f1eaa5ef59 100644 --- a/rocclr/runtime/device/rocm/rocdevice.cpp +++ b/rocclr/runtime/device/rocm/rocdevice.cpp @@ -377,13 +377,13 @@ hsa_status_t Device::iterateAgentCallback(hsa_agent_t agent, void *data) { } uint32_t isaNameLength = 0; - if (hsa_isa_get_info(isa, HSA_ISA_INFO_NAME_LENGTH, 0, &isaNameLength) + if (hsa_isa_get_info_alt(isa, HSA_ISA_INFO_NAME_LENGTH, &isaNameLength) != HSA_STATUS_SUCCESS) { return HSA_STATUS_ERROR; } char *isaName = (char*)alloca((size_t)isaNameLength + 1); - if (hsa_isa_get_info(isa, HSA_ISA_INFO_NAME, 0, isaName) + if (hsa_isa_get_info_alt(isa, HSA_ISA_INFO_NAME, isaName) != HSA_STATUS_SUCCESS) { return HSA_STATUS_ERROR; } @@ -615,7 +615,13 @@ Device::populateOCLDeviceConstants() roc::Settings* hsa_settings = static_cast(settings_); - strcpy(info_.name_, "AMD HSA Device"); + int gfxipMajor = deviceInfo_.gfxipVersion_ / 100; + int gfxipMinor = deviceInfo_.gfxipVersion_ / 10 % 10; + int gfxipStepping = deviceInfo_.gfxipVersion_ % 10; + + std::ostringstream oss; + oss << "gfx" << gfxipMajor << gfxipMinor << gfxipStepping; + ::strcpy(info_.name_, oss.str().c_str()); char device_name[64] = { 0 }; if (HSA_STATUS_SUCCESS != @@ -623,8 +629,7 @@ Device::populateOCLDeviceConstants() _bkendDevice, HSA_AGENT_INFO_NAME, device_name)) { return false; } - - strcpy(info_.boardName_, device_name); + ::strcpy(info_.boardName_, device_name); if (HSA_STATUS_SUCCESS != hsa_agent_get_info(_bkendDevice, HSA_AGENT_INFO_PROFILE, @@ -826,7 +831,7 @@ Device::populateOCLDeviceConstants() return false; } std::stringstream ss; - ss << major << "." << minor << " (hsa)"; + ss << major << "." << minor << " (HSA)"; strcpy(info_.driverVersion_, ss.str().c_str()); info_.version_ = "OpenCL " /*OPENCL_VERSION_STR*/"1.2" " ";