Read name of Hsa Agent from a new field of Node Properties

Change-Id: I3abca521a904c40cb84d90800a16363b1ad64768


[ROCm/ROCR-Runtime commit: 5ab5396529]
This commit is contained in:
Ramesh Errabolu
2016-08-30 18:25:15 -05:00
parent 1306432ae1
commit 87018b14b4
2 changed files with 11 additions and 8 deletions
@@ -191,10 +191,14 @@ hsa_status_t CpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const {
const size_t attribute_u = static_cast<size_t>(attribute);
switch (attribute_u) {
case HSA_AGENT_INFO_NAME:
// TODO: hardcode for now, wait until SWDEV-88894 implemented
case HSA_AGENT_INFO_NAME: {
// The code copies from HsaNodeProperties.AMDName is encoded in
// 7-bit ASCII as the runtime output is 7-bit ASCII in bytes.
std::memset(value, 0, kNameSize);
std::memcpy(value, "CPU Device", sizeof("CPU Device"));
char* temp = reinterpret_cast<char*>(value);
for (uint32_t i = 0; properties_.AMDName[i] != 0 && i < kNameSize - 1; i++)
temp[i] = properties_.AMDName[i];
}
break;
case HSA_AGENT_INFO_VENDOR_NAME:
// TODO: hardcode for now, wait until SWDEV-88894 implemented
@@ -657,13 +657,12 @@ hsa_status_t GpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const {
switch (attribute_u) {
case HSA_AGENT_INFO_NAME:
{
// This code assumes that UTF-16 HsaNodeProperties.MarketingName is
// actually encoded in 7-bit ASCII, and the runtime output is 7-bit ASCII
// in bytes.
// The code copies from HsaNodeProperties.AMDName is encoded in
// 7-bit ASCII as the runtime output is 7-bit ASCII in bytes.
std::memset(value, 0, kNameSize);
char* temp = reinterpret_cast<char*>(value);
for (uint32_t i = 0; properties_.MarketingName[i] != 0 && i < kNameSize - 1; i++)
temp[i] = properties_.MarketingName[i];
for (uint32_t i = 0; properties_.AMDName[i] != 0 && i < kNameSize - 1; i++)
temp[i] = properties_.AMDName[i];
break;
}
case HSA_AGENT_INFO_VENDOR_NAME: