rocr/aie: Use util/os to get system memory (#2520)

This commit is contained in:
Yiannis Papadopoulos
2026-01-08 13:40:22 -05:00
zatwierdzone przez GitHub
rodzic d8a914d8cc
commit e8fef02e5a
3 zmienionych plików z 3 dodań i 14 usunięć
@@ -155,12 +155,6 @@ hsa_status_t XdnaDriver::DiscoverDriver(std::unique_ptr<core::Driver>& driver) {
return HSA_STATUS_ERROR;
}
uint64_t XdnaDriver::GetSystemMemoryByteSize() {
const long pagesize = sysconf(_SC_PAGESIZE);
const long page_count = sysconf(_SC_PHYS_PAGES);
return pagesize * page_count;
}
uint64_t XdnaDriver::GetDevHeapByteSize() {
return dev_heap_size;
}
@@ -181,9 +181,6 @@ public:
static hsa_status_t DiscoverDriver(std::unique_ptr<core::Driver>& driver);
/// @brief Returns the size of the system memory heap in bytes.
static uint64_t GetSystemMemoryByteSize();
/// @brief Returns the size of the dev heap in bytes.
static uint64_t GetDevHeapByteSize();
@@ -53,6 +53,7 @@
#include "core/inc/amd_xdna_driver.h"
#include "core/inc/driver.h"
#include "core/inc/runtime.h"
#include "core/util/os.h"
namespace rocr {
namespace AMD {
@@ -293,11 +294,8 @@ hsa_status_t AieAgent::QueueCreate(size_t size, hsa_queue_type32_t queue_type, u
}
void AieAgent::InitRegionList() {
/// TODO: Find a way to set the other memory properties in a reasonable way.
/// This should be easier once the ROCt source is incorporated into the
/// ROCr source. Since the AIE itself currently has no memory regions of
/// its own all memory is just the system DRAM.
const uint64_t total_system_memory = XdnaDriver::GetSystemMemoryByteSize();
/// AIE itself currently has no memory regions of its own, all memory is just the system DRAM.
const uint64_t total_system_memory = os::HostTotalPhysicalMemory();
/// For allocating kernel arguments or other objects that only need
/// system memory.