rocr/driver: add AvailableMemory API to driver

This commit introduces a new AvailableMemory API to the KfdDriver and
 XdnaDriver classes.

- Implemented AvailableMemory in KfdDriver to return the available memory size
  using hsaKmtAvailableMemory.
- Added a stub implementation of AvailableMemory in XdnaDriver that returns an error.
- Updated the GpuAgent class to use the new AvailableMemory API instead of
  directly calling hsaKmtAvailableMemory.

Signed-off-by: Honglei Huang <Honglei1.Huang@amd.com>
Αυτή η υποβολή περιλαμβάνεται σε:
Honglei Huang
2025-07-15 10:49:11 +08:00
υποβλήθηκε από Huang, Honglei1
γονέας 9c18618847
υποβολή 6c390e32cc
6 αρχεία άλλαξαν με 25 προσθήκες και 5 διαγραφές
@@ -616,6 +616,14 @@ hsa_status_t KfdDriver::GetTileConfig(uint32_t node_id, HsaGpuTileConfig* config
return HSA_STATUS_SUCCESS;
}
hsa_status_t KfdDriver::AvailableMemory(uint32_t node_id, uint64_t* available_size) const {
assert(available_size);
if (HSAKMT_CALL(hsaKmtAvailableMemory(node_id, available_size)) != HSAKMT_STATUS_SUCCESS)
return HSA_STATUS_ERROR;
return HSA_STATUS_SUCCESS;
}
hsa_status_t KfdDriver::IsModelEnabled(bool* enable) const {
// AIE does not support streaming performance monitor.
HSAKMT_STATUS status = HSAKMT_STATUS_ERROR;
@@ -898,5 +898,9 @@ hsa_status_t XdnaDriver::GetWallclockFrequency(uint32_t node_id, uint64_t* frequ
return HSA_STATUS_ERROR;
}
hsa_status_t XdnaDriver::AvailableMemory(uint32_t node_id, uint64_t* available_size) const {
return HSA_STATUS_ERROR;
}
} // namespace AMD
} // namespace rocr