Support a new property of Rocr Agents called Product Name
Change-Id: Ia7217094223bfed908d9aa9ccdaa590e785503cb
This commit is contained in:
@@ -187,22 +187,29 @@ hsa_status_t CpuAgent::IterateCache(hsa_status_t (*callback)(hsa_cache_t cache,
|
||||
}
|
||||
|
||||
hsa_status_t CpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const {
|
||||
const size_t kNameSize = 64; // agent, and vendor name size limit
|
||||
|
||||
|
||||
// agent, and vendor name size limit
|
||||
const size_t attribute_u = static_cast<size_t>(attribute);
|
||||
|
||||
switch (attribute_u) {
|
||||
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);
|
||||
|
||||
// The code copies HsaNodeProperties.MarketingName a Unicode string
|
||||
// which is encoded in UTF-16 as a 7-bit ASCII string. The value of
|
||||
// HsaNodeProperties.MarketingName is obtained from the "model name"
|
||||
// property of /proc/cpuinfo file
|
||||
case HSA_AGENT_INFO_NAME:
|
||||
case HSA_AMD_AGENT_INFO_PRODUCT_NAME: {
|
||||
std::memset(value, 0, HSA_PUBLIC_NAME_SIZE);
|
||||
char* temp = reinterpret_cast<char*>(value);
|
||||
for (uint32_t i = 0; properties_.AMDName[i] != 0 && i < kNameSize - 1; i++)
|
||||
temp[i] = properties_.AMDName[i];
|
||||
for (uint32_t idx = 0;
|
||||
properties_.MarketingName[idx] != 0 && idx < HSA_PUBLIC_NAME_SIZE - 1; idx++) {
|
||||
temp[idx] = (uint8_t)properties_.MarketingName[idx];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HSA_AGENT_INFO_VENDOR_NAME:
|
||||
// TODO: hardcode for now, wait until SWDEV-88894 implemented
|
||||
std::memset(value, 0, kNameSize);
|
||||
std::memset(value, 0, HSA_PUBLIC_NAME_SIZE);
|
||||
std::memcpy(value, "CPU", sizeof("CPU"));
|
||||
break;
|
||||
case HSA_AGENT_INFO_FEATURE:
|
||||
|
||||
@@ -652,21 +652,24 @@ hsa_status_t GpuAgent::EnableDmaProfiling(bool enable) {
|
||||
}
|
||||
|
||||
hsa_status_t GpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const {
|
||||
const size_t kNameSize = 64; // agent, and vendor name size limit
|
||||
|
||||
// agent, and vendor name size limit
|
||||
const size_t attribute_u = static_cast<size_t>(attribute);
|
||||
|
||||
switch (attribute_u) {
|
||||
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);
|
||||
|
||||
// Build agent name by concatenating the Major, Minor and Stepping Ids
|
||||
// of devices compute capability with a prefix of "gfx"
|
||||
case HSA_AGENT_INFO_NAME: {
|
||||
std::stringstream name;
|
||||
std::memset(value, 0, HSA_PUBLIC_NAME_SIZE);
|
||||
char* temp = reinterpret_cast<char*>(value);
|
||||
for (uint32_t i = 0; properties_.AMDName[i] != 0 && i < kNameSize - 1; i++)
|
||||
temp[i] = properties_.AMDName[i];
|
||||
name << "gfx" << isa_->GetMajorVersion() << isa_->GetMinorVersion() << isa_->GetStepping();
|
||||
std::strcpy(temp, name.str().c_str());
|
||||
break;
|
||||
}
|
||||
case HSA_AGENT_INFO_VENDOR_NAME:
|
||||
std::memset(value, 0, kNameSize);
|
||||
std::memset(value, 0, HSA_PUBLIC_NAME_SIZE);
|
||||
std::memcpy(value, "AMD", sizeof("AMD"));
|
||||
break;
|
||||
case HSA_AGENT_INFO_FEATURE:
|
||||
@@ -821,6 +824,18 @@ hsa_status_t GpuAgent::GetInfo(hsa_agent_info_t attribute, void* value) const {
|
||||
case HSA_AMD_AGENT_INFO_MEMORY_MAX_FREQUENCY:
|
||||
*((uint32_t*)value) = memory_max_frequency_;
|
||||
break;
|
||||
|
||||
// The code copies HsaNodeProperties.MarketingName a Unicode string
|
||||
// which is encoded in UTF-16 as a 7-bit ASCII string
|
||||
case HSA_AMD_AGENT_INFO_PRODUCT_NAME: {
|
||||
std::memset(value, 0, HSA_PUBLIC_NAME_SIZE);
|
||||
char* temp = reinterpret_cast<char*>(value);
|
||||
for (uint32_t idx = 0;
|
||||
properties_.MarketingName[idx] != 0 && idx < HSA_PUBLIC_NAME_SIZE - 1; idx++) {
|
||||
temp[idx] = (uint8_t)properties_.MarketingName[idx];
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
|
||||
break;
|
||||
|
||||
@@ -111,7 +111,12 @@ typedef enum hsa_amd_agent_info_s {
|
||||
/**
|
||||
* Max Memory Clock, the return value type is uint32_t.
|
||||
*/
|
||||
HSA_AMD_AGENT_INFO_MEMORY_MAX_FREQUENCY = 0xA008
|
||||
HSA_AMD_AGENT_INFO_MEMORY_MAX_FREQUENCY = 0xA008,
|
||||
/**
|
||||
* Board name of Agent - populated from MarketingName of Kfd Node
|
||||
* The value is an Ascii string of 64 chars.
|
||||
*/
|
||||
HSA_AMD_AGENT_INFO_PRODUCT_NAME = 0xA009
|
||||
} hsa_amd_agent_info_t;
|
||||
|
||||
/**
|
||||
|
||||
Verwijs in nieuw issue
Block a user