SWDEV-520384 - Improve postLoad latency during program load (#758)

Change-Id: I3c5a9e148efbd845c8fa3e4b51d9653664e9c499
This commit is contained in:
Xie, Pengda
2025-08-13 19:36:06 -07:00
committed by GitHub
parent a028359ead
commit 191f068193
5 changed files with 87 additions and 59 deletions
+58
View File
@@ -81,6 +81,9 @@ bool VirtualDevice::ActiveWait() const {
return device_().ActiveWait();
}
#if defined(USE_COMGR_LIBRARY)
extern amd_comgr_status_t getMetaBuf(const amd_comgr_metadata_node_t meta, std::string* str);
#endif
}
static_assert(static_cast<uint32_t>(device::Memory::MemAccess::kMemAccessNone)
@@ -328,6 +331,61 @@ const Isa* Isa::end() {
return supportedIsas().second;
}
#if defined(USE_COMGR_LIBRARY)
void Isa::setAvailableSgprVgprCached() const {
std::call_once(setSgprVgprFlag, [this]() {
std::string buf;
amd_comgr_metadata_node_t isaMeta;
amd_comgr_metadata_node_t sgprMeta;
amd_comgr_metadata_node_t vgprMeta;
bool hasIsaMeta = false;
bool hasSgprMeta = false;
bool hasVgprMeta = false;
amd_comgr_status_t status = amd::Comgr::get_isa_metadata(isaName().c_str(), &isaMeta);
if (status == AMD_COMGR_STATUS_SUCCESS) {
hasIsaMeta = true;
status = amd::Comgr::metadata_lookup(isaMeta, "AddressableNumSGPRs", &sgprMeta);
}
if (status == AMD_COMGR_STATUS_SUCCESS) {
hasSgprMeta = true;
status = amd::device::getMetaBuf(sgprMeta, &buf);
}
sgprPerWavefront_ = (status == AMD_COMGR_STATUS_SUCCESS) ? atoi(buf.c_str()) : 0;
if (status == AMD_COMGR_STATUS_SUCCESS) {
status = amd::Comgr::metadata_lookup(isaMeta, "AddressableNumVGPRs", &vgprMeta);
}
if (status == AMD_COMGR_STATUS_SUCCESS) {
hasVgprMeta = true;
status = amd::device::getMetaBuf(vgprMeta, &buf);
}
vgprPerWavefront_ = (status == AMD_COMGR_STATUS_SUCCESS) ? atoi(buf.c_str()) : 0;
if (hasVgprMeta) {
amd::Comgr::destroy_metadata(vgprMeta);
}
if (hasSgprMeta) {
amd::Comgr::destroy_metadata(sgprMeta);
}
if (hasIsaMeta) {
amd::Comgr::destroy_metadata(isaMeta);
}
if (status != AMD_COMGR_STATUS_SUCCESS) {
DevLogPrintfError("Failed to set SGPR/VGPR for ISA: %s", isaName().c_str());
}
});
}
#endif
std::vector<Device*>* Device::devices_ = nullptr;
AppProfile Device::appProfile_;