rocr: Remove KMT usage from CPU agent

Use the core Driver object in the CPU agent to make it OS/driver
agnostic.

Implement the GetMemoryProperties() and GetCacheProperties methods
for the KFD driver.
This commit is contained in:
Tony Gutierrez
2025-02-04 10:24:10 -08:00
committed by Yat Sin, David
parent 20e6c87a09
commit a9f6bc8d0e
7 changed files with 73 additions and 40 deletions
@@ -178,9 +178,25 @@ hsa_status_t KfdDriver::GetAgentProperties(core::Agent &agent) const {
return HSA_STATUS_SUCCESS;
}
hsa_status_t
KfdDriver::GetMemoryProperties(uint32_t node_id,
core::MemoryRegion &mem_region) const {
hsa_status_t KfdDriver::GetMemoryProperties(uint32_t node_id,
std::vector<HsaMemoryProperties>& mem_props) const {
if (!mem_props.data()) return HSA_STATUS_ERROR_INVALID_ARGUMENT;
if (hsaKmtGetNodeMemoryProperties(node_id, mem_props.size(), mem_props.data()) !=
HSAKMT_STATUS_SUCCESS)
return HSA_STATUS_ERROR;
return HSA_STATUS_SUCCESS;
}
hsa_status_t KfdDriver::GetCacheProperties(uint32_t node_id, uint32_t processor_id,
std::vector<HsaCacheProperties>& cache_props) const {
if (!cache_props.data()) return HSA_STATUS_ERROR_INVALID_ARGUMENT;
if (hsaKmtGetNodeCacheProperties(node_id, processor_id, cache_props.size(), cache_props.data()) !=
HSAKMT_STATUS_SUCCESS)
return HSA_STATUS_ERROR;
return HSA_STATUS_SUCCESS;
}
@@ -175,12 +175,17 @@ hsa_status_t XdnaDriver::GetAgentProperties(core::Agent &agent) const {
return HSA_STATUS_SUCCESS;
}
hsa_status_t
XdnaDriver::GetMemoryProperties(uint32_t node_id,
core::MemoryRegion &mem_region) const {
hsa_status_t XdnaDriver::GetMemoryProperties(uint32_t node_id,
std::vector<HsaMemoryProperties>& mem_props) const {
return HSA_STATUS_SUCCESS;
}
hsa_status_t XdnaDriver::GetCacheProperties(uint32_t node_id, uint32_t processor_id,
std::vector<HsaCacheProperties>& cache_props) const {
// AIE currently has no caches.
return HSA_STATUS_ERROR_INVALID_CACHE;
}
hsa_status_t
XdnaDriver::AllocateMemory(const core::MemoryRegion &mem_region,
core::MemoryRegion::AllocateFlags alloc_flags,