Query device name from KFD

Before this change, runtime hard code the device name, in this commit,
we will query the name from KFD. Will use codecvt to do UTF-16 to
UTF-8 transfer after GCC supports it.



Change-Id: I7c4dc32ef857296296c810d083888c5ba1c808b6
이 커밋은 다음에 포함됨:
Fan Cao
2016-07-05 18:13:46 -04:00
커밋한 사람 Gerrit Code Review
부모 d0d13c34fc
커밋 88708b8e5a
+8 -14
파일 보기
@@ -640,22 +640,16 @@ hsa_status_t GpuAgent::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.
{
// 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.
std::memset(value, 0, kNameSize);
if (isa_->GetMajorVersion() == 7) {
std::memcpy(value, "Kaveri", sizeof("Kaveri"));
} else if (isa_->GetMajorVersion() == 8) {
if (isa_->GetMinorVersion() == 0 && isa_->GetStepping() == 2) {
std::memcpy(value, "Tonga", sizeof("Tonga"));
} else if (isa_->GetMinorVersion() == 0 && isa_->GetStepping() == 3) {
std::memcpy(value, "Fiji", sizeof("Fiji"));
} else {
std::memcpy(value, "Carrizo", sizeof("Carrizo"));
}
} else {
std::memcpy(value, "Unknown", sizeof("Unknown"));
}
char* temp = reinterpret_cast<char*>(value);
for (uint32_t i = 0; properties_.MarketingName[i] != 0 && i < kNameSize - 1; i++)
temp[i] = properties_.MarketingName[i];
break;
}
case HSA_AGENT_INFO_VENDOR_NAME:
std::memset(value, 0, kNameSize);
std::memcpy(value, "AMD", sizeof("AMD"));