diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/driver/xdna/amd_xdna_driver.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/driver/xdna/amd_xdna_driver.cpp index 40afc148664f..4f8e71e6cc9e 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/driver/xdna/amd_xdna_driver.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/driver/xdna/amd_xdna_driver.cpp @@ -1273,13 +1273,6 @@ hsa_status_t XdnaDriver::AllocateMemory(const core::MemoryRegion& mem_region, if (use_bo_share) { create_bo_args.type = AMDXDNA_BO_SHARE; } else { - // While this is already checked in MemoryRegion::AllocateImpl, the max size is - // MemoryRegion::max_sysmem_alloc_size_ for HSA_HEAPTYPE_DEVICE_SVM which is incorrect - // for dev heap. - if (size > dev_heap_size) { - return HSA_STATUS_ERROR_INVALID_ALLOCATION; - } - create_bo_args.type = AMDXDNA_BO_DEV; } diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aie_agent.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aie_agent.cpp index 09886e73ea9f..2ac809e62dfe 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aie_agent.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aie_agent.cpp @@ -332,8 +332,8 @@ void AieAgent::InitRegionList() { // We use HSA_HEAPTYPE_DEVICE_SVM so that the recommended // HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_REC_GRANULE is 0. We can use that to determine if a pool // is regular pool or dev heap. - // The system will report the max allocatable size as MemoryRegion::max_sysmem_alloc_size_, but - // this is incorrect. The pool is exactly XdnaDriver::GetDevHeapByteSize() bytes. + // The pool reports its max allocatable size as MemoryRegion::max_single_alloc_size_, which is + // exactly XdnaDriver::GetDevHeapByteSize() bytes. HsaMemoryProperties dev_mem_props = {}; dev_mem_props.HeapType = HSA_HEAPTYPE_DEVICE_SVM; dev_mem_props.SizeInBytes = XdnaDriver::GetDevHeapByteSize(); diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp index 21dba2e16b69..286eea71dc31 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp @@ -152,7 +152,9 @@ hsa_status_t MemoryRegion::AllocateImpl(size_t& size, AllocateFlags alloc_flags, // Skip the per-region cap on Windows/DXG so over-commit requests can // reach WDDM; system memory still enforces the cap. const bool is_windxg = core::Runtime::runtime_singleton_->thunkLoader()->IsDXG(); - if (IsSystem() && (size > max_sysmem_alloc_size_)) { + const size_t max_alloc_size = + IsDeviceSVM() ? max_single_alloc_size_ : max_sysmem_alloc_size_; + if (IsSystem() && (size > max_alloc_size)) { return HSA_STATUS_ERROR_INVALID_ALLOCATION; } if (!IsSystem() && !is_windxg && (size > max_single_alloc_size_)) { @@ -231,9 +233,9 @@ hsa_status_t MemoryRegion::GetInfo(hsa_region_info_t attribute, case HSA_REGION_INFO_ALLOC_MAX_SIZE: switch (mem_props_.HeapType) { case HSA_HEAPTYPE_SYSTEM: - case HSA_HEAPTYPE_DEVICE_SVM: *((size_t*)value) = max_sysmem_alloc_size_; break; + case HSA_HEAPTYPE_DEVICE_SVM: case HSA_HEAPTYPE_FRAME_BUFFER_PRIVATE: case HSA_HEAPTYPE_FRAME_BUFFER_PUBLIC: case HSA_HEAPTYPE_GPU_SCRATCH: