diff --git a/runtime/hsa-runtime/core/driver/xdna/amd_xdna_driver.cpp b/runtime/hsa-runtime/core/driver/xdna/amd_xdna_driver.cpp index b9b62ad6f2..bec2e98128 100644 --- a/runtime/hsa-runtime/core/driver/xdna/amd_xdna_driver.cpp +++ b/runtime/hsa-runtime/core/driver/xdna/amd_xdna_driver.cpp @@ -84,6 +84,10 @@ hsa_status_t XdnaDriver::DiscoverDriver() { return HSA_STATUS_ERROR; } +uint64_t XdnaDriver::GetDevHeapByteSize() { + return dev_heap_size; +} + hsa_status_t XdnaDriver::Init() { return InitDeviceHeap(); } hsa_status_t XdnaDriver::QueryKernelModeDriver(core::DriverQuery query) { diff --git a/runtime/hsa-runtime/core/inc/amd_xdna_driver.h b/runtime/hsa-runtime/core/inc/amd_xdna_driver.h index e313eb4bb6..2bb67c5b8e 100644 --- a/runtime/hsa-runtime/core/inc/amd_xdna_driver.h +++ b/runtime/hsa-runtime/core/inc/amd_xdna_driver.h @@ -63,6 +63,9 @@ public: static hsa_status_t DiscoverDriver(); + /// @brief Returns the size of the dev heap in bytes. + static uint64_t GetDevHeapByteSize(); + hsa_status_t Init() override; hsa_status_t QueryKernelModeDriver(core::DriverQuery query) override; diff --git a/runtime/hsa-runtime/core/runtime/amd_aie_agent.cpp b/runtime/hsa-runtime/core/runtime/amd_aie_agent.cpp index 29d300410a..4d2d1f60fd 100644 --- a/runtime/hsa-runtime/core/runtime/amd_aie_agent.cpp +++ b/runtime/hsa-runtime/core/runtime/amd_aie_agent.cpp @@ -46,6 +46,7 @@ #include "core/inc/amd_aie_aql_queue.h" #include "core/inc/amd_memory_region.h" +#include "core/inc/amd_xdna_driver.h" #include "core/inc/driver.h" #include "core/inc/runtime.h" @@ -199,16 +200,18 @@ void AieAgent::InitRegionList() { /// For allocating kernel arguments or other objects that only need /// system memory. - HsaMemoryProperties sys_mem_props{ - .HeapType = HSA_HEAPTYPE_SYSTEM, - }; + HsaMemoryProperties sys_mem_props = {}; + sys_mem_props.HeapType = HSA_HEAPTYPE_SYSTEM; + /// For allocating memory for programmable device image (PDI) files. These /// need to be mapped to the device so the hardware can access the PDIs. - HsaMemoryProperties dev_mem_props{ - .HeapType = HSA_HEAPTYPE_DEVICE_SVM, - }; + HsaMemoryProperties dev_mem_props = {}; + dev_mem_props.HeapType = HSA_HEAPTYPE_DEVICE_SVM, + dev_mem_props.SizeInBytes = XdnaDriver::GetDevHeapByteSize(); + /// As of now the AIE devices support coarse-grain memory regions that require /// explicit sync operations. + regions_.reserve(2); regions_.push_back( new MemoryRegion(false, true, false, false, true, this, sys_mem_props)); regions_.push_back(